/* Master Project Launcher: dark, premium, touch-first. Status colours always come with a text label. */
:root {
  color-scheme: dark;
  --bg: #0b0c10; --surface: #14161c; --surface-2: #1a1d25; --surface-3: #232733;
  --line: #252a35; --line-2: #323745;
  --text: #eef0f5; --text-2: #a6abba; --text-3: #707689;
  --accent: #338ced; --accent-ink: #08172a;
  --good: #0aac23; --warning: #fbb315; --critical: #dc3c3d;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body { background: radial-gradient(1200px 600px at 50% -200px, #1b2a44 0%, transparent 70%), var(--bg); background-attachment: fixed; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); } .small { font-size: 12.5px; font-weight: 500; }

/* Boot */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { width: 100%; min-height: 52px; font-size: 16.5px; border-radius: 14px; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { color: #ff8e8e; }
.btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 8px 0; color: var(--accent); font-weight: 600; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 380px; text-align: center; display: grid; gap: 14px; }
.auth-mark { width: 72px; height: 72px; margin: 0 auto; border-radius: 20px; box-shadow: 0 18px 40px #0008; }
.auth-card h1 { margin: 6px 0 0; font-size: 26px; letter-spacing: .2px; }
.auth-card p { margin: 0; }
.auth-card form, #auth-signin { display: grid; gap: 12px; text-align: left; }
.auth-card label { display: grid; gap: 6px; font-weight: 600; font-size: 13.5px; color: var(--text-2); }
.auth-card input { height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-size: 17px; letter-spacing: .5px; }
.hint { color: var(--text-3); font-size: 13px; text-align: center; }
.msg { min-height: 1.4em; color: #ff9a9a; font-weight: 600; }
.msg.ok { color: #7fe08f; }

/* App shell */
.app { max-width: 1240px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 20px calc(40px + var(--safe-b)); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 38px; height: 38px; border-radius: 11px; }
.brand b { display: block; font-size: 16px; } .brand small { color: var(--text-3); font-size: 12px; }
.bar-actions { display: flex; gap: 8px; }

/* Health strip */
.health { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.metric { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: #14161ccc; }
.metric span { display: block; color: var(--text-3); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.metric b { font-size: 18px; font-variant-numeric: tabular-nums; }
.metric .bar-track { height: 4px; margin-top: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.metric .bar-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.metric .bar-fill.warn { background: var(--warning); } .metric .bar-fill.bad { background: var(--critical); }

/* Tools */
.tools { display: grid; gap: 10px; margin-bottom: 8px; }
#search { width: 100%; height: 46px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); font-size: 16px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.fchip { flex: none; height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.fchip.on { background: var(--text); color: var(--bg); border-color: transparent; }

/* Grid & cards */
.group { margin-top: 22px; }
.group h2 { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .7px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.card { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: start; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(180deg, #171a22, #13151b); box-shadow: 0 1px 0 #ffffff08 inset, 0 10px 30px #0004; }
.card.openable { cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.card.openable:hover { border-color: var(--line-2); transform: translateY(-1px); }
.card.openable:active { transform: scale(.99); }
.card.dim { opacity: .72; }
.icon { width: 56px; height: 56px; border-radius: 15px; object-fit: cover; background: var(--surface-3); display: grid; place-items: center; font-size: 20px; font-weight: 800; letter-spacing: .5px; color: #fff; }
.icon.m0 { background: linear-gradient(135deg, #2b5fae, #1d3b6e); } .icon.m1 { background: linear-gradient(135deg, #6c4fc8, #3b2a78); }
.icon.m2 { background: linear-gradient(135deg, #1f8a6b, #145444); } .icon.m3 { background: linear-gradient(135deg, #b5683a, #6e3b1f); }
.icon.m4 { background: linear-gradient(135deg, #a8406b, #5e2440); } .icon.m5 { background: linear-gradient(135deg, #4b5568, #2b313d); }
.card-body { min-width: 0; display: grid; gap: 6px; padding-right: 28px; }
.card-title { display: flex; align-items: center; gap: 8px; }
.card-title b { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-desc { color: var(--text-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.chip.good .dot { background: var(--good); } .chip.warn .dot { background: var(--warning); } .chip.bad .dot { background: var(--critical); }
.chip.kind { background: transparent; }
.ver { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.note { color: var(--text-3); font-size: 12.5px; }
.priv { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.priv .btn { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.star { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: var(--text-3); font-size: 18px; cursor: pointer; }
.star.on { color: var(--warning); }
.empty { color: var(--text-3); padding: 20px 0; }

/* Presentation mode: demos only, larger, no internals */
body.present .health, body.present #kinds, body.present #sec-recent, body.present .ver, body.present .note, body.present .star, body.present #btn-security { display: none !important; }
body.present .grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
body.present .card { padding: 22px; grid-template-columns: 72px 1fr; }
body.present .icon { width: 72px; height: 72px; border-radius: 19px; font-size: 26px; }
body.present .card-title b { font-size: 18px; }

/* Security */
.back { margin-bottom: 6px; }
.panel { margin-bottom: 14px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.list li > div { min-width: 0; }
.list li b { display: block; overflow-wrap: anywhere; }
.list li small { color: var(--text-3); overflow-wrap: anywhere; }
.list.log li { display: block; font-size: 13px; }
.code-out { margin: 12px 0 0; padding: 12px; border-radius: 12px; background: var(--surface-2); font: 600 22px/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 2px; text-align: center; }
.secret { font-family: ui-monospace, "SF Mono", Menlo, monospace; overflow-wrap: anywhere; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.totp-form { display: flex; gap: 8px; margin-top: 10px; }
.totp-form input { width: 140px; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); letter-spacing: 2px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: 0 10px 30px #0008; font-weight: 600; z-index: 20; }

@media (max-width: 640px) {
  .app { padding-left: 14px; padding-right: 14px; }
  .health { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid, body.present .grid { grid-template-columns: 1fr; }
  .bar-actions .btn { padding: 0 12px; }
}
