/* ════════════════════════════════════════════════════════════
   InvoiceFlow — Main Stylesheet
   Font: Syne (headings) + DM Sans (body)
   Theme: Deep teal/slate dark with vibrant accents
   ════════════════════════════════════════════════════════════ */

/* ── Reset & Variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg:          #0b1120;
  --color-surface:     #111827;
  --color-surface2:    #1a2438;
  --color-border:      rgba(255,255,255,.07);
  --color-border2:     rgba(255,255,255,.12);

  --color-primary:     #14b8a6;
  --color-primary-dk:  #0d9488;
  --color-primary-lt:  #5eead4;

  --color-success:     #22c55e;
  --color-warning:     #f59e0b;
  --color-danger:      #ef4444;
  --color-info:        #3b82f6;

  --color-text:        #e2e8f0;
  --color-text-muted:  #64748b;
  --color-text-dim:    #94a3b8;

  --sidebar-w:         240px;
  --topbar-h:          60px;
  --radius:            10px;
  --radius-sm:         6px;
  --shadow:            0 4px 24px rgba(0,0,0,.35);
  --shadow-sm:         0 2px 8px rgba(0,0,0,.2);

  --font-display:      'Syne', sans-serif;
  --font-body:         'DM Sans', sans-serif;

  --transition:        .18s ease;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-lt); }
strong { font-weight: 600; }
code { font-family: 'Fira Mono', monospace; font-size: 12px; background: var(--color-surface2); padding: 1px 5px; border-radius: 3px; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-surface); }
::-webkit-scrollbar-thumb { background: var(--color-surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-border2); }

/* ── Layout ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Sidebar Brand ──────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--color-border);
}
.brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dk));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
  box-shadow: 0 0 16px rgba(20,184,166,.35);
}
.brand-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -.3px;
}

/* ── Sidebar Nav ────────────────────────────────────────────── */
.sidebar-nav {
  list-style: none;
  padding: 12px 12px;
  flex: 1;
  overflow-y: auto;
}
.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--color-text-muted);
  padding: 14px 10px 5px;
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-dim);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.sidebar-nav li a svg {
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.sidebar-nav li a:hover { background: var(--color-surface2); color: var(--color-text); }
.sidebar-nav li a.active {
  background: rgba(20,184,166,.12);
  color: var(--color-primary-lt);
  font-weight: 600;
}
.sidebar-nav li a.active svg { stroke: var(--color-primary-lt); }
.sidebar-footer {
  padding: 12px 20px;
  font-size: 11px;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  flex: 1;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-date { font-size: 12px; color: var(--color-text-muted); }
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--color-text-dim);
  border-radius: 2px;
  transition: var(--transition);
}

/* ── Content ────────────────────────────────────────────────── */
.content {
  padding: 28px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 4px solid;
  animation: slideIn .3s ease;
}
.alert-success { background: rgba(34,197,94,.1); border-color: var(--color-success); color: #86efac; }
.alert-error   { background: rgba(239,68,68,.1);  border-color: var(--color-danger);  color: #fca5a5; }
@keyframes slideIn { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--color-border);
}
.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}
.card-body { padding: 22px; }
.card-body.p-0 { padding: 0; }

