@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root{
  --bg:#1d2530;
  --bg-elevated:#232c39;
  --panel:#242e3c;
  --line:#334155;
  --line-soft:#2b3644;
  --text:#e8ecf1;
  --text-soft:#9aa7b5;
  --text-faint:#6b7789;
  --accent:#714b67;
  --accent-light:#8a5f80;
  --success:#2f9e6e;
  --danger:#c0553f;
  --mono:'IBM Plex Mono', monospace;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:'Inter', sans-serif;
  font-size:14px;
}
a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; cursor:pointer; }
input, textarea, select{ font-family:inherit; color:var(--text); }

/* Topbar */
.topbar{
  display:flex; align-items:center; gap:32px;
  padding:0 24px; height:52px;
  background:var(--bg-elevated);
  border-bottom:1px solid var(--line);
}
.brand{ font-weight:600; font-size:15px; display:flex; align-items:center; gap:8px; }
.brand-dot{ width:9px; height:9px; border-radius:50%; background:var(--accent-light); display:inline-block; }
.topnav{ display:flex; gap:22px; }
.topnav a{ color:var(--text-soft); font-size:13px; padding:16px 0; }
.topnav a.active{ color:var(--text); border-bottom:2px solid var(--accent-light); }

#app{ padding:20px 24px 60px; max-width:1200px; margin:0 auto; }

/* Buttons */
.btn{
  border:1px solid var(--line); background:var(--panel); color:var(--text);
  padding:7px 14px; border-radius:5px; font-size:13px; font-weight:500;
}
.btn:hover{ background:var(--line-soft); }
.btn.primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.primary:hover{ background:var(--accent-light); }
.btn.ghost{ background:transparent; border-color:transparent; color:var(--text-soft); }
.btn.ghost:hover{ background:var(--line-soft); color:var(--text); }
.btn.danger{ color:var(--danger); border-color:var(--danger); background:transparent; }
.btn.danger:hover{ background:rgba(192,85,63,0.12); }
.btn:disabled{ opacity:0.4; cursor:not-allowed; }
.btn-row{ display:flex; gap:8px; margin-bottom:18px; align-items:center; }

/* List view */
.list-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.list-head h1{ font-size:20px; font-weight:600; margin:0; }

table.list{ width:100%; border-collapse:collapse; }
table.list th{
  text-align:left; font-size:11px; letter-spacing:0.05em; color:var(--text-faint);
  text-transform:uppercase; padding:10px 12px; border-bottom:1px solid var(--line);
}
table.list td{ padding:12px; border-bottom:1px solid var(--line-soft); font-size:13.5px; }
table.list tr.row{ cursor:pointer; }
table.list tr.row:hover td{ background:var(--line-soft); }
table.list td.num{ font-family:var(--mono); text-align:right; }
.empty-state{ padding:60px 20px; text-align:center; color:var(--text-soft); }
.empty-state h3{ color:var(--text); font-weight:600; margin-bottom:6px; }

.status-pill{
  display:inline-block; padding:2px 10px; border-radius:12px; font-size:11.5px; font-weight:500;
}
.status-pill.draft{ background:rgba(154,167,181,0.15); color:var(--text-soft); }
.status-pill.posted{ background:rgba(47,158,110,0.15); color:var(--success); }

