:root {
  /* Design A, "Clean" (4.0): the app icon's blue as the accent */
  --bg: #f4f6fa;
  --panel: #ffffff;
  --text: #1a1d26;
  --muted: #6b7180;
  --line: rgba(26, 35, 64, 0.09);
  --accent: #2152c4;
  --accent-soft: rgba(33, 82, 196, 0.09);
  --brand-grad: linear-gradient(160deg, #2a5fd6, #33399b);
  --red: #e5484d;
  --orange: #f76b15;
  --radius: 12px;
  color-scheme: light dark;
  /* iOS system colors, for text colored in the app's note editor */
  --ios-red: #ff383c; --ios-orange: #ff8d28; --ios-yellow: #ffcc00; --ios-green: #34c759;
  --ios-mint: #00c8b3; --ios-teal: #00c3d0; --ios-cyan: #00c0e8; --ios-blue: #0088ff;
  --ios-indigo: #6155f5; --ios-purple: #cb30e0; --ios-pink: #ff2d55; --ios-brown: #ac7f5e;
  --ios-gray: #8e8e93;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f14;
    --panel: #171a21;
    --text: #eef0f5;
    --muted: #9399a6;
    --line: rgba(235, 240, 255, 0.09);
    --accent: #6b95ff;
    --accent-soft: rgba(107, 149, 255, 0.14);
    --ios-red: #ff4245; --ios-orange: #ff9230; --ios-yellow: #ffd600; --ios-green: #30d158;
    --ios-mint: #00dac3; --ios-teal: #00d2e0; --ios-cyan: #3cd3fe; --ios-blue: #0091ff;
    --ios-indigo: #6d7cff; --ios-purple: #db34f2; --ios-pink: #ff375f; --ios-brown: #b78a66;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.logo { width: 28px; height: 28px; border-radius: 7px; display: block; }
#search {
  flex: 1; max-width: 520px;
  padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text);
  font: inherit;
}
.auth { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* Before sign-in */
/* Login screen (design B, "Split"); the top bar shows once signed in */
body:not(.signed-in) .topbar { display: none; }
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login[hidden] { display: none; }
/* Left: the app icon's own colors */
.login-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center;
  padding: 64px 8vw; color: #fff; background: linear-gradient(170deg, #2152c4, #33399b);
}
.login-hero::after {   /* soft glow */
  content: ""; position: absolute; width: 520px; height: 520px; right: -160px; top: -140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 65%); pointer-events: none;
}
.login-brand { display: flex; align-items: center; gap: 16px; }
.login-icon { width: 72px; height: 72px; border-radius: 17px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.login-brand h1 { margin: 0; font-size: 40px; letter-spacing: -0.02em; }
.login-headline { margin: 36px 0 8px; font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; max-width: 14em; }
.login-sub { margin: 0 0 32px; font-size: 18px; opacity: 0.85; max-width: 26em; }
.login-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.login-features li { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.login-check {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: #f4a523;
  display: grid; place-items: center; font-size: 14px; font-weight: 800; color: #fff;
}
/* Right: signing in */
.login-side { display: flex; align-items: center; justify-content: center; padding: 48px 32px; background: var(--panel); }
.login-panel { width: min(360px, 100%); }
.login-panel h2 { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.01em; }
.login-text { margin: 0 0 28px; color: var(--muted); font-size: 15px; }
/* Apple's button (div.apple-auth-button, 218 × 40). Its "Sign in with Apple" text is an SVG it places
   with left: 50% from the button's left edge, so it needs left-aligned text around it. */
.login-button { display: flex; justify-content: flex-start; min-height: 40px; }
.login-button .apple-auth-button, #apple-sign-out-button .apple-auth-button { text-align: left; line-height: normal; }
.login-status { margin: 14px 0 0; font-size: 13px; color: var(--muted); min-height: 1.5em; }
.login-privacy {
  margin-top: 28px; padding: 14px 16px; border-radius: 12px; font-size: 13px; color: var(--muted);
  background: color-mix(in srgb, #2152c4 8%, transparent);
}
.login-privacy b { color: var(--text); }
.login-foot { margin: 16px 0 0; font-size: 12px; color: var(--muted); }
/* Phones: one column, the blue part on top and shorter */
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 40px 28px; }
  .login-headline { font-size: 26px; margin-top: 24px; }
  .login-sub { margin-bottom: 20px; font-size: 16px; }
}

/* Three panes: sidebar · list · detail */
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) auto;
  min-height: calc(100vh - 58px);
}

