*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	--background: 0 0% 100%;
	--foreground: 240 10% 3.9%;
	--card: 0 0% 100%;
	--card-foreground: 240 10% 3.9%;
	--muted: 240 4.8% 95.9%;
	--muted-foreground: 240 3.8% 46.1%;
	--accent: 240 4.8% 95.9%;
	--accent-foreground: 240 5.9% 10%;
	--primary: 346 77% 50%;
	--primary-foreground: 0 0% 100%;
	--secondary: 240 4.8% 95.9%;
	--secondary-foreground: 240 5.9% 10%;
	--destructive: 0 84% 60%;
	--destructive-foreground: 0 0% 100%;
	--success: 142 76% 36%;
	--success-foreground: 0 0% 100%;
	--gold: 38 90% 45%;
	--border: 240 5.9% 90%;
	--input: 240 5.9% 90%;
	--ring: 346 77% 50%;
	--radius: 0.5rem;

	--font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
	--font-serif: "Bitter", ui-serif, Georgia, serif;
	--font-mono: "Fira Code", ui-monospace, "Cascadia Code", monospace;
}

.dark {
	--background: 240 10% 3.9%;
	--foreground: 0 0% 98%;
	--card: 240 10% 6%;
	--card-foreground: 0 0% 98%;
	--muted: 240 3.7% 15.9%;
	--muted-foreground: 240 5% 64.9%;
	--accent: 240 3.7% 15.9%;
	--accent-foreground: 0 0% 98%;
	--primary: 346 77% 50%;
	--primary-foreground: 0 0% 100%;
	--secondary: 240 3.7% 15.9%;
	--secondary-foreground: 0 0% 98%;
	--destructive: 0 62% 50%;
	--destructive-foreground: 0 0% 98%;
	--success: 142 76% 36%;
	--success-foreground: 0 0% 100%;
	--gold: 38 90% 55%;
	--border: 240 3.7% 15.9%;
	--input: 240 3.7% 15.9%;
	--ring: 346 77% 50%;
}

html {
	font-size: 16px;
}

body {
	font-family: var(--font-sans);
	background: hsl(var(--background));
	color: hsl(var(--foreground));
	line-height: 1.5;
	min-height: 100vh;
}

h1,
h2,
h3 {
	font-family: var(--font-serif);
	font-weight: 700;
	letter-spacing: -0.025em;
}

.hidden {
	display: none !important;
}

/* ── Landing ── */

#landing {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 2rem;
	background:
		radial-gradient(ellipse at 50% 0%, hsl(var(--primary) / 0.06) 0%, transparent 60%),
		hsl(var(--background));
}

.landing-theme-toggle {
	position: absolute;
	top: 1rem;
	right: 1rem;
}

.bag-container {
	text-align: center;
	max-width: 720px;
}

@media (max-width: 600px) {
	.bag-container {
		max-width: 420px;
	}
}

/* ── The Bag (single persistent element) ── */

#the-bag {
	position: fixed;
	z-index: 9999;
	pointer-events: none;
	left: var(--bag-x, 50%);
	top: var(--bag-y, 50%);
	width: calc(200px * var(--bag-scale, 1));
	height: calc(300px * var(--bag-scale, 1));
	translate: -50% -68%;
	clip-path: inset(var(--bag-clip-top, 46%) var(--bag-clip-right, 15%) var(--bag-clip-bottom, 10%) var(--bag-clip-left, 15%));
	filter: drop-shadow(0 8px 16px hsl(var(--foreground) / 0.15));
	transition:
		left 0.5s cubic-bezier(0.4, 0, 0.2, 1),
		top 0.5s cubic-bezier(0.4, 0, 0.2, 1),
		width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
		height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
		clip-path 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#the-bag.no-transition {
	transition: none !important;
}

#the-bag.bag-float {
	animation: float 3s ease-in-out infinite;
}

#the-bag.bag-initializing {
	opacity: 0;
}

