/* ===== RESET & VARIABLES ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #111111;
  --bg-card:     #1A1A1A;
  --bg-card2:    #222222;
  --bg-input:    #1E1E1E;
  --accent:      #C7FE23;
  --accent-dim:  #9ec91a;
  --text:        #FFFFFF;
  --text-2:      #AAAAAA;
  --text-3:      #555555;
  --positive:    #C7FE23;
  --negative:    #FF4646;
  --border:      #272727;
  --nav-w:       220px;
  --nav-h:       72px;
  --radius:      16px;
  --radius-sm:   10px;
  --radius-xs:   6px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; font-size: 15px; line-height: 1.5; overflow: hidden; }

/* ===== APP SHELL ===== */
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ===== NAV (mobile = bottom bar) ===== */
#nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: #161616;
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 0 8px;
  gap: 4px;
}

.nav-logo { display: none; }
.nav-footer { display: none; }

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 10px 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  transition: color .15s;
}
.nav-btn svg { width: 22px; height: 22px; stroke: currentColor; }
.nav-btn.active { color: var(--accent); }
.nav-btn:hover { color: var(--text-2); }
.nav-btn.active:hover { color: var(--accent); }

/* ===== MAIN ===== */
#main {
  flex: 1;
  overflow-y: auto;
  padding-bottom: var(--nav-h);
}

/* ===== VIEWS ===== */
.view { display: none; padding: 20px 16px; min-height: 100%; }
.view.active { display: block; }

.view-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.view-top h1 {
  flex: 1;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  outline: none;
}
.view-top h1[contenteditable="true"] {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}

/* ===== DESKTOP LAYOUT ===== */
@media (min-width: 900px) {
  #app { flex-direction: row; }

  #nav {
    position: static;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    width: var(--nav-w);
    min-width: var(--nav-w);
    height: 100vh;
    border-top: none;
    border-right: 1px solid var(--border);
    padding: 28px 12px 20px;
    gap: 4px;
    overflow: hidden;
  }

  .nav-logo {
    display: block;
    padding: 4px 12px 24px;
  }
  .logo-text {
    font-family: 'PT Mono', monospace;
    font-weight: 700;
    font-size: 26px;
    color: var(--accent);
    letter-spacing: -1px;
  }

  .nav-btn {
    flex-direction: row;
    justify-content: flex-start;
    flex: none;
    padding: 12px 14px;
    font-size: 14px;
    gap: 12px;
    color: var(--text-2);
  }
  .nav-btn svg { width: 18px; height: 18px; }

  .nav-footer {
    display: flex;
    flex-direction: column;
    margin-top: auto;
    gap: 12px;
    padding: 0 4px;
  }

  #main { padding-bottom: 0; }
  .view { padding: 32px 40px; max-width: 860px; }
}

/* ===== BUTTONS ===== */
.btn-accent {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #000;
  border: none; border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: 13px; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: opacity .15s;
  white-space: nowrap;
}
.btn-accent:hover { opacity: .85; }
.btn-accent svg { width: 14px; height: 14px; stroke: #000; }

.btn-accent-sm {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent); color: #000;
  border: none; border-radius: var(--radius-xs);
  padding: 6px 12px; font-size: 12px; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: opacity .15s;
}
.btn-accent-sm:hover { opacity: .85; }
.btn-accent-sm svg { width: 12px; height: 12px; stroke: #000; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer; transition: background .15s;
}
.btn-secondary:hover { background: #2a2a2a; }

.btn-danger {
  display: inline-flex; align-items: center;
  background: transparent; color: var(--negative);
  border: 1px solid var(--negative); border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: background .15s;
}
.btn-danger:hover { background: rgba(255,70,70,.08); }

.btn-back {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex-shrink: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text);
  transition: background .15s;
}
.btn-back:hover { background: var(--bg-card2); }
.btn-back svg { width: 18px; height: 18px; }

.btn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; background: none;
  border: none; cursor: pointer; color: var(--text-2);
  border-radius: var(--radius-xs); transition: color .15s;
}
.btn-icon:hover { color: var(--text); }
.btn-icon svg { width: 16px; height: 16px; }

.full-w { width: 100%; justify-content: center; }

/* ===== PORTFOLIO CARDS ===== */
#portfolios-list { display: flex; flex-direction: column; gap: 14px; }

.portfolio-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color .2s, transform .15s;
}
.portfolio-card:hover { border-color: #3a3a3a; transform: translateY(-1px); }

.portfolio-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.portfolio-card-name { font-size: 17px; font-weight: 700; }
.portfolio-card-date { font-size: 12px; color: var(--text-3); }

.portfolio-card-values { display: flex; gap: 24px; margin-bottom: 16px; }
.portfolio-val-block { display: flex; flex-direction: column; gap: 2px; }
.portfolio-val-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; }
.portfolio-val-amount { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.portfolio-val-change { font-size: 14px; font-weight: 600; }

.portfolio-card-tickers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ticker-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card2);
  border-radius: 30px;
  padding: 4px 10px 4px 4px;
  font-size: 12px;
  font-weight: 600;
}
.ticker-chip img {
  width: 20px; height: 20px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card2);
}

