/* === Theme Variables === */

:root {
    --bg-gradient: linear-gradient(180deg, #f7efe4 0%, #f4f6fb 48%, #eef3f8 100%);
    --text-primary: #18212b;
    --text-muted: #526070;
    --text-subtle: #677688;
    --text-faint: #8a9aaa;
    --text-brand-sub: #586575;
    --accent: #c46c2f;
    --accent-hover: #ab5b23;
    --accent-soft: rgba(196, 108, 47, 0.08);
    --accent-softer: rgba(196, 108, 47, 0.07);
    --accent-glow: rgba(196, 108, 47, 0.18);
    --accent-focus: rgba(196, 108, 47, 0.25);
    --accent-link: #ab5b23;
    --eyebrow: #946c37;
    --surface: rgba(255, 255, 255, 0.8);
    --surface-nav: rgba(255, 255, 255, 0.72);
    --surface-input: #ffffff;
    --surface-subtle: #f5f7fb;
    --surface-ghost: rgba(255, 255, 255, 0.55);
    --border-faint: rgba(24, 33, 43, 0.05);
    --border-soft: rgba(24, 33, 43, 0.08);
    --border-mid: rgba(24, 33, 43, 0.1);
    --border-mid2: rgba(100, 100, 100, 0.1);
    --border-normal: rgba(24, 33, 43, 0.12);
    --border-input: rgba(24, 33, 43, 0.14);
    --border-strong: rgba(24, 33, 43, 0.18);
    --shadow-soft: rgba(24, 33, 43, 0.06);
    --shadow-normal: rgba(24, 33, 43, 0.08);
    --modal-backdrop: rgba(24, 33, 43, 0.48);
    --nav-chip-bg: #e9edf4;
    --nav-chip-hover: #dfe6ef;
    --nav-active-bg: #18212b;
    --nav-active-text: #f8fafc;
    --table-header-bg: rgba(247, 239, 228, 0.35);
    --table-row-hover: rgba(247, 239, 228, 0.25);
    --section-badge-bg: rgba(148, 108, 55, 0.1);
    --section-badge-text: #946c37;
    --bookmark-meta-bg: #eff3f8;
    --bookmark-meta-text: #526070;
    --btn-primary-text: #fffaf5;
    --pin-border-color: #eeeeee;
}

[data-theme="ocean-blue"] {
    --bg-gradient: linear-gradient(180deg, #cbe3f8 0%, #d5e6fa 48%, #c2deff 100%);
    --accent: #1976d2;
    --accent-hover: #1565c0;
    --accent-soft: rgba(25, 118, 210, 0.08);
    --accent-softer: rgba(25, 118, 210, 0.07);
    --accent-glow: rgba(25, 118, 210, 0.18);
    --accent-focus: rgba(25, 118, 210, 0.25);
    --accent-link: #1565c0;
    --eyebrow: #1565c0;
    --table-header-bg: rgba(25, 118, 210, 0.07);
    --table-row-hover: rgba(25, 118, 210, 0.04);
    --section-badge-bg: rgba(21, 101, 192, 0.1);
    --section-badge-text: #1565c0;
    --btn-primary-text: #ffffff;
}

[data-theme="fresh-green"] {
    --bg-gradient: linear-gradient(180deg, #d2ebd6 0%, #dbf0dd 48%, #cbe5ce 100%);
    --accent: #388e3c;
    --accent-hover: #2e7d32;
    --accent-soft: rgba(56, 142, 60, 0.08);
    --accent-softer: rgba(56, 142, 60, 0.07);
    --accent-glow: rgba(56, 142, 60, 0.18);
    --accent-focus: rgba(56, 142, 60, 0.25);
    --accent-link: #2e7d32;
    --eyebrow: #2e7d32;
    --table-header-bg: rgba(56, 142, 60, 0.07);
    --table-row-hover: rgba(56, 142, 60, 0.04);
    --section-badge-bg: rgba(46, 125, 50, 0.1);
    --section-badge-text: #2e7d32;
    --btn-primary-text: #ffffff;
}

[data-theme="purple"] {
    --bg-gradient: linear-gradient(180deg, #e3d2f7 0%, #e7dcfa 48%, #dcbeff 100%);
    --accent: #7b1fa2;
    --accent-hover: #6a1b8e;
    --accent-soft: rgba(123, 31, 162, 0.08);
    --accent-softer: rgba(123, 31, 162, 0.07);
    --accent-glow: rgba(123, 31, 162, 0.18);
    --accent-focus: rgba(123, 31, 162, 0.25);
    --accent-link: #6a1b8e;
    --eyebrow: #6a1b8e;
    --table-header-bg: rgba(123, 31, 162, 0.07);
    --table-row-hover: rgba(123, 31, 162, 0.04);
    --section-badge-bg: rgba(106, 27, 142, 0.1);
    --section-badge-text: #6a1b8e;
    --btn-primary-text: #ffffff;
}

[data-theme="cool-beans"] {
    --bg-gradient: linear-gradient(180deg, #e8dbc9 0%, #ede6d5 48%, #e3d9c7 100%);
    --accent: #8b6f47;
    --accent-hover: #7a5c3a;
    --accent-soft: rgba(139, 111, 71, 0.08);
    --accent-softer: rgba(139, 111, 71, 0.07);
    --accent-glow: rgba(139, 111, 71, 0.18);
    --accent-focus: rgba(139, 111, 71, 0.25);
    --accent-link: #7a5c3a;
    --eyebrow: #5d4637;
    --table-header-bg: rgba(139, 111, 71, 0.07);
    --table-row-hover: rgba(139, 111, 71, 0.04);
    --section-badge-bg: rgba(93, 70, 55, 0.1);
    --section-badge-text: #5d4637;
    --btn-primary-text: #ffffff;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg-gradient: linear-gradient(180deg, #111c28 0%, #131f2d 48%, #101a24 100%);
    --text-primary: #c9d8e8;
    --text-muted: #7a9ab5;
    --text-subtle: #6a8aa5;
    --text-faint: #4e7090;
    --text-brand-sub: #6a8aa5;
    --accent: #e07b3a;
    --accent-hover: #c46c2f;
    --accent-soft: rgba(224, 123, 58, 0.12);
    --accent-softer: rgba(224, 123, 58, 0.09);
    --accent-glow: rgba(224, 123, 58, 0.22);
    --accent-focus: rgba(224, 123, 58, 0.28);
    --accent-link: #e07b3a;
    --eyebrow: #e07b3a;
    --surface: rgba(18, 30, 45, 0.92);
    --surface-nav: rgba(15, 26, 40, 0.88);
    --surface-input: #162030;
    --surface-subtle: #162030;
    --surface-ghost: rgba(18, 30, 45, 0.6);
    --border-faint: rgba(255, 255, 255, 0.04);
    --border-soft: rgba(255, 255, 255, 0.08);
    --border-mid: rgba(255, 255, 255, 0.1);
    --border-normal: rgba(255, 255, 255, 0.12);
    --border-input: rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.18);
    --shadow-soft: rgba(0, 0, 0, 0.2);
    --shadow-normal: rgba(0, 0, 0, 0.28);
    --modal-backdrop: rgba(0, 0, 0, 0.65);
    --nav-chip-bg: #1a2b3e;
    --nav-chip-hover: #213347;
    --nav-active-bg: #c9d8e8;
    --nav-active-text: #111c28;
    --table-header-bg: rgba(255, 255, 255, 0.05);
    --table-row-hover: rgba(255, 255, 255, 0.04);
    --section-badge-bg: rgba(224, 123, 58, 0.15);
    --section-badge-text: #e07b3a;
    --bookmark-meta-bg: #1a2b3e;
    --bookmark-meta-text: #7a9ab5;
    --btn-primary-text: #111c28;
    --pin-border-color: #333333;
}

[data-theme="dark-ocean-blue"] {
    color-scheme: dark;
    --bg-gradient: linear-gradient(180deg, #012A4A 0%, #204B74 100%);
    --text-primary: #E9EFF7;
    --text-muted: #9CB7D3;
    --text-subtle: #9CB7D3;
    --text-faint: #5076A1;
    --text-brand-sub: #9CB7D3;
    --accent: #9CB7D3;
    --accent-hover: #E9EFF7;
    --accent-soft: rgba(156, 183, 211, 0.12);
    --accent-softer: rgba(156, 183, 211, 0.08);
    --accent-glow: rgba(156, 183, 211, 0.18);
    --accent-focus: rgba(156, 183, 211, 0.24);
    --accent-link: #9CB7D3;
    --eyebrow: #cccc33;
    --surface: rgba(1, 42, 74, 0.92);
    --surface-nav: rgba(1, 42, 74, 0.88);
    --surface-input: #204B74;
    --surface-subtle: #204B74;
    --surface-ghost: rgba(1, 42, 74, 0.6);
    --border-faint: rgba(233, 239, 247, 0.04);
    --border-soft: rgba(233, 239, 247, 0.08);
    --border-mid: rgba(233, 239, 247, 0.1);
    --border-normal: rgba(233, 239, 247, 0.12);
    --border-input: rgba(233, 239, 247, 0.14);
    --border-strong: rgba(233, 239, 247, 0.18);
    --shadow-soft: rgba(1, 42, 74, 0.3);
    --shadow-normal: rgba(1, 42, 74, 0.4);
    --modal-backdrop: rgba(1, 42, 74, 0.7);
    --nav-chip-bg: #204B74;
    --nav-chip-hover: #5076A1;
    --nav-active-bg: #E9EFF7;
    --nav-active-text: #012A4A;
    --table-header-bg: rgba(233, 239, 247, 0.04);
    --table-row-hover: rgba(233, 239, 247, 0.03);
    --section-badge-bg: rgba(156, 183, 211, 0.14);
    --section-badge-text: #9CB7D3;
    --bookmark-meta-bg: #204B74;
    --bookmark-meta-text: #9CB7D3;
    --btn-primary-text: #012A4A;
    --pin-border-color: #5076A1;
}

[data-theme="dark-fresh-green"] {
    color-scheme: dark;
    --bg-gradient: linear-gradient(180deg, #1f3026 0%, #283d31 48%, #19271f 100%);
    --text-primary: #F6FFF2;
    --text-muted: #C4E3CB;
    --text-subtle: #AFD3B6;
    --text-faint: #7CA982;
    --text-brand-sub: #C4E3CB;
    --accent: #EAE69E;
    --accent-hover: #F7F5CC;
    --accent-soft: rgba(234, 230, 158, 0.14);
    --accent-softer: rgba(234, 230, 158, 0.09);
    --accent-glow: rgba(234, 230, 158, 0.2);
    --accent-focus: rgba(234, 230, 158, 0.28);
    --accent-link: #EAE69E;
    --eyebrow: #EAE69E;
    --surface: rgba(28, 44, 35, 0.94);
    --surface-nav: rgba(22, 36, 28, 0.9);
    --surface-input: #1d2f25;
    --surface-subtle: #1d2f25;
    --surface-ghost: rgba(28, 44, 35, 0.6);
    --border-faint: rgba(246, 255, 242, 0.04);
    --border-soft: rgba(246, 255, 242, 0.08);
    --border-mid: rgba(246, 255, 242, 0.1);
    --border-normal: rgba(246, 255, 242, 0.12);
    --border-input: rgba(246, 255, 242, 0.15);
    --border-strong: rgba(246, 255, 242, 0.2);
    --shadow-soft: rgba(10, 20, 14, 0.25);
    --shadow-normal: rgba(10, 20, 14, 0.35);
    --modal-backdrop: rgba(20, 32, 25, 0.7);
    --nav-chip-bg: #2D4739;
    --nav-chip-hover: #3F6844;
    --nav-active-bg: #C4E3CB;
    --nav-active-text: #2D4739;
    --table-header-bg: rgba(196, 227, 203, 0.06);
    --table-row-hover: rgba(196, 227, 203, 0.04);
    --section-badge-bg: rgba(124, 169, 130, 0.18);
    --section-badge-text: #C4E3CB;
    --bookmark-meta-bg: #2D4739;
    --bookmark-meta-text: #C4E3CB;
    --btn-primary-text: #2D4739;
    --pin-border-color: #2D4739;
}

[data-theme="dark-purple"] {
    color-scheme: dark;
    --bg-gradient: linear-gradient(180deg, #3d324a 0%, #4c3f5c 48%, #362a45 100%);
    --text-primary: #ded5e8;
    --text-muted: #9a8f9f;
    --text-subtle: #7c7283;
    --text-faint: #5e5564;
    --text-brand-sub: #aa9cbd;
    --accent: #b5a4d4;
    --accent-hover: #9b87bd;
    --accent-soft: rgba(181, 164, 212, 0.12);
    --accent-softer: rgba(181, 164, 212, 0.08);
    --accent-glow: rgba(181, 164, 212, 0.18);
    --accent-focus: rgba(181, 164, 212, 0.24);
    --accent-link: #b5a4d4;
    --eyebrow: #ffdab9;
    --surface: rgba(38, 31, 46, 0.92);
    --surface-nav: rgba(32, 26, 39, 0.88);
    --surface-input: #2e2539;
    --surface-subtle: #2e2539;
    --surface-ghost: rgba(38, 31, 46, 0.6);
    --border-faint: rgba(255, 255, 255, 0.03);
    --border-soft: rgba(255, 255, 255, 0.06);
    --border-mid: rgba(255, 255, 255, 0.09);
    --border-normal: rgba(255, 255, 255, 0.11);
    --border-input: rgba(255, 255, 255, 0.13);
    --border-strong: rgba(255, 255, 255, 0.16);
    --shadow-soft: rgba(3, 0, 6, 0.25);
    --shadow-normal: rgba(3, 0, 6, 0.35);
    --modal-backdrop: rgba(11, 7, 15, 0.7);
    --nav-chip-bg: #292133;
    --nav-chip-hover: #352b42;
    --nav-active-bg: #ded5e8;
    --nav-active-text: #15111a;
    --table-header-bg: rgba(255, 255, 255, 0.04);
    --table-row-hover: rgba(255, 255, 255, 0.03);
    --section-badge-bg: rgba(181, 164, 212, 0.14);
    --section-badge-text: #b5a4d4;
    --bookmark-meta-bg: #292133;
    --bookmark-meta-text: #9a8f9f;
    --btn-primary-text: #15111a;
    --pin-border-color: #222222;
}

[data-theme="dark-cool-beans"] {
    color-scheme: dark;
    --bg-gradient: linear-gradient(180deg, #2b2222 0%, #5a4b42 100%);
    --text-primary: #FFF8F2;
    --text-muted: #EFE0D2;
    --text-subtle: #CDB4A0;
    --text-faint: #8D6E63;
    --text-brand-sub: #CDB4A0;
    --accent: #CDB4A0;
    --accent-hover: #EFE0D2;
    --accent-soft: rgba(205, 180, 160, 0.12);
    --accent-softer: rgba(205, 180, 160, 0.08);
    --accent-glow: rgba(205, 180, 160, 0.18);
    --accent-focus: rgba(205, 180, 160, 0.24);
    --accent-link: #CDB4A0;
    --eyebrow: #ffefd5;
    --surface: rgba(26, 20, 20, 0.92);
    --surface-nav: rgba(26, 20, 20, 0.88);
    --surface-input: #433730;
    --surface-subtle: #433730;
    --surface-ghost: rgba(26, 20, 20, 0.6);
    --border-faint: rgba(255, 248, 242, 0.04);
    --border-soft: rgba(255, 248, 242, 0.08);
    --border-mid: rgba(255, 248, 242, 0.1);
    --border-normal: rgba(255, 248, 242, 0.12);
    --border-input: rgba(255, 248, 242, 0.14);
    --border-strong: rgba(255, 248, 242, 0.18);
    --shadow-soft: rgba(59, 47, 47, 0.3);
    --shadow-normal: rgba(59, 47, 47, 0.4);
    --modal-backdrop: rgba(26, 20, 20, 0.7);
    --nav-chip-bg: #8D6E63;
    --nav-chip-hover: #CDB4A0;
    --nav-active-bg: #FFF8F2;
    --nav-active-text: #3B2F2F;
    --table-header-bg: rgba(255, 248, 242, 0.04);
    --table-row-hover: rgba(255, 248, 242, 0.03);
    --section-badge-bg: rgba(205, 180, 160, 0.14);
    --section-badge-text: #CDB4A0;
    --bookmark-meta-bg: #8D6E63;
    --bookmark-meta-text: #EFE0D2;
    --btn-primary-text: #3B2F2F;
    --pin-border-color: #8D6E63;
}

/* === Base === */

* {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-gradient);
    color: var(--text-primary);
}

.page-header {
    font-size: 18px;
    font-weight: bold;
    padding: 24px 28px 12px;
}

.brand-block {
    max-width: 1800px;
    margin: 0 auto;
}

.brand-title,
.hero-title,
.content-title {
    margin: 0;
}

.brand-title-row {
    display: flex;
    align-items: flex-start;
    gap: 7px;
}

.brand-info-btn {
    width: 17px;
    height: 17px;
    margin-top: 2px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-brand-sub);
    cursor: pointer;
    flex: 0 0 auto;
    transition: color 0.15s ease, transform 0.15s ease;
}

.brand-info-btn svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
}

.brand-info-btn:hover,
.brand-info-btn:focus-visible {
    color: var(--accent);
    transform: translateY(-1px);
    outline: none;
}

.brand-info-btn:focus-visible {
    box-shadow: 0 0 0 3px var(--accent-focus);
}

.brand-subtitle,
.hero-copy,
.section-note,
.eyebrow,
.stat-label {
    margin: 0;
}

.brand-subtitle {
    margin-top: 6px;
    font-size: 14px;
    font-weight: normal;
    color: var(--text-brand-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-shell {
    max-width: 1800px;
    margin: 0 auto;
    padding: 12px 28px 40px;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
    transition: grid-template-columns 0.22s ease;
}

.page-shell.is-nav-collapsed {
    grid-template-columns: 56px minmax(0, 1fr);
}

.page-container {
    display: grid;
    gap: 24px;
}

.legal-brand-link {
    color: inherit;
    text-decoration: none;
}

.legal-shell {
    max-width: 920px;
    margin: 0 auto;
    padding: 12px 28px 40px;
}

.legal-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.legal-back-link,
.legal-nav-link,
.legal-content a {
    color: var(--accent-link);
    font-weight: bold;
    text-decoration: none;
}

.legal-back-link:hover,
.legal-back-link:focus-visible,
.legal-nav-link:hover,
.legal-nav-link:focus-visible,
.legal-content a:hover,
.legal-content a:focus-visible {
    text-decoration: none;
}

.legal-back-link {
    margin-right: auto;
}

.legal-back-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 4px;
    vertical-align: -4px;
}

.legal-nav-link {
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 13px;
}

.legal-nav-link.is-active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
}

.legal-card {
    padding: 30px 34px;
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    background: var(--surface);
    backdrop-filter: blur(12px);
    box-shadow: 0 18px 40px var(--shadow-normal);
}

.legal-heading {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-soft);
}

.legal-heading .content-title {
    margin-top: 8px;
}

.legal-intro {
    max-width: 680px;
    margin: 14px 0 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.legal-content {
    display: grid;
    gap: 24px;
    padding-top: 26px;
}

.legal-content section {
    display: grid;
    gap: 8px;
}

.legal-content h3,
.legal-content p {
    margin: 0;
}

.legal-content h3 {
    font-size: 17px;
}

.legal-content p {
    color: var(--text-muted);
    line-height: 1.65;
}

.site-footer {
    max-width: 1200px;
    margin: 50px auto 0px auto;
    padding: 0 28px 28px;
    display: flex;
    justify-content: flex-end;
    gap: 18px;
}

.site-footer a {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
    color: var(--accent-link);
    text-decoration: underline;
}

.sidebar {
    align-self: start;
    position: sticky;
    top: 20px;
    display: grid;
    gap: 14px;
}

.section-nav {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    background: var(--surface-nav);
    backdrop-filter: blur(14px);
}

.dashboard-nav {
    margin-bottom: 0;
}

.nav-chip,
.primary-action {
    border: 0;
    cursor: pointer;
}

.nav-chip {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--nav-chip-bg);
    color: var(--text-primary);
    text-align: left;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
}

.nav-label {
    overflow: hidden;
    transition: opacity 0.15s ease, max-width 0.22s ease;
    max-width: 200px;
    opacity: 1;
}

.sidebar-toggle {
    width: 45px;
    height: 36px;
    padding: 8px 14px;
    border: 1px solid var(--border-mid);
    border-radius: 12px;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: bold;
    transition: background 0.15s, color 0.15s;
    overflow: hidden;
    white-space: nowrap;
    margin-top: 2px;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
    background: var(--nav-chip-bg);
    color: var(--text-primary);
    outline: none;
}

.toggle-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    transition: transform 0.22s ease;
}

/* Collapsed state */
.page-shell.is-nav-collapsed .section-nav {
    padding: 12px 6px;
}

.page-shell.is-nav-collapsed .nav-chip {
    justify-content: center;
    padding: 10px;
    gap: 0;
}

.page-shell.is-nav-collapsed .nav-label {
    max-width: 0;
    opacity: 0;
}

.page-shell.is-nav-collapsed .sidebar-toggle {
    justify-content: center;
    padding: 8px;
    gap: 0;
}

.page-shell.is-nav-collapsed .toggle-icon {
    transform: rotate(180deg);
}

.nav-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    fill: currentColor;
    stroke: none;
}

.nav-icon-gear {
    width: 20px;
    height: 20px;
}

.nav-chip:hover,
.nav-chip:focus-visible {
    background: var(--nav-chip-hover);
    outline: none;
    transform: translateY(-1px);
}

.nav-chip.is-active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
}

.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--nav-chip-bg);
    color: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    position: relative;
}

