/* ============================================================
   KAMI OS — EFFECTS / ALIEN-TECH LAYER
   Ambient HUD · corner brackets · quick console · notifications
   ============================================================ */

/* ---------- Ambient background field ---------- */
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.ambient-grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 35%, #000 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 35%, #000 30%, transparent 85%);
  animation: griddrift 22s linear infinite;
}
@keyframes griddrift { to { background-position: 46px 46px, 46px 46px; } }

.ambient-aurora { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; mix-blend-mode: screen; }
.ambient-aurora.a1 { width: 52vw; height: 52vw; left: -8vw; top: -14vw; background: radial-gradient(circle, rgba(0,229,255,0.20), transparent 65%); animation: float1 26s var(--ease) infinite alternate; }
.ambient-aurora.a2 { width: 46vw; height: 46vw; right: -6vw; bottom: -16vw; background: radial-gradient(circle, rgba(123,92,255,0.18), transparent 65%); animation: float2 31s var(--ease) infinite alternate; }
@keyframes float1 { to { transform: translate(8vw, 6vh) scale(1.12); } }
@keyframes float2 { to { transform: translate(-7vw, -5vh) scale(1.15); } }

.ambient-scan {
  position: absolute; inset: 0; opacity: 0.5;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(0,8,12,0.20) 3px, rgba(0,0,0,0) 4px);
  mix-blend-mode: multiply;
}
.ambient-scan::after {
  content: ""; position: absolute; left: 0; right: 0; height: 32%;
  background: linear-gradient(180deg, transparent, rgba(0,229,255,0.05), transparent);
  animation: sweep 7.5s linear infinite;
}
@keyframes sweep { 0% { top: -32%; } 100% { top: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .ambient-grid, .ambient-aurora, .ambient-scan::after { animation: none; }
}

/* ---------- HUD corner brackets on panels ---------- */
.panel { --hud: rgba(0, 229, 255, 0.34); }
.panel > .panel-head::before,
.panel > .panel-head::after {
  content: ""; position: absolute; top: 9px; width: 12px; height: 12px; pointer-events: none;
}
.panel > .panel-head::before { left: 8px; border-left: 1.5px solid var(--hud); border-top: 1.5px solid var(--hud); }
.panel > .panel-head::after { right: 8px; border-right: 1.5px solid var(--hud); border-top: 1.5px solid var(--hud); }
.panel-head { position: relative; }
/* animated sheen under the panel header */
.panel-head { background: linear-gradient(180deg, rgba(0,229,255,0.02), transparent); }
.panel-head::after { box-shadow: none; }
.panel:hover { border-color: rgba(0, 229, 255, 0.28); }

/* Bottom corner ticks on stat cards for the HUD feel */
.stat-card::before {
  content: ""; position: absolute; left: 10px; bottom: 9px; width: 11px; height: 11px;
  border-left: 1.5px solid rgba(0,229,255,0.28); border-bottom: 1.5px solid rgba(0,229,255,0.28); pointer-events: none;
}
.stat-card { position: relative; }
.stat-card .value { text-shadow: 0 0 18px rgba(0,229,255,0.18); }

/* Boot logo: alien shimmer */
.boot-logo { font-family: var(--font-display); }
.boot-logo::after { content: ""; }

/* ============================================================
   QUICK CAPTURE BAR  (Cmd/Ctrl+K)
   ============================================================ */
.qbar-scrim {
  position: fixed; inset: 0; z-index: 150; display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 20px 20px; background: rgba(2,4,8,0.62); backdrop-filter: blur(6px);
  animation: fade 0.16s var(--ease);
}
.qbar {
  width: min(680px, 100%);
  background: var(--glass-2); border: 1px solid var(--glass-border-hot);
  border-radius: var(--radius-lg); box-shadow: 0 40px 100px -24px #000, 0 0 50px -10px var(--accent-glow);
  overflow: hidden; animation: pop 0.18s var(--ease); position: relative;
}
.qbar::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scanline 2.4s linear infinite;
}
@keyframes scanline { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.qbar-row { display: flex; align-items: center; gap: 12px; padding: 16px 18px; }
.qbar-prompt { font-family: var(--font-mono); font-size: 22px; color: var(--accent); line-height: 1; text-shadow: 0 0 12px var(--accent-glow); }
.qbar-input {
  flex: 1; background: transparent; border: none; outline: none; color: var(--text);
  font-family: var(--font-head); font-size: 18px; letter-spacing: 0.4px;
}
.qbar-input::placeholder { color: var(--text-faint); }
.qbar-mic {
  width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--glass); border: 1px solid var(--glass-border); color: var(--text-dim);
  font-size: 17px; transition: all 0.15s var(--ease);
}
.qbar-mic:hover { color: var(--accent); border-color: var(--glass-border-hot); }
.qbar-mic.listening { color: var(--bad); border-color: rgba(255,77,109,0.5); animation: pulse 1s var(--ease) infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255,77,109,0.12); } }

.qbar-preview {
  padding: 0 18px 12px; min-height: 22px; font-family: var(--font-mono); font-size: 12.5px;
  color: var(--accent); letter-spacing: 0.5px;
}
.qbar-preview .muted { color: var(--text-faint); }
.qbar-feed { max-height: 220px; overflow-y: auto; padding: 0 18px; }
.qbar-feed:not(:empty) { padding-bottom: 12px; }
.qbar-feed .fd {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim);
  padding: 7px 0; border-top: 1px solid rgba(255,255,255,0.05); display: flex; gap: 9px; align-items: baseline;
}
.qbar-feed .fd .ok { color: var(--good); } .qbar-feed .fd .er { color: var(--bad); }
.qbar-feed .fd .tm { margin-left: auto; color: var(--text-faint); font-size: 10px; }
.qbar-hint {
  display: flex; gap: 14px; flex-wrap: wrap; padding: 11px 18px; border-top: 1px solid var(--glass-border);
  background: rgba(4,8,14,0.4); font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); letter-spacing: 0.5px;
}
.qbar-hint b { color: var(--text-dim); font-weight: 400; }
.qbar-hint kbd { padding: 1px 5px; border: 1px solid var(--glass-border); border-radius: 4px; color: var(--text-dim); }