#the-bag svg {
	width: 100%;
	height: 100%;
}

/* ── Spacers ── */

.bag-spacer {
	width: 10rem;
	height: 13rem;
	margin: 0 auto 1.25rem;
	cursor: pointer;
}

.header-bag-spacer {
	display: inline-block;
	width: 1.5em;
	height: 1.5em;
	vertical-align: middle;
	cursor: pointer;
}

@keyframes float {

	0%,
	100% {
		transform: translateY(0);
	}

	50% {
		transform: translateY(-10px);
	}
}

.bag-container h1 {
	font-size: clamp(1.5rem, 4vw, 2rem);
	margin-bottom: 0.5rem;
}

.tagline {
	color: hsl(var(--muted-foreground));
	font-size: 0.95rem;
	margin-bottom: 2rem;
}

/* ── Buttons ── */

.btn-primary {
	background: hsl(var(--primary));
	color: hsl(var(--primary-foreground));
	border: none;
	border-radius: var(--radius);
	padding: 0.6rem 1.5rem;
	font-family: var(--font-sans);
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
	box-shadow: 0 1px 3px 0 hsl(var(--primary) / 0.3);
}

.btn-primary:hover {
	opacity: 0.9;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px hsl(var(--primary) / 0.35);
}

.btn-primary:active {
	transform: translateY(0);
}

.btn-secondary {
	background: hsl(var(--secondary));
	color: hsl(var(--secondary-foreground));
	border: 1px solid hsl(var(--border));
	border-radius: var(--radius);
	padding: 0.5rem 1rem;
	font-family: var(--font-sans);
	font-size: 0.95rem;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
	background: hsl(var(--accent));
	border-color: hsl(var(--ring));
}

.btn-secondary:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.btn-destructive {
	background: hsl(var(--destructive));
	color: hsl(var(--destructive-foreground));
	border: none;
	border-radius: var(--radius);
	padding: 0.35rem 0.75rem;
	font-family: var(--font-sans);
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.2s;
}

.btn-destructive:hover {
	opacity: 0.85;
}

.btn-success {
	background: hsl(var(--success));
	color: hsl(var(--success-foreground));
	border: none;
	border-radius: var(--radius);
	padding: 0.35rem 0.75rem;
	font-family: var(--font-sans);
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.2s;
}

.btn-success:hover {
	opacity: 0.85;
}

.btn-ghost {
	background: transparent;
	color: hsl(var(--muted-foreground));
	border: none;
	border-radius: var(--radius);
	padding: 0.4rem 0.6rem;
	font-family: var(--font-sans);
	font-size: 0.95rem;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.btn-ghost:hover {
	background: hsl(var(--accent));
	color: hsl(var(--accent-foreground));
}

/* ── Theme toggle ── */

.theme-toggle {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	background: hsl(var(--muted));
	border-radius: var(--radius);
	padding: 3px;
	border: 1px solid hsl(var(--border));
}

.theme-toggle button {
	background: none;
	border: none;
	border-radius: calc(var(--radius) - 2px);
	padding: 0.35rem 0.55rem;
	cursor: pointer;
	color: hsl(var(--muted-foreground));
	font-size: 0.95rem;
	line-height: 1;
	transition: background 0.15s, color 0.15s;
}

.theme-toggle button:hover {
	color: hsl(var(--foreground));
}

.theme-toggle button.active {
	background: hsl(var(--background));
	color: hsl(var(--foreground));
	box-shadow: 0 1px 2px hsl(var(--foreground) / 0.08);
}

/* ── Table view ── */

#table-view {
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 1rem 3rem;
}

#table-view header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.75rem;
	padding: 1rem 0;
	border-bottom: 1px solid hsl(var(--border));
	position: sticky;
	top: 0;
	z-index: 10;
	background: hsl(var(--background));
}

.header-left {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

#table-view header h1 {
	font-size: clamp(1.1rem, 3vw, 1.5rem);
}

