/* MG Vault — styles. No external fonts/resources (strict CSP). */
:root {
  --bg: #0c0f16; --bg2: #11151e; --surface: #161b26; --surface2: #1c2230; --line: #262d3d;
  --text: #e8ecf5; --muted: #8b95ab; --accent: #6d7cff; --accent2: #9b6dff; --accent-soft: rgba(109,124,255,.14);
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --shadow: 0 10px 40px rgba(0,0,0,.45);
  --radius: 14px; --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) { :root:not([data-theme]) { --bg:#f3f5fa; --bg2:#eaedf5; --surface:#fff; --surface2:#f6f8fc; --line:#dfe4ef; --text:#151a27; --muted:#667089; --accent-soft:rgba(109,124,255,.12); --shadow:0 10px 40px rgba(40,50,90,.15); color-scheme: light; } }
:root[data-theme="light"] { --bg:#f3f5fa; --bg2:#eaedf5; --surface:#fff; --surface2:#f6f8fc; --line:#dfe4ef; --text:#151a27; --muted:#667089; --accent-soft:rgba(109,124,255,.12); --shadow:0 10px 40px rgba(40,50,90,.15); color-scheme: light; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.sp { height: 14px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); font-weight: 600; font-size: 14px; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(109,124,255,.35); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); transition: .15s; }
.icon-btn:hover { background: var(--accent-soft); color: var(--text); }
.icon-btn.on { color: var(--warn); }
.input, .select, .textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
.textarea.big { min-height: 280px; }
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.input-group { display: flex; gap: 6px; }
.input-group .input { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.err { color: var(--bad); font-size: 13.5px; margin: 8px 0 0; min-height: 1px; }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 500px at 20% -10%, rgba(109,124,255,.18), transparent), radial-gradient(700px 400px at 100% 110%, rgba(155,109,255,.14), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 560px; }
.logo { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; box-shadow: 0 8px 24px rgba(109,124,255,.4); }
.logo svg { width: 28px; height: 28px; }
.auth h1 { font-size: 24px; margin: 18px 0 4px; letter-spacing: -.01em; }
.auth p.sub { color: var(--muted); margin: 0 0 22px; }
.notice { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface2); }
.notice.warn { border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.08); }
.notice.bad { border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.08); }
.notice.ok { border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.08); }
.keybox { font-family: var(--mono); font-size: 15px; letter-spacing: .04em; word-break: break-word; line-height: 1.9; padding: 14px; border-radius: 12px; background: var(--bg2); border: 1px dashed var(--accent); text-align: center; user-select: all; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-size: 13.5px; }
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--accent); }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--bg2); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.brand .logo { width: 40px; height: 40px; border-radius: 12px; }
.brand .logo svg { width: 22px; height: 22px; }
.brand b { font-size: 16px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 12px; }
.nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; background: none; border: 0; color: var(--muted); font-weight: 600; text-align: left; transition: .15s; }
.nav-btn:hover { background: var(--accent-soft); color: var(--text); }
.nav-btn.on { background: var(--accent-soft); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav-btn .cnt { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--surface2); border-radius: 20px; padding: 1px 8px; }
.side .spacer { flex: 1; }
.credit { font-size: 12px; color: var(--muted); padding: 10px 12px 2px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search .input { padding-left: 38px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.content { padding: 24px 28px 60px; max-width: 1240px; width: 100%; margin: 0 auto; }
.timer { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* ---------- panels ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: .15s; }
.stat:hover { border-color: var(--accent); transform: translateY(-2px); }
.stat .n { font-size: 30px; font-weight: 750; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 20px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.chip.on, .chip:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.tag { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); font-weight: 600; margin: 2px 4px 2px 0; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .5; margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* notes */
.notes-grid { columns: 270px; column-gap: 14px; }
.note { break-inside: avoid; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: .15s; position: relative; }
.note:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.note[data-c="amber"] { border-top-color: #fbbf24; } .note[data-c="green"] { border-top-color: #34d399; } .note[data-c="blue"] { border-top-color: #60a5fa; }
.note[data-c="rose"] { border-top-color: #fb7185; } .note[data-c="violet"] { border-top-color: #a78bfa; }
.note h4 { margin: 0 0 6px; font-size: 16px; padding-right: 26px; }
.note p { margin: 0; color: var(--muted); font-size: 14px; white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.note .pin { position: absolute; top: 12px; right: 12px; color: var(--accent); }
.note .meta { margin-top: 10px; font-size: 12px; color: var(--muted); }
.swatches { display: flex; gap: 8px; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); }
.sw.on { border-color: var(--text); }
.sw[data-c="none"] { background: var(--surface2); } .sw[data-c="amber"] { background: #fbbf24; } .sw[data-c="green"] { background: #34d399; }
.sw[data-c="blue"] { background: #60a5fa; } .sw[data-c="rose"] { background: #fb7185; } .sw[data-c="violet"] { background: #a78bfa; }

/* list rows */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: .15s; }
.item:hover { border-color: var(--accent); }
.avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 750; font-size: 17px; color: #fff; flex: none; background: var(--accent); }
.item .t { font-weight: 650; }
.item .s { color: var(--muted); font-size: 13px; }
.item .acts { display: flex; gap: 2px; flex: none; }
.badge { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--surface2); color: var(--muted); }
.badge.bad { background: rgba(248,113,113,.14); color: var(--bad); } .badge.warn { background: rgba(251,191,36,.14); color: var(--warn); } .badge.ok { background: rgba(52,211,153,.14); color: var(--ok); }

/* secure items */
.secure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.sitem { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: .15s; }
.sitem:hover { border-color: var(--accent); }
.frow { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.frow:first-of-type { border-top: 0; }
.frow .k { width: 38%; color: var(--muted); font-size: 12.5px; flex: none; }
.frow .v { flex: 1; min-width: 0; word-break: break-all; }

/* tasks */
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.task.done .t { text-decoration: line-through; color: var(--muted); }
.tick { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); background: none; display: grid; place-items: center; color: #fff; flex: none; margin-top: 1px; padding: 0; }
.tick.on { background: var(--ok); border-color: var(--ok); }
.tick svg { width: 14px; height: 14px; stroke-width: 3; }
.prio { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; background: var(--muted); }
.prio.high { background: var(--bad); } .prio.medium { background: var(--warn); } .prio.low { background: var(--ok); }
.quickadd { display: flex; gap: 8px; margin-bottom: 18px; }

/* modal */
.back { position: fixed; inset: 0; z-index: 100; background: rgba(5,8,14,.66); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 620px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); animation: pop .18s; }
.modal.lg { max-width: 780px; } .modal.sm { max-width: 440px; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal header h3 { margin: 0; font-size: 17px; }
.modal .body { padding: 20px; }
.modal footer { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.modal footer .left { margin-right: auto; }
@keyframes fade { from { opacity: 0 } } @keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98) } }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.meter { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; width: 0; border-radius: 6px; transition: width .25s, background .25s; background: var(--bad); }
.meter[data-l="2"] i { background: var(--warn); } .meter[data-l="3"] i { background: #a3e635; } .meter[data-l="4"] i { background: var(--ok); }
.gen { margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); }
.gen .opts { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 13.5px; }
.gen input[type=range] { width: 100%; accent-color: var(--accent); }
.fieldrow { display: grid; grid-template-columns: 1fr 1.6fr auto auto; gap: 6px; margin-bottom: 8px; align-items: center; }

/* settings */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 2px; }
.tab { padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 650; white-space: nowrap; }
.tab.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.t th, table.t td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); animation: pop .2s; }
.toast.bad { background: var(--bad); color: #fff; }
.mobnav { display: none; }

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .topbar h2 { font-size: 18px; }
  .search { order: 5; max-width: none; flex-basis: 100%; margin: 0; }
  .timer { display: none; }
  .content { padding: 16px 14px 100px; }
  .mobnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--bg2); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); overflow-x: auto; }
  .mobnav button { flex: 1 0 auto; min-width: 58px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; background: none; border: 0; color: var(--muted); font-size: 10.5px; font-weight: 650; border-radius: 10px; }
  .mobnav button.on { color: var(--accent); background: var(--accent-soft); }
  .two-col, .fieldrow { grid-template-columns: 1fr; }
  .fieldrow { gap: 6px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
  .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 8px; }
  .modal { max-height: calc(100vh - 16px); border-radius: 16px; }
  .item { padding: 10px; gap: 10px; }
  .item .acts .hide-m { display: none; }
}