.tab-chip-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    color: inherit;
    opacity: 1;
    cursor: pointer;
    transition: opacity 0.15s;
}

.tab-chip:hover .tab-chip-menu-trigger,
.tab-chip-menu-trigger:focus-visible {
    opacity: 1;
}

.tab-chip-menu-trigger:hover,
.tab-chip-menu-trigger:focus-visible {
    background: rgba(0, 0, 0, 0.12);
    outline: none;
}

.tab-chip-menu-trigger svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    pointer-events: none;
}

.tab-chip-menu {
    position: absolute;
    top: calc(100% - 105px);
    right: -105px;
    min-width: 120px;
    padding: 8px 0;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface-input);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24), 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 100;
    color: var(--text-primary);
}

.tab-chip-menu[hidden] {
    display: none;
}

.tab-chip-menu-content {
    display: flex;
    flex-direction: column;
}

.tab-chip-menu-rename,
.tab-chip-menu-delete {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    padding: 4px 16px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
}

.tab-chip-menu-rename {
    color: #2e7d32;
}

.tab-chip-menu-rename:hover,
.tab-chip-menu-rename:focus-visible {
    background: #e8f5e9;
    outline: none;
}

.tab-chip-menu-delete {
    color: #a63f22;
}

.tab-chip-menu-delete:hover,
.tab-chip-menu-delete:focus-visible {
    background: #ffe9e5;
    outline: none;
}