/* Breadcrumb status stepper */
.status-stepper{ display:flex; align-items:center; gap:0; font-size:12.5px; }
.status-stepper .step{ padding:5px 14px; color:var(--text-faint); border:1px solid var(--line); }
.status-stepper .step:first-child{ border-radius:4px 0 0 4px; }
.status-stepper .step:last-child{ border-radius:0 4px 4px 0; }
.status-stepper .step.current{ color:#fff; background:var(--accent); border-color:var(--accent); font-weight:500; }

/* Detail view */
.detail-grid{ display:grid; grid-template-columns:1fr 320px; gap:24px; align-items:start; }
.sheet{
  background:var(--panel); border:1px solid var(--line); border-radius:8px;
  padding:28px 32px;
}
.sheet-top{ display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:24px; }
.doc-title{ font-size:11px; letter-spacing:0.08em; color:var(--text-faint); margin-bottom:6px; }
.doc-number{ font-size:26px; font-weight:700; }

.meta-grid{ display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-bottom:22px; }
.field label{ display:block; font-size:11px; color:var(--text-faint); margin-bottom:5px; }
.field input, .field textarea, .field select{
  width:100%; background:var(--bg-elevated); border:1px solid var(--line); border-radius:5px;
  padding:7px 9px; font-size:13.5px;
}
.field textarea{ resize:none; line-height:1.6; }
.field input:focus, .field textarea:focus, .field select:focus{ outline:none; border-color:var(--accent-light); }
.customer-link{ color:#7fb0e0; font-size:14px; font-weight:500; }

.tabs{ display:flex; gap:4px; border-bottom:1px solid var(--line); margin-bottom:20px; }
.tab{ padding:9px 4px; margin-right:20px; font-size:13px; color:var(--text-soft); border-bottom:2px solid transparent; cursor:pointer; }
.tab.active{ color:var(--text); border-bottom-color:var(--accent-light); }
.tab-panel{ display:none; }
.tab-panel.active{ display:block; }

table.lines{ width:100%; border-collapse:collapse; margin-bottom:6px; }
table.lines th{ text-align:left; font-size:11px; color:var(--text-faint); padding:0 8px 8px; border-bottom:1px solid var(--line); text-transform:uppercase; letter-spacing:0.05em; }
table.lines th.num{ text-align:right; }
table.lines td{ padding:8px; border-bottom:1px solid var(--line-soft); vertical-align:top; }
table.lines td.num{ text-align:right; font-family:var(--mono); }
table.lines input{ width:100%; background:transparent; border:none; padding:4px 2px; font-size:13.5px; }
table.lines input.num{ text-align:right; font-family:var(--mono); }
table.lines input:focus{ outline:none; background:var(--bg-elevated); border-radius:3px; }
.col-del{ width:36px; text-align:center; }
.link-add{ font-size:13px; color:var(--accent-light); background:none; border:none; padding:6px 8px; font-weight:500; }
.link-add:hover{ text-decoration:underline; }

.totals{ display:flex; justify-content:flex-end; margin-top:16px; }
.totals-box{ width:260px; }
.totals-row{ display:flex; justify-content:space-between; align-items:center; padding:6px 0; font-size:13.5px; }
.totals-row label{ color:var(--text-soft); display:flex; align-items:center; gap:6px; }
.totals-row input.pct{ width:44px; background:var(--bg-elevated); border:1px solid var(--line); border-radius:4px; padding:3px 5px; text-align:right; font-family:var(--mono); }
.totals-row .amt{ font-family:var(--mono); }
.totals-row.grand{ border-top:1px solid var(--line); margin-top:6px; padding-top:12px; font-size:16px; font-weight:700; }

/* Sidebar activity */
.side-panel{ padding-top:6px; }
.side-tabs{ display:flex; gap:16px; margin-bottom:16px; font-size:13px; color:var(--text-soft); }
.side-tabs span.active{ color:var(--text); font-weight:500; }
.activity-item{ display:flex; gap:10px; padding:12px 0; border-bottom:1px solid var(--line-soft); }
.avatar{ width:28px; height:28px; border-radius:50%; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:600; flex-shrink:0; }
.activity-body .who{ font-size:12.5px; font-weight:500; }
.activity-body .when{ font-size:11px; color:var(--text-faint); margin-left:6px; font-weight:400; }
.activity-body .msg{ font-size:13px; color:var(--text-soft); margin-top:3px; line-height:1.5; }
.activity-body .msg b{ color:var(--text); font-weight:500; }

.modal-backdrop{ position:fixed; inset:0; background:rgba(0,0,0,0.5); display:flex; align-items:center; justify-content:center; z-index:10; }
.modal{ background:var(--panel); border:1px solid var(--line); border-radius:8px; padding:24px; width:360px; }
.modal h3{ margin:0 0 16px; font-size:16px; }
.modal .field{ margin-bottom:12px; }
.modal-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }

.toast{
  position:fixed; bottom:20px; right:20px; background:var(--panel); border:1px solid var(--line);
  padding:10px 16px; border-radius:6px; font-size:13px; box-shadow:0 4px 12px rgba(0,0,0,0.3);
  opacity:0; transform:translateY(8px); transition:all 0.2s; z-index:20;
}
.toast.show{ opacity:1; transform:translateY(0); }
.toast.error{ border-color:var(--danger); color:#ffb4a3; }

@media (max-width:860px){
  .detail-grid{ grid-template-columns:1fr; }
  .meta-grid{ grid-template-columns:1fr; }
  .sheet{ padding:20px; }
}