/* ===== PORTFOLIO SUMMARY ===== */
.portfolio-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.summary-card.accent { border-color: var(--accent); background: rgba(199,254,35,.04); }
.summary-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.summary-value { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.summary-sub { font-size: 13px; font-weight: 600; margin-top: 2px; }

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; }

/* ===== HOLDINGS LIST ===== */
#holdings-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }

.holding-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color .15s;
}
.holding-card:hover { border-color: #3a3a3a; }

.holding-logo {
  width: 42px; height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card2);
  flex-shrink: 0;
}
.holding-logo-placeholder {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--text-3);
  flex-shrink: 0;
}

.holding-info { flex: 1; min-width: 0; }
.holding-ticker { font-size: 15px; font-weight: 700; }
.holding-name { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.holding-shares { font-size: 11px; color: var(--text-3); margin-top: 1px; }

.holding-values { text-align: right; flex-shrink: 0; }
.holding-current { font-size: 15px; font-weight: 700; }
.holding-pnl { font-size: 12px; font-weight: 600; margin-top: 2px; }
.holding-pct { font-size: 11px; color: var(--text-3); }

.holding-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.holding-action-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); cursor: pointer; color: var(--text-2);
  transition: color .15s, border-color .15s;
}
.holding-action-btn:hover { color: var(--text); border-color: #444; }
.holding-action-btn svg { width: 13px; height: 13px; }

/* ===== POSITIVE / NEGATIVE ===== */
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.neutral { color: var(--text-2); }

/* ===== DANGER ZONE ===== */
.danger-zone {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ===== STOCK DETAIL ===== */
.stock-logo-header { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--bg-card2); }

#stock-detail-content { display: flex; flex-direction: column; gap: 16px; }

.stock-price-block {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 4px;
}
.stock-price { font-size: 36px; font-weight: 700; letter-spacing: -1px; }
.stock-change-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 14px; font-weight: 700;
  margin-bottom: 4px;
}
.stock-change-badge.positive { background: rgba(199,254,35,.12); color: var(--positive); }
.stock-change-badge.negative { background: rgba(255,70,70,.12); color: var(--negative); }