.tab-chip-menu-rename svg,
.tab-chip-menu-delete svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    pointer-events: none;
    flex-shrink: 0;
}

.bookmark-io-wrap {
    position: relative;
    display: flex;
    align-self: stretch;
}

.bookmark-io-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 14px;
    border: 1.5px solid var(--accent);
    border-radius: 14px;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
}

.bookmark-io-trigger svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.bookmark-io-trigger:hover,
.bookmark-io-trigger:focus-visible {
    background: var(--accent-soft);
    outline: none;
}

.bookmark-io-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    padding: 6px 0;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface-input);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24), 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 100;
}

.bookmark-io-menu[hidden] {
    display: none;
}

.bookmark-io-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 16px;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.bookmark-io-item svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

.bookmark-io-item:hover,
.bookmark-io-item:focus-visible {
    background: var(--nav-chip-hover);
    outline: none;
}

.tab-chip:hover,
.tab-chip:focus-visible {
    background: var(--nav-chip-hover);
    outline: none;
    transform: translateY(-1px);
}

.tab-chip.is-active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
}

.tab-chip-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
}

.tab-chip-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.12);
}

.tab-chip-rename {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
}

.tab-chip-rename:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.12);
}

.tab-chip-rename svg {
    fill: currentColor;
}

.tab-chip-add {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px dashed var(--border-soft);
    background: transparent;
    color: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.tab-chip-add:hover,
.tab-chip-add:focus-visible {
    background: var(--nav-chip-hover);
    outline: none;
}

.hero-panel,
.stat-card,
.bookmark-card,
.editor-panel {
    border: 1px solid var(--border-soft);
    border-radius: 22px;
    background: var(--surface);
    backdrop-filter: blur(12px);
    box-shadow: 0 18px 40px var(--shadow-normal);
}

.is-hidden {
    display: none !important;
}

.hero-panel {
    padding: 28px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: end;
}

.eyebrow {
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--eyebrow);
}

