:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --soft: #eff6ff;
  --danger: #dc2626;
  --success: #16a34a;
  --sidebar: #101827;
  --sidebar-soft: #1f2937;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; background: var(--sidebar); color: white; padding: 20px 16px; overflow-y: auto; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; background: linear-gradient(135deg, #60a5fa, #34d399); display: grid; place-items: center; font-weight: 800; }
.brand span { display: block; color: #cbd5e1; font-size: 12px; margin-top: 2px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #e5e7eb; border-radius: 10px; margin: 2px 0; font-size: 14px; }
.nav-link:hover { background: var(--sidebar-soft); color: #fff; }
.nav-section { color: #94a3b8; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; margin: 18px 12px 6px; }
.main { margin-left: 270px; min-height: 100vh; }
.topbar { height: 68px; background: rgba(255,255,255,.88); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 10; }
.search-wrap input { width: 460px; max-width: 45vw; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #f9fafb; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.quick, .btn { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.quick { background: var(--primary); color: white; border-color: var(--primary); }
.quick.secondary { background: #fff; color: var(--text); border-color: var(--line); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.danger { color: var(--danger); }
.icon-btn, .avatar { width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; background: #f3f4f6; }
.avatar { background: #dbeafe; color: #1e40af; font-weight: 800; }
.content { padding: 28px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 2px 0 4px; font-size: 30px; letter-spacing: -0.03em; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; margin: 0; }
.muted { color: var(--muted); margin: 0; }
.head-actions { display: flex; gap: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card, .panel, .soft-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.stat-card { padding: 18px; min-height: 120px; display: flex; flex-direction: column; gap: 8px; }
.stat-card span, .soft-card span, .mini-grid span { color: var(--muted); font-size: 13px; }
.stat-card strong { font-size: 24px; letter-spacing: -0.03em; }
.stat-card a { margin-top: auto; font-weight: 700; font-size: 13px; }
.two-col { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 18px; margin-bottom: 18px; }
.panel { padding: 20px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h2, .section-title { margin: 0; font-size: 18px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); padding: 12px 8px; }
.table td { border-bottom: 1px solid var(--line); padding: 12px 8px; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table small { display: block; color: var(--muted); margin-top: 3px; }
.right { text-align: right !important; }
.badge { display: inline-flex; align-items: center; background: #eef2ff; color: #3730a3; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; }
.empty { color: var(--muted); text-align: center; padding: 28px !important; }
.checklist { display: grid; gap: 10px; }
.checklist a, .checklist span { color: var(--text); padding: 12px 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; }
.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.mini-grid div { background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.mini-grid strong { display: block; font-size: 28px; margin-top: 6px; }
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; background: #fff; }
textarea { min-height: 92px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-grid.compact { grid-template-columns: repeat(4, minmax(0,1fr)); }
.field label { display: block; font-size: 13px; color: #374151; font-weight: 700; margin-bottom: 6px; }
.field.check { display: flex; align-items: end; }
.field.check label { margin: 0; display: flex; align-items: center; gap: 8px; }
.field.check input { width: auto; }
.span-2 { grid-column: span 2; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; padding-top: 10px; }
.invoice-form { overflow-x: auto; }
.line-table select, .line-table input { min-width: 110px; }
.line-table td:nth-child(2) input { min-width: 280px; }
.totals-inputs { margin-top: 18px; }
.document-card { max-width: 980px; margin: 0 auto 18px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 16px; }
.doc-meta { display: grid; grid-template-columns: auto auto; gap: 6px 16px; text-align: right; }
.doc-meta span { color: var(--muted); }
.totals { margin-left: auto; max-width: 360px; display: grid; gap: 8px; padding-top: 18px; }
.totals div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.totals .grand { font-size: 20px; border-bottom: 0; padding-top: 8px; }
.note-box { margin-top: 18px; padding: 14px; background: #f8fafc; border-radius: 12px; color: #374151; }
.stack-form { display: grid; gap: 10px; }
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }
.soft-card { padding: 18px; box-shadow: none; }
.soft-card h3 { margin: 8px 0; }
.soft-card p { color: var(--muted); min-height: 44px; }
.report-table { width: 100%; border-collapse: collapse; }
.report-table td { padding: 12px 8px; border-bottom: 1px solid var(--line); }
.report-table .total td { font-weight: 800; font-size: 18px; }
.flash-stack { margin-bottom: 16px; display: grid; gap: 8px; }
.flash { padding: 12px 14px; border-radius: 12px; background: #eff6ff; border: 1px solid #bfdbfe; }
.flash.success { background: #ecfdf5; border-color: #bbf7d0; color: #166534; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash.info { background: #f8fafc; border-color: #e2e8f0; color: #334155; }
.org-card h2 { margin-top: 0; }
@media (max-width: 1100px) { .stat-grid, .card-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } .two-col { grid-template-columns: 1fr; } .form-grid.compact { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) { .sidebar { position: static; width: auto; height: auto; } .main { margin-left: 0; } .topbar { position: static; height: auto; align-items: stretch; flex-direction: column; padding: 12px; gap: 10px; } .search-wrap input { max-width: none; width: 100%; } .content { padding: 16px; } .page-head { flex-direction: column; } .stat-grid, .card-grid, .form-grid, .form-grid.compact { grid-template-columns: 1fr; } .span-2 { grid-column: span 1; } }


.brand-logo { width: 42px; height: 42px; border-radius: 14px; object-fit: cover; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.inline-form { display: inline; }
.inline-form button { margin-left: 4px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #0f172a; color: #e5e7eb; padding: 12px; border-radius: 10px; }
.nav-link.active { background: var(--sidebar-soft); color: #fff; }


.brand-preview { display: flex; align-items: center; gap: 16px; }
.brand-logo.big { width: 72px; height: 72px; border-radius: 20px; }
code { background: #f1f5f9; border: 1px solid var(--line); border-radius: 6px; padding: 2px 5px; }
