/* BryantOS — layout and look */

:root {
  --bg: #0b1120;
  --side: #0f172a;
  --card: #131d33;
  --card-2: #1a2540;
  --raised: #1d2b4a;
  --line: #22304d;
  --line-2: #2b3a5c;
  --text: #e8eefc;
  --text-2: #b6c2da;
  --muted: #93a3c0;
  --accent: #38bdf8;
  --on-accent: #04121f;
  --good-bg: #10301f;
  --good: #6ee7a0;
  --bad: #fca5a5;
  --bad-line: #5c2b33;
  --radius: 14px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
a { color: #7dd3fc; }
a:hover { color: #bae6fd; }
h1, h2, h3, p { margin: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::placeholder { color: #7d8cab; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.loading { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* ── Layout ─────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  flex: 0 0 248px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side);
  border-right: 1px solid #1e2a44;
  padding: 24px 16px;
  display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--muted); }

.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 14px 4px; }
.nav-btn {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text-2); text-align: left; font-size: 15px;
}
.nav-btn:hover { background: #16213a; color: var(--text); }
.nav-btn.active { background: var(--raised); color: #fff; font-weight: 600; }
.nav-tag { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.nav-tag.open { color: var(--good); }

.user-card { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--card); }
.user-avatar, .user-initial { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; }
.user-initial { background: var(--raised); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.user-text { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-sub { font-size: 12px; color: var(--muted); }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 48px) 64px; display: flex; flex-direction: column; gap: 20px; }

.phone-header { display: none; }
.bottom-nav { display: none; }

/* ── Top bar ─────────────────────────────────────────── */
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.search {
  flex: 1 1 280px; display: flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  color: var(--muted);
}
.search input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; color: var(--text); outline: none; font-size: 15px; }
.search:focus-within { border-color: var(--accent); }

/* ── Buttons & fields ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: transparent; color: var(--text); font-weight: 500;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #16213a; color: var(--text); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: #7dd3fc; color: var(--on-accent); }
.btn-soft { background: var(--raised); border-color: transparent; }
.btn-danger { color: var(--bad); border-color: var(--bad-line); }
.btn-small { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn-big { min-height: 50px; font-size: 16px; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--line-2); background: transparent; color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 14px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--muted); }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--text);
}
.field textarea, textarea.input { padding: 12px 14px; min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.select-small { min-height: 38px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font-size: 14px; max-width: 160px; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ── Chips ───────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font-size: 14px;
}
.chip.active { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

/* ── Content blocks ──────────────────────────────────── */
.view { display: flex; flex-direction: column; gap: 18px; }
.view-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.view-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-right: auto; }
.lead { color: var(--text-2); max-width: 680px; }
.small { font-size: 13px; color: var(--muted); }
h2.sub { font-size: 18px; font-weight: 600; }

.card { padding: 20px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.list { border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); overflow: hidden; }
.list-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 14px 18px; border-bottom: 1px solid #1e2a44; }
.list-row:last-child { border-bottom: 0; }
.list-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.list-title { font-weight: 600; overflow-wrap: anywhere; }
.list-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.list-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.folder-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.letter { width: 40px; height: 40px; border-radius: 10px; background: var(--raised); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; text-transform: uppercase; }
.empty { padding: 22px 18px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); color: var(--text); text-align: left; display: flex; flex-direction: column; gap: 4px; }
.tile:hover { border-color: var(--line-2); background: #16213a; }
.tile-num { font-size: 28px; font-weight: 700; }
.tile-label { color: var(--muted); }

.kind { flex: 0 0 auto; width: 64px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Notes */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.note { padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; gap: 8px; min-height: 140px; }
.note h3 { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.note-body { color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; flex: 1; }
.note-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: space-between; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.photo { margin: 0; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); overflow: hidden; display: flex; flex-direction: column; }
.photo-img { display: block; aspect-ratio: 4 / 3; background: var(--card-2); }
.photo-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-file { aspect-ratio: 4 / 3; background: var(--card-2); display: flex; align-items: center; justify-content: center; color: var(--muted); text-decoration: none; font-weight: 700; }
.photo figcaption { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.photo-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-label { position: relative; }
.upload-label input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Vault */
.lock-box { width: 100%; max-width: 440px; margin: 24px auto 0; text-align: center; }
.lock-box .field { text-align: left; }
.lock-icon { align-self: center; width: 60px; height: 60px; border-radius: 16px; background: var(--raised); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.lock-icon svg { width: 28px; height: 28px; }
.pill-good { padding: 6px 10px; border-radius: 999px; background: var(--good-bg); color: var(--good); font-size: 13px; font-weight: 600; }
.secret { flex: 1 1 220px; min-width: 0; font-family: var(--mono); font-size: 14px; color: #dbe5f7; background: var(--bg); padding: 10px 12px; border-radius: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secret.shown { white-space: pre-wrap; overflow-wrap: anywhere; }
.error { color: var(--bad); font-size: 14px; min-height: 1em; }
.banner { padding: 12px 16px; border-radius: 12px; font-size: 14px; }
.banner-error { background: #3a1820; color: #fecdd3; border: 1px solid var(--bad-line); }
.banner-info { background: #0f2a3d; color: #bae6fd; border: 1px solid #1e4a66; }

/* More */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.amount-pos { color: var(--good); font-weight: 600; }
.amount-neg { color: var(--bad); font-weight: 600; }
.paid .list-title { text-decoration: line-through; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); z-index: 50; max-width: calc(100vw - 32px);
}

/* ── Phone ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .phone-header {
    display: flex; align-items: center; gap: 10px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    background: var(--side); border-bottom: 1px solid #1e2a44;
    position: sticky; top: 0; z-index: 20;
  }
  .phone-header .brand-name { margin-right: auto; }
  .phone-header .brand-logo { width: 32px; height: 32px; }
  .main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); gap: 16px; }
  .topbar { flex-wrap: nowrap; }
  .search { flex: 1 1 0; }
  .topbar .btn-primary { flex: 0 0 auto; }
  .view-head h1 { font-size: 24px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--side); border-top: 1px solid #1e2a44;
  }
  .bottom-nav button {
    min-height: 54px; border: 0; background: transparent; color: var(--muted);
    font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  }
  .bottom-nav button svg { width: 22px; height: 22px; }
  .bottom-nav button.active { color: var(--accent); font-weight: 600; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .chip { flex: 0 0 auto; }
}