.hero-title {
    margin-top: 10px;
    font-size: 34px;
    line-height: 1.15;
    max-width: 700px;
}

.hero-copy {
    margin-top: 12px;
    max-width: 720px;
    color: var(--text-muted);
    line-height: 1.6;
}

.heading-actions {
    width: 75%;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.dashboard-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 260px;
    min-width: 200px;
    max-width: 263px;
}

.dashboard-search-icon {
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    color: var(--text-subtle);
    pointer-events: none;
}

.dashboard-search-input {
    width: 100%;
    padding: 12px 30px 12px 38px;
    border-radius: 14px;
    border: 1.5px solid var(--border, rgba(127, 127, 127, 0.3));
    background: var(--input-bg, transparent);
    color: inherit;
    font-size: 14px;
}

.dashboard-search-input::-webkit-search-cancel-button {
    display: none;
}

.dashboard-search-input:focus-visible {
    outline: none;
    border-color: var(--accent);
}

.dashboard-search-clear {
    position: absolute;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-subtle);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-search-clear:hover,
.dashboard-search-clear:focus-visible {
    background: var(--accent-soft);
    outline: none;
}

.section-tile.search-no-match {
    display: none;
}

.section-tile-item.search-no-match {
    display: none;
}

.secondary-action {
    padding: 14px 18px;
    border-radius: 14px;
    background: transparent;
    border: 1.5px solid var(--accent);
    color: var(--accent);
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    cursor: pointer;
}

