/* ============================================================
   CT-DESIGN.CSS  —  CTEngine Operator Dashboard Design System
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg0: #07101c;     /* sidebar, topbar */
  --bg1: #0a1320;     /* page background */
  --bg2: #0f1923;     /* cards */
  --bg3: #132030;     /* input backgrounds */
  --border: #1a2d42;
  --border-hi: #2a4a6a;
  --text: #f1f5f9;
  --text-2: #e2e8f0;
  --text-3: #c8d9ea;
  --muted: #6b8daa;
  --dim: #4a6b8a;
  --accent: #38bdf8;
  --accent-bg: rgba(56,189,248,.12);
  --accent-border: rgba(56,189,248,.25);
  --green: #4ade80;
  --green-bg: rgba(74,222,128,.09);
  --red: #f87171;
  --red-bg: rgba(248,113,113,.09);
  --orange: #fb923c;
  --radius-card: 10px;
  --radius-btn: 7px;
}

/* ── 1. Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg1);
  color: var(--text-2);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  display: flex;
  height: 100vh;
  overflow: hidden;
}
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 2. Sidebar Layout ──────────────────────────────────────── */
.sidebar {
  width: 216px;
  background: var(--bg0);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width .22s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  position: relative;
  z-index: 50;
}
.sidebar.collapsed { width: 52px; }
.sidebar.collapsed .co-name,
.sidebar.collapsed .co-meta,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .logo-sub,
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .sidebar-add-text { display: none; }
.sidebar.collapsed .sidebar-add { padding: 8px; justify-content: center; }
.sidebar.collapsed .company-item { padding: 8px; justify-content: center; }

