:root {
  --ink: #15171a;
  --muted: #5f636b;
  --faint: #8a8e96;
  --bg: #fbfaf7;
  --panel: #ffffff;
  --side: #f3f1ec;
  --line: #e7e4dd;
  --accent: #5b3df5;
  --accent-ink: #ffffff;
  --accent-soft: #efebff;
  --ok: #1f8a4c;
  --danger: #c2372b;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.shell { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }

/* Sidebar */
.sidebar { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px 18px; }
.is-desktop .sidebar { padding-top: 46px; -webkit-app-region: drag; }
.is-desktop .sidebar button { -webkit-app-region: no-drag; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand strong { display: block; font-size: 15px; line-height: 1.2; }
.brand span { font-size: 12px; color: var(--muted); }
.nav { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 9px; text-align: left; color: var(--muted); font-weight: 500; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: rgba(0,0,0,.04); color: var(--ink); }
.nav-item.is-active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.badge { margin-left: auto; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.sidebar-foot { margin-top: auto; padding: 0 4px; }
.check { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 7px 10px; width: 100%; font-size: 13px; font-weight: 500; }
.check svg { width: 16px; height: 16px; }
.check:hover { border-color: #d4d0c7; }
.check.is-busy svg { animation: spin 1s linear infinite; }
.checked { margin: 8px 2px 0; font-size: 12px; color: var(--faint); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Main */
.main { overflow-y: auto; padding: 28px 36px 48px; }
.is-desktop .main { padding-top: 40px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; width: 260px; }
.search svg { width: 16px; height: 16px; color: var(--faint); flex: none; }
.search input { border: 0; outline: 0; background: none; padding: 9px 0; width: 100%; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.group-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 26px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.empty { color: var(--muted); }

/* Notices */
.notice { background: var(--side); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--muted); margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notice-accent { background: var(--accent-soft); border-color: #dcd4ff; color: var(--ink); }

/* Buttons */
.btn { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 9px; padding: 7px 16px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: filter .15s; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn-light { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.btn-light:hover { filter: none; border-color: #d4d0c7; }
.btn-ghost { background: none; color: var(--muted); padding: 7px 8px; }
.btn-ghost:hover { background: rgba(0,0,0,.05); filter: none; }
.btn-ghost svg { width: 18px; height: 18px; display: block; fill: currentColor; stroke: none; }
.btn-small { padding: 5px 12px; }

/* Cards */
.card { position: relative; display: flex; gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; transition: box-shadow .15s, border-color .15s; }
.card:hover { border-color: #dcd8cf; box-shadow: 0 6px 20px rgba(20,20,30,.06); }
.card-icon { width: 64px; height: 64px; border-radius: 15px; flex: none; object-fit: cover; }
.card-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.card-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card-name { font-size: 16px; margin: 0; }
.card-cat { font-size: 12px; color: var(--faint); }
.card-tagline { margin: 4px 0 14px; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-status { font-size: 12.5px; color: var(--faint); }
.card-status.is-update { color: var(--accent); font-weight: 500; }
.card-status.is-ok { color: var(--ok); }
.card-actions { display: flex; align-items: center; gap: 6px; }
.progress { height: 4px; background: var(--side); border-radius: 2px; overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width .25s; }
.progress.is-indeterminate span { width: 35% !important; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

.menu { position: absolute; right: 18px; top: calc(100% - 14px); z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20,20,30,.12); padding: 5px; min-width: 170px; display: grid; }
.menu button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 7px; font-size: 13px; }
.menu button:hover { background: var(--side); }
.menu .danger { color: var(--danger); }

/* Updates list */
.list { display: grid; gap: 10px; }
.list .card { align-items: center; }
.list .card-icon { width: 48px; height: 48px; border-radius: 12px; }
.list .card-tagline { margin-bottom: 0; }
.all-good { text-align: center; padding: 60px 20px; color: var(--muted); }
.all-good svg { width: 56px; height: 56px; color: var(--ok); stroke-width: 2; }
.all-good h3 { color: var(--ink); margin: 12px 0 4px; font-size: 18px; }
.all-good p { margin: 0; }

/* Settings */
.settings { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-width: 680px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 20px; border-top: 1px solid var(--line); }
.setting:first-child { border-top: 0; }
.setting strong { display: block; font-weight: 600; }
.setting span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.setting select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--panel); }
.toggle { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: #d6d3cc; position: relative; flex: none; cursor: pointer; transition: background .2s; margin: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.toggle:checked { background: var(--accent); }
.toggle:checked::after { transform: translateX(16px); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: 520px; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; height: auto; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { grid-auto-flow: column; }
  .sidebar-foot { margin-top: 14px; }
  .main { padding: 22px 18px 40px; }
  .view-head { flex-direction: column; align-items: stretch; }
  .search { width: 100%; }
  .grid { grid-template-columns: 1fr; }
}

/* Lock screen */
.lock { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, #ece6ff, transparent 60%), var(--bg); }
.is-desktop .lock { -webkit-app-region: drag; }
.lock-box { -webkit-app-region: no-drag; width: 100%; max-width: 340px; display: grid; gap: 10px; text-align: center; }
.lock-box img { margin: 0 auto 6px; filter: drop-shadow(0 8px 20px rgba(91,61,245,.25)); }
.lock-box h1 { font-size: 22px; }
.lock-box .sub { margin: -4px 0 8px; }
.lock-box input, .pw-form input { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 11px 14px; outline: 0; }
.lock-box input:focus, .pw-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lock-error { margin: 0; min-height: 18px; color: var(--danger); font-size: 13px; }
.btn-wide { width: 100%; padding: 11px 16px; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-wide svg { width: 18px; height: 18px; }
.link { border: 0; background: none; color: var(--muted); font-size: 13px; padding: 4px; }
.link:hover { color: var(--ink); text-decoration: underline; }
.lock-box.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.lock-now { margin-top: 10px; }
.setting-stack { display: block; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.pw-form { display: grid; gap: 8px; margin-top: 14px; max-width: 360px; }
.pw-actions { display: flex; gap: 8px; justify-content: flex-end; }