.secondary-action:hover,
.secondary-action:focus-visible {
    background: var(--accent-soft);
    outline: none;
}

.primary-action {
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--accent);
    color: var(--btn-primary-text);
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
}

.primary-action:hover,
.primary-action:focus-visible {
    background: var(--accent-hover);
    outline: none;
}

.primary-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.stats-grid,
.bookmark-grid {
    display: grid;
    gap: 18px;
}

.stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
    padding: 20px;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-subtle);
}

.stat-value {
    display: block;
    margin-top: 8px;
    font-size: 28px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 18px;
}

.content-title {
    margin-top: 8px;
    font-size: 28px;
}

.section-note {
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.5;
}

.section-privacy-note {
    color: var(--text-muted);
    line-height: 1.5;
}

.bookmark-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bookmark-card {
    padding: 18px 64px 18px 18px;
    position: relative;
    border-radius: 10px;
    width: 95%;
    height: 60px;
    justify-self: start;
    display: flex;
    align-items: center;
}

.bookmark-actions {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
}

.bookmark-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--bookmark-meta-bg);
    color: var(--bookmark-meta-text);
    font-size: 12px;
    font-weight: bold;
}

.bookmark-card h3 {
    margin: 0;
    font-size: 10px;
    padding-right: 0;
}

.bookmark-title-link {
    color: var(--text-primary);
    text-decoration: none;
}

.bookmark-title-link:hover,
.bookmark-title-link:focus-visible {
    color: var(--accent-link);
    text-decoration: underline;
    outline: none;
}

.bookmark-card p {
    margin: 0 0 18px;
    color: var(--text-muted);
    line-height: 1.5;
}

.bookmark-delete {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 999px;
    background: #ffe9e5;
    color: #a63f22;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bookmark-edit {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 999px;
    background: #e6f0ff;
    color: #1f5bbf;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bookmark-edit:hover,
.bookmark-edit:focus-visible {
    background: #d4e6ff;
    outline: none;
}

.bookmark-edit svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.bookmark-delete:hover,
.bookmark-delete:focus-visible {
    background: #ffd9d1;
    outline: none;
}

.bookmark-delete svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.section-list {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface-subtle);
    border: 1px solid var(--border-mid);
}

.section-row-title {
    margin: 0;
    font-size: 16px;
}

.section-row-meta {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.section-row-actions {
    display: flex;
    gap: 8px;
}

.section-delete {
    background: #ffe9e5;
    color: #9e2a12;
}

.section-delete:hover,
.section-delete:focus-visible {
    background: #ffd9d1;
}

.editor-panel {
    padding: 24px;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 20;
}

.modal.is-open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--modal-backdrop);
    backdrop-filter: blur(6px);
}

.modal-dialog {
    position: relative;
    width: min(100%, 680px);
    max-height: calc(100vh - 48px);
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
}