.header-right {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

/* ── Table ── */

#bookmarks-table-container {
	border-radius: var(--radius);
}

#bookmarks-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 1rem;
	table-layout: fixed;
}

.title-col {
	width: 30%;
}


.thumb-cell {
	width: 60px;
}

.desc-cell,
.desc-col-head {
	width: 26%;
}

.meta-col {
	width: 11%;
}

.narrow-col {
	width: 36px;
}

.check-col {
	width: 36px;
	text-align: center;
}

.actions-cell {
	width: 180px;
}

.actions-cell button {
	margin: 0.1rem 0.15rem;
}

.btn-sm {
	padding: 0.2rem 0.5rem;
	font-size: 0.72rem;
	border-radius: calc(var(--radius) - 2px);
}

#bookmarks-table thead {
	background: hsl(var(--muted));
	position: sticky;
	top: var(--header-height, 60px);
	z-index: 5;
}

#bookmarks-table th {
	text-align: left;
	padding: 0.75rem 1rem;
	font-family: var(--font-sans);
	font-weight: 600;
	color: hsl(var(--muted-foreground));
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	white-space: nowrap;
	border-bottom: 1px solid hsl(var(--border));
}

#bookmarks-table th:first-child {
	border-top-left-radius: var(--radius);
}

#bookmarks-table th:last-child {
	border-top-right-radius: var(--radius);
}

#bookmarks-table .narrow-col {
	text-align: center;
}

#bookmarks-table td {
	padding: 0.75rem 1rem;
	vertical-align: top;
}

#bookmarks-table tbody tr {
	background: none;
	transition: background 0.15s;
}

#bookmarks-table a {
	color: hsl(var(--primary));
	text-decoration: none;
	font-weight: 500;
	word-break: break-word;
}

#bookmarks-table a:hover {
	opacity: 0.8;
	text-decoration: underline;
}

.thumb {
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: calc(var(--radius) - 2px);
	background: hsl(var(--muted));
	border: 1px solid hsl(var(--border));
}

.desc-cell {
	color: hsl(var(--muted-foreground));
	font-size: 0.9rem;
	line-height: 1.45;
	overflow: hidden;
	text-overflow: ellipsis;
}

.title-col {
	overflow: hidden;
	text-overflow: ellipsis;
}

.title-col .title-text {
	font-weight: 600;
	color: hsl(var(--foreground));
}

.meta-col {
	font-size: 0.85rem;
	color: hsl(var(--muted-foreground));
	white-space: nowrap;
}

/* ── Source badges ── */

.source-favicon {
	width: 20px;
	height: 20px;
	border-radius: 4px;
	object-fit: contain;
	vertical-align: middle;
}

.source-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 0.78rem;
	font-weight: 600;
	padding: 3px 8px;
	border-radius: 999px;
	white-space: nowrap;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.badge-twitter {
	background: hsl(204 89% 53% / 0.12);
	color: hsl(204 89% 53%);
	border: 1px solid hsl(204 89% 53% / 0.25);
}

.badge-youtube {
	background: hsl(0 100% 50% / 0.1);
	color: hsl(0 70% 55%);
	border: 1px solid hsl(0 100% 50% / 0.2);
}

.badge-reddit {
	background: hsl(16 100% 50% / 0.1);
	color: hsl(16 90% 55%);
	border: 1px solid hsl(16 100% 50% / 0.2);
}

.badge-instagram {
	background: hsl(340 75% 54% / 0.1);
	color: hsl(340 75% 54%);
	border: 1px solid hsl(340 75% 54% / 0.2);
}

.badge-tiktok {
	background: hsl(174 100% 47% / 0.1);
	color: hsl(174 80% 40%);
	border: 1px solid hsl(174 100% 47% / 0.2);
}

.badge-github {
	background: hsl(var(--muted-foreground) / 0.1);
	color: hsl(var(--muted-foreground));
	border: 1px solid hsl(var(--muted-foreground) / 0.2);
}

