/* The BookMo dashboard, registration page and public site pages. */
:root {
  --bg: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --surface: #f9fafb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --radius: 10px;
  --side: 220px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { color: var(--fg); background: var(--bg); font-size: 14px; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 8px; }

/* ---- header ---- */
header.top, body > header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand strong { font-size: 16px; }
.search { flex: 1; max-width: 640px; }
.search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  background: var(--surface);
  color: inherit;
}
.who { margin-left: auto; font-size: 12.5px; }

/* ---- buttons ---- */
button { font: inherit; cursor: pointer; border-radius: 8px; }
button.primary {
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  padding: 8px 16px; white-space: nowrap;
}
button.primary:disabled { opacity: .5; cursor: default; }
button.ghost {
  background: transparent; color: var(--fg);
  border: 1px solid var(--border); padding: 7px 12px; white-space: nowrap;
}
button.ghost:hover:not(:disabled) { border-color: #9ca3af; }
button.ghost:disabled { opacity: .45; cursor: default; }
button.small { padding: 5px 11px; font-size: 12.5px; }
button.danger { color: #b91c1c; }
button.danger:hover:not(:disabled) { border-color: #fca5a5; }
button.link { background: none; border: none; color: var(--accent); padding: 4px 6px; text-decoration: underline; }
a.button-link {
  display: inline-block; padding: 7px 14px; border-radius: 8px;
  background: var(--accent); color: #fff; text-decoration: none;
}
select, input { font: inherit; color: inherit; }

/* ---- the dashboard shell: sidebar + main ---- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: calc(100vh - 57px); }
.side {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 57px;
  height: calc(100vh - 57px);
}
.side a[data-route] {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-radius: 8px;
  color: var(--fg); text-decoration: none;
}
.side a[data-route]:hover { background: var(--border); }
.side a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.count {
  font-size: 12px; font-variant-numeric: tabular-nums;
  background: var(--bg); border: 1px solid var(--border);
  padding: 0 7px; border-radius: 999px; color: var(--muted);
}
.count:empty { display: none; }
.side-foot {
  margin-top: auto; padding: 10px 12px; font-size: 12.5px;
  display: flex; align-items: center; gap: 8px;
}
.side-foot a { color: var(--muted); text-decoration: none; }
.side-foot a:hover { text-decoration: underline; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.on { background: #16a34a; }
.dot.off { background: #d97706; }

main { padding: 20px 24px 48px; max-width: 1080px; }
.page-head { margin-bottom: 14px; }
.page-head p { margin: 0; }

/* ---- quick filters: toggle buttons ---- */
.facets { display: grid; gap: 8px; margin: 4px 0 6px; }
.facet-row { display: flex; align-items: flex-start; gap: 10px; }
.facet-label { width: 44px; flex: none; padding-top: 5px; font-size: 12.5px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.chip {
  border: 1px solid var(--border); background: var(--bg); color: var(--fg);
  padding: 4px 10px; border-radius: 999px; font-size: 12.5px; line-height: 1.3;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: #9ca3af; }
.chip .n { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.zero { opacity: .55; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; opacity: 1; }
.chip[aria-pressed="true"] .n { color: rgba(255, 255, 255, .85); }
.chip.more { border-style: dashed; color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; flex: none; }
.seg button { background: var(--bg); color: var(--muted); border: none; border-radius: 0; padding: 4px 10px; font-size: 12px; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag-all {
  margin-left: 54px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); display: grid; gap: 8px; max-height: 260px; overflow: auto;
}
.tag-all input { padding: 6px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); max-width: 280px; }

/* ---- list: toolbar, result line, bulk bar, pager ---- */
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 12px 0; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.inline select, .bulk select, .bulk input {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg);
}
.result-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 8px; }
.bulk {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 8px 0 12px; padding: 8px 12px;
  border: 1px solid #bfdbfe; border-radius: var(--radius); background: var(--accent-soft);
  position: sticky; top: 57px; z-index: 5;
}
.bulk .sep { width: 1px; height: 20px; background: #bfdbfe; margin: 0 2px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 20px 0 0; }
.pager span { min-width: 110px; text-align: center; }

/* ---- bookmark cards ---- */
.list { display: grid; gap: 10px; }
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  background: var(--bg);
}
.card-top { display: flex; align-items: baseline; gap: 10px; }
.card-title {
  font-weight: 600; color: var(--fg); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
a.card-title:hover { color: var(--accent); text-decoration: underline; }
.card-host { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.card-desc {
  color: var(--muted); font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.editor { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 6px; margin-left: auto; }
.card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }

.level-select { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 999px; border: 1px solid transparent; }
.level-public { background: #dcfce7; color: #166534; }
.level-internal { background: #dbeafe; color: #1e40af; }
.level-confidential { background: #fef3c7; color: #92400e; }
.level-secret { background: #fee2e2; color: #991b1b; }
.level-unclassified { background: #f3f4f6; color: #374151; }

.tag-editor {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  flex: 1; min-width: 220px; padding: 3px 6px;
  border: 1px solid var(--border); border-radius: 8px;
}
.tag-editor input { border: none; outline: none; background: transparent; padding: 3px 4px; min-width: 90px; flex: 1; font-size: 12.5px; }
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  background: #eef2ff; color: #3730a3; padding: 2px 4px 2px 9px; border-radius: 999px; font-size: 12px;
}
.tag .x { background: none; border: none; color: inherit; padding: 0 4px; font-size: 13px; line-height: 1; opacity: .7; }
.tag .x:hover { opacity: 1; }
.review { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; padding: 1px 8px; border-radius: 999px; }

/* ---- panels (Import, Settings) ---- */
.panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.panel p { line-height: 1.55; }
.howto { line-height: 1.7; margin: 8px 0; }
details summary { cursor: pointer; color: var(--accent); }
.result { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); line-height: 1.7; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 999px; }
.badge.on { background: #dcfce7; color: #166534; }
.badge.off { background: #fef3c7; color: #92400e; }
.steps { line-height: 1.7; }
.row-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.small { font-size: 12.5px; }

/* ---- AI status banner ---- */
.ai { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; line-height: 1.5; }
.ai.off { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; }

/* ---- a reading page (privacy) ---- */
main.doc { max-width: 760px; margin: 0 auto; padding: 28px 24px 64px; line-height: 1.6; }
main.doc h2 { margin-top: 26px; }
main.doc li { margin: 4px 0; }

/* ---- centred views (sign-in, refused, register) ---- */
.center { max-width: 520px; margin: 64px auto; padding: 0 20px; text-align: center; }
.center h1 { font-size: 22px; margin-bottom: 8px; }
.form { text-align: left; display: grid; gap: 12px; margin-top: 24px; }
.form label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.form input, .form select { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---- states ---- */
.notice { margin-bottom: 12px; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; }
.notice.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.notice.info, .notice.ok { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; }
.empty { padding: 48px 0; text-align: center; }
.empty p { margin: 4px 0; }
.muted { color: var(--muted); }

/* ---- narrow screens: the sidebar becomes a top bar ---- */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); }
  .side-foot { margin-top: 0; }
  main { padding: 14px; }
  .search { display: none; }
}

/* ---- settings: account deletion ---- */
.danger-zone { border-color: #fca5a5; }
.danger-zone p { margin: 0 0 8px; }
.confirm-label { display: grid; gap: 6px; max-width: 360px; margin: 12px 0; font-size: 13px; }
.confirm-label input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }

/* ---- public site pages: /marketing, /support, /privacy (body.site) ---- */
.site .brand { color: var(--fg); text-decoration: none; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 14px; }
.site-nav a:not(.button) { color: var(--muted); text-decoration: none; }
.site-nav a:not(.button):hover, .site-nav a[aria-current="page"] { color: var(--fg); }
.site a.button {
  display: inline-block; padding: 9px 18px; border-radius: 8px; font-weight: 600;
  background: var(--accent); color: #fff; text-decoration: none; border: 1px solid var(--accent);
}
.site a.button.secondary { background: transparent; color: var(--fg); border-color: var(--border); }
.site-nav a.button { padding: 6px 14px; font-weight: 500; }
.site main:not(.doc) { max-width: 1080px; margin: 0 auto; padding: 0 24px 64px; }
.site section { padding: 48px 0 8px; }
.site section h2 { font-size: 22px; margin-bottom: 12px; }
.site h3 { font-size: 15px; margin: 0 0 6px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: center; padding-top: 56px; }
.hero h1 { font-size: 40px; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 16px; }
.lead { font-size: 17px; line-height: 1.6; color: var(--muted); max-width: 560px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 12px; }
.small { font-size: 12.5px; }
.shot { display: block; max-width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 12px 40px rgba(15, 23, 42, .18); }
.shot-popup { width: 368px; }
.level { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.level-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.level-row p { margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature-grid article { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.feature-grid p { margin: 0; color: var(--muted); line-height: 1.55; }
.showcase .shot { margin-top: 16px; }
.steps ol { padding-left: 20px; line-height: 1.8; font-size: 15px; }
.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 12px 14px; margin: 18px 0 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.levels-table { border-collapse: collapse; margin: 8px 0; }
.levels-table th, .levels-table td { text-align: left; padding: 6px 12px 6px 0; vertical-align: top; }
.faq dt { font-weight: 600; margin-top: 14px; }
.faq dd { margin: 4px 0 0; color: var(--muted); }
.site-foot { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; padding: 24px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.site-foot a { color: var(--muted); }

@media (max-width: 760px) {
  .site main:not(.doc) { padding: 0 16px 48px; }
  .site main.doc { padding: 20px 16px 48px; }
  .site-nav { gap: 12px; }
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 32px; }
  .hero h1 { font-size: 30px; }
  .shot-popup { width: 100%; max-width: 368px; }
  .level-row, .feature-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .site-nav a[href="/privacy"] { display: none; }
  .level-row, .feature-grid { grid-template-columns: 1fr; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --fg: #e5e7eb; --muted: #9ca3af;
    --border: #1f2937; --surface: #111827; --accent: #3b82f6; --accent-soft: #172554;
  }
  .search input { background: #111827; }
  .level-public { background: #052e16; color: #86efac; }
  .level-internal { background: #172554; color: #93c5fd; }
  .level-confidential { background: #451a03; color: #fcd34d; }
  .level-secret { background: #450a0a; color: #fca5a5; }
  .level-unclassified { background: #1f2937; color: #d1d5db; }
  .tag { background: #1e1b4b; color: #c7d2fe; }
  .bulk { border-color: #1e3a8a; }
  .bulk .sep { background: #1e3a8a; }
  .ai.off { background: #422006; border-color: #713f12; color: #fde68a; }
  .notice.error { background: #450a0a; border-color: #7f1d1d; color: #fecaca; }
  .notice.info, .notice.ok { background: #172554; border-color: #1e3a8a; color: #bfdbfe; }
  .review { background: #422006; border-color: #713f12; color: #fde68a; }
  .badge.on { background: #052e16; color: #86efac; }
  .badge.off { background: #422006; color: #fde68a; }
  button.danger { color: #fca5a5; }
  .shot { box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
  .danger-zone { border-color: #7f1d1d; }
}