.sidebar {
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  height: calc(100vh - 58px);
  position: sticky; top: 58px;
  display: flex; flex-direction: column;   /* so the footer can sit at the bottom */
}
.sidebar-footer { margin: auto 0 0; padding: 20px 10px 0; font-size: 12px; color: var(--muted); }
.sidebar h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); margin: 20px 10px 6px;
}
.nav { list-style: none; margin: 0; padding: 0; }
.nav-row {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border: 0; border-radius: 8px;
  background: none; text-align: left; cursor: pointer;
}
.nav-row:hover { background: var(--accent-soft); }
.nav-row.active { background: var(--accent); color: #fff; }
.nav-row.active .nav-count { color: rgba(255, 255, 255, 0.85); }
.nav-icon { width: 20px; text-align: center; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* Tag chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px; }
.chip {
  --chip: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--chip) 16%, transparent);
  color: var(--chip);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.chip.small { padding: 1px 7px; font-size: 12px; cursor: default; }
.chip.active { background: var(--chip); color: #fff; }
.chip-count { opacity: 0.7; font-variant-numeric: tabular-nums; }

/* Item list */
.content { padding: 20px 24px; min-width: 0; }
.content-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.content-head h1 { margin: 0; font-size: 26px; }
.link-button { margin-left: auto; border: 0; background: none; color: var(--accent); cursor: pointer; }

.items {
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}
.item {
  width: 100%; display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line);
  background: none; text-align: left; cursor: pointer;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--accent-soft); }
