:root {
  /* Jace's palette (okjace/Jace app/globals.css): cool greys, green accent. */
  --bg: #f4f5f7; --panel: #ffffff; --panel2: #eceef1; --line: #dfe2e7; --text: #16181d; --muted: #5d6470;
  --accent: #1f9d5a; --accent2: #188049; --on-accent: #ffffff; --accent-soft: color-mix(in srgb, #1f9d5a 13%, transparent);
  --ok: #1f9d5a; --warn: #c98200; --bad: #e0464f;
  --shadow: 0 10px 40px rgba(16, 20, 28, .10); --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317; --panel: #1c1f26; --panel2: #23272f; --line: #2a2f38; --text: #e6e8eb; --muted: #8b919c;
    --accent: #3ddc84; --accent2: #5ae69a; --on-accent: #0c1410; --accent-soft: color-mix(in srgb, #3ddc84 14%, transparent);
    --ok: #3ddc84; --warn: #f0b429; --bad: #ff6b6b; --shadow: 0 10px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111317; --panel: #1c1f26; --panel2: #23272f; --line: #2a2f38; --text: #e6e8eb; --muted: #8b919c;
    --accent: #3ddc84; --accent2: #5ae69a; --on-accent: #0c1410; --accent-soft: color-mix(in srgb, #3ddc84 14%, transparent);
    --ok: #3ddc84; --warn: #f0b429; --bad: #ff6b6b; --shadow: 0 10px 40px rgba(0,0,0,.5);
    color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Geist, system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.mono { font-family: "Geist Mono", ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 550; white-space: nowrap; }
.btn:hover { background: var(--panel2); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 650; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.btn.icon { padding: 6px 8px; min-width: 32px; }
.btn.block { width: 100%; padding: 11px 14px; }
.btn:disabled { opacity: .55; cursor: default; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 12px; outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 90px; resize: vertical; }
label.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 5px; text-transform: uppercase; letter-spacing: .04em; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; cursor: pointer; }

/* onboarding */
.center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 32px; width: 100%; max-width: 440px; }
.card.wide { max-width: 620px; }
.logo { display: flex; align-items: center; gap: 12px; font-weight: 750; font-size: 20px; }
.logo img { width: 40px; height: 40px; }
.card h1 { font-size: 24px; margin: 22px 0 6px; }
.card p { margin: 6px 0; }
.or { text-align: center; color: var(--muted); margin: 14px 0; font-size: 12px; }
.jace-btn { background: var(--panel); color: var(--text); border-color: var(--line); font-weight: 650; }
.jace-btn:hover { border-color: var(--accent); background: var(--panel); }
.jace-btn img { width: 20px; height: 20px; }
.error { color: var(--bad); margin-top: 10px; min-height: 1em; }
.meter { height: 6px; border-radius: 6px; background: var(--panel2); overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.kit { border: 2px dashed var(--accent); border-radius: 16px; padding: 20px; margin: 16px 0; background: var(--accent-soft); }
@media print { .kit { background: #fff; color: #000; } }
.kit .sk { font-size: 19px; letter-spacing: .04em; word-break: break-all; font-weight: 700; }

/* layout */
.layout { display: grid; grid-template-columns: 236px 360px 1fr; height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.side .top { padding: 16px; display: flex; align-items: center; gap: 10px; font-weight: 750; }
.side .top img { width: 30px; }
.nav { padding: 0 10px; }
.nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 6px; display: flex; justify-content: space-between; align-items: center; }
.nav button.it { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: 9px; cursor: pointer; text-align: left; }
.nav button.it:hover { background: var(--panel2); }
.nav button.it.on { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.nav .dot { width: 10px; height: 10px; border-radius: 4px; flex: none; }
.side .foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); }
.acct { display: flex; align-items: center; gap: 10px; padding: 6px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; font-weight: 700; color: var(--accent); overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.sync { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sync .s { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync .s.synced { background: var(--ok); } .sync .s.error { background: var(--bad); } .sync .s.syncing { background: var(--warn); }

.list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.list .head { padding: 14px; display: flex; gap: 8px; border-bottom: 1px solid var(--line); }
.list .items { overflow: auto; flex: 1; padding: 6px; }
.li { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; cursor: pointer; }
.li:hover { background: var(--panel2); }
.li.on { background: var(--panel); box-shadow: 0 0 0 1px var(--line), 0 4px 14px rgba(0,0,0,.06); }
.li .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .meta { min-width: 0; flex: 1; }
.tile { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; font-size: 16px; }
.tile.lg { width: 64px; height: 64px; border-radius: 16px; font-size: 28px; }
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty .big { font-size: 40px; }

.detail { overflow: auto; min-width: 0; }
.detail .inner { max-width: 720px; margin: 0 auto; padding: 28px 28px 60px; }
.dhead { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.dhead h2 { margin: 0; font-size: 22px; word-break: break-word; }
.dhead .actions { margin-left: auto; display: flex; gap: 6px; }
.fields { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.field { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.field:last-child { border-bottom: 0; }
.field .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.field .v { word-break: break-all; white-space: pre-wrap; }
.field .body { flex: 1; min-width: 0; }
.field .tools { display: flex; gap: 4px; opacity: .55; }
.field:hover .tools { opacity: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--panel2); font-size: 12px; font-weight: 600; }
.pill.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.totp { font-size: 22px; font-weight: 700; letter-spacing: .12em; }
.ring { width: 26px; height: 26px; }
.ring circle { fill: none; stroke-width: 4; }
.ring .bg { stroke: var(--panel2); } .ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; transform: rotate(-90deg); transform-origin: center; }
.ring.low .fg { stroke: var(--bad); }
.pw-char-d { color: #3b82f6; } .pw-char-s { color: var(--accent); }
.provider { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); font-weight: 600; }

/* credit card visual */
.ccard { width: 340px; max-width: 100%; aspect-ratio: 1.586; border-radius: 18px; padding: 20px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow); margin-bottom: 18px; position: relative; overflow: hidden; }
.ccard::after { content: ""; position: absolute; inset: -40% -20% auto auto; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.08); }
.ccard .num { font-size: 20px; letter-spacing: .12em; }
.ccard .chip { width: 40px; height: 30px; border-radius: 6px; background: linear-gradient(135deg, #f3d27a, #c99a2e); }
.ccard .row2 { display: flex; justify-content: space-between; align-items: flex-end; font-size: 12px; text-transform: uppercase; }

/* generator / watchtower pages */
.page { overflow: auto; grid-column: 2 / span 2; }
.page .inner { max-width: 820px; margin: 0 auto; padding: 28px; }
.genout { font-size: 22px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); word-break: break-all; min-height: 76px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 18px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; }
.stat:hover { border-color: var(--accent); }
.stat .n { font-size: 26px; font-weight: 800; }
.score { display: flex; align-items: center; gap: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
.score .big { font-size: 54px; font-weight: 850; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 6px; font-size: 16px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.seg { display: inline-flex; background: var(--panel2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

/* modal */
.backdrop { position: fixed; inset: 0; background: rgba(8, 10, 14, .55); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(3px); }
.modal { background: var(--panel); border-radius: 20px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow); border: 1px solid var(--line); }
.modal .mh { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.modal .mh h3 { margin: 0; font-size: 17px; flex: 1; }
.modal .mb { padding: 6px 22px 20px; }
.modal .mf { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--panel); }
.typepick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 16px 0; }
.typepick button { border: 1px solid var(--line); background: var(--panel2); border-radius: 14px; padding: 16px; cursor: pointer; text-align: left; }
.typepick button:hover { border-color: var(--accent); }
.typepick .e { font-size: 24px; display: block; margin-bottom: 6px; }
.cf { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 6px; margin-bottom: 6px; }

/* quick search palette */
.palette { max-width: 600px; align-self: start; margin-top: 12vh; }
.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 18px 20px; font-size: 17px; }
.palette .res { max-height: 50vh; overflow: auto; padding: 6px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(40px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px; opacity: 0; transition: .2s; pointer-events: none; z-index: 99; font-weight: 600; }
#toast.show { opacity: 1; transform: translateX(-50%); }

.mobile-back { display: none; }
@media (max-width: 1100px) { .layout { grid-template-columns: 200px 300px 1fr; } }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  .side .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .side .nav .sec { width: 100%; }
  .side .nav button.it { width: auto; }
  .layout.show-detail .list, .layout:not(.show-detail) .detail { display: none; }
  .page { grid-column: 1; }
  .mobile-back { display: inline-flex; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .card { padding: 22px; }
}
@media print {
  body * { visibility: hidden; }
  .kit, .kit * { visibility: visible; }
  .kit { position: absolute; left: 0; top: 0; width: 100%; }
}
