:root {
  --bg: #edf4ed;
  --bg-strong: #e3efdf;
  --surface: #ffffff;
  --surface-soft: #f7faf5;
  --surface-muted: #edf4ed;
  --ink: #16251b;
  --ink-soft: #3a4b41;
  --muted: #5d6d63;
  --primary: #183d2a;
  --primary-strong: #1f5637;
  --primary-soft: #dfeee6;
  --primary-soft-strong: #cfe8d8;
  --success: #1d7d4d;
  --success-soft: #dff6e8;
  --danger: #c94a3d;
  --danger-soft: #fde9e6;
  --warning: #986c1f;
  --warning-soft: #faf0d0;
  --border: #dfe8d8;
  --input-bg: #f9fbf8;
  --chip-muted: #edf0e7;
  --shadow: 0 10px 26px rgba(18, 38, 28, 0.08);
  --shadow-soft: 0 1px 2px rgba(18, 38, 28, 0.04);
  --radius: 16px;
  --radius-sm: 12px;
  --sidebar-width: 240px;
  color-scheme: light;
}

.dark-theme {
  --bg: #0b1217;
  --bg-strong: #111d24;
  --surface: #101b21;
  --surface-soft: #17262d;
  --surface-muted: #0d171d;
  --ink: #edf3f5;
  --ink-soft: #d5e0e1;
  --muted: #9aa8af;
  --primary: #9fe0b8;
  --primary-strong: #7ed1a3;
  --primary-soft: rgba(70, 185, 123, 0.14);
  --primary-soft-strong: rgba(70, 185, 123, 0.2);
  --success: #6dd5a0;
  --success-soft: rgba(109, 213, 160, 0.12);
  --danger: #ff8d85;
  --danger-soft: rgba(255, 141, 133, 0.12);
  --warning: #f2d58a;
  --warning-soft: rgba(242, 213, 138, 0.14);
  --border: rgba(148, 168, 175, 0.16);
  --input-bg: #111d24;
  --chip-muted: rgba(255, 255, 255, 0.03);
  --shadow: 0 14px 36px rgba(3, 8, 11, 0.4);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(73, 127, 89, 0.12), transparent 30%), var(--bg);
  color: var(--ink);
  font-family: 'Poppins', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.app {
  display: flex;
  min-height: 100vh;
  max-width: 1680px;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid var(--border);
  padding: 20px 14px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--primary-strong); font-weight: 600; }

.nav { list-style: none; margin: 0; padding: 0; flex: 1; }
.nav li + li { margin-top: 2px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav a:hover {
  background: var(--surface-soft);
  transform: translateX(2px);
}

.nav a.active {
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary-soft-strong);
}

.nav .icon { width: 18px; text-align: center; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}

/* Main column */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.dark-theme .topbar {
  background: rgba(16, 27, 33, 0.78);
}

.topbar-spacer { flex: 1; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.search-box {
  flex: 1;
  max-width: 440px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  font-size: 13px;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.search-box::placeholder { color: var(--muted); }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.mobile-menu-btn {
  display: none;
  min-width: 46px;
}

.icon-btn:hover {
  background: var(--surface-soft);
  border-color: var(--primary-soft-strong);
  transform: translateY(-1px);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-soft);
}

.content { padding: 28px; flex: 1; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--primary-soft-strong);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.04);
}

.btn-outline { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-danger {
  color: var(--danger);
  border-color: var(--danger-soft);
  background: var(--danger-soft);
}

.btn[data-theme-toggle] { min-width: 140px; }

/* Page header */
.page-title { font-size: 26px; font-weight: 800; margin: 0 0 4px; }
.page-sub { color: var(--primary-strong); margin: 0 0 24px; font-size: 14px; }
.page-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.stat-card { padding: 18px 20px; }
.stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  text-transform: uppercase;
}
.stat-value { font-size: 28px; font-weight: 800; margin-top: 8px; }
.stat-value.green { color: var(--success); }
.stat-value.red { color: var(--danger); }