/* ── Stat Cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.stat-primary::before { background: var(--color-primary); }
.stat-card.stat-success::before { background: var(--color-success); }
.stat-card.stat-warning::before { background: var(--color-warning); }
.stat-card.stat-info::before    { background: var(--color-info); }

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg {
  width: 22px; height: 22px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.stat-primary .stat-icon { background: rgba(20,184,166,.15); color: var(--color-primary-lt); }
.stat-success .stat-icon { background: rgba(34,197,94,.15);  color: var(--color-success); }
.stat-warning .stat-icon { background: rgba(245,158,11,.15); color: var(--color-warning); }
.stat-info    .stat-icon { background: rgba(59,130,246,.15); color: var(--color-info); }

.stat-label { font-size: 12px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }
.stat-value { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--color-text); line-height: 1.2; }
.stat-sub   { font-size: 11.5px; color: var(--color-text-muted); margin-top: 2px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--color-primary);  color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dk); color: #fff; }
.btn-secondary { background: var(--color-surface2); color: var(--color-text); border-color: var(--color-border2); }
.btn-success   { background: rgba(34,197,94,.15);   color: var(--color-success); border-color: rgba(34,197,94,.25); }
.btn-ghost     { background: transparent; color: var(--color-text-dim); border-color: var(--color-border2); }
.btn-ghost:hover { background: var(--color-surface2); color: var(--color-text); }
.btn-danger    { background: rgba(239,68,68,.12);   color: var(--color-danger);  border-color: rgba(239,68,68,.2); }
.btn-danger:hover { background: rgba(239,68,68,.22); }
.btn-link      { background: none; border: none; color: var(--color-primary); padding: 4px 0; font-size: 13px; cursor: pointer; }
.btn-link:hover { color: var(--color-primary-lt); }

.btn-sm  { padding: 5px 12px; font-size: 12.5px; }
.btn-lg  { padding: 11px 28px; font-size: 15px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { margin-bottom: 16px; }
.col-2 { flex: 0 0 calc(16.66% - 8px); }
.col-3 { flex: 0 0 calc(25% - 12px); }
.col-4 { flex: 0 0 calc(33.33% - 11px); }
.col-5 { flex: 0 0 calc(41.66% - 10px); }
.col-6 { flex: 0 0 calc(50% - 8px); }
.col-7 { flex: 0 0 calc(58.33% - 7px); }
.col-8 { flex: 0 0 calc(66.66% - 5px); }
@media (max-width: 768px) {
  .col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8 { flex: 0 0 100%; }
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-dim);
  margin-bottom: 6px;
  letter-spacing: .2px;
}
.form-label.required::after { content: ' *'; color: var(--color-danger); }

.form-control {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: var(--color-surface2);
  border: 1px solid var(--color-border2);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 13.5px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(20,184,166,.15);
}
.form-control::placeholder { color: var(--color-text-muted); }
.form-control.is-invalid { border-color: var(--color-danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
.form-control-sm { padding: 6px 9px; font-size: 12.5px; }
.form-control[readonly] { background: rgba(255,255,255,.03); cursor: default; color: var(--color-text-muted); }

textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.invalid-feedback { font-size: 12px; color: var(--color-danger); margin-top: 4px; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.form-card { max-width: 900px; }
.section-heading {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary-lt);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin: 24px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}
.section-heading:first-child { margin-top: 0; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--color-text-muted);
  background: var(--color-surface2);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }
.table-footer-row td { background: var(--color-surface2); border-top: 2px solid var(--color-border2); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge-draft    { background: rgba(100,116,139,.2); color: #94a3b8; }
.badge-sent     { background: rgba(59,130,246,.2);  color: #93c5fd; }
.badge-partial  { background: rgba(245,158,11,.2);  color: #fcd34d; }
.badge-paid     { background: rgba(34,197,94,.2);   color: #86efac; }
.badge-overdue  { background: rgba(239,68,68,.2);   color: #fca5a5; }
.badge-optional { background: rgba(100,116,139,.15); color: #64748b; font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: 500; vertical-align: middle; }

/* ── Action buttons in table ────────────────────────────────── */
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Page actions bar ───────────────────────────────────────── */
.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-form, .filter-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.search-input { width: 260px; }

/* ── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 18px;
}
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-primary); }

/* ── Invoice Form ───────────────────────────────────────────── */
.invoice-form-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) { .invoice-form-grid { grid-template-columns: 1fr; } }

.client-preview-card { background: rgba(20,184,166,.04); border-color: rgba(20,184,166,.15); }
.client-preview-text { font-size: 13.5px; color: var(--color-text); line-height: 1.8; }

/* Items table */
.items-table .form-control { background: rgba(255,255,255,.04); font-size: 12.5px; padding: 5px 8px; }
.items-table .form-control:focus { background: var(--color-surface2); }
.items-table td { padding: 8px 6px; vertical-align: middle; }
.items-table th { padding: 9px 6px; }
.price-field { color: var(--color-primary-lt) !important; }
.col-amount { font-weight: 600; color: var(--color-text); white-space: nowrap; text-align: right; }
.btn-remove-row {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); font-size: 14px; padding: 4px 6px;
  border-radius: 4px; transition: color var(--transition), background var(--transition);
}
.btn-remove-row:hover { color: var(--color-danger); background: rgba(239,68,68,.1); }

