/* Lake Project App — Night Station mobile */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #07090C;
  --panel: #0C1016;
  --border: #1a2535;
  --text: #E8EDF2;
  --muted: #8B96A3;
  --dim: #5A6675;
  --faint: #3A4453;
  --accent: #6FE3D1;
  --accent-dark: #2A5F57;
  --red: #E36F81;
  --amber: #E3C56F;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
}

.boot { padding: 40vh 20px 0; text-align: center; color: var(--dim); font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: 0.1em; }

/* ---------- Login ---------- */
.login {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px;
}
.login .mark { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.login .mark .horizon { width: 64px; height: 4px; background: var(--accent); border-radius: 2px; box-shadow: 0 8px 24px rgba(111,227,209,0.35); }
.login .mark .word { font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--accent); }
.login .sub { font-size: 13px; color: var(--dim); text-align: center; max-width: 260px; }
.login .error { color: var(--red); font-size: 13px; text-align: center; max-width: 280px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--bg);
  font-weight: 700; font-size: 15px;
  border: none; border-radius: 10px;
  padding: 14px 26px; width: 100%;
  cursor: pointer;
}
.btn:active { transform: scale(0.98); }
.btn--ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); font-weight: 500; }
.btn--danger { background: transparent; color: var(--red); border: 1px solid rgba(227,111,129,0.35); font-weight: 500; }
.btn--sm { padding: 9px 16px; font-size: 13px; width: auto; border-radius: 8px; }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* ---------- Layout ---------- */
.screen { padding: calc(var(--safe-top) + 14px) 16px calc(var(--safe-bottom) + 84px); max-width: 560px; margin: 0 auto; }
.screen-title {
  font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.screen-title .logout { color: var(--faint); font-size: 10px; letter-spacing: 0.1em; background: none; border: none; font-family: inherit; text-transform: uppercase; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex;
  background: rgba(12,16,22,0.92);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.tabbar button {
  flex: 1; background: none; border: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 0 8px; color: var(--dim);
  font-family: ui-monospace, monospace; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
}
.tabbar button.active { color: var(--accent); }
.tabbar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Cards & lists ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.row-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid rgba(26,37,53,0.6);
}
.row-item:last-child { border-bottom: none; }
.row-item .l { min-width: 0; }
.row-item .l .t { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .l .s { font-size: 11px; color: var(--dim); font-family: ui-monospace, monospace; }
.row-item .r { text-align: right; flex-shrink: 0; }
.row-item .r .amt { font-family: ui-monospace, monospace; font-size: 14px; font-weight: 600; }

.chip {
  display: inline-block; font-family: ui-monospace, monospace; font-size: 9px;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border); color: var(--dim);
}
.chip--pending  { color: var(--amber); border-color: rgba(227,197,111,0.35); }
.chip--approved { color: var(--accent); border-color: rgba(111,227,209,0.35); }
.chip--paid     { color: var(--accent); background: rgba(111,227,209,0.12); border-color: transparent; }
.chip--sent     { color: var(--accent); border-color: rgba(111,227,209,0.35); }
.chip--draft    { color: var(--dim); }
.chip--overdue  { color: var(--red); border-color: rgba(227,111,129,0.4); }

/* Filter chips */
.filters { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.filters button {
  background: none; border: 1px solid var(--border); color: var(--dim);
  font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 6px 14px; border-radius: 20px; white-space: nowrap;
}
.filters button.active { color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 700; }

/* ---------- Expense capture ---------- */
.pm-label { font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--dim); margin: 4px 0 10px; }
.pm-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.pm-chips button {
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  font-size: 13px; padding: 10px 16px; border-radius: 10px;
}
.pm-chips button.active { border-color: var(--accent); color: var(--accent); background: rgba(111,227,209,0.08); }

.shoot {
  width: 100%; aspect-ratio: 4/3; max-height: 46dvh;
  border: 1.5px dashed var(--border); border-radius: 16px;
  background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--dim); font-size: 14px;
}
.shoot svg { width: 40px; height: 40px; stroke: var(--accent); fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.shoot:active { border-color: var(--accent); }

.preview-wrap { position: relative; margin-bottom: 16px; }
.preview-wrap img { width: 100%; border-radius: 14px; border: 1px solid var(--border); display: block; max-height: 38dvh; object-fit: contain; background: #000; }
.scanning {
  position: absolute; inset: 0; border-radius: 14px;
  background: rgba(7,9,12,0.72); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--accent); font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: 0.15em; text-transform: uppercase;
}
.pulse { width: 46px; height: 3px; background: var(--accent); border-radius: 2px; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 0.25; transform: scaleX(0.5);} 50% { opacity: 1; transform: scaleX(1);} }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 16px; padding: 12px 14px; font-family: inherit;
  appearance: none; -webkit-appearance: none;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent-dark); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

/* ---------- Detail sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 90; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  background: var(--panel); border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  max-height: 88dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 10px 18px calc(var(--safe-bottom) + 20px);
}
.sheet .grab { width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 4px auto 16px; }
.sheet h2 { font-size: 17px; font-weight: 650; margin-bottom: 2px; }
.sheet .sheet-sub { font-family: ui-monospace, monospace; font-size: 11px; color: var(--dim); margin-bottom: 16px; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid rgba(26,37,53,0.5); font-size: 14px; }
.kv:last-of-type { border-bottom: none; }
.kv .k { color: var(--dim); }
.kv .v { font-family: ui-monospace, monospace; text-align: right; }
.sheet .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

/* ---------- P&L ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.stat .lbl { font-family: ui-monospace, monospace; font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); margin-bottom: 5px; }
.stat .val { font-family: ui-monospace, monospace; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .val.pos { color: var(--accent); }
.stat .val.neg { color: var(--red); }
.stat--wide { grid-column: 1 / -1; }

.bar-row { margin-bottom: 10px; }
.bar-row .bar-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.bar-row .bar-head .n { color: var(--muted); }
.bar-row .bar-head .a { font-family: ui-monospace, monospace; color: var(--text); }
.bar-track { height: 5px; background: rgba(26,37,53,0.7); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent-dark); border-radius: 3px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: calc(var(--safe-top) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--accent-dark); color: var(--text);
  font-size: 13px; padding: 10px 20px; border-radius: 30px; z-index: 200;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); white-space: nowrap;
}
.toast--err { border-color: rgba(227,111,129,0.5); color: var(--red); }

/* ---------- Notifications ---------- */
.notif-row { margin-top: 18px; text-align: center; }
.notif-row .btn { width: auto; }

/* ---------- Document viewer ---------- */
.doc-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: #000;
  display: flex; flex-direction: column;
}
.doc-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted);
}
.doc-bar a { color: var(--accent); text-decoration: none; margin-right: 14px; font-size: 12px; }
.doc-bar button { background: none; border: none; color: var(--text); font-size: 17px; padding: 4px 6px; }
.doc-body { flex: 1; width: 100%; border: none; background: #202225; }
.doc-body--img { overflow: auto; -webkit-overflow-scrolling: touch; display: flex; align-items: flex-start; justify-content: center; padding: 12px; }
.doc-body--img img { max-width: 100%; height: auto; border-radius: 6px; }

.empty { text-align: center; color: var(--faint); font-size: 13px; padding: 40px 0; }
.muted { color: var(--dim); }
.spin { text-align: center; color: var(--dim); font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: 0.15em; padding: 30px 0; text-transform: uppercase; }