.item.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
/* Rows match the app's ItemRow: a page-shaped preview for files, a square for links */
.item-icon { flex: none; font-size: 20px; width: 32px; text-align: center; padding-top: 2px; }
.thumb-frame {
  height: 42px; padding: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 4px; border: 1px solid var(--line); background: var(--bg); overflow: hidden; font-size: 18px;
}
.thumb-frame.link { width: 40px; height: 40px; border-radius: 8px; }
/* A file's thumbnail from the app (app.js fileIcon) in place of the icon */
.thumb-frame.has-thumb { background: #fff; }
.thumb-frame.has-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.item-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.item-title-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.item-title {
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.version { flex: none; font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 999px; background: var(--line); }
.item-sub { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.expiry.soon { color: var(--orange); }
.expiry.expired { color: var(--red); }
.folder-row { align-items: center; }
.folder-row .folder-icon { flex: none; width: 32px; text-align: center; font-size: 20px; }
.folder-row .item-title { flex: 1; }
.folder-count { color: var(--muted); font-size: 14px; }
/* Uploading */
.small-button { padding: 5px 12px; font-size: 14px; }
/* Head: title, then (sort menu,) layout toggle, Upload and Refresh on the right */
.select-toggle { margin-left: auto; white-space: nowrap; }
#sort:not([hidden]) + .select-toggle, .layout-toggle, #upload, #upload ~ #refresh { margin-left: 0; white-space: nowrap; }
.upload-status { margin: -6px 0 12px; font-size: 13px; color: var(--muted); }
.content.dropping { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: var(--radius); }
/* Date filter, under the view's title */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 14px; }
.filter-bar select, .filter-bar input, #sort {
  padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 14px;
}
.filter-bar .link-button { margin-left: 0; }
.date-custom { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
/* Grid layout, like the app's ItemCard / FolderTile */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; }
.card {
  display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none;
  text-align: left; cursor: pointer; color: var(--text); min-width: 0;
}
.card-frame {
  position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.card:hover .card-frame { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); }
.card.selected .card-frame { outline: 3px solid var(--accent); outline-offset: 1px; }
.card-preview {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: var(--muted);
}
.thumb-card.has-thumb { background: #fff; }
.thumb-card.has-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.note-page {
  align-items: flex-start; justify-content: flex-start; padding: 10px; font-size: 9px; line-height: 1.35;
  color: var(--muted); white-space: pre-wrap; overflow: hidden; overflow-wrap: anywhere; text-align: left;
}
.link-card { flex-direction: column; gap: 8px; }
.link-globe { font-size: 36px; }
.link-host { font-size: 11px; padding: 0 8px; text-align: center; overflow-wrap: anywhere; }
.card-star, .card-version {
  position: absolute; top: 6px; padding: 2px 6px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: color-mix(in srgb, var(--panel) 80%, transparent); backdrop-filter: blur(6px);
}
.card-star { right: 6px; color: #f5b300; }
.card-version { left: 6px; font-size: 11px; }
.card-title {
  font-size: 14px; font-weight: 500; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.card-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 100px; padding: 8px; border: 0; border-radius: 12px; background: var(--panel);
  cursor: pointer; color: var(--text); text-align: center;
}
.tile:hover { background: var(--accent-soft); }
.tile-icon { font-size: 32px; }
.tile-name { font-size: 13px; font-weight: 500; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.tile-count { font-size: 11px; color: var(--muted); }
/* Sections like the app's grouped lists */
.list-section + .list-section { margin-top: 18px; }
.section-title { font-size: 13px; font-weight: 500; text-transform: uppercase; color: var(--muted); margin: 0 14px 6px; }
.list-footer { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0; }
#sort { margin-left: auto; }
.item-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.star { color: #f5b300; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.expired { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.badge.soon { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); }
.badge.later { background: var(--accent-soft); color: var(--accent); }

/* Detail */
.detail {
  width: 420px;
  padding: 20px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
  max-height: calc(100vh - 58px);
  position: sticky; top: 58px;
  display: flex; flex-direction: column; gap: 14px;
}
.detail-head { display: flex; align-items: flex-start; gap: 10px; }
.detail-head h2 { flex: 1; margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.detail-icon { font-size: 28px; }
.detail-icon.has-thumb { display: none; }
.detail-preview {
  display: block; padding: 0; margin: 4px 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; overflow: hidden; cursor: pointer; max-width: 100%;
}
.detail-preview img { display: block; max-width: 100%; max-height: 320px; }
/* Select mode */
.select-bar {
  position: sticky; top: 66px; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.select-bar .link-button { margin-left: 0; }
.select-count { font-weight: 600; margin-right: 4px; }
.bar-field { width: auto; min-width: 12em; margin: 0; padding: 6px 10px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
select.bar-field { max-width: 16em; }
.select-status { flex-basis: 100%; }
.notice {
  display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 12px; border-radius: 10px;
  background: var(--accent-soft); font-size: 14px;
}
.notice.warning { background: color-mix(in srgb, var(--orange) 15%, transparent); }
.notice span { flex: 1; }
.notice .close { font-size: 20px; }
/* Tag suggestions while typing (app.js withTagSuggestions) */
.tag-suggest-wrap { position: relative; display: inline-block; }
.tag-suggest {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 10; min-width: 100%; max-height: 260px; overflow-y: auto;
  list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.tag-suggest-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.tag-suggest-item.active, .tag-suggest-item:hover { background: var(--accent-soft); }
.tag-suggest-item .chip { cursor: pointer; }
.select-status:empty { display: none; }
.tick {
  flex: none; width: 22px; height: 22px; margin-top: 6px; border-radius: 50%; border: 2px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff;
}
.tick.on { background: var(--accent); border-color: var(--accent); }
.card-tick { position: absolute; bottom: 8px; right: 8px; margin: 0; background: var(--panel); }
.card-tick.on { background: var(--accent); }
.item.picked { background: var(--accent-soft); }
.card.picked .card-frame { outline: 3px solid var(--accent); outline-offset: 1px; }
/* Tag manager (app.js openTagManager), like the app's Tags screen */
.sidebar-head { display: flex; align-items: center; }
.sidebar-head .link-button { margin-left: auto; font-size: 12px; text-transform: none; letter-spacing: 0; }
.tag-dialog {
  width: min(460px, calc(100vw - 32px)); max-height: 80vh; padding: 20px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.tag-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.tag-dialog h3 { font-size: 13px; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.dialog-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dialog-head h2 { margin: 0; font-size: 20px; flex: 1; }
.tag-list { list-style: none; margin: 0; padding: 0; }
.tag-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tag-row:last-child { border-bottom: 0; }
.tag-row .link-button { margin-left: 0; }
.tag-name { flex: 1; overflow-wrap: anywhere; }
.tag-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.danger-link { color: var(--red); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.none { background: linear-gradient(135deg, transparent 45%, var(--red) 45%, var(--red) 55%, transparent 55%), var(--bg); border-color: var(--line); }
.swatch.on { outline: 2px solid var(--text); outline-offset: 2px; }
/* Delete, at the bottom of the panel */
.danger-zone { border-top: 1px solid var(--line); padding-top: 14px; }
.button.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.button.danger:hover:not(:disabled) { background: var(--red); border-color: var(--red); color: #fff; }
/* Version history (app.js versionsSection) */
.version-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.version-list .version-row:last-child { border-bottom: 0; }
.version-no { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2.2em; }
.version-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.version-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version-actions { display: flex; gap: 10px; }
.version-actions .link-button { margin-left: 0; }
/* The file itself, in the panel (app.js livePreview) */
/* The panel scrolls; its sections keep their own height instead of being squeezed to fit (which
   shrank the preview and cut off the PDF viewer's toolbar). */
.detail > * { flex-shrink: 0; }
.live-preview { border-radius: 10px; }
.live-preview iframe { display: block; width: 100%; height: min(85vh, 820px); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.live-preview iframe.text { height: min(65vh, 600px); }
.live-preview img { display: block; max-width: 100%; max-height: 85vh; margin: 0 auto; border-radius: 10px; }
.live-preview .button { width: 100%; }
.close { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; }
.actions { display: flex; gap: 8px; }
.button {
  padding: 8px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); cursor: pointer; text-decoration: none; color: var(--text);
}
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button:disabled { opacity: 0.6; cursor: progress; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.detail h3 { font-size: 13px; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.notes, .doc-text { white-space: pre-wrap; margin: 0; }
/* A formatted note (richtext.js): one div per paragraph, sizes relative to the app's body text */
.rich-notes { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.section-head .link-button { margin-left: 0; }
.notes-editor {
  width: 100%; min-height: 160px; resize: vertical;
  padding: 10px; margin: 4px 0 8px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text);
  font: inherit;
}
.notes-editor:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Editing tags and expiry */
.text-field {
  width: 100%; padding: 8px 10px; margin: 4px 0 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit;
}
.text-field:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.text-field.days { width: 5.5em; margin: 0 4px; }
.field-row { display: flex; align-items: center; margin: 4px 0 8px; }
.editor .chips { padding: 0; margin: 4px 0 8px; }
.editor .chip { cursor: pointer; }
.expiry-line { margin: 2px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.star-toggle {
  margin-left: auto; border: 0; background: none; cursor: pointer; font-size: 22px; line-height: 1;
  color: var(--muted); padding: 2px 4px;
}
.star-toggle.on { color: #f5b300; }
.star-toggle:disabled { opacity: 0.4; cursor: default; }
.star-toggle + .close { margin-left: 0; }
.actions { align-items: center; }
.doc-text { font-size: 13px; color: var(--muted); max-height: 300px; overflow-y: auto; }

/* Narrow screens: one column, detail on top of the list */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .detail { position: fixed; inset: 58px 0 0 0; width: auto; max-height: none; z-index: 5; }
  .topbar { flex-wrap: wrap; }
  #search { order: 3; max-width: none; flex-basis: 100%; }
}

/* Line icons (app.js svgIcon), drawn in the text color */
:root { --folder-color: var(--accent); --folder-muted: var(--muted); }
.icon { width: 1em; height: 1em; display: block; flex: none; }
.nav-icon { display: inline-flex; width: 20px; justify-content: center; font-size: 18px; color: var(--accent); }
.nav-row.active .nav-icon { color: inherit; }
.folder-glyph { position: relative; display: inline-flex; }
.folder-badge { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.62em; padding-top: 0.12em; }
.folder-icon { font-size: 18px; }
.tile-icon { font-size: 34px; }
.item-icon { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.thumb-frame .icon { font-size: 18px; }
.card-preview .icon { font-size: 44px; }
.link-globe .icon { font-size: 40px; color: var(--accent); }
.detail-icon { display: inline-flex; color: var(--accent); }

/* Design A, "Clean" (4.0): chosen by the user from two options (pictures in design-previews/) */
body { background: var(--bg); }
.topbar { background: color-mix(in srgb, var(--panel) 90%, transparent); border-bottom: 1px solid var(--line); padding: 10px 24px; }
.brand { font-size: 19px; letter-spacing: -0.01em; }
.logo { border-radius: 8px; box-shadow: 0 2px 6px rgba(33, 82, 196, 0.3); }
#search { border: 0; background: var(--bg); border-radius: 12px; padding: 9px 14px; }
#search:focus { outline: 2px solid var(--accent); }
.sidebar { background: var(--bg); border-right: 1px solid var(--line); padding: 18px 14px; }
.sidebar h2 { color: var(--muted); font-weight: 600; letter-spacing: 0.06em; margin: 22px 10px 8px; }
.nav-row { border-radius: 9px; padding: 7px 10px; }
.nav-row:hover { background: var(--accent-soft); }
.nav-row.active { background: var(--panel); color: var(--accent); font-weight: 600; box-shadow: 0 1px 3px rgba(20, 30, 60, 0.1); }
.nav-row.active .nav-count { color: var(--accent); }
.content { padding: 24px 28px; }
.content-head h1 { font-size: 30px; letter-spacing: -0.02em; }
.items { background: var(--panel); border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(20, 30, 60, 0.05); }
.item { padding: 14px 18px; }
.item:hover { background: var(--accent-soft); }
.item.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.item-title { font-weight: 600; }
.button { border-radius: 10px; background: var(--panel); }
.button.primary { background: var(--brand-grad); border-color: transparent; box-shadow: 0 2px 8px rgba(33, 82, 196, 0.3); }
.detail { background: var(--panel); border-left: 1px solid var(--line); padding: 24px; }
.detail-head h2 { font-size: 22px; letter-spacing: -0.01em; }
.detail h3 { letter-spacing: 0.06em; font-weight: 600; }
.detail section + section { border-top: 1px solid var(--line); padding-top: 14px; }
.filter-bar select, .filter-bar input, #sort { border-radius: 10px; background: var(--panel); }
.card-frame { border-radius: 14px; }
.tile { border-radius: 14px; border: 1px solid var(--line); }

/* Top bar in the app icon's blue (4.1) */
.topbar {
  background: linear-gradient(100deg, #2152c4, #33399b); border-bottom: 0; color: #fff;
  backdrop-filter: none; box-shadow: 0 1px 8px rgba(20, 30, 90, 0.25);
}
@media (prefers-color-scheme: dark) { .topbar { background: linear-gradient(100deg, #1b449f, #2a2f80); } }
.topbar .brand { color: #fff; }
.topbar .logo { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.55), 0 2px 6px rgba(0, 0, 0, 0.25); }
.topbar #search { background: rgba(255, 255, 255, 0.16); color: #fff; }
.topbar #search::placeholder { color: rgba(255, 255, 255, 0.72); }
.topbar #search:focus { background: #fff; color: #1a1d26; outline: 2px solid rgba(255, 255, 255, 0.6); }
.topbar #search:focus::placeholder { color: #6b7180; }
.topbar #user-name { color: rgba(255, 255, 255, 0.85); }