/* Totals strip */
.invoice-totals-wrap { display: flex; justify-content: flex-end; margin-top: 16px; }
.invoice-totals {
  min-width: 320px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-dim);
}
.totals-row:last-child { border-bottom: none; }
.totals-grand {
  background: var(--color-surface2);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary-lt);
  font-family: var(--font-display);
}

/* ── Invoice Document (view + print) ───────────────────────── */
.invoice-document {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 40px;
  max-width: 900px;
}
.inv-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; margin-bottom: 32px; }
.inv-company h2.company-name { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--color-primary-lt); margin-bottom: 6px; }
.inv-company p { font-size: 13px; color: var(--color-text-dim); line-height: 1.7; }
.inv-number-badge { text-align: right; }
.inv-label { font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--color-text-muted); }
.inv-number { font-family: var(--font-display); font-size: 28px; font-weight: 800; color: var(--color-primary-lt); margin-bottom: 12px; }
.inv-meta-table { font-size: 13px; }
.inv-meta-table td { padding: 3px 12px 3px 0; color: var(--color-text-dim); }
.inv-meta-table td:first-child { font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }

.inv-parties { margin-bottom: 28px; }
.inv-bill-to h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--color-text-muted); margin-bottom: 8px; }
.inv-bill-to { font-size: 13.5px; line-height: 1.8; color: var(--color-text-dim); }
.inv-bill-to strong { color: var(--color-text); font-size: 15px; }

.inv-items { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 0; }
.inv-items th {
  padding: 10px 12px; text-align: left;
  background: var(--color-surface2);
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-primary);
}
.inv-items td { padding: 10px 12px; border-bottom: 1px solid var(--color-border); color: var(--color-text-dim); }
.inv-items tbody tr:hover { background: rgba(255,255,255,.02); }
.text-xs { font-size: 11px; }

.inv-totals-wrap { display: flex; justify-content: flex-end; margin-top: 20px; }
.inv-totals { min-width: 280px; }
.inv-total-row {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  font-size: 13.5px;
  color: var(--color-text-dim);
  border-bottom: 1px solid var(--color-border);
}
.inv-total-row:last-child { border-bottom: none; }
.inv-grand-total { font-size: 18px; font-weight: 800; color: var(--color-text); font-family: var(--font-display); padding: 12px 0; }
.inv-balance-due { color: var(--color-danger) !important; font-weight: 700; }
.inv-notes { font-size: 13px; color: var(--color-text-muted); margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--color-border); }

/* ── Dashboard specific ─────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}
.chart-card .card-body { padding: 20px; }
.status-breakdown { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.status-row { display: flex; align-items: center; gap: 10px; }
.status-label { width: 70px; font-size: 13px; color: var(--color-text-dim); flex-shrink: 0; }
.status-bar-wrap { flex: 1; background: var(--color-surface2); border-radius: 4px; height: 8px; overflow: hidden; }
.status-bar { height: 100%; border-radius: 4px; transition: width .6s ease; }
.status-count { width: 30px; text-align: right; font-size: 13px; font-weight: 600; color: var(--color-text); }

/* ── Payments ───────────────────────────────────────────────── */
.payments-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) { .payments-grid { grid-template-columns: 1fr; } }
.balance-preview {
  display: flex; align-items: center; gap: 10px;
  background: rgba(20,184,166,.08);
  border: 1px solid rgba(20,184,166,.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--color-text-dim);
  margin: 8px 0 4px;
}
.balance-preview strong { color: var(--color-primary-lt); font-size: 16px; }

/* ── Mini progress bar (ledger) ─────────────────────────────── */
.mini-progress {
  display: flex; align-items: center; gap: 8px;
  background: var(--color-surface2);
  border-radius: 4px; height: 10px; position: relative; overflow: visible;
}
.mini-bar {
  height: 100%; background: var(--color-primary);
  border-radius: 4px; min-width: 2px;
  transition: width .5s ease;
}
.mini-pct { font-size: 11.5px; color: var(--color-text-dim); flex-shrink: 0; }

/* ── invoice-link ───────────────────────────────────────────── */
.invoice-link {
  font-family: 'Fira Mono', monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-primary-lt);
}
.invoice-link:hover { color: var(--color-text); }