.modal-close {
    border: 0;
    border-radius: 999px;
    background: var(--nav-chip-bg);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

.modal-close:hover,
.modal-close:focus-visible {
    background: var(--nav-chip-hover);
    outline: none;
}

.icon-close {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
}

.modal-note {
    margin-top: 14px;
    margin-bottom: 20px;
    max-width: none;
}

#section-edit-form {
    margin-top: 14px;
}

#bookmark-edit-form {
    margin-top: 14px;
}

body.modal-open {
    overflow: hidden;
}

.section-heading-compact {
    margin-bottom: 20px;
}

.form-title {
    font-size: 24px;
}

.bookmark-form {
    display: grid;
    gap: 16px;
}

.modal-header + .bookmark-form {
    margin-top: 20px;
}

.bookmark-form label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    font-weight: bold;
}

.bookmark-form input,
.bookmark-form select,
.bookmark-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-input);
    border-radius: 14px;
    background: var(--surface-input);
    color: var(--text-primary);
    font-size: 14px;
}

.bookmark-form textarea {
    resize: vertical;
}

.bookmark-form input:focus-visible,
.bookmark-form select:focus-visible,
.bookmark-form textarea:focus-visible {
    outline: 2px solid var(--accent-focus);
    outline-offset: 1px;
    border-color: var(--accent);
}

.checkbox-field {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.checkbox-field input {
    width: auto;
    margin: 0;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.confirm-check {
    display: flex;
    gap: 10px;
    align-items: start;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.confirm-check input {
    margin-top: 2px;
}

.section-delete-action[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}


.bookmark-form .confirm-check {
    display: flex;
    gap: 10px;
    align-items: start;
    text-align: left;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.bookmark-form .confirm-check .privacy-confirm-box {
    width: 15px;
}

.pin-setup-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--pin-border-color, #eeeeee);
    border-radius: 8px;
    margin-bottom: 8px;
}

.form-status {
    min-height: 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.overview-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    align-items: start;
}

.tab-loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

.tab-loading-spinner.is-hidden {
    display: none;
}

.spinner-circle {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-soft);
    border-top-color: var(--accent, #c46c2f);
    border-radius: 50%;
    animation: spinner-rotate 0.7s linear infinite;
}

@keyframes spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}

.import-progress-modal {
    z-index: 100;
}

.import-progress-dialog {
    width: min(100%, 360px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.import-progress-dialog .spinner-circle {
    width: 48px;
    height: 48px;
}

.section-tile {
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--surface);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px var(--shadow-soft);
    padding: 18px 10px 18px 20px;
    display: flex;
    gap: 4px;
    align-items: flex-start;
    position: relative;
}

.tile-content {
    flex: 1;
    min-width: 0;
}

.tile-menu-trigger {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s;
    transform: translate(5px, -12px);
    flex-shrink: 0;
}

.section-tile:hover .tile-menu-trigger,
.tile-menu-trigger:focus-visible {
    opacity: 1;
}

.tile-menu-trigger svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    pointer-events: none;
}

.tile-menu-trigger:hover,
.tile-menu-trigger:focus-visible {
    background: var(--border-soft);
    color: var(--text-primary);
    outline: none;
}

.tile-menu {
    position: absolute;
    top: 30px;
    right: -10px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24), 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 100;
    width: fit-content;
    padding: 8px 0;
}

.tile-menu[hidden] {
    display: none;
}

.tile-menu-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tile-edit-btn,
.tile-add-btn,
.tile-delete-btn {
    width: 100%;
    padding: 4px 16px;
    border: 0;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    font-size: 14px;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    transition: background 0.15s;
}

.tile-edit-btn {
    color: #2e7d32;
}

.tile-edit-btn:hover,
.tile-edit-btn:focus-visible {
    background: #e8f5e9;
    outline: none;
}

.tile-add-btn {
    color: #1f5bbf;
}

.tile-add-btn:hover,
.tile-add-btn:focus-visible {
    background: #e6f0ff;
    outline: none;
}

.tile-delete-btn {
    color: #a63f22;
}

.tile-delete-btn:hover,
.tile-delete-btn:focus-visible {
    background: #ffe9e5;
    outline: none;
}

.tile-edit-btn svg,
.tile-add-btn svg,
.tile-delete-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    pointer-events: none;
    flex-shrink: 0;
}

.section-tile-title {
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--eyebrow);
}

.section-tile-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.section-tile-item {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.bookmark-favicon {
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    padding: 2px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.10);
    margin-right: 0.4em;
    vertical-align: -2px;
    flex-shrink: 0;
    object-fit: contain;
}

.section-tile-link {
    background: transparent;
    border: none;
    padding: 2px 0px 0px 4px;
    cursor: pointer;

    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-bookmark-actions {
    display: flex;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
    margin-right: -30px;
}

.section-tile-item:hover .tile-bookmark-actions,
.tile-bookmark-actions:focus-within {
    opacity: 1;
}

.tile-bookmark-menu-trigger {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    padding: 0;
}

.tile-bookmark-menu-trigger:hover,
.tile-bookmark-menu-trigger:focus-visible {
    background: var(--border-soft);
    color: var(--text-primary);
    outline: none;
}

.tile-bookmark-menu-trigger svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    pointer-events: none;
}

.tile-bookmark-menu {
    position: absolute;
    top: 28px;
    right: -40px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24), 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 100;
    width: fit-content;
    padding: 8px 0;
}

.tile-bookmark-menu[hidden] {
    display: none;
}

.tile-bookmark-edit,
.tile-bookmark-delete {
    width: 100%;
    padding: 4px 16px;
    border: 0;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    font-size: 14px;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    transition: background 0.15s;
}

.tile-bookmark-edit {
    color: #2e7d32;
}

.tile-bookmark-edit:hover,
.tile-bookmark-edit:focus-visible {
    background: #e8f5e9;
    outline: none;
}

.tile-bookmark-delete {
    color: #a63f22;
}

