/* =========================================================
   RAYMALTSED DIGITAL — design system
   ========================================================= */
:root {
  --navy-950: #050B1A;
  --navy-900: #0A1530;
  --navy-850: #0D1A3A;
  --navy-800: #112147;
  --navy-700: #1B3A7A;
  --gold: #C9A45C;
  --gold-soft: #F1D9A0;
  --accent: #2F5BEA;
  --accent-ink: #ffffff;

  --bg: #F3F5FA;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --border: #E3E8F1;
  --border-strong: #CFD7E6;
  --text: #0B1834;
  --text-2: #4A5878;
  --text-3: #8592AD;
  --danger: #DC3545;
  --success: #16A36A;
  --star: #E6A817;

  --shadow-sm: 0 1px 2px rgba(10, 21, 48, .05), 0 1px 3px rgba(10, 21, 48, .06);
  --shadow-md: 0 4px 12px -2px rgba(10, 21, 48, .08), 0 2px 4px rgba(10, 21, 48, .04);
  --shadow-lg: 0 24px 48px -12px rgba(10, 21, 48, .28);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 272px;
  --topbar-h: 72px;
  --font: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Sora', 'Manrope', ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #060C1C;
  --surface: #0C1631;
  --surface-2: #101C3C;
  --border: #1A2850;
  --border-strong: #24366A;
  --text: #EEF2FB;
  --text-2: #A9B5D0;
  --text-3: #6E7DA0;
  --accent: #5B83FF;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; }
.ic { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Boot ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--navy-900); color: #fff; }
.boot-mark { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 26px; color: var(--navy-900); background: linear-gradient(135deg, var(--gold-soft), var(--gold)); }
.boot-name { font-family: var(--font-display); letter-spacing: .18em; font-size: 13px; font-weight: 600; opacity: .9; }
.boot-bar { width: 140px; height: 2px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
.boot-bar span { display: block; width: 40%; height: 100%; background: var(--gold); animation: boot 1s ease-in-out infinite; }
@keyframes boot { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: var(--navy-900); font-family: var(--font-display); font-weight: 700; font-size: 18px; box-shadow: 0 6px 16px -6px rgba(201,164,92,.6); }
.brand-text { line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; letter-spacing: .08em; color: #fff; }
.brand-sub { font-size: 10.5px; letter-spacing: .32em; color: var(--gold-soft); opacity: .85; font-weight: 600; margin-top: 3px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: radial-gradient(120% 60% at 0% 0%, #142a5c 0%, transparent 60%), var(--navy-900);
  color: #C9D3EA; display: flex; flex-direction: column; padding: 22px 16px 16px; gap: 6px;
  border-right: 1px solid rgba(255,255,255,.04);
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent;
}
.sidebar .brand { padding: 2px 8px 20px; }
.nav-label { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #6F7FA6; font-weight: 700; padding: 16px 12px 8px; display: flex; align-items: center; justify-content: space-between; }
.nav-label button { background: none; border: 0; color: #8E9CC0; padding: 4px; border-radius: 6px; display: grid; }
.nav-label button:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #B7C2DD; font-weight: 600; font-size: 14px; border: 0; background: none; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(91,131,255,.22), rgba(91,131,255,.06)); color: #fff; box-shadow: inset 2px 0 0 var(--gold); }
.nav-item .count { margin-left: auto; font-size: 11.5px; font-weight: 700; color: #7E8DB3; background: rgba(255,255,255,.05); border-radius: 999px; padding: 1px 8px; min-width: 24px; text-align: center; }
.nav-item.active .count { color: #fff; background: rgba(255,255,255,.12); }
.nav-cat-dot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.nav-item.cat { padding: 7px 10px; font-size: 13.5px; font-weight: 600; }
.nav-item.cat span.label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot { margin-top: auto; padding-top: 14px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--navy-700), var(--accent)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.user-meta { min-width: 0; flex: 1; }
.user-role { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-soft); font-weight: 700; }
.user-email { font-size: 12.5px; color: #D9E0F1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn-dark { background: none; border: 0; color: #9AA8CB; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.icon-btn-dark:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn, .topbar .brand-mobile, .topbar .mobile-search { display: none; }
.page-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
.top-search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.content { padding: 28px 32px 56px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* ---------- Inputs ---------- */
.search-field { position: relative; display: flex; align-items: center; }
.search-field .ic { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.search-field input {
  width: 100%; height: 44px; padding: 0 64px 0 42px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); outline: none; font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s;
}
.search-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.kbd { position: absolute; right: 10px; font-size: 11px; font-weight: 700; color: var(--text-3); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; background: var(--surface-2); pointer-events: none; }
.search-pop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; max-height: 420px; overflow-y: auto;
}
.search-pop .sp-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.search-pop .sp-item:hover, .search-pop .sp-item.hl { background: var(--surface-2); }
.search-pop .sp-name { font-weight: 700; font-size: 14px; }
.search-pop .sp-sub { font-size: 12px; color: var(--text-3); }
.search-pop .sp-foot { border-top: 1px solid var(--border); margin-top: 4px; padding: 10px; font-size: 13px; color: var(--accent); font-weight: 700; display: flex; align-items: center; gap: 6px; cursor: pointer; border-radius: 0 0 10px 10px; }
.search-pop .sp-empty { padding: 18px; text-align: center; color: var(--text-3); font-size: 13.5px; }

.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; font-size: 14.5px;
}
.textarea { height: auto; min-height: 84px; padding: 11px 14px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238592AD' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.input.invalid { border-color: var(--danger); }
.err-text { color: var(--danger); font-size: 12.5px; font-weight: 600; }
.input-wrap { position: relative; }
.input-wrap .ic-left { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-wrap .input { padding-left: 42px; }
.input-wrap .reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--text-3); width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; }
.input-wrap .reveal:hover { color: var(--text); background: var(--surface-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 11px; border: 1px solid transparent; font-weight: 700; font-size: 14px; white-space: nowrap;
  transition: transform .06s, background .15s, border-color .15s, box-shadow .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy-900); color: #fff; box-shadow: 0 6px 16px -8px rgba(10,21,48,.6); }
.btn-primary:hover { background: var(--navy-800); }
[data-theme="dark"] .btn-primary { background: var(--accent); }
[data-theme="dark"] .btn-primary:hover { background: #6f92ff; }
.btn-gold { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: var(--navy-900); }
.btn-gold:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.plain { border-color: transparent; background: transparent; }
.icon-btn.plain:hover { background: var(--surface-2); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 34px 36px;
  background:
    radial-gradient(80% 120% at 100% 0%, rgba(91,131,255,.35) 0%, transparent 55%),
    radial-gradient(60% 90% at 0% 100%, rgba(201,164,92,.18) 0%, transparent 60%),
    linear-gradient(135deg, #0D1C42 0%, var(--navy-900) 60%, #08112A 100%);
  color: #fff; box-shadow: var(--shadow-lg);
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 36px 36px; mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.hero > * { position: relative; z-index: 1; }
.hero-top { display: flex; gap: 24px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.hero-eyebrow { font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-soft); font-weight: 700; }
.hero h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.02em; margin: 10px 0 6px; line-height: 1.15; }
.hero p { margin: 0; color: #B9C5E3; font-size: 15px; }
.hero-date { font-size: 13px; color: #B9C5E3; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); padding: 8px 12px; border-radius: 10px; }
.hero-search { margin-top: 26px; max-width: 640px; }
.hero-search .search-field input { height: 52px; border-radius: 14px; background: rgba(255,255,255,.97); border-color: transparent; color: #0B1834; font-size: 15px; }
[data-theme="dark"] .hero-search .search-field input { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.1); }
.hero-search .kbd { background: #EEF1F8; color: #6E7DA0; border-color: #DDE3EF; }
[data-theme="dark"] .hero-search .kbd { background: transparent; border-color: rgba(255,255,255,.15); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 28px; }
.stat { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.stat-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.08); color: var(--gold-soft); }
.stat-val { font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1; }
.stat-label { font-size: 12px; color: #9FB0D6; margin-top: 4px; font-weight: 600; }

/* ---------- Sections ---------- */
.section { margin-top: 34px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.section-head h2 .ic { color: var(--text-3); }
.link-more { font-size: 13px; font-weight: 700; color: var(--accent); display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 4px 0; }
.link-more:hover { text-decoration: underline; }

/* ---------- Logos ---------- */
.logo { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; position: relative; }
.logo img { width: 62%; height: 62%; object-fit: contain; }
.logo.sm { width: 34px; height: 34px; border-radius: 9px; }
.logo.lg { width: 56px; height: 56px; border-radius: 15px; }
.logo .mono { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff; letter-spacing: .02em; }
.logo.sm .mono { font-size: 12px; }
.logo.has-img .mono { display: none; }

/* ---------- Link cards ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.link-card { position: relative; padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: transform .18s ease, box-shadow .18s ease, border-color .18s; cursor: pointer; }
.link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.lc-top { display: flex; align-items: flex-start; gap: 12px; }
.lc-title { min-width: 0; flex: 1; padding-top: 2px; }
.lc-name { font-weight: 800; font-size: 15px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-domain { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.lc-desc { font-size: 13.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; margin: 0; }
.lc-desc.empty { color: var(--text-3); font-style: italic; }
.lc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px 4px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); max-width: 70%; overflow: hidden; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lc-actions { display: flex; gap: 2px; }
.star-btn { color: var(--text-3); }
.star-btn.on { color: var(--star); }
.star-btn.on svg { fill: currentColor; }
.open-hint { position: absolute; top: 16px; right: 16px; color: var(--text-3); opacity: 0; transition: opacity .15s; }
.link-card:hover .open-hint { opacity: 1; }
.lc-menu-anchor { position: relative; }

/* list view */
.list-view { display: flex; flex-direction: column; }
.list-row { display: grid; grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .lr-desc { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* favorites strip */
.fav-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.fav-tile { scroll-snap-align: start; padding: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; cursor: pointer; transition: transform .18s, box-shadow .18s; position: relative; }
.fav-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.fav-tile .ft-name { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.fav-tile .ft-sub { font-size: 12px; color: var(--text-3); margin-top: -8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.fav-tile .ft-star { position: absolute; top: 14px; right: 14px; color: var(--star); }
.fav-tile .ft-star svg { fill: currentColor; }

/* dashboard 2-col */
.dash-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); gap: 24px; }
.recent-list { padding: 6px; }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 11px; cursor: pointer; }
.recent-item:hover { background: var(--surface-2); }
.recent-item .ri-main { min-width: 0; flex: 1; }
.recent-item .ri-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .ri-sub { font-size: 12px; color: var(--text-3); }
.recent-item .ri-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cat-tile { padding: 16px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; transition: transform .18s, box-shadow .18s, border-color .18s; }
.cat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.cat-tile-top { display: flex; align-items: center; justify-content: space-between; }
.cat-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }
.cat-count { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.cat-name { font-weight: 800; font-size: 14px; line-height: 1.3; }
.cat-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.mini-logos { display: flex; }
.mini-logos .logo { width: 24px; height: 24px; border-radius: 7px; margin-right: -6px; border: 2px solid var(--surface); }
.mini-logos .logo .mono { font-size: 9px; }
.bar { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 4px; }

/* ---------- Toolbar (tools page) ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin: 0; letter-spacing: -.02em; display: flex; align-items: center; gap: 12px; }
.page-head p { margin: 6px 0 0; color: var(--text-2); font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .search-field { flex: 1; min-width: 220px; }
.toolbar .select { width: auto; min-width: 170px; height: 44px; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); }
.seg button { height: 36px; padding: 0 10px; border: 0; background: none; border-radius: 8px; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-sm); }
.chips-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.fchip { flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; font-size: 13px; color: var(--text-2); }
.fchip:hover { border-color: var(--border-strong); color: var(--text); }
.fchip.on { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
[data-theme="dark"] .fchip.on { background: var(--accent); border-color: var(--accent); }
.fchip .n { font-size: 11px; opacity: .7; }
.result-meta { font-size: 13px; color: var(--text-3); margin-bottom: 12px; font-weight: 600; }

/* ---------- Categories manager ---------- */
.cat-rows { overflow: hidden; }
.cat-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cat-row:last-child { border-bottom: 0; }
.cat-row .cr-main { flex: 1; min-width: 0; cursor: pointer; }
.cat-row .cr-actions { display: flex; gap: 4px; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.panel { padding: 22px; }
.panel h3 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.panel p { margin: 0 0 16px; color: var(--text-2); font-size: 13.5px; }
.panel .row { display: flex; gap: 10px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--text-3); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; }
.badge.ok { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
.badge.warn { color: #B7791F; background: color-mix(in srgb, #F59E0B 14%, transparent); }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 56px 24px; border: 1.5px dashed var(--border-strong); border-radius: 18px; background: var(--surface); }
.empty .empty-ic { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.empty h3 { margin: 0 0 6px; font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.empty p { margin: 0 auto 20px; color: var(--text-2); max-width: 420px; font-size: 14px; }
.empty .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.empty.compact { padding: 28px 18px; }

/* ---------- Dropdown menu ---------- */
.menu-pop { position: fixed; z-index: 90; min-width: 190px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: pop .12s ease-out; }
.menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--text); text-align: left; }
.menu-pop button:hover { background: var(--surface-2); }
.menu-pop button.danger { color: var(--danger); }
.menu-pop hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(5, 11, 26, .55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .15s ease-out; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: hidden; display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: rise .2s cubic-bezier(.2,.9,.3,1.2); }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 6px; gap: 12px; }
.modal-head h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -.01em; }
.modal-body { padding: 14px 22px 8px; overflow-y: auto; display: grid; gap: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px 20px; border-top: 1px solid var(--border); margin-top: 8px; }
.modal-foot .spacer { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.logo-preview { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.logo-preview .lp-name { font-weight: 800; }
.logo-preview .lp-sub { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; font-weight: 700; font-size: 14px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .15s; flex-shrink: 0; }
.toggle .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .18s; }
.toggle input:checked + .track { background: var(--star); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 8px; }
.icon-picker button { height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--text-2); }
.icon-picker button:hover { border-color: var(--border-strong); color: var(--text); }
.icon-picker button.on { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); display: grid; place-items: center; color: #fff; }
.swatches button.on { box-shadow: 0 0 0 2px var(--text); }
.cat-preview { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 800; }

/* ---------- Toasts ---------- */
#toast-root { position: fixed; z-index: 200; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--navy-900); color: #fff; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; max-width: 380px; animation: rise .2s ease-out; }
.toast .ic { color: var(--gold-soft); }
.toast.error { background: #7A1625; }
.toast.error .ic { color: #FFC2CA; }
.toast button { background: none; border: 0; color: var(--gold-soft); font-weight: 800; margin-left: 6px; }

/* ---------- Auth screen ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side {
  position: relative; overflow: hidden; color: #fff; padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(91,131,255,.32), transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(201,164,92,.22), transparent 60%),
    linear-gradient(160deg, #0F2150, var(--navy-900) 55%, var(--navy-950));
}
.auth-side::after { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle at 70% 40%, #000, transparent 75%); }
.auth-side > * { position: relative; z-index: 1; }
.auth-headline { max-width: 520px; }
.auth-headline .hero-eyebrow { margin-bottom: 16px; display: block; }
.auth-headline h1 { font-family: var(--font-display); font-size: clamp(30px, 3.4vw, 46px); line-height: 1.1; letter-spacing: -.025em; margin: 0 0 18px; font-weight: 600; }
.auth-headline h1 em { font-style: normal; background: linear-gradient(135deg, var(--gold-soft), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-headline p { color: #B9C5E3; font-size: 16px; margin: 0; max-width: 440px; }
.auth-feats { display: grid; gap: 12px; margin-top: 30px; }
.auth-feat { display: flex; align-items: center; gap: 12px; color: #D5DDF0; font-size: 14px; font-weight: 600; }
.auth-feat .fi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); color: var(--gold-soft); }
.auth-copy { font-size: 12.5px; color: #7F8EB4; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand-mobile-auth { display: none; margin-bottom: 28px; }
.auth-card h2 { font-family: var(--font-display); font-weight: 600; font-size: 26px; letter-spacing: -.02em; margin: 0 0 6px; }
.auth-card .sub { color: var(--text-2); margin: 0 0 28px; font-size: 14.5px; }
.auth-form { display: grid; gap: 16px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 600; }
.alert.error { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.info { background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.alert.info .ic { color: var(--accent); }
.secure-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.demo-banner { background: linear-gradient(90deg, var(--gold-soft), var(--gold)); color: var(--navy-900); text-align: center; font-size: 12.5px; font-weight: 800; padding: 6px 12px; letter-spacing: .02em; }

.setup { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--navy-900); color: #fff; }
.setup-card { max-width: 560px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 20px; padding: 32px; }
.setup-card h1 { font-family: var(--font-display); font-weight: 600; font-size: 24px; margin: 22px 0 8px; }
.setup-card p, .setup-card li { color: #B9C5E3; font-size: 14.5px; }
.setup-card code { background: rgba(255,255,255,.08); padding: 2px 6px; border-radius: 6px; font-size: 13px; color: var(--gold-soft); }

/* ---------- Mobile nav ---------- */
.bottom-nav { display: none; }
.drawer-backdrop { display: none; }
.fab { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dash-cols { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 80; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-105%); transition: transform .25s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow-lg); }
  .app.drawer-open .sidebar { transform: none; }
  .app.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(5,11,26,.5); backdrop-filter: blur(2px); animation: fade .15s; }
  .topbar { padding: 0 20px; }
  .topbar .menu-btn { display: grid; }
  .content { padding: 22px 20px 48px; }
}
@media (max-width: 720px) {
  :root { --topbar-h: 62px; }
  body { font-size: 14.5px; }
  .topbar { gap: 8px; padding: 0 14px; }
  .topbar .page-title { display: none; }
  .topbar .brand-mobile { display: flex; gap: 10px; }
  .topbar .brand-mobile .brand-mark { width: 32px; height: 32px; font-size: 15px; border-radius: 9px; }
  .topbar .brand-mobile .brand-name { color: var(--text); font-size: 13px; }
  .topbar .brand-mobile .brand-sub { color: var(--gold); font-size: 9px; }
  .topbar .menu-btn { display: none; }
  .topbar .mobile-search { display: grid; }
  .top-search { display: none; }
  .top-actions .add-desktop { display: none; }
  .top-actions { margin-left: auto; }
  .content { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  .hero { padding: 24px 20px; border-radius: 18px; }
  .hero-date { display: none; }
  .hero-search { margin-top: 20px; }
  .hero-search .kbd { display: none; }
  .stats { gap: 10px; margin-top: 20px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-ic { width: 32px; height: 32px; }
  .stat-val { font-size: 19px; }
  .section { margin-top: 26px; }
  .grid-cards { grid-template-columns: 1fr; gap: 12px; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-tile { padding: 14px; gap: 10px; }
  .page-head h1 { font-size: 22px; }
  .toolbar .select { flex: 1; min-width: 0; }
  .toolbar .seg { display: none; }
  .list-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .list-row .lr-desc { display: none; }
  .two { grid-template-columns: 1fr; }
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { max-width: none; border-radius: 22px 22px 0 0; max-height: 92vh; animation: sheet .25s cubic-bezier(.2,.8,.2,1); }
  .modal-foot { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  @keyframes sheet { from { transform: translateY(100%); } }
  #toast-root { left: 14px; right: 14px; bottom: calc(86px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  .open-hint { display: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 60; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--navy-900) 94%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-radius: 20px; padding: 6px; box-shadow: 0 14px 32px -10px rgba(5,11,26,.55); border: 1px solid rgba(255,255,255,.06);
  }
  .bottom-nav button { border: 0; background: none; color: #8E9CC0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 6px; border-radius: 14px; font-size: 10.5px; font-weight: 700; }
  .bottom-nav button.active { color: #fff; background: rgba(255,255,255,.07); }
  .bottom-nav button.active .ic { color: var(--gold-soft); }
  .bottom-nav .bn-add { display: grid; place-items: center; }
  .bottom-nav .bn-add span { width: 48px; height: 48px; margin-top: -2px; border-radius: 15px; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: var(--navy-900); box-shadow: 0 8px 18px -6px rgba(201,164,92,.7); }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-card .brand-mobile-auth { display: flex; }
  .auth-card .brand-mobile-auth .brand-name { color: var(--text); }
  .auth-card .brand-mobile-auth .brand-sub { color: var(--gold); }
  .kv { grid-template-columns: 100px 1fr; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-label { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