.badge-generic {
	background: hsl(var(--muted-foreground) / 0.08);
	color: hsl(var(--muted-foreground));
	border: 1px solid hsl(var(--muted-foreground) / 0.15);
}

.dark .badge-tiktok {
	color: hsl(174 100% 47%);
}

/* ── Bookmark groups (main + URL sub-row) ── */

.bookmark-group {
	--group-bg: var(--card);
	--group-border: var(--primary);
}

.bookmark-group:nth-child(even) {
	--group-bg: var(--muted);
	--group-border: 220 70% 55%;
}

/* All cells: shared background, no real borders */
.bookmark-group .row-main td,
.bookmark-group .row-url td {
	background: hsl(var(--group-bg));
	border: none;
}

/* ── Card outline via uniform inset box-shadows ── */

/* Main row: top edge only (middle cells) */
.bookmark-group .row-main td {
	box-shadow: inset 0 1px 0 0 hsl(var(--border));
}

/* Main row: first cell — left edge + top edge + accent */
.bookmark-group .row-main td:first-child {
	box-shadow:
		inset 0 1px 0 0 hsl(var(--border)),
		inset 1px 0 0 0 hsl(var(--border)),
		inset 3px 0 0 0 hsl(var(--group-border) / 0.5);
}

/* Main row: last cell — right edge + top edge */
.bookmark-group .row-main td:last-child {
	box-shadow:
		inset 0 1px 0 0 hsl(var(--border)),
		inset -1px 0 0 0 hsl(var(--border));
}

/* URL row: bottom + left + right edges (single colspan cell) */
.bookmark-group .row-url td {
	padding: 0.3rem 1rem 0.65rem;
	box-shadow:
		inset 0 -1px 0 0 hsl(var(--border)),
		inset 1px 0 0 0 hsl(var(--border)),
		inset -1px 0 0 0 hsl(var(--border)),
		inset 3px 0 0 0 hsl(var(--group-border) / 0.5);
}

/* ── Rounded corners ── */

/* Top: horizontal stays at --radius (no left/right border to eat it),
   vertical inflated by 30px to compensate the 30px top border */
.bookmark-group .row-main td:first-child {
	border-top-left-radius: var(--radius) calc(var(--radius) + 30px);
}

.bookmark-group .row-main td:last-child {
	border-top-right-radius: var(--radius) calc(var(--radius) + 30px);
}

/* Bottom: standard radius */
.bookmark-group .row-url td {
	border-bottom-left-radius: var(--radius);
	border-bottom-right-radius: var(--radius);
}

/* Spacing: 30px after table header and between groups */
#bookmarks-body+.bookmark-group .row-main td {
	border-top: 30px solid transparent;
	background-clip: padding-box;
}

.bookmark-group+.bookmark-group .row-main td {
	border-top: 30px solid transparent;
	background-clip: padding-box;
}

.row-url .url-text {
	display: inline-flex;
	align-items: center;
	max-width: 100%;
	overflow: hidden;
	white-space: nowrap;
	font-family: var(--font-mono);
	font-size: 1.33rem;
	color: hsl(var(--muted-foreground));
	background: hsl(var(--background));
	padding: 0.3rem 0.85rem;
	border-radius: 999px;
	border: 1px solid hsl(var(--border));
	text-decoration: none;
}

.row-url .url-text:hover {
	color: hsl(var(--primary));
	border-color: hsl(var(--primary) / 0.3);
}

.row-url .url-text .source-favicon {
	flex: 0 0 auto;
	width: 1em;
	height: 1em;
	border-radius: 3px;
	object-fit: contain;
}

.row-url .url-text .source-badge {
	flex: 0 0 auto;
	font-size: 0.72rem;
}

.row-url .url-text .url-sep {
	flex: 0 0 auto;
	width: 1px;
	align-self: stretch;
	margin: 0.15em 0.6rem;
	background: hsl(var(--border));
}

