:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: #0d1424;
  --panel-2: #111a2d;
  --panel-3: #151f35;
  --border: #24304a;
  --text: #f5f7ff;
  --muted: #99a7c2;
  --muted-2: #6f7e9d;
  --accent: #8ea8ff;
  --accent-2: #6385ff;
  --accent-soft: rgba(99,133,255,.14);
  --green: #51d89a;
  --green-soft: rgba(81,216,154,.12);
  --yellow: #f6c85f;
  --yellow-soft: rgba(246,200,95,.12);
  --red: #ff7787;
  --red-soft: rgba(255,119,135,.12);
  --cyan: #57c8ee;
  --shadow: 0 18px 48px rgba(0,0,0,.28);
  --radius: 16px;
  --radius-sm: 10px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% -10%, rgba(86,99,255,.16), transparent 36rem),
    radial-gradient(circle at -5% 80%, rgba(32,171,199,.07), transparent 30rem),
    var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.app-shell { display: grid; grid-template-columns: 248px minmax(0,1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 20;
  padding: 22px 16px; border-right: 1px solid rgba(255,255,255,.07);
  background: rgba(7,11,20,.87); backdrop-filter: blur(18px);
  display: flex; flex-direction: column;
}
.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  flex-shrink: 0;
}
.brand { display:flex; align-items:center; gap:12px; padding:4px 8px 22px; border-bottom:1px solid rgba(255,255,255,.06); }
.brand-mark { width:38px; height:38px; border-radius:11px; display:grid; place-items:center; font-weight:900; font-size:18px; background:linear-gradient(145deg,#6f88ff,#a9b9ff); color:#061025; box-shadow:0 8px 24px rgba(99,133,255,.22); }
.brand strong { display:block; font-size:14px; letter-spacing:.01em; }
.brand span { display:block; color:var(--muted-2); font-size:11px; margin-top:1px; }
.nav-list { display:grid; gap:5px; margin-top:18px; }
.nav-list a { display:flex; align-items:center; gap:12px; color:var(--muted); padding:10px 12px; border-radius:10px; font-weight:650; transition:.18s ease; }
.nav-list a:hover { color:var(--text); background:rgba(255,255,255,.045); }
.nav-list a.active { color:#dce4ff; background:var(--accent-soft); box-shadow:inset 0 0 0 1px rgba(142,168,255,.12); }
.nav-icon { width:20px; text-align:center; font-size:16px; color:currentColor; }
.sidebar-foot { margin-top:auto; padding:16px 10px 4px; color:var(--muted-2); display:grid; gap:4px; }
.sidebar-foot small { font-size:11px; }
.privacy-dot { color:var(--muted); font-size:12px; display:flex; align-items:center; gap:7px; }
.privacy-dot span { width:7px; height:7px; border-radius:50%; background:var(--green); box-shadow:0 0 0 4px var(--green-soft); }
.main-wrap { min-width:0; }
.topbar { height:86px; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:18px 28px; border-bottom:1px solid rgba(255,255,255,.055); background:rgba(7,11,20,.6); backdrop-filter: blur(16px); position:sticky; top:0; z-index:14; }
.topbar-left { display:flex; align-items:center; gap:12px; }
.eyebrow { margin:0 0 2px; text-transform:uppercase; letter-spacing:.13em; color:var(--muted-2); font-size:10px; font-weight:800; }
h1 { margin:0; font-size:23px; line-height:1.1; letter-spacing:-.025em; }
.topbar-actions { display:flex; gap:8px; align-items:center; }
.mobile-menu { display:none !important; }
main { padding:26px 28px 48px; max-width:1600px; margin:0 auto; }

.button, .icon-button {
  border:1px solid var(--border); color:var(--text); background:var(--panel-2); cursor:pointer; border-radius:10px; min-height:38px;
  display:inline-flex; align-items:center; justify-content:center; gap:8px; font-weight:750; transition:.16s ease;
}
.button { padding:8px 13px; }
.icon-button { width:38px; padding:0; }
.button:hover, .icon-button:hover { border-color:#3a4a6c; background:#17223a; transform:translateY(-1px); }
.button.primary { background:linear-gradient(180deg,#7894ff,#617ef0); color:#081025; border-color:#7894ff; }
.button.primary:hover { background:linear-gradient(180deg,#8ba3ff,#6d88f6); }
.button.ghost { background:transparent; }
.button.danger { color:#ffc4cb; background:var(--red-soft); border-color:rgba(255,119,135,.25); }
.button.success { color:#b9f8da; background:var(--green-soft); border-color:rgba(81,216,154,.22); }
.button.small { min-height:32px; padding:5px 9px; font-size:12px; border-radius:8px; }
.button:disabled { opacity:.45; pointer-events:none; }
.link-button { border:0; background:none; color:var(--accent); padding:0; cursor:pointer; font:inherit; font-weight:700; }

.grid { display:grid; gap:16px; }
.metrics { grid-template-columns:repeat(4,minmax(0,1fr)); }
.metric-card, .card { background:linear-gradient(180deg,rgba(17,26,45,.94),rgba(12,19,33,.94)); border:1px solid var(--border); border-radius:var(--radius); box-shadow:0 10px 30px rgba(0,0,0,.12); }
.metric-card { padding:18px; min-height:128px; display:flex; flex-direction:column; justify-content:space-between; overflow:hidden; position:relative; }
.metric-card::after { content:""; position:absolute; width:120px; height:120px; border-radius:50%; right:-64px; top:-62px; background:rgba(142,168,255,.07); }
.metric-label { color:var(--muted); font-size:12px; font-weight:700; }
.metric-value { font-size:27px; font-weight:850; letter-spacing:-.035em; margin-top:7px; }
.metric-foot { color:var(--muted-2); font-size:11px; margin-top:8px; }
.metric-foot.positive { color:var(--green); }
.section-grid { grid-template-columns:minmax(0,1.55fr) minmax(300px,.75fr); margin-top:16px; align-items:start; }
.card { overflow:hidden; }
.card-header { min-height:58px; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 17px; border-bottom:1px solid rgba(255,255,255,.06); }
.card-header h2, .section-title { margin:0; font-size:15px; letter-spacing:-.012em; }
.card-header p { margin:2px 0 0; color:var(--muted-2); font-size:11px; }
.card-body { padding:17px; }
.card-body.flush { padding:0; }
.stack { display:grid; gap:12px; }
.row { display:flex; align-items:center; gap:10px; }
.row.between { justify-content:space-between; }
.muted { color:var(--muted); }
.muted-2 { color:var(--muted-2); }
.note { color:var(--muted); font-size:12px; }
.divider { height:1px; background:rgba(255,255,255,.06); }

.table-wrap { overflow:auto; }
table { width:100%; border-collapse:collapse; min-width:760px; }
th { color:var(--muted-2); text-align:left; font-size:10px; letter-spacing:.08em; text-transform:uppercase; font-weight:850; padding:11px 14px; border-bottom:1px solid rgba(255,255,255,.06); white-space:nowrap; }
td { padding:12px 14px; border-bottom:1px solid rgba(255,255,255,.052); vertical-align:middle; }
tbody tr:last-child td { border-bottom:0; }
tbody tr:hover { background:rgba(255,255,255,.018); }
.cell-title { font-weight:750; color:#f2f5ff; }
.cell-sub { color:var(--muted-2); font-size:11px; margin-top:2px; }
.money { font-variant-numeric:tabular-nums; white-space:nowrap; }
.status { display:inline-flex; align-items:center; gap:6px; font-size:11px; font-weight:800; border-radius:999px; padding:5px 8px; border:1px solid transparent; text-transform:capitalize; white-space:nowrap; }
.status::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.85; }
.status.received { color:#a9bbff; background:rgba(99,133,255,.10); border-color:rgba(99,133,255,.18); }
.status.in-progress { color:#8fdcf5; background:rgba(87,200,238,.10); border-color:rgba(87,200,238,.18); }
.status.completed, .status.paid { color:#8ee5bb; background:var(--green-soft); border-color:rgba(81,216,154,.18); }
.status.invoiced, .status.sent { color:#f6d88e; background:var(--yellow-soft); border-color:rgba(246,200,95,.18); }
.status.draft { color:#b1bdd2; background:rgba(177,189,210,.08); border-color:rgba(177,189,210,.13); }
.status.overdue { color:#ff9eaa; background:var(--red-soft); border-color:rgba(255,119,135,.2); }
.actions { display:flex; gap:6px; align-items:center; white-space:nowrap; }
.text-danger { color:var(--red); }

.toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:14px; }
.toolbar .search { flex:1 1 260px; min-width:220px; }
.field, .search { position:relative; }
input, select, textarea {
  width:100%; border:1px solid var(--border); border-radius:9px; background:#0a1120; color:var(--text); min-height:39px; padding:8px 10px; outline:none;
}
input::placeholder, textarea::placeholder { color:#566581; }
input:focus, select:focus, textarea:focus { border-color:#6279c5; box-shadow:0 0 0 3px rgba(99,133,255,.10); }
textarea { min-height:86px; resize:vertical; }
label { display:grid; gap:6px; color:#c8d1e3; font-size:12px; font-weight:700; }
label small { color:var(--muted-2); font-weight:500; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; }
.form-grid .span-2 { grid-column:1/-1; }
.form-grid .span-3 { grid-column:1/-1; }
.checkbox-line { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:12px; font-weight:650; }
.checkbox-line input { width:16px; min-height:16px; height:16px; }
.inline-prefix { display:flex; align-items:stretch; }
.inline-prefix span { display:grid; place-items:center; min-width:36px; padding:0 9px; border:1px solid var(--border); border-right:0; background:#10192b; color:var(--muted); border-radius:9px 0 0 9px; }
.inline-prefix input { border-radius:0 9px 9px 0; }

.empty { padding:38px 18px; text-align:center; color:var(--muted); }
.empty-icon { width:46px; height:46px; border-radius:13px; background:var(--accent-soft); color:var(--accent); margin:0 auto 12px; display:grid; place-items:center; font-size:20px; }
.empty h3 { color:var(--text); margin:0 0 5px; font-size:15px; }
.empty p { margin:0 auto 14px; max-width:440px; font-size:12px; }

.deadline-list { display:grid; gap:9px; }
.deadline { display:grid; grid-template-columns:auto 1fr auto; gap:10px; align-items:center; padding:10px 0; border-bottom:1px solid rgba(255,255,255,.055); }
.deadline:last-child { border:0; }
.deadline-mark { width:9px; height:34px; border-radius:5px; background:var(--green); }
.deadline-mark.soon { background:var(--yellow); }
.deadline-mark.late { background:var(--red); }
.deadline-title { font-weight:750; }
.deadline-sub { color:var(--muted-2); font-size:11px; }
.deadline-time { color:var(--muted); font-size:11px; text-align:right; }

.timer-banner { margin-bottom:16px; border:1px solid rgba(87,200,238,.25); background:linear-gradient(90deg,rgba(87,200,238,.10),rgba(99,133,255,.08)); border-radius:13px; padding:12px 14px; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.timer-left { display:flex; align-items:center; gap:10px; min-width:0; }
.timer-pulse { width:10px; height:10px; border-radius:50%; background:var(--cyan); box-shadow:0 0 0 5px rgba(87,200,238,.10); animation:pulse 1.5s infinite; flex:0 0 auto; }
@keyframes pulse { 50% { box-shadow:0 0 0 9px rgba(87,200,238,0); } }
.timer-name { font-weight:800; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.timer-elapsed { color:#a8dcf0; font-variant-numeric:tabular-nums; font-weight:800; margin-left:8px; }

.rate-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.rate-card { border:1px solid var(--border); background:linear-gradient(160deg,#111a2d,#0c1322); border-radius:13px; padding:16px; display:flex; justify-content:space-between; gap:14px; align-items:flex-start; }
.rate-name { font-weight:800; font-size:14px; }
.rate-meta { color:var(--muted-2); font-size:11px; margin-top:4px; }
.rate-price { text-align:right; font-size:20px; font-weight:900; color:#dbe3ff; white-space:nowrap; }
.rate-price small { display:block; color:var(--muted-2); font-size:10px; font-weight:700; }
.rate-actions { margin-top:10px; display:flex; gap:6px; justify-content:flex-end; }

.client-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.client-card { padding:16px; border:1px solid var(--border); border-radius:13px; background:linear-gradient(160deg,#10192a,#0b1220); }
.client-top { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.avatar { width:38px; height:38px; border-radius:11px; display:grid; place-items:center; background:var(--accent-soft); color:#b8c7ff; font-weight:850; }
.client-name { font-weight:850; margin-top:8px; }
.client-company { color:var(--muted-2); font-size:11px; min-height:16px; }
.client-stats { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; margin-top:14px; }
.mini-stat { padding:9px; border-radius:9px; background:rgba(255,255,255,.025); }
.mini-stat strong { display:block; font-size:14px; }
.mini-stat span { color:var(--muted-2); font-size:10px; }

.progress-row { display:grid; grid-template-columns:minmax(90px,160px) 1fr auto; gap:12px; align-items:center; }
.progress-track { height:8px; border-radius:99px; overflow:hidden; background:#182238; }
.progress-fill { height:100%; border-radius:99px; background:linear-gradient(90deg,#6f8aff,#9bb0ff); }

.modal-backdrop { position:fixed; inset:0; z-index:50; display:grid; place-items:center; padding:20px; background:rgba(0,0,0,.68); backdrop-filter:blur(5px); }
.modal { width:min(720px,100%); max-height:min(88vh,900px); background:#0b1220; border:1px solid #2b3955; border-radius:16px; box-shadow:var(--shadow); display:flex; flex-direction:column; overflow:hidden; }
.modal.wide { width:min(860px,100%); }
.modal-header { padding:16px 18px; border-bottom:1px solid rgba(255,255,255,.07); display:flex; align-items:center; justify-content:space-between; gap:12px; }
.modal-header h2 { margin:0; font-size:17px; }
.modal-body { padding:18px; overflow:auto; }
.modal-footer { padding:13px 18px; border-top:1px solid rgba(255,255,255,.07); display:flex; justify-content:flex-end; gap:8px; background:#0d1525; }
.job-picker { border:1px solid var(--border); border-radius:10px; overflow:hidden; max-height:220px; overflow-y:auto; }
.job-pick { display:grid; grid-template-columns:auto 1fr auto; gap:10px; align-items:center; padding:10px; border-bottom:1px solid rgba(255,255,255,.05); }
.job-pick:last-child { border:0; }
.job-pick input { width:16px; min-height:16px; }
.job-pick strong { font-size:12px; }
.job-pick small { color:var(--muted-2); display:block; }

.toast-stack { position:fixed; z-index:80; right:18px; bottom:18px; display:grid; gap:8px; max-width:min(380px,calc(100vw - 36px)); }
.toast { padding:11px 13px; border:1px solid var(--border); border-radius:10px; background:#121c30; box-shadow:var(--shadow); color:#e8edff; animation:toast-in .18s ease; }
.toast.error { border-color:rgba(255,119,135,.35); background:#2a141b; }
@keyframes toast-in { from { opacity:0; transform:translateY(8px); } }

.loading-card { min-height:50vh; display:grid; place-items:center; align-content:center; gap:10px; color:var(--muted); }
.spinner { width:25px; height:25px; border:3px solid #202c45; border-top-color:var(--accent); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

.callout { border:1px solid rgba(142,168,255,.20); background:rgba(99,133,255,.08); border-radius:11px; padding:12px; color:#cbd6fa; font-size:12px; }
.callout strong { color:#eff2ff; }
.kpi-line { display:flex; justify-content:space-between; gap:12px; padding:9px 0; border-bottom:1px solid rgba(255,255,255,.05); }
.kpi-line:last-child { border:0; }
.kpi-line span { color:var(--muted); }
.kpi-line strong { font-variant-numeric:tabular-nums; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .client-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns:1fr; }
  .sidebar { position:fixed; left:0; transform:translateX(-102%); width:248px; transition:.2s ease; box-shadow:var(--shadow); }
  .sidebar.open { transform:translateX(0); }
  .sidebar-scrim { position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:19; display:none; }
  .sidebar-scrim.open { display:block; }
  .mobile-menu { display:inline-flex !important; }
  .section-grid { grid-template-columns:1fr; }
  .rate-grid, .client-grid { grid-template-columns:1fr; }
  .topbar { padding:16px 18px; }
  main { padding:20px 18px 40px; }
}
@media (max-width: 620px) {
  .metrics { grid-template-columns:1fr; }
  .metric-card { min-height:112px; }
  .form-grid { grid-template-columns:1fr; }
  .form-grid .span-2 { grid-column:auto; }
  .topbar-actions .button .hide-mobile { display:none; }
  .topbar-actions { gap:5px; }
  .topbar { height:78px; }
  h1 { font-size:20px; }
  .modal-backdrop { padding:8px; place-items:end center; }
  .modal { max-height:94vh; border-radius:15px 15px 0 0; }
  .timer-banner { align-items:flex-start; flex-direction:column; }
  .progress-row { grid-template-columns:90px 1fr; }
  .progress-row > :last-child { grid-column:2; }
}


/* Cutoff reporting */
.status.open { color:#8fdcf5; background:rgba(87,200,238,.10); border-color:rgba(87,200,238,.18); }
.status.closed { color:#8ee5bb; background:var(--green-soft); border-color:rgba(81,216,154,.18); }
.status.ready-to-close { color:#f6d88e; background:var(--yellow-soft); border-color:rgba(246,200,95,.18); }
.cutoff-spotlight { margin-top:16px; padding:16px 18px; display:grid; grid-template-columns:minmax(220px,1fr) auto auto; gap:22px; align-items:center; background:linear-gradient(105deg,rgba(99,133,255,.13),rgba(17,26,45,.96) 48%,rgba(81,216,154,.05)); }
.cutoff-spotlight h2 { margin:1px 0 3px; font-size:18px; }
.cutoff-spotlight p { margin:0; color:var(--muted); font-size:11px; }
.cutoff-spotlight-stats { display:flex; gap:20px; align-items:center; }
.cutoff-spotlight-stats div { min-width:68px; }
.cutoff-spotlight-stats strong { display:block; font-size:17px; }
.cutoff-spotlight-stats span { display:block; color:var(--muted-2); font-size:10px; text-transform:uppercase; letter-spacing:.06em; }
.cutoff-toolbar { align-items:end; justify-content:space-between; }
.cutoff-select-label { min-width:min(420px,100%); }
.cutoff-toolbar-actions { margin-left:auto; }
.cutoff-ready { margin-bottom:14px; }
.cutoff-metrics { margin-bottom:16px; }
.cutoff-report-body { padding:0; }
.cutoff-client-section { padding:18px; border-bottom:1px solid rgba(255,255,255,.07); }
.cutoff-client-section:last-of-type { border-bottom:0; }
.cutoff-client-head { display:flex; justify-content:space-between; align-items:end; gap:14px; margin-bottom:10px; }
.cutoff-client-head h3 { margin:0; font-size:15px; }
.cutoff-client-head p { margin:2px 0 0; color:var(--muted-2); font-size:11px; }
.cutoff-client-head > strong { font-size:18px; }
.cutoff-table { min-width:820px; border:1px solid rgba(255,255,255,.055); border-radius:10px; overflow:hidden; }
.cutoff-client-subtotal { display:grid; grid-template-columns:minmax(180px,1fr) auto auto auto; gap:18px; padding:10px 12px; background:rgba(255,255,255,.025); color:var(--muted); font-size:11px; }
.cutoff-client-subtotal strong { color:var(--text); min-width:88px; text-align:right; }
.cutoff-grand-total { margin:0 18px 18px; border:1px solid rgba(142,168,255,.20); background:rgba(99,133,255,.07); border-radius:12px; padding:14px; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.cutoff-grand-total div { display:grid; gap:3px; }
.cutoff-grand-total span { color:var(--muted-2); font-size:10px; text-transform:uppercase; letter-spacing:.06em; }
.cutoff-grand-total strong { font-size:18px; }

@media (max-width: 900px) {
  .cutoff-spotlight { grid-template-columns:1fr; gap:12px; }
  .cutoff-spotlight-stats { justify-content:space-between; }
  .cutoff-toolbar-actions { margin-left:0; width:100%; flex-wrap:wrap; }
  .cutoff-grand-total { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 620px) {
  .cutoff-client-subtotal { grid-template-columns:1fr auto; }
  .cutoff-client-subtotal span:nth-child(3) { grid-column:1; }
  .cutoff-grand-total { grid-template-columns:1fr 1fr; }
}