.tile-bookmark-delete:hover,
.tile-bookmark-delete:focus-visible {
    background: #ffe9e5;
    outline: none;
}

.tile-bookmark-edit svg,
.tile-bookmark-delete svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    pointer-events: none;
    flex-shrink: 0;
}

.section-tile-link:hover,
.section-tile-link:focus-visible {
    color: var(--accent);
    text-decoration: none;
    outline: none;
    background-color: var(--accent-soft);
    border-radius: 6px;
}

.section-tile-add-link {
    background: none;
    border: none;
    padding: 0;
    margin: 10px 0px 0px 0px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    color: var(--accent);
}

.section-tile-add-link:hover,
.section-tile-add-link:focus-visible {
    color: var(--accent);
    text-decoration: underline;
    outline: none;
}

.section-tile-add-link:active {
    opacity: 0.7;
}

.section-tile-empty {
    margin: 0;
    color: var(--text-faint);
    font-size: 12px;
    font-style: italic;
}

.empty-state-search-empty {
    margin: 20px 0px 0px 0px;
    padding: 24px;
    border-radius: 18px;
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
    background: var(--surface-ghost);
}

.empty-state {
    padding: 24px;
    border-radius: 18px;
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
    background: var(--surface-ghost);
}

.empty-state-button {
    padding: 24px;
    border-radius: 18px;
    border: 1px dashed var(--border-strong);
    background: var(--surface-ghost);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    font-family: inherit;
    font-size: inherit;
}

.empty-state-button:hover {
    border-color: var(--text-muted);
    background: var(--surface-secondary);
    color: var(--text-primary);
}

.empty-state-button:active {
    transform: scale(0.98);
}

.empty-state-plus {
    display: block;
    font-size: 48px;
    font-weight: 300;
    line-height: 1;
}

.empty-state-text {
    display: block;
    font-size: 16px;
    font-weight: 500;
}

@media (max-width: 1200px) {
    .bookmark-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .page-shell,
    .page-shell.is-nav-collapsed {
        grid-template-columns: 1fr;
    }

    .page-shell.is-nav-collapsed .section-nav {
        padding: 16px;
    }

    .page-shell.is-nav-collapsed .nav-chip {
        justify-content: flex-start;
        padding: 12px 14px;
        gap: 10px;
    }

    .page-shell.is-nav-collapsed .nav-label {
        max-width: 200px;
        opacity: 1;
    }

    .page-shell.is-nav-collapsed .sidebar-toggle {
        justify-content: flex-start;
        padding: 8px 14px;
        gap: 10px;
    }

    .sidebar {
        position: static;
    }

    .sidebar-toggle {
        display: none;
    }

    .section-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-panel,
    .section-heading {
        flex-direction: column;
        align-items: start;
    }

    #overview-grid .heading-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
    }

    #overview-grid .dashboard-search {
        width: 100%;
        min-width: 0;
        max-width: none;
        grid-column: 1 / -1;
    }

    #overview-grid .heading-actions > .secondary-action,
    #overview-grid .heading-actions > .primary-action {
        width: 100%;
    }

    .stats-grid,
    .bookmark-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .page-header {
        padding: 20px 18px 10px;
    }

    .page-shell {
        padding: 8px 18px 28px;
    }

    .section-nav {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 28px;
    }

    .modal {
        padding: 12px;
    }

    .bookmark-grid {
        grid-template-columns: 1fr;
    }
}

/* Admin bookmarks grid */

.admin-grid-title {
    font-size: 14px;
    font-weight: 600
}

.admin-grid-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-grid-page-size-label {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.admin-grid-page-size-label select {
    padding: 6px 10px;
    border: 1px solid var(--border-input);
    border-radius: 10px;
    background: var(--surface-input);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.admin-grid-wrap {
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    background: var(--surface);
    backdrop-filter: blur(12px);
    box-shadow: 0 18px 40px var(--shadow-normal);
    overflow: hidden;
}

.admin-grid-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.admin-grid-th:nth-child(1) { width: 15%; }
.admin-grid-th:nth-child(2) { width: 18%; }
.admin-grid-th:nth-child(3) { width: 32%; }
.admin-grid-th:nth-child(4) { width: 25%; }
.admin-grid-th:nth-child(5) { width: 10%; }

.admin-grid-th {
    padding: 11px 16px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-subtle);
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
    background: var(--table-header-bg);
    white-space: nowrap;
    overflow: hidden;
}

.admin-grid-th.sortable {
    cursor: pointer;
    user-select: none;
}

.admin-grid-th.sortable:hover {
    background: var(--accent-softer);
    color: var(--accent);
}

.sort-icon::after {
    content: " ↕";
    opacity: 0.3;
    font-size: 10px;
}

.admin-grid-th.sort-asc .sort-icon::after {
    content: " ↑";
    opacity: 1;
    color: var(--accent);
}

.admin-grid-th.sort-desc .sort-icon::after {
    content: " ↓";
    opacity: 1;
    color: var(--accent);
}

.admin-grid-td {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-faint);
    vertical-align: middle;
    overflow: hidden;
}

.admin-grid-tr:last-child .admin-grid-td {
    border-bottom: 0;
}

.admin-grid-tr:hover .admin-grid-td {
    background: var(--table-row-hover);
}

.admin-grid-section-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--section-badge-bg);
    color: var(--section-badge-text);
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.admin-grid-tab-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--section-badge-bg);
    color: var(--section-badge-text);
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.admin-grid-td-title {
    font-weight: 600;
}

.admin-grid-url {
    color: var(--text-muted);
    font-size: 12px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-grid-actions {
    display: flex;
    gap: 6px;
}

.admin-grid-edit-btn {
    background: #e8f5e9;
    color: #2e7d32;
}

.admin-grid-edit-btn:hover,
.admin-grid-edit-btn:focus-visible {
    background: #d7f0da;
}

.admin-grid-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0 4px;
    flex-wrap: wrap;
}

