/* ═══════════════════════════════════════════════════════════
   EDITH — style.css
   Dark glassmorphism · Teal accent · Inter font
═══════════════════════════════════════════════════════════ */

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }
input  { font-family: inherit; }

/* ── DESIGN TOKENS ── */
:root {
  --bg:           #060b18;
  --bg-2:         #0b1221;
  --surface:      rgba(255,255,255,0.04);
  --surface-2:    rgba(255,255,255,0.07);
  --surface-3:    rgba(255,255,255,0.11);
  --border:       rgba(255,255,255,0.08);
  --border-2:     rgba(255,255,255,0.14);

  --accent:       #00d4b1;
  --accent-2:     #00f0cc;
  --accent-dim:   rgba(0,212,177,0.12);
  --accent-glow:  rgba(0,212,177,0.28);

  --indigo:       #6366f1;
  --amber:        #f59e0b;
  --green:        #10b981;
  --danger:       #f43f5e;
  --danger-dim:   rgba(244,63,94,0.12);
  --warning:      #f59e0b;

  --text:         #e2e8f0;
  --text-2:       #8892a4;
  --text-3:       #475569;

  --radius:       14px;
  --radius-sm:    8px;
  --radius-xs:    5px;
  --shadow:       0 4px 24px rgba(0,0,0,0.45);
  --shadow-lg:    0 12px 56px rgba(0,0,0,0.65);
  --header-h:     62px;
}

/* ── BASE ── */
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════════════
   SCREENS
══════════════════════════════════════════════════════ */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ══════════════════════════════════════════════════════
   ORB BACKGROUNDS (animated gradient blobs)
══════════════════════════════════════════════════════ */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(110px);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}
.orb-1 {
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(0,212,177,0.18) 0%, transparent 68%);
  top: -140px; left: -120px;
  animation: orbDrift 14s ease-in-out infinite;
}
.orb-2 {
  width: 440px; height: 440px;
  background: radial-gradient(circle, rgba(99,102,241,0.13) 0%, transparent 68%);
  bottom: -100px; right: -100px;
  animation: orbDrift 18s ease-in-out infinite reverse;
}
@keyframes orbDrift {
  0%,100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(24px,-16px) scale(1.06); }
  66%      { transform: translate(-12px,22px) scale(0.94); }
}

/* ══════════════════════════════════════════════════════
   LANDING SCREEN
══════════════════════════════════════════════════════ */
.landing-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 64px 24px 48px;
  gap: 52px;
  text-align: center;
}

/* Brand */
.brand-logo {
  font-size: 4rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--indigo) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  animation: fadeUp 0.7s ease both;
}
.brand-sub {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 14px;
  animation: fadeUp 0.7s 0.1s ease both;
}
.brand-desc {
  color: var(--text-3);
  font-size: 0.83rem;
  animation: fadeUp 0.7s 0.2s ease both;
}

/* Cards */
.landing-cards {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: center;
  animation: fadeUp 0.7s 0.25s ease both;
}