.stock-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.stat-label { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.stat-value { font-size: 14px; font-weight: 600; }

/* ===== CHART ===== */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.chart-period-selector {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.period-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.period-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }
.period-btn:hover:not(.active) { border-color: #444; color: var(--text); }

.chart-container { position: relative; height: 200px; }

/* ===== HOLDING POSITION CARD (in stock detail) ===== */
.position-card {
  background: rgba(199,254,35,.04);
  border: 1px solid rgba(199,254,35,.2);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.position-card-title { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.position-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.pos-item-label { font-size: 11px; color: var(--text-3); }
.pos-item-value { font-size: 14px; font-weight: 600; }

.stock-actions { display: flex; gap: 10px; }
.stock-actions button { flex: 1; }

/* ===== SEARCH ===== */
.search-wrap {
  position: relative;
  margin-bottom: 20px;
}
.search-wrap .search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--text-3);
}
#search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
#search-input:focus { border-color: var(--accent); }
#search-input::placeholder { color: var(--text-3); }

#search-results { display: flex; flex-direction: column; gap: 8px; }

.search-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s;
}
.search-item:hover { border-color: #3a3a3a; }

.search-item-logo {
  width: 40px; height: 40px;
  border-radius: 50%; object-fit: cover;
  background: var(--bg-card2); flex-shrink: 0;
}
.search-item-logo-placeholder {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--text-3);
  flex-shrink: 0;
}
.search-item-info { flex: 1; min-width: 0; }
.search-item-ticker { font-size: 14px; font-weight: 700; }
.search-item-name { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search-item-price { text-align: right; flex-shrink: 0; }
.search-item-price-val { font-size: 14px; font-weight: 700; }
.search-item-change { font-size: 12px; font-weight: 600; }

.search-item-add {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); border: none; border-radius: 50%;
  cursor: pointer; flex-shrink: 0; transition: opacity .15s;
}
.search-item-add:hover { opacity: .8; }
.search-item-add svg { width: 14px; height: 14px; stroke: #000; stroke-width: 2.5; }

/* ===== SETTINGS ===== */
.settings-content { display: flex; flex-direction: column; gap: 16px; }

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-card h2 { font-size: 16px; font-weight: 700; }
.settings-card.danger { border-color: rgba(255,70,70,.2); }

.settings-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.settings-desc strong { color: var(--text); }

.settings-label { font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

.settings-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: 'PT Mono', monospace;
  outline: none;
  transition: border-color .15s;
}
.settings-input:focus { border-color: var(--accent); }

.settings-status {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  font-weight: 500;
}
.settings-status.ok { background: rgba(199,254,35,.1); color: var(--accent); }
.settings-status.err { background: rgba(255,70,70,.1); color: var(--negative); }

/* ===== MARKET STATUS ===== */
.market-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  padding: 6px 8px;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}
.status-dot.open { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.status-dot.closed { background: var(--text-3); }

.refresh-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-2);
  transition: color .15s, border-color .15s;
}
.refresh-btn:hover { color: var(--accent); border-color: var(--accent); }
.refresh-btn svg { width: 16px; height: 16px; }
.refresh-btn.spinning svg { animation: spin .7s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== MODALS ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal.hidden { display: none; }

@media (min-width: 600px) {
  .modal { align-items: center; }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  z-index: 1;
  background: #1A1A1A;
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 600px) {
  .modal-box { border-radius: var(--radius); max-width: 480px; }
  .modal-box.wide { max-width: 560px; }
}

.modal-box h2 { font-size: 18px; font-weight: 700; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.modal-input:focus { border-color: var(--accent); }
.modal-input:read-only { opacity: .6; cursor: not-allowed; }

.modal-actions { display: flex; gap: 10px; }
.modal-actions > * { flex: 1; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* Op type selector */
.op-type-selector { display: flex; gap: 8px; }
.op-type-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.op-type-btn.active.buy { background: rgba(199,254,35,.12); border-color: var(--accent); color: var(--accent); }
.op-type-btn.active.sell { background: rgba(255,70,70,.12); border-color: var(--negative); color: var(--negative); }

.op-total {
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  padding: 12px;
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  min-height: 46px;
}

/* Operations list */
.op-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.op-row:last-child { border-bottom: none; }
.op-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}
.op-badge.buy { background: rgba(199,254,35,.12); color: var(--accent); }
.op-badge.sell { background: rgba(255,70,70,.12); color: var(--negative); }
.op-info { flex: 1; }
.op-date { font-size: 12px; color: var(--text-3); }
.op-details { font-size: 14px; font-weight: 600; }
.op-total-val { text-align: right; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.op-delete {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  cursor: pointer; color: var(--text-3);
  border-radius: var(--radius-xs); transition: color .15s;
}
.op-delete:hover { color: var(--negative); }
.op-delete svg { width: 13px; height: 13px; }

/* Pick portfolio list */
#pick-portfolio-list { display: flex; flex-direction: column; gap: 8px; }
.pick-portfolio-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s;
}
.pick-portfolio-item:hover { border-color: var(--accent); }
.pick-portfolio-item-name { font-size: 15px; font-weight: 600; }
.pick-portfolio-item-count { font-size: 12px; color: var(--text-3); }

/* ===== EMPTY STATES ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-2);
}
.empty-icon {
  width: 64px; height: 64px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.empty-icon svg { width: 28px; height: 28px; }
.empty-state p { font-size: 15px; font-weight: 500; }

.empty-state-sm {
  padding: 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}
.hidden { display: none !important; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: var(--text);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  z-index: 999;
  white-space: nowrap;
  animation: fadeInOut 2.5s ease forwards;
}
@media (min-width: 900px) {
  .toast { bottom: 24px; }
}
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(8px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-2);
  font-size: 14px;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ===== AUTH OVERLAY ===== */
.auth-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.auth-box {
  width: 100%; max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  display: flex; flex-direction: column; gap: 16px;
}

.auth-logo {
  font-family: 'PT Mono', monospace;
  font-weight: 700; font-size: 32px;
  color: var(--accent); letter-spacing: -1px;
  text-align: center; margin-bottom: 4px;
}

.auth-tabs {
  display: flex; gap: 0;
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.auth-tab {
  flex: 1; padding: 9px;
  background: none; border: none;
  color: var(--text-2); font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  border-radius: calc(var(--radius-sm) - 2px);
  transition: all .15s;
}
.auth-tab.active { background: var(--bg-card); color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 10px; }

.auth-error {
  font-size: 13px; color: var(--negative);
  background: rgba(255,70,70,.08);
  border-radius: var(--radius-xs); padding: 8px 12px;
}

.auth-footer {
  font-size: 12px; color: var(--text-3);
  text-align: center; margin-top: 4px;
}

/* ===== USER EMAIL (nav footer) ===== */
.user-email {
  font-size: 11px; color: var(--text-3);
  padding: 4px 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 180px;
}

/* ===== SEARCH MANUAL SECTION ===== */
.search-manual-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== MISC ===== */
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.4); cursor: pointer; }