/* Filter tabs */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.tab {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.tab.active {
  background: var(--surface-muted);
  color: var(--ink);
}

/* Order cards */
.order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.order-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status-actions { display: inline-flex; align-items: center; gap: 10px; }
.inline-form { display: inline-flex; margin: 0; }
.inline-form .btn { white-space: nowrap; }
.order-id { font-size: 12px; font-weight: 700; color: var(--muted); }
.order-name { font-size: 20px; font-weight: 800; margin: 2px 0 4px; }
.customer-card { min-height: 190px; }

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.pill-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pill-paid { background: var(--success-soft); color: var(--success); }
.pill-unpaid { background: var(--danger-soft); color: var(--danger); }

.pill-pending { background: var(--chip-muted); color: var(--muted); }
.pill-in_progress { background: var(--success-soft); color: var(--success); }
.pill-finished { background: var(--primary); color: #fff; }
.pill-cancelled { background: var(--danger-soft); color: var(--danger); }
.pill-high { background: var(--danger-soft); color: var(--danger); }
.pill-medium { background: var(--success-soft); color: var(--success); }
.pill-low { background: var(--chip-muted); color: var(--muted); }
.pill-active { background: var(--success-soft); color: var(--success); }
.pill-inactive { background: var(--danger-soft); color: var(--danger); }
.pill-on_leave { background: var(--chip-muted); color: var(--ink); }

.kv-row { display: flex; justify-content: space-between; font-size: 13px; }
.kv-row .k { color: var(--muted); }
.kv-row .v { font-weight: 600; }

.employee-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.employee-name-link {
  color: var(--ink);
  text-decoration: none;
}

.employee-name-link:hover {
  color: var(--primary);
}

.employee-detail-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.employee-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.employee-detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.employee-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.employee-section {
  padding: 20px;
}

.employee-section h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.employee-summary-list {
  display: flex;
  flex-direction: column;
}

.employee-section .kv-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.employee-section .kv-row:last-child {
  border-bottom: none;
}

.employee-summary-row {
  padding: 10px 0;
}

.employee-section .kv-row .k,
.employee-section .kv-row .v {
  display: block;
  width: 100%;
}

.employee-section .kv-row .k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.employee-section .kv-row .v {
  font-size: 13px;
  font-weight: 600;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: left;
}

.employee-history-card {
  margin-top: 0;
}

.employee-table-wrap {
  overflow-x: auto;
}

.employee-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.employee-table th,
.employee-table td {
  padding: 12px 10px;
  text-align: left;
  border-top: 1px solid var(--border);
  vertical-align: top;
}

.employee-table thead th {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.employee-table tbody tr:hover {
  background: rgba(138, 151, 141, 0.04);
}

.employee-table .empty-row {
  text-align: center;
  color: var(--muted);
  padding: 18px 10px;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

@media (max-width: 680px) {
  .employee-detail-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .employee-detail-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .employee-section .kv-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.order-total-row {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}

.progress-dots { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(138, 151, 141, 0.6); }
.dot.filled { background: var(--primary-strong); }
.dot-line { flex: 1; height: 2px; background: rgba(138, 151, 141, 0.6); }
.dot-line.filled { background: var(--primary-strong); }

/* Forms */
.form-card { padding: 24px; margin-bottom: 20px; }
.form-card h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 800;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 700; color: var(--primary-strong); }
.field .required { color: var(--danger); }

input[type=text], input[type=email], input[type=number], input[type=date],
input[type=password], textarea, select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-soft-strong);
  box-shadow: 0 0 0 3px rgba(31, 86, 55, 0.12);
}

textarea { resize: vertical; }

table.items-table { width: 100%; border-collapse: collapse; }
table.items-table th {
  text-align: left;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
table.items-table td { padding: 8px 10px; vertical-align: top; border-bottom: 1px solid var(--border); }
table.items-table input { padding: 8px; font-size: 13px; }
.amount-cell { text-align: right; font-weight: 700; white-space: nowrap; }
.qty-cell input, .rate-cell input { text-align: right; }
.row-remove {
  color: var(--danger);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 16px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.row-remove:hover { background: var(--danger-soft); }

.add-row-btn {
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--primary-strong);
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}

.totals-box { max-width: 320px; margin-left: auto; margin-top: 16px; }
.totals-box .kv-row { padding: 6px 0; }
.totals-box .grand { font-size: 17px; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px; }
.totals-box .grand .v { color: var(--primary-strong); }

.discount-input { display: flex; align-items: center; gap: 4px; }
.discount-input input { width: 70px; text-align: right; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* Detail page */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.detail-grid.thirds { grid-template-columns: 1fr 1fr 1.1fr; }
.info-card { padding: 20px; }
.info-card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 800; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.info-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.info-row .k { color: var(--muted); }
.info-row .v { font-weight: 700; text-align: right; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--primary-strong); margin-bottom: 8px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 20px 28px; border-left: 2px solid var(--border); margin-left: 8px; }
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline .dot-check {
  position: absolute; left: -11px; top: -2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary-strong); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.timeline .t-title { font-weight: 700; font-size: 13px; }
.timeline .t-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.timeline .t-note {
  margin-top: 6px;
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}

/* Expense page */
.expense-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.summary-card { padding: 24px; border-radius: var(--radius); }
.summary-card.dark { background: linear-gradient(135deg, var(--primary), var(--primary-strong)); color: #fff; }
.summary-card .label { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; opacity: .8; font-weight: 700; }
.summary-card .big { font-size: 34px; font-weight: 800; margin: 10px 0; }
.summary-card p { font-size: 12px; opacity: .85; margin: 0; }
.summary-list .row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.summary-list .row:last-child { border-bottom: none; font-weight: 800; font-size: 15px; }

.order-context-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; font-size: 13px; color: var(--muted); }
.order-context-bar .pill-order { background: var(--surface-muted); font-weight: 700; padding: 6px 12px; border-radius: 8px; color: var(--ink); }

.order-name-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 16px 0 12px; }
.order-name-row .order-name { margin: 0; }
.expense-card-list { margin-top: 16px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;

  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card { width: 360px; padding: 32px; text-align: center; }
.login-card .brand-mark { margin: 0 auto 14px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.login-card .field { text-align: left; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 6px; }
.error-list { color: var(--red); font-size: 12px; margin: 0 0 12px; text-align: left; }

/* Reports */
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.bar-label { width: 130px; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.bar-track { flex: 1; height: 10px; background: var(--surface-muted); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary-strong); border-radius: 6px; }
.bar-fill.danger-fill { background: var(--danger); }
.bar-value { width: 90px; text-align: right; font-size: 12px; font-weight: 700; flex-shrink: 0; }

/* Dashboard charts */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.chart-card { padding: 20px 22px; }
.chart-card.span-2 { grid-column: span 2; }

.chart-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
}

.chart-card .chart-sub {
  margin: 0 0 18px;
  font-size: 12px;
  color: var(--muted);
}

.chart-card .empty-state { padding: 20px 0; text-align: left; }

.donut-layout {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.donut-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  flex-shrink: 0;
}

.donut {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.donut-hole {
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px var(--border);
}

.donut-hole .donut-total { font-size: 22px; font-weight: 800; line-height: 1; }
.donut-hole .donut-caption { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; margin-top: 4px; }

.chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
  min-width: 150px;
}

.chart-legend .legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-label { color: var(--ink-soft); font-weight: 600; flex: 1; }
.legend-value { font-weight: 800; }
.legend-pct { color: var(--muted); font-size: 11px; width: 42px; text-align: right; }

/* Trend columns */
.trend-legend { display: flex; gap: 18px; margin-bottom: 16px; }
.trend-legend .legend-row { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--ink-soft); }

.chart-columns {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 170px;
  padding-top: 8px;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chart-col-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 130px;
  width: 100%;
}

.chart-bar {
  width: 14px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}

.chart-bar.revenue-bar { background: var(--primary-strong); }
.chart-bar.expenses-bar { background: var(--danger); }

.chart-col-label { font-size: 11px; color: var(--muted); font-weight: 700; }

/* Invoice */
.invoice-wrap { max-width: 760px; margin: 40px auto; padding: 40px; background: #fff; }
.invoice-head { display: flex; justify-content: space-between; margin-bottom: 30px; }
.invoice-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.invoice-table th, .invoice-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.invoice-table th { text-transform: uppercase; font-size: 11px; color: var(--muted); }
.invoice-totals { max-width: 260px; margin-left: auto; margin-top: 16px; }
.print-bar { max-width: 760px; margin: 20px auto 0; display: flex; justify-content: flex-end; gap: 10px; }

@media print {
  .print-bar { display: none; }
  body { background: #fff; }
  .invoice-wrap { margin: 0; box-shadow: none; }
}

.text-muted { color: var(--muted); }

@media (max-width: 1100px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); width: var(--sidebar-width); z-index: 60; transition: transform 0.25s ease; background: var(--surface); box-shadow: 12px 0 40px rgba(18, 38, 28, 0.12); visibility: hidden; }
  .sidebar-footer { display: none; }
  body.mobile-nav-open .sidebar { transform: translateX(0); visibility: visible; }
  .app { min-height: 100vh; }
  .topbar { padding: 12px 16px; }
  .mobile-menu-btn { display: inline-flex; }
  .search-box { max-width: none; width: 100%; }
  .topbar-actions { gap: 8px; flex-wrap: wrap; margin-left: 0; }
  .content { padding: 16px; }
  .page-head-row { flex-direction: column; align-items: stretch; }
  .actions-row { justify-content: flex-start; }
  .card { border-radius: 18px; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); visibility: hidden; }
  body.mobile-nav-open .sidebar { transform: translateX(0); visibility: visible; }
  .topbar { position: relative; }
  .topbar-spacer { display: none; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .mobile-menu-btn { display: inline-flex; }
  .field-grid, .field-grid.cols-3 { grid-template-columns: 1fr; }
  .detail-grid, .detail-grid.thirds { grid-template-columns: 1fr; }
  .order-grid, .stat-grid { grid-template-columns: 1fr; }
  .expense-layout { grid-template-columns: 1fr; }
  .page-title { font-size: 22px; }
  .page-sub { margin-bottom: 18px; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .content { padding: 16px; }
  .form-card { padding: 18px; }
  .kv-row { flex-wrap: wrap; gap: 10px; }
  .kv-row .k, .kv-row .v { width: 100%; }
  .items-table { display: block; overflow-x: auto; }
  .items-table thead, .items-table tbody, .items-table tr { display: table; width: 100%; }
  .items-table th, .items-table td { white-space: nowrap; }
  .summary-card, .invoice-wrap { padding: 20px; }
  .order-name-row { flex-direction: column; align-items: stretch; }
  .order-name-row a { width: 100%; margin-top: 10px; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn { width: 100%; }
  .btn { width: auto; }
}

@media (max-width: 700px) {
  .topbar-actions { gap: 6px; }
  .search-box { order: 3; }
  .mobile-menu-btn { min-width: 38px; }
  .btn, .icon-btn { width: 100%; justify-content: center; }
  .topbar-actions { flex-direction: column; align-items: stretch; }
  .btn-primary { width: 100%; }
}