/* ── Utilities ──────────────────────────────────────────────── */
.mt-4 { margin-top: 20px; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--color-text-muted) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger  { color: var(--color-danger) !important; }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }

/* ── Confirm modal overlay ──────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border2);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: scaleIn .2s ease;
}
@keyframes scaleIn { from { transform:scale(.92); opacity:0; } to { transform:scale(1); opacity:1; } }
.modal-box h4 { font-family: var(--font-display); font-size: 17px; margin-bottom: 10px; }
.modal-box p  { color: var(--color-text-dim); font-size: 13.5px; margin-bottom: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ── Print styles ───────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-actions, .no-print, .alert { display: none !important; }
  .main-wrapper { margin-left: 0; }
  .content { padding: 0; }
  body { background: #fff; color: #000; }
  .invoice-document {
    background: #fff; border: none; border-radius: 0;
    padding: 20px; max-width: 100%;
    color: #000;
  }
  .inv-company .company-name { color: #0d9488; }
  .inv-number { color: #0d9488; }
  .inv-items th { background: #f0fdf4; color: #374151; border-bottom-color: #0d9488; }
  .inv-items td, .inv-total-row, .inv-bill-to { color: #374151; }
  .inv-grand-total { color: #111827; }
  .badge { border: 1px solid #ccc; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .main-wrapper { margin-left: 0; }
  .hamburger { display: flex; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .invoice-document { padding: 20px; }
  .inv-header { flex-direction: column; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-actions { flex-direction: column; align-items: stretch; }
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR — User Profile Card & Logout Button
   ══════════════════════════════════════════════════════════════ */

/* brand sub-label */
.brand-sub {
  font-size: 9.5px;
  color: var(--color-text-muted);
  letter-spacing: .8px;
  margin-top: -3px;
  text-transform: uppercase;
}

/* User card pinned at bottom of sidebar */
.sb-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--color-border);
  background: rgba(255,255,255,.02);
  flex-shrink: 0;          /* never compress */
}

.sb-user-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;            /* allow text truncation */
  flex: 1;
}

/* Avatar circle */
.sb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dk) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(20,184,166,.25);
  user-select: none;
}

/* Name + role text */
.sb-info {
  min-width: 0;
  flex: 1;
}
.sb-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.sb-role {
  font-size: 10.5px;
  color: var(--color-primary-lt);
  text-transform: uppercase;
  letter-spacing: .5px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Logout icon button */
.sb-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(239, 68, 68, .08);
  border: 1px solid rgba(239, 68, 68, .18);
  color: #f87171;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), transform .12s;
  text-decoration: none;
}
.sb-logout:hover {
  background: rgba(239, 68, 68, .2);
  border-color: rgba(239, 68, 68, .4);
  color: #fca5a5;
  transform: scale(1.08);
}
.sb-logout svg {
  display: block;
  width: 18px;
  height: 18px;
}

/* Topbar user badge (mobile) */
.topbar-user { display: flex; align-items: center; }

/* ── Invoice words + signatory ───────────────────────────── */
.inv-words {
  margin-top: 14px;
  padding: 10px 16px;
  background: rgba(20,184,166,.05);
  border: 1px solid rgba(20,184,166,.15);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--color-text-dim);
}
.inv-signatory {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
}
.inv-sign-right { text-align: right; font-size: 12.5px; color: var(--color-text-dim); }
.inv-sign-line {
  width: 150px; height: 1px;
  background: var(--color-border2);
  margin: 42px 0 6px auto;
}
.inv-computer-gen {
  text-align: center;
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 10px;
  font-style: italic;
}

/* ── Print rules ─────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-actions,
  .no-print, .alert, .sb-user       { display: none !important; }
  .main-wrapper                      { margin-left: 0 !important; }
  .content                           { padding: 0 !important; }
  body                               { background: #fff; color: #000; }
  .invoice-document                  { background: #fff; border: none; padding: 10px; max-width: 100%; }
  .inv-words                         { background: #f0fdf4 !important; border-color: #0d9488 !important; color: #000 !important; }
  .inv-sign-line                     { background: #000; }
  .inv-signatory, .inv-sign-right,
  .inv-computer-gen, .inv-notes      { color: #333 !important; }
}