.landing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 44px 40px;
  width: 290px;
  text-align: center;
  backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.landing-card:hover {
  border-color: rgba(0,212,177,0.5);
  transform: translateY(-6px);
  box-shadow: 0 20px 48px rgba(0,212,177,0.1);
}
.card-icon { font-size: 2.8rem; line-height: 1; }
.landing-card h3 { font-size: 1.15rem; font-weight: 700; }
.landing-card p  { font-size: 0.83rem; color: var(--text-2); line-height: 1.65; }
.landing-card code {
  font-size: 0.78rem;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

.landing-divider {
  color: var(--text-3);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.landing-footnote {
  color: var(--text-3);
  font-size: 0.78rem;
  animation: fadeUp 0.7s 0.35s ease both;
}

/* ══════════════════════════════════════════════════════
   AUTH SCREENS (new password / decrypt)
══════════════════════════════════════════════════════ */
#screen-newpass,
#screen-decrypt {
  align-items: center;
  justify-content: center;
}
.auth-wrap {
  position: relative;
  z-index: 1;
  padding: 24px;
  width: 100%;
  display: flex;
  justify-content: center;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 44px;
  width: 448px;
  max-width: 100%;
  backdrop-filter: blur(28px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeUp 0.4s ease both;
  box-shadow: var(--shadow-lg);
}
.auth-icon { font-size: 2.6rem; text-align: center; }
.auth-card h2 { font-size: 1.4rem; font-weight: 700; text-align: center; }
.auth-desc {
  font-size: 0.84rem;
  color: var(--text-2);
  text-align: center;
  line-height: 1.65;
}
.auth-desc strong { color: var(--danger); font-weight: 600; }
.file-badge {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: monospace;
}

/* ══════════════════════════════════════════════════════
   FORM ELEMENTS
══════════════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.form-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.form-group input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.93rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  width: 100%;
  -moz-appearance: textfield;
}
.form-group input::-webkit-inner-spin-button,
.form-group input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--surface-3);
}
.form-group input::placeholder { color: var(--text-3); }
.form-group input[type="month"] { color-scheme: dark; }

.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper input { padding-right: 46px; }
.toggle-pw {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  font-size: 1rem;
  padding: 4px 6px;
  opacity: 0.45;
  transition: opacity 0.2s;
  line-height: 1;
}
.toggle-pw:hover { opacity: 1; }

/* Strength bar */
.strength-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.3s ease, background-color 0.3s ease;
}
.strength-label {
  font-size: 0.72rem;
  font-weight: 500;
  min-height: 1em;
}

.auth-error {
  color: var(--danger);
  font-size: 0.82rem;
  text-align: center;
  background: var(--danger-dim);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(244,63,94,0.2);
  animation: shake 0.35s ease;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

/* Back button */
.btn-back {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0;
  align-self: flex-start;
  transition: color 0.2s;
}
.btn-back:hover { color: var(--text); }

/* ══════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════ */
.btn-primary {
  background: var(--accent);
  color: #060b18;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.01em;
}
.btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }
.btn-primary.full   { width: 100%; padding: 13px; font-size: 0.95rem; }
.btn-primary:disabled { opacity: 0.5; pointer-events: none; }

.btn-outline {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, border-color 0.2s;
}
.btn-outline:hover { background: var(--surface-3); border-color: var(--accent); }
.btn-outline.full  { width: 100%; padding: 13px; }

/* ══════════════════════════════════════════════════════
   DASHBOARD — HEADER
══════════════════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  height: var(--header-h);
  background: rgba(6,11,24,0.88);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.header-brand {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--indigo) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}
.header-tabs { display: flex; gap: 2px; }
.tab-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.86rem;
  font-weight: 500;
  padding: 6px 16px;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab-btn:hover  { color: var(--text); background: var(--surface-2); }
.tab-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(0,212,177,0.22);
}
.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.unsaved-badge {
  font-size: 0.73rem;
  color: var(--warning);
  font-weight: 600;
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.45; } }

.btn-download {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0,212,177,0.28);
  border-radius: var(--radius-sm);
  padding: 6px 16px;
  font-size: 0.84rem;
  font-weight: 700;
  transition: all 0.2s;
}
.btn-download:hover  { background: var(--accent); color: #060b18; }
.btn-download:disabled { opacity: 0.5; pointer-events: none; }

.btn-lock {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.84rem;
  transition: all 0.2s;
}
.btn-lock:hover { background: var(--danger-dim); color: var(--danger); border-color: rgba(244,63,94,0.3); }

/* ══════════════════════════════════════════════════════
   DASHBOARD — MAIN AREA
══════════════════════════════════════════════════════ */
.dashboard-main {
  flex: 1;
  padding: 30px 28px 72px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}
.tab-pane { display: none; animation: fadeUp 0.3s ease; }
.tab-pane.active { display: block; }

.pane-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.pane-header h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.pane-desc { color: var(--text-2); font-size: 0.82rem; line-height: 1.6; max-width: 520px; }

/* FIRE config row */
.fire-config { display: flex; flex-direction: column; gap: 7px; align-items: flex-end; }
.fire-config label {
  font-size: 0.72rem;
  color: var(--text-2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.inr-input {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  transition: border-color 0.2s;
}
.inr-input:focus-within { border-color: var(--accent); }
.inr-input span { color: var(--text-2); font-size: 0.83rem; font-weight: 500; }
.inr-input input {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 700;
  width: 120px;
  outline: none;
  -moz-appearance: textfield;
}
.inr-input input::-webkit-inner-spin-button,
.inr-input input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* Stats cards row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  backdrop-filter: blur(14px);
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.stat-label {
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 8px;
}
.stat-value { font-size: 1.3rem; font-weight: 700; line-height: 1; margin-bottom: 5px; }
.stat-value.accent   { color: var(--accent); }
.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--danger); }
.stat-delta { font-size: 0.73rem; color: var(--text-3); }

/* FIRE corpus card */
.fire-corpus-card {
  background: linear-gradient(135deg, rgba(0,212,177,0.07), rgba(99,102,241,0.07));
  border: 1px solid rgba(0,212,177,0.18);
  border-radius: var(--radius);
  padding: 22px 28px;
  margin-bottom: 26px;
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
  align-items: center;
}
.fire-item { display: flex; flex-direction: column; gap: 5px; }
.fire-item-label {
  font-size: 0.69rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
}
.fire-item-value { font-size: 1.35rem; font-weight: 700; color: var(--accent); }
.fire-item-sub   { font-size: 0.82rem; color: var(--text-3); }

/* Bucket legend */
.bucket-legend {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-2); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.b1 { background: var(--amber); }
.dot.b2 { background: var(--indigo); }
.dot.b3 { background: var(--accent); }
.dot.b4 { background: var(--green); }

/* ══════════════════════════════════════════════════════
   DATA TABLES
══════════════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(14px);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}
.data-table thead th {
  padding: 13px 18px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: rgba(255,255,255,0.018);
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover      { background: var(--surface-2); }
.data-table tbody td { padding: 13px 18px; white-space: nowrap; }

/* Cell variants */
.td-date     { color: var(--accent); font-weight: 700; }
.td-total    { font-weight: 700; }
.td-positive { color: var(--green);  font-weight: 600; }
.td-negative { color: var(--danger); font-weight: 600; }
.td-muted    { color: var(--text-2); }
.td-empty    { text-align: center; color: var(--text-3); padding: 56px 18px !important; font-style: italic; }

/* Allocation bar */
.alloc-bar {
  display: flex;
  height: 8px;
  border-radius: 6px;
  overflow: hidden;
  gap: 2px;
  min-width: 150px;
}
.alloc-seg  { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.seg-b1     { background: var(--amber); }
.seg-b2     { background: var(--indigo); }
.seg-b3     { background: var(--accent); }
.seg-b4     { background: var(--green); }

/* Action buttons in table */
.btn-icon {
  background: none;
  border: none;
  font-size: 0.95rem;
  padding: 5px 7px;
  border-radius: 6px;
  transition: background 0.2s, transform 0.15s;
  line-height: 1;
}
.btn-icon.edit   { color: var(--text-2); }
.btn-icon.edit:hover   { background: var(--surface-3); color: var(--accent); }
.btn-icon.delete { color: var(--text-3); }
.btn-icon.delete:hover {
  background: var(--danger-dim);
  color: var(--danger);
  transform: scale(1.15);
}

/* ══════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════ */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-card {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  width: 560px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s ease both;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(14px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }

.modal-body { padding: 26px; display: flex; flex-direction: column; gap: 22px; }

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.modal-grid .span-2 { grid-column: 1 / -1; }
.separator-top { padding-top: 10px; border-top: 1px solid var(--border); }

.modal-total-preview {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.83rem;
  color: var(--text-2);
  text-align: center;
}
.modal-total-preview strong { color: var(--accent); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

/* ══════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 26px;
  right: 26px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.84rem;
  font-weight: 500;
  z-index: 300;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  animation: toastIn 0.28s ease;
  max-width: 320px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast.success { border-color: rgba(16,185,129,0.45); color: var(--green); }
.toast.error   { border-color: rgba(244,63,94,0.45);  color: var(--danger); }
.toast.info    { border-color: rgba(0,212,177,0.35);  color: var(--accent); }

/* ══════════════════════════════════════════════════════
   UTILITIES & ANIMATIONS
══════════════════════════════════════════════════════ */
.hidden { display: none !important; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