.sidebar-logo {
  padding: 15px 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-icon {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: #0a1320; flex-shrink: 0;
}
.logo-text { font-weight: 700; font-size: 14px; color: var(--text); white-space: nowrap; }
.logo-sub { font-size: 9px; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }

.sidebar-toggle {
  position: absolute; top: 50%; right: -11px;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  background: #0d1f30; border: 1px solid var(--border); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 10px; color: var(--dim);
  transition: color .15s, background .15s; z-index: 10;
}
.sidebar-toggle:hover { color: var(--accent); background: var(--bg3); }

.sidebar-section {
  padding: 11px 12px 4px;
  font-size: 9px; color: var(--dim);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}
.company-list {
  padding: 0 6px; flex: 1;
  overflow-y: auto; overflow-x: hidden;
}
.company-item {
  padding: 8px; border-radius: 7px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 2px;
  transition: background .15s;
  border: 1px solid transparent;
  min-width: 0;
  text-decoration: none; color: inherit;
}
.company-item:hover { background: rgba(56,189,248,.07); text-decoration: none; }
.company-item.active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}
.co-av {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0; overflow: hidden;
}
.co-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.co-name { font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.co-meta { font-size: 9px; color: var(--dim); margin-top: 1px; white-space: nowrap; }

.sidebar-add {
  margin: 8px 6px;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px dashed #1e3550;
  color: var(--dim);
  display: flex; align-items: center; gap: 7px;
  cursor: pointer; font-size: 11px;
  transition: all .15s; flex-shrink: 0;
  text-decoration: none;
}
.sidebar-add:hover { border-color: var(--accent); color: var(--accent); background: rgba(56,189,248,.05); text-decoration: none; }
.sidebar-add-icon { font-size: 14px; flex-shrink: 0; }

/* ── 3. Main Area ───────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: var(--bg0); flex-shrink: 0; min-width: 0;
}
.tb-co { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-av {
  width: 30px; height: 30px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; overflow: hidden;
}
.tb-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; }
.tb-title { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-nip { font-size: 10px; color: var(--dim); }
.mobile-menu-btn { display: none; padding: 6px; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; }

.content { flex: 1; overflow-y: auto; padding: 18px 20px 30px; background: var(--bg1); }

/* ── 4. Period Filter ───────────────────────────────────────── */
.pf {
  display: flex; align-items: center; gap: 2px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px; position: relative; flex-shrink: 0;
}
.pb {
  padding: 4px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 500; cursor: pointer;
  color: var(--muted); transition: all .15s;
  border: none; background: transparent; white-space: nowrap;
}
.pb:hover { color: #94b8d0; }
.pb.active { background: var(--accent-bg); color: var(--accent); }
.pd {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: #0d1f30; border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; width: 290px;
  z-index: 200; box-shadow: 0 8px 32px rgba(0,0,0,.6); display: none;
}
.pd.open { display: block; }
.pd-title { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 9px; font-weight: 600; }
.pd-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 11px; }
.pd-qb {
  padding: 5px 10px; border-radius: 6px; font-size: 11px;
  border: 1px solid var(--border); background: var(--bg3); color: #8fb3cc;
  cursor: pointer; transition: all .15s;
}
.pd-qb:hover, .pd-qb.sel { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.pd-sep { height: 1px; background: var(--border); margin: 10px 0; }
.pd-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.pd-fl label { font-size: 9px; color: var(--dim); display: block; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.pd-fl input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font-size: 12px; color: var(--text-2); outline: none; font-family: monospace;
}
.pd-fl input:focus { border-color: var(--accent); }
.pd-apply {
  width: 100%; padding: 7px;
  background: var(--accent-bg); border: 1px solid rgba(56,189,248,.3);
  border-radius: 6px; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer;
}
.pd-apply:hover { background: rgba(56,189,248,.25); }

/* ── 5. Tabs ────────────────────────────────────────────────── */
.tabs {
  padding: 0 20px; border-bottom: 1px solid var(--border);
  display: flex; background: var(--bg0); flex-shrink: 0; overflow-x: auto;
}
.tab {
  padding: 11px 16px; font-size: 12px; font-weight: 500; color: var(--dim);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .15s; user-select: none; white-space: nowrap;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover:not(.active) { color: #8fb3cc; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Tab entrance animation */
@keyframes ctFadeSlide {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
.ct-entering { animation: ctFadeSlide .2s ease forwards; }

/* ── 6. Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 16px 18px;
}
.card-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.card-sub { font-size: 10px; color: var(--dim); }

/* ── 7. KPI Row ─────────────────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 11px; margin-bottom: 16px; }
.kpi { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 13px 14px; }
.kpi.hl { border-color: var(--accent-border); }
.kpi-lbl { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.kpi-val { font-size: 18px; font-weight: 700; color: var(--text); font-family: 'Consolas', monospace; line-height: 1.1; }
.kpi.hl .kpi-val { color: var(--accent); }
.kpi-eur { font-size: 10px; color: var(--dim); margin-top: 2px; }
.kpi-d { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; margin-top: 4px; padding: 2px 6px; border-radius: 4px; }
.kpi-d.up { color: var(--green); background: var(--green-bg); }
.kpi-d.dn { color: var(--red); background: var(--red-bg); }
.kpi-d.neu { color: #94a3b8; background: rgba(148,163,184,.09); }

/* ── 8. Main Chart ──────────────────────────────────────────── */
.chart-full {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 16px 18px; margin-bottom: 16px;
}
.ch-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.ch-title { font-size: 14px; font-weight: 600; color: var(--text-2); }
.ch-toggle {
  display: flex; gap: 3px; background: var(--bg1);
  border: 1px solid var(--border); border-radius: 6px; padding: 3px;
}
.ch-tog {
  padding: 4px 11px; border-radius: 4px; font-size: 11px; font-weight: 500;
  border: none; background: transparent; color: var(--dim); cursor: pointer; transition: all .15s;
}
.ch-tog.active { background: var(--accent-bg); color: var(--accent); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.leg { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted); }
.leg-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.type-btns { display: flex; gap: 3px; }
.type-btn {
  padding: 3px 9px; border-radius: 4px; font-size: 10px;
  cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--dim); transition: all .15s;
}
.type-btn.active { background: var(--accent-bg); border-color: rgba(56,189,248,.3); color: var(--accent); }

/* ── 9. GL + Invoices Row ───────────────────────────────────── */
.gl-inv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.gl-head { display: flex; align-items: center; padding: 0 0 7px; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.gl-trow { display: flex; align-items: center; padding: 7px 0; border-bottom: 1px solid rgba(26,45,66,.4); }
.gl-trow:last-child { border-bottom: none; }
.gl-code { width: 44px; font-size: 10px; color: var(--dim); font-family: monospace; flex-shrink: 0; }
.gl-name { flex: 1; font-size: 11px; color: var(--text-3); }
.gl-debit { width: 86px; text-align: right; font-size: 11px; font-family: monospace; color: var(--red); flex-shrink: 0; }
.gl-credit { width: 86px; text-align: right; font-size: 11px; font-family: monospace; color: var(--green); flex-shrink: 0; }

.inv-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.inv-stat { background: var(--bg1); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; }
.inv-stat-lbl { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .4px; }
.inv-stat-val { font-size: 16px; font-weight: 700; font-family: monospace; margin-top: 3px; }
.inv-stat-eur { font-size: 9px; color: var(--dim); margin-top: 1px; }
.trow { display: flex; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(26,45,66,.45); }
.trow:last-child { border-bottom: none; }
.c-date { width: 56px; font-size: 10px; color: var(--muted); flex-shrink: 0; }
.c-desc { flex: 1; font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.c-amt { width: 90px; text-align: right; font-size: 11px; font-family: monospace; font-weight: 600; flex-shrink: 0; }
.income { color: var(--green); }
.expense { color: var(--red); }
.c-st { width: 42px; text-align: right; flex-shrink: 0; }

/* ── 10. Assets by Coin ─────────────────────────────────────── */
.assets-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 18px; }
.assets-layout { display: grid; grid-template-columns: 150px 1fr; gap: 20px; align-items: start; }
.donut-wrap { position: relative; width: 130px; height: 130px; flex-shrink: 0; margin: 0 auto; }
.donut-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; }
.donut-total { font-size: 14px; font-weight: 700; color: var(--text); font-family: monospace; }
.donut-lbl { font-size: 8px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }
.asset-table { width: 100%; }
.al-head { display: flex; padding: 0 0 6px; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.al-head span { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .4px; }
.al-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(26,45,66,.5); transition: background .15s; border-radius: 4px; }
.al-row:last-child { border-bottom: none; }
.al-row--active { background: rgba(56,189,248,.06); font-weight: 600; }
.al-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.al-ticker { font-size: 11px; font-weight: 600; color: var(--text-2); width: 40px; flex-shrink: 0; }
.al-name { flex: 1; font-size: 11px; color: #8fb3cc; }
.al-bar-wrap { width: 100px; height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.al-bar { height: 100%; border-radius: 2px; opacity: .75; }
.al-amount { width: 70px; text-align: right; font-size: 11px; color: var(--text-3); font-family: monospace; flex-shrink: 0; }
.al-pln { width: 110px; text-align: right; font-size: 10px; color: var(--muted); flex-shrink: 0; }
.al-eur { width: 90px; text-align: right; font-size: 10px; color: var(--dim); flex-shrink: 0; }

/* ── 11. Badges ─────────────────────────────────────────────── */
.badge { padding: 2px 7px; border-radius: 8px; font-size: 10px; font-weight: 600; display: inline-block; }
.bg-blue  { background: var(--accent-bg); color: var(--accent); }
.bg-green { background: var(--green-bg); color: var(--green); }
.bg-orange{ background: rgba(251,146,60,.1); color: var(--orange); }
.bg-red   { background: var(--red-bg); color: var(--red); }

/* Backward-compatible badge aliases */
.badge-done          { background: var(--green-bg); color: var(--green); }
.badge-failed        { background: var(--red-bg); color: var(--red); }
.badge-running       { background: var(--accent-bg); color: var(--accent); }
.badge-queued        { background: rgba(148,163,184,.08); color: #94a3b8; }
.badge-manual_review { background: rgba(251,146,60,.1); color: var(--orange); }
.badge-pending       { background: rgba(148,163,184,.08); color: #94a3b8; }
.badge-warning       { background: rgba(251,146,60,.1); color: var(--orange); }
.badge-info          { background: var(--accent-bg); color: var(--accent); }
.badge-error         { background: var(--red-bg); color: var(--red); }

/* Pulse animation for running state */
@keyframes ctPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
.badge-running, .pulse { animation: ctPulse 1.6s ease-in-out infinite; }

/* ── 12. Buttons ────────────────────────────────────────────── */
.btn {
  padding: 6px 14px; border-radius: var(--radius-btn);
  font-size: 11px; font-weight: 600; cursor: pointer;
  border: none; transition: all .15s; display: inline-block; text-align: center;
}
.btn-p, .btn-primary {
  background: var(--accent-bg); border: 1px solid rgba(56,189,248,.3); color: var(--accent);
}
.btn-p:hover, .btn-primary:hover { background: rgba(56,189,248,.25); }
.btn-g, .btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
}
.btn-g:hover, .btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-d, .btn-danger {
  background: var(--red-bg); border: 1px solid rgba(248,113,113,.2); color: var(--red);
}
.btn-d:hover, .btn-danger:hover { background: rgba(248,113,113,.2); }
.btn-sm { padding: 3px 8px; font-size: 10px; border-radius: 5px; }
.btn-primary { text-decoration: none; }
.btn-primary:hover { text-decoration: none; }

/* ── 13. Forms ──────────────────────────────────────────────── */
/* Keep old class names intact */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; font-weight: 600; }
.form-input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 12px; font-size: 12px; color: var(--text-2);
  outline: none; transition: border-color .15s; font-family: 'Consolas', monospace;
}
.form-input:focus { border-color: var(--accent); }
.form-hint { font-size: 10px; color: var(--dim); margin-top: 3px; display: block; }
textarea.form-input { resize: vertical; }
select.form-input { cursor: pointer; }
.row { display: flex; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-3 { margin-bottom: 16px; }
.text-dim { color: var(--dim); }
.mono { font-family: 'Consolas', monospace; }

/* ── 14. Tables ─────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th {
  text-align: left; padding: 7px 10px;
  font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border); font-weight: 600;
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid rgba(26,45,66,.4); color: var(--text-3); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(56,189,248,.03); }

/* ── 15. Stage Cards (Jobs) ─────────────────────────────────── */
.stages-bar {
  display: flex; gap: 5px; padding: 12px 14px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-card); margin-bottom: 14px; overflow-x: auto;
}
.stg { flex: 1; min-width: 80px; background: var(--bg1); border: 1px solid rgba(74,222,128,.2); border-radius: 7px; padding: 9px; }
.stg.fail  { border-color: rgba(248,113,113,.2); }
.stg.pend  { border-color: var(--border); }
.stg.running { border-color: rgba(56,189,248,.3); }
.stg-name { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .4px; }
.stg-st   { font-size: 11px; font-weight: 600; margin-top: 4px; }
.stg-rows { font-size: 10px; color: var(--dim); margin-top: 2px; }

/* Job table */
.job-table { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; margin-bottom: 16px; }
.jrow { display: flex; align-items: center; padding: 9px 14px; border-bottom: 1px solid rgba(26,45,66,.5); gap: 10px; }
.jrow:last-child { border-bottom: none; }
.jrow.head { background: rgba(26,45,66,.4); padding: 6px 14px; }
.jrow.head span { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.j-id  { width: 52px; font-family: monospace; font-size: 11px; color: var(--dim); flex-shrink: 0; }
.j-per { width: 68px; font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.j-st  { width: 86px; flex-shrink: 0; }
.j-cre { flex: 1; font-size: 10px; color: var(--muted); }
.j-stg { display: flex; gap: 3px; flex-shrink: 0; }
.j-act { display: flex; gap: 4px; flex-shrink: 0; }
.sd { width: 19px; height: 19px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 7px; font-weight: 700; }
.sd-ok   { background: rgba(74,222,128,.14); color: var(--green); }
.sd-fail { background: rgba(248,113,113,.14); color: var(--red); }
.sd-pend { background: rgba(148,163,184,.07); color: var(--dim); }

.issue-list { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.irow { display: flex; align-items: flex-start; gap: 10px; padding: 9px 14px; border-bottom: 1px solid rgba(26,45,66,.4); }
.irow:last-child { border-bottom: none; }
.i-sev  { width: 60px; flex-shrink: 0; }
.i-code { width: 108px; font-size: 10px; font-family: monospace; color: var(--muted); flex-shrink: 0; }
.i-msg  { flex: 1; font-size: 11px; color: var(--text-3); line-height: 1.4; }

/* ── 16. Settings ───────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sc { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 18px; }
.sc-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.field { margin-bottom: 13px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; display: block; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg1); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 12px; font-size: 12px; color: var(--text-2);
  outline: none; transition: border-color .15s; font-family: 'Consolas', monospace;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field .hint { font-size: 10px; color: var(--dim); margin-top: 3px; }
.field-row { display: flex; gap: 8px; align-items: flex-end; }
.field-row .field { flex: 1; margin-bottom: 0; }
.status-line { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--bg1); border: 1px solid var(--border); border-radius: 7px; margin-bottom: 13px; }
.sdot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sdot.ok { background: var(--green); box-shadow: 0 0 5px var(--green); }
.sdot.warn { background: var(--orange); }
.sdot.err  { background: var(--red); }
.st-text { font-size: 11px; color: #8fb3cc; }
.divider { height: 1px; background: var(--border); margin: 13px 0; }

/* Logo upload */
.logo-upload-area { display: flex; align-items: center; gap: 16px; padding: 14px; background: var(--bg1); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 13px; }
.logo-preview {
  width: 56px; height: 56px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
  flex-shrink: 0; overflow: hidden; border: 2px solid var(--border);
  transition: border-color .15s; cursor: pointer; position: relative;
}
.logo-preview:hover { border-color: var(--accent); }
.logo-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.logo-input { display: none; }

/* ── 17. Mobile Overlay ─────────────────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }

/* ── 18. Miscellaneous Utility Classes ──────────────────────── */
.text-success { color: var(--green); }
.text-danger  { color: var(--red); }
.text-warning { color: var(--orange); }
.text-muted   { color: var(--muted); }
.small        { font-size: 10px; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-1        { gap: 4px; }
.w-100        { width: 100%; }
.me-1         { margin-right: 4px; }
.ms-1         { margin-left: 4px; }
.ms-auto      { margin-left: auto; }
/* Old .page wrapper — harmless passthrough */
.page         { flex: 1; overflow-y: auto; padding: 18px 20px 30px; }

/* ── 19. Responsive Breakpoints ─────────────────────────────── */
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .assets-layout { grid-template-columns: 1fr; }
  .donut-wrap { margin-bottom: 12px; }
}
@media (max-width: 900px) {
  .sidebar { width: 52px; }
  .sidebar .co-name, .sidebar .co-meta, .sidebar .logo-text, .sidebar .logo-sub,
  .sidebar .sidebar-section, .sidebar .sidebar-add-text { display: none; }
  .sidebar .sidebar-add { padding: 8px; justify-content: center; }
  .sidebar .company-item { padding: 8px; justify-content: center; }
  .sidebar-toggle { display: none; }
  .sidebar.expanded { width: 216px !important; }
  .sidebar.expanded .co-name, .sidebar.expanded .co-meta,
  .sidebar.expanded .logo-text, .sidebar.expanded .logo-sub,
  .sidebar.expanded .sidebar-section, .sidebar.expanded .sidebar-add-text { display: block; }
  .sidebar.expanded .sidebar-add { padding: 8px 10px; justify-content: flex-start; }
  .sidebar.expanded .company-item { padding: 8px; justify-content: flex-start; }
  .gl-inv-row { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; width: 52px; }
  .sidebar.expanded { width: 220px; box-shadow: 4px 0 20px rgba(0,0,0,.5); }
  .main { margin-left: 52px; }
  .mobile-menu-btn { display: flex; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .tb-title { font-size: 13px; }
  .pf { display: none; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .chart-full { padding: 12px 14px; }
  .assets-layout { grid-template-columns: 1fr; }
  .j-cre, .j-stg { display: none; }
}
@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .gl-inv-row { grid-template-columns: 1fr; }
  .inv-stats { grid-template-columns: 1fr 1fr; }
  .stages-bar { flex-wrap: wrap; }
  .stg { min-width: calc(50% - 5px); }
}