.admin-grid-pagination-info {
    font-size: 13px;
    color: var(--text-subtle);
}

.admin-grid-pagination-pages {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.admin-grid-page-btn {
    min-width: 32px;
    height: 32px;
    border: 1px solid var(--border-normal);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.admin-grid-page-btn:hover:not(:disabled):not(.is-active) {
    background: var(--nav-chip-bg);
}

.admin-grid-page-btn.is-active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
    border-color: var(--nav-active-bg);
    cursor: default;
}

.admin-grid-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.admin-grid-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 32px;
    color: var(--text-faint);
    font-size: 14px;
}

/* Sort Sections */

.sort-sections-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 12px;
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.sort-sections-btn:hover,
.sort-sections-btn:focus-visible {
    background: var(--nav-chip-bg);
    outline: none;
}

.sort-sections-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.sort-sections-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border-mid);
    border-radius: 12px;
    background: var(--surface-input);
    cursor: grab;
    user-select: none;
    transition: background 0.12s, box-shadow 0.12s, opacity 0.12s;
}

.sort-sections-item:active {
    cursor: grabbing;
}

.sort-sections-item.is-dragging {
    opacity: 0.38;
}

.sort-sections-item.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.drag-handle {
    color: var(--text-faint);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    touch-action: none;
}

.sort-sections-item-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
}

.sort-sections-actions {
    margin-top: 16px;
}

/* Theme Picker */

.theme-picker-panel {
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    background: var(--surface);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px var(--shadow-soft);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.theme-picker-title {
    font-size: 22px;
    margin-top: 6px;
}

.theme-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.theme-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 2px solid var(--border-mid2);
    border-radius: 8px;
    /*background: transparent;*/
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    min-width: 90px;
}

.theme-option:hover,
.theme-option:focus-visible {
    border-color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}

.theme-option.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.theme-swatch {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: block;
    border: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.theme-option-label {
    font-size: 12px;
    font-weight: bold;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Auth pages */

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

/* Landing hero */

.landing-hero {
    flex: 1;
    background: url('/hero-pattern.svg') center / cover no-repeat, linear-gradient(150deg, #18212b 0%, #1e2c3a 55%, #162130 100%);
    padding: 64px 56px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: left;
}

.landing-hero-inner {
    max-width: 520px;
    width: 100%;
}

.landing-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 36px;
}

.landing-brand-name {
    font-size: 28px;
    font-weight: bold;
    color: #f7efe4;
    letter-spacing: -0.2px;
}

.landing-headline {
    font-size: clamp(28px, 5vw, 48px);
    color: #f7efe4;
    line-height: 1.15;
    margin: 0 0 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.landing-headline em {
    color: #c46c2f;
    font-style: normal;
}

.landing-tagline {
    font-size: 16px;
    color: rgba(247, 239, 228, 0.62);
    margin: 0px 0px 20px 0px;
    max-width: 440px;
    line-height: 1.65;
}

.landing-features {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    margin: 35px 0px 0px 0px;
    padding: 0;
}

.landing-feature {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(247, 239, 228, 0.07);
    border: 1px solid rgba(247, 239, 228, 0.13);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 13px;
    color: rgba(247, 239, 228, 0.78);
}

.landing-feature svg {
    flex-shrink: 0;
    opacity: 0.75;
}

/* Auth section (below hero) */

.auth-section {
    flex: 0 0 auto;
    width: min(100%, 500px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
}

.auth-card {
    width: min(100%, 440px);
}

.auth-title {
    font-size: 26px;
    margin: 0 0 4px;
}

.auth-subtitle {
    font-size: 14px;
    color: #586575;
    margin: 0 0 22px;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 18px;
    border: 1.5px solid rgba(24, 33, 43, 0.18);
    border-radius: 14px;
    background: #fff;
    color: #18212b;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.google-btn:hover {
    background: #f0f4fa;
}

.demo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 18px;
    border: 1.5px solid #4f46e5;
    border-radius: 14px;
    background: #4f46e5;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.demo-btn:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #8a9aaa;
    font-size: 13px;
    margin: 18px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(24, 33, 43, 0.12);
}

.auth-link {
    font-size: 13px;
    color: #586575;
    text-align: center;
    margin: 18px 0 0;
}

.auth-link a {
    color: #c46c2f;
    font-weight: bold;
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

.form-error {
    background: #fff5f3;
    border: 1px solid #ffc9c0;
    border-radius: 12px;
    padding: 12px 14px;
    color: #9e2a12;
    font-size: 14px;
}

.form-error ul {
    margin: 0;
    padding-left: 18px;
}

@media (max-width: 800px) {
    .auth-shell {
        flex-direction: column;
    }

    .landing-hero {
        padding: 56px 24px 48px;
        justify-content: center;
        text-align: center;
    }

    .landing-hero-inner {
        max-width: 600px;
    }

    .landing-tagline {
        margin: 0 auto 40px;
    }

    .landing-features {
        justify-content: center;
    }

    .auth-section {
        width: 100%;
        padding: 48px 24px 64px;
    }
}

/* User bar in header */

.brand-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap;
}

.brand-row .brand-block {
    min-width: 0;
    flex: 1 1 auto;
}

.user-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 1 auto;
    min-width: 0;
}

.user-email {
    font-size: 13px;
    color: var(--text-brand-sub);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.signout-btn {
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s;
}

.signout-btn:hover {
    background: var(--nav-chip-bg);
}

/* Forgot / reset password */

.fp-link-row {
    display: flex;
    justify-content: flex-end;
    margin: 2px 0 4px;
}

.forgot-pw-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent-link);
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

.forgot-pw-link:hover,
.forgot-pw-link:focus-visible {
    text-decoration: underline;
    outline: none;
}

.fp-msg {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.fp-msg--error {
    background: #fff5f3;
    border: 1px solid #ffc9c0;
    color: #9e2a12;
}

.fp-msg--success {
    background: #f0faf0;
    border: 1px solid #b6ddb6;
    color: #1e5c1e;
}