.row-url .url-text .url-start {
	flex: 0 1 auto;
	overflow: hidden;
	text-overflow: ellipsis;
}

.row-url .url-text .url-end {
	flex: 0 0 auto;
}

.row-url .url-wrap {
	position: relative;
	display: inline-flex;
	max-width: 100%;
}

.row-url .url-tooltip {
	display: none;
	position: absolute;
	bottom: calc(100% + 6px);
	left: 0;
	background: hsl(var(--card));
	color: hsl(var(--card-foreground));
	border: 1px solid hsl(var(--border));
	font-family: var(--font-mono);
	font-size: 0.78rem;
	padding: 0.4rem 0.7rem;
	border-radius: var(--radius);
	white-space: nowrap;
	max-width: 90vw;
	overflow: hidden;
	text-overflow: ellipsis;
	z-index: 10;
	pointer-events: none;
	box-shadow: 0 4px 12px hsl(var(--foreground) / 0.08);
}

.row-url .url-wrap:hover .url-tooltip {
	display: block;
}

.row-url .url-wrap.no-truncation .url-tooltip {
	display: none !important;
}

/* ── Pagination ── */

#pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	margin-top: 1.5rem;
}

#page-info {
	color: hsl(var(--muted-foreground));
	font-size: 0.95rem;
	min-width: 120px;
	text-align: center;
}

/* ── Responsive ── */

@media (max-width: 1100px) {

	.desc-cell,
	.desc-col-head {
		display: none;
	}

	.thumb-cell {
		display: none;
	}

	.title-col {
		width: 35%;
	}
}

@media (max-width: 600px) {
	.source-col {
		display: none;
	}

	#pagination {
		flex-wrap: wrap;
		gap: 0.75rem;
	}

	#bookmarks-table {
		table-layout: auto;
	}
}

/* ── Admin styles ── */

.deleted-row {
	opacity: 0.45;
}

.deleted-row .row-main td {
	text-decoration: line-through;
}

.toggle-deleted {
	color: hsl(var(--muted-foreground));
	font-size: 0.95rem;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.login-form {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-top: 1.25rem;
}

.login-form input {
	padding: 0.6rem 0.85rem;
	border-radius: var(--radius);
	border: 1px solid hsl(var(--input));
	background: hsl(var(--background));
	color: hsl(var(--foreground));
	font-family: var(--font-sans);
	font-size: 1rem;
}

.login-form input:focus {
	outline: 2px solid hsl(var(--ring));
	outline-offset: 1px;
}

.checkmark {
	color: hsl(var(--success));
	font-weight: bold;
	cursor: default;
}

.close-bag {
	cursor: pointer;
	transition: opacity 0.2s;
}

.close-bag:hover {
	opacity: 0.8;
}

.check-col input[type="checkbox"] {
	cursor: pointer;
	width: 16px;
	height: 16px;
	accent-color: hsl(var(--primary));
}

/* ── Stats footer ── */

#stats-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: hsl(var(--background));
    border-top: 1px solid hsl(var(--border));
    padding: 0.5rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

#stats-footer.hidden {
    display: none !important;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.stat-chip-muted {
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    border: 1px solid hsl(var(--border));
}

.stat-chip-accent {
    background: hsl(var(--gold) / 0.12);
    color: hsl(var(--gold));
    border: 1px solid hsl(var(--gold) / 0.25);
}

.stat-chip-success {
    background: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
    border: 1px solid hsl(var(--success) / 0.2);
}

.stat-chip .chip-icon {
    font-size: 0.75rem;
    width: 1em;
    text-align: center;
}

.stat-chip .chip-label {
    color: hsl(var(--muted-foreground));
    font-weight: 500;
}

.stat-sep {
    color: hsl(var(--border));
    font-size: 0.7rem;
}

/* "Since" chip tooltip for mobile tap-to-reveal */
.since-chip-wrap {
    position: relative;
    display: inline-flex;
}

.since-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius);
    white-space: nowrap;
    z-index: 25;
    pointer-events: none;
    box-shadow: 0 4px 12px hsl(var(--foreground) / 0.08);
}

