/* PassBox — mobile-first dark UI. No external fonts (offline + private). */
:root {
  --bg: #0b1220;
  --bg-elev: #131c2e;
  --bg-card: #18233a;
  --line: #243049;
  --text: #e8eef7;
  --muted: #93a1b8;
  --teal: #14b8a6;
  --teal-dark: #0f766e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 14px;
  --tap: 48px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

#app { min-height: 100%; display: flex; flex-direction: column; }
.boot { margin: auto; color: var(--muted); padding: 40px; }

/* ---------- layout ---------- */
.screen { flex: 1; display: flex; flex-direction: column; min-height: 100%; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  background: var(--bg-elev); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 650; letter-spacing: .2px; flex: 1; }
.topbar .brand { display: flex; align-items: center; gap: 8px; flex: 1; }
.topbar .brand .logo { width: 26px; height: 26px; }
.content { padding: 16px 14px 96px; flex: 1; }
.centered { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 28px 22px; gap: 16px; flex: 1; }

/* ---------- buttons ---------- */
button {
  font: inherit; color: var(--text); cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-card);
  border-radius: 12px; min-height: var(--tap); padding: 0 16px;
}
button:active { transform: translateY(1px); }
.btn-primary { background: var(--teal-dark); border-color: var(--teal); color: #fff; font-weight: 600; }
.btn-primary:active { background: var(--teal); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: var(--danger); color: #fda4a4; }
.icon-btn { min-width: var(--tap); min-height: var(--tap); padding: 0; display: grid; place-items: center; font-size: 20px; background: transparent; border: none; }
.row-btns { display: flex; gap: 10px; }
.row-btns > * { flex: 1; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px; min-height: var(--tap);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
.input-wrap { position: relative; }
.input-wrap .inline-btn { position: absolute; right: 6px; top: 6px; min-height: 36px; height: 36px; padding: 0 12px; font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.field { margin-bottom: 4px; }

/* ---------- cards / list ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; display: flex; align-items: center; gap: 12px;
}
.card .avatar {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 17px;
  background: var(--teal-dark); color: #fff;
}
.card .grow { flex: 1; min-width: 0; }
.card .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .chev { color: var(--muted); }

/* ---------- search + tabs ---------- */
.search { margin-bottom: 12px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.tab { white-space: nowrap; padding: 8px 14px; border-radius: 999px; font-size: 14px; min-height: 38px; }
.tab.active { background: var(--teal-dark); border-color: var(--teal); color: #fff; }

/* ---------- detail ---------- */
.detail-field { background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.detail-field .k { font-size: 12px; color: var(--muted); }
.detail-field .v { display: flex; align-items: center; gap: 10px; word-break: break-word; }
.detail-field .v .text { flex: 1; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

/* ---------- photos ---------- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gallery .thumb { aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-elev); padding: 0; }
.gallery .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 50; display: flex; flex-direction: column; }
.viewer img { flex: 1; width: 100%; object-fit: contain; min-height: 0; }
.viewer .viewer-bar { display: flex; justify-content: space-between; padding: max(12px, env(safe-area-inset-top)) 14px 12px; }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 18px; bottom: max(20px, env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; font-size: 28px; z-index: 10;
  background: var(--teal-dark); border: 1px solid var(--teal); color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); display: grid; place-items: center;
}

/* ---------- misc ---------- */
.muted { color: var(--muted); }
.danger-text { color: #fda4a4; }
.warn-box { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.5); color: #fcd9a0; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 22px 0 8px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.spacer { height: 14px; }
.strength { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 8px; }
.strength > span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.logo { display: inline-block; }

.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: #0c1526; border: 1px solid var(--teal); color: var(--text);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 60;
  max-width: 88%; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}

.install-banner {
  position: fixed; left: 10px; right: 10px; bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 70; display: flex; align-items: center; gap: 10px;
  background: var(--bg-elev); border: 1px solid var(--teal);
  border-radius: 14px; padding: 10px 10px 10px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.install-banner .grow { flex: 1; font-size: 14px; }
.install-banner .btn-primary { min-height: 40px; padding: 0 16px; }
.install-banner .icon-btn { min-width: 40px; min-height: 40px; }

.checkbox-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.checkbox-row input { width: auto; min-height: auto; }
.checkbox-row label { margin: 0; color: var(--text); }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; }