/* ============================================================
   QUICK CONSOLE TAB
   ============================================================ */
.qc-shell {
  background: linear-gradient(135deg, rgba(0,229,255,0.06), rgba(43,127,255,0.02));
  border: 1px solid var(--glass-border-hot); border-radius: var(--radius-lg); padding: 8px; position: relative; overflow: hidden;
}
.qc-shell::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: scanline 3s linear infinite;
}
.qc-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.qc-prompt { font-family: var(--font-mono); font-size: 22px; color: var(--accent); text-shadow: 0 0 12px var(--accent-glow); }
.qc-input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--font-head); font-size: 19px; }
.qc-input::placeholder { color: var(--text-faint); }
.qc-preview { padding: 0 16px 10px; min-height: 20px; font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); }
.qc-preview .muted { color: var(--text-faint); }

.cheat { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.cheat .row-c { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--glass-border); border-radius: var(--radius-sm); background: rgba(4,8,14,0.4); }
.cheat code { font-family: var(--font-mono); font-size: 12px; color: var(--accent); white-space: nowrap; }
.cheat .desc { font-size: 12px; color: var(--text-dim); }

.cap-log .list-item { cursor: default; }
.cap-log .li-kind { font-family: var(--font-mono); font-size: 9px; letter-spacing: 1px; text-transform: uppercase; padding: 2px 7px; border-radius: 12px; border: 1px solid var(--glass-border); color: var(--text-faint); }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
.notif-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.notif-row:last-child { border-bottom: none; }
.notif-row .nr-main { min-width: 0; }
.notif-row .nr-title { font-size: 13.5px; color: var(--text); font-weight: 500; }
.notif-row .nr-sub { font-size: 11.5px; color: var(--text-faint); font-family: var(--font-mono); margin-top: 2px; }
.notif-row .nr-ctl { display: flex; align-items: center; gap: 10px; flex: none; }
.notif-row input.time {
  background: rgba(4,8,14,0.6); border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  color: var(--text); padding: 6px 8px; font-family: var(--font-mono); font-size: 12px;
}

/* toggle switch */
.switch { position: relative; width: 44px; height: 25px; flex: none; }
.switch input { display: none; }
.switch .track { position: absolute; inset: 0; border-radius: 20px; background: rgba(255,255,255,0.08); border: 1px solid var(--glass-border); transition: all 0.18s var(--ease); }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: var(--text-faint); transition: all 0.18s var(--ease); }
.switch input:checked + .track { background: rgba(0,229,255,0.18); border-color: var(--glass-border-hot); }
.switch input:checked + .track::after { left: 21px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 10px var(--accent-glow); }

.notif-status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; padding: 6px 11px; border-radius: 20px; border: 1px solid var(--glass-border); }
.notif-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.notif-status.granted { color: var(--good); border-color: rgba(46,230,166,0.3); background: var(--good-dim); }
.notif-status.granted .dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.notif-status.denied { color: var(--bad); border-color: rgba(255,77,109,0.3); background: var(--bad-dim); }
.notif-status.denied .dot { background: var(--bad); }

/* ============================================================
   SPENDING TRACKER
   ============================================================ */
.spend-shell { padding-bottom: 6px; }
.spend-type { width: auto; }
.spend-type button[data-t="expense"].active { color: var(--bad); background: linear-gradient(135deg, rgba(255,77,109,0.18), rgba(255,77,109,0.06)); }
.spend-type button[data-t="income"].active { color: var(--good); background: linear-gradient(135deg, rgba(46,230,166,0.18), rgba(46,230,166,0.06)); }
.spend-add {
  display: grid; grid-template-columns: 130px 1fr 170px 150px auto; gap: 12px; align-items: end;
  padding: 12px 14px 4px;
}
.spend-add .field { margin-bottom: 0; }
.spend-add #sp-amount { font-family: var(--font-display); font-size: 18px; }
.spend-add .btn { height: 42px; }
.spend-hint { padding: 8px 14px 4px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); letter-spacing: 0.3px; }
.spend-hint code { color: var(--accent); }
.spend-hint b { color: var(--text-dim); }
@media (max-width: 760px) {
  .spend-add { grid-template-columns: 1fr 1fr; }
  .spend-add .field:nth-child(2) { grid-column: 1 / -1; }
  .spend-add .btn { grid-column: 1 / -1; width: 100%; }
}

/* ============================================================
   CLOUD SYNC
   ============================================================ */
.sync-box { border: 1px solid var(--glass-border-hot); border-radius: var(--radius-md, 12px); padding: 14px; background: linear-gradient(135deg, rgba(0,229,255,0.05), rgba(43,127,255,0.02)); }
.sync-box .nr-title { font-size: 13.5px; color: var(--text); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.sync-code-row { display: flex; gap: 8px; align-items: center; }
.sync-code-row .input { flex: 1; min-width: 0; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); display: inline-block; }
.sync-dot.ok { background: var(--good); box-shadow: 0 0 8px var(--good); }
.sync-dot.syncing { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 1s var(--ease) infinite; }
.sync-dot.error { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.sync-dot.idle { background: var(--warn); }
.sync-dot.off { background: var(--text-faint); }
.top-sync-dot { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; pointer-events: none; }
#btn-data { position: relative; }
.sync-err { color: var(--bad); line-height: 1.45; }