.since-tooltip.visible {
    display: block;
    animation: sinceFade 1s ease 4s forwards;
}

@keyframes sinceFade {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ── Card layout (mobile) ── */

#bookmarks-cards-container {
    display: none;
}

.bookmark-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-left: 3px solid hsl(var(--primary) / 0.5);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.bookmark-card:nth-child(even) {
    background: hsl(var(--muted));
    border-left-color: hsl(220 70% 55% / 0.5);
}

.bookmark-card .card-header {
    display: flex;
    gap: 0.6rem;
    padding: 0.75rem;
    align-items: flex-start;
}

.bookmark-card .card-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: calc(var(--radius) - 2px);
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    flex-shrink: 0;
}

.bookmark-card .card-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.bookmark-card .card-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: hsl(var(--foreground));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-card .card-url {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    margin-top: 0.2rem;
}

.bookmark-card .card-url:hover {
    color: hsl(var(--primary));
}

.bookmark-card .card-url .source-favicon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.bookmark-card .card-url .source-badge {
    font-size: 0.65rem;
    padding: 1px 5px;
    flex-shrink: 0;
}

.bookmark-card .card-expand {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: hsl(var(--muted-foreground) / 0.45);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0.25rem 0;
    text-align: center;
    transition: transform 0.2s, color 0.15s;
}

.bookmark-card .card-expand:hover {
    color: hsl(var(--muted-foreground));
}

.bookmark-card.expanded .card-expand {
    transform: rotate(180deg);
}

.bookmark-card .card-details {
    display: none;
    padding: 0.5rem 0.75rem 0.6rem;
    border-top: 1px solid hsl(var(--border));
    font-size: 0.82rem;
    color: hsl(var(--muted-foreground));
}

.bookmark-card.expanded .card-details {
    display: block;
}

.bookmark-card .card-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
}

.bookmark-card .card-details .detail-label {
    font-weight: 500;
    color: hsl(var(--foreground));
}

.bookmark-card .card-actions {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid hsl(var(--border));
    flex-wrap: wrap;
}

.bookmark-card .card-checkbox {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
}

.bookmark-card {
    position: relative;
}

/* ── Theme cycle button (mobile single-button toggle) ── */

.theme-cycle {
    display: none;
    font-size: 1.1rem;
    padding: 0.3rem 0.5rem;
    line-height: 1;
}

/* ── Admin hamburger menu ── */

.admin-hamburger {
    display: none;
    font-size: 1.3rem;
    padding: 0.3rem 0.5rem;
}

@media (max-width: 767px) {
    /* Hide table, show cards */
    #bookmarks-table-container {
        display: none !important;
    }

    #bookmarks-cards-container {
        display: block !important;
    }

    #bookmarks-cards-container.hidden {
        display: none !important;
    }

    /* Stats footer: no separators on mobile */
    .stat-sep {
        display: none;
    }

    /* Theme cycle replaces toggle on mobile */
    .theme-toggle {
        display: none !important;
    }

    .theme-cycle {
        display: inline-flex;
    }

    /* Admin hamburger visible */
    .admin-hamburger {
        display: block;
    }

    /* Admin menu hidden by default on mobile */
    .admin-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 0;
    }

    .admin-menu-open .admin-menu {
        display: flex;
    }

    /* Header adjustments */
    #table-view header h1 {
        font-size: 1rem;
    }
}

@keyframes cascadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.anim-cascade-in {
    animation: cascadeIn 0.4s ease-out both;
}

@keyframes cascadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(20px); }
}

.anim-cascade-out {
    animation: cascadeOut 0.3s ease-in both;
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
	.anim-cascade-in,
	.anim-cascade-out {
		animation: none !important;
	}

	#the-bag {
		transition: none !important;
	}
}
