:root {
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: #23364a;
  background: #f5f7fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --navy: #102a43;
  --navy-light: #183e5b;
  --teal: #18a999;
  --ink: #203449;
  --muted: #8291a2;
  --line: #e8edf2;
  --surface: #fff;
  --green: #159570;
  --red: #d65b63;
  --gold: #c0882a;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 252px; flex: 0 0 252px; background: var(--navy); color: #d4dfeb; display: flex; flex-direction: column; padding: 27px 15px 19px; min-height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; padding: 0 10px 36px; }
.brand strong { display: block; font: 800 17px Manrope, sans-serif; letter-spacing: 1.4px; }
.brand small { display: block; color: #94a8ba; font-size: 11px; margin-top: 2px; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: white; background: linear-gradient(145deg, #24b49f, #198f99); font: 800 22px Manrope, sans-serif; box-shadow: 0 6px 15px #091c2a55; }
.brand-logo { width: 39px; height: 39px; flex: 0 0 39px; object-fit: cover; border-radius: 9px; background: white; }
.nav-caption { padding: 0 12px 10px; color: #8299ab; font-size: 9px; font-weight: 700; letter-spacing: 1.2px; }
.navigation { display: grid; gap: 4px; flex: 1; min-height: 0; align-content: start; overflow-y: auto; }
.nav-item { appearance: none; border: 0; width: 100%; text-align: left; color: #b6c6d3; border-radius: 8px; background: transparent; padding: 11px 12px; display: flex; gap: 12px; align-items: center; font-size: 13px; transition: .15s ease; }
.nav-item:hover { color: white; background: #ffffff10; }
.nav-item.active { color: white; background: #ffffff17; box-shadow: inset 3px 0 #28bea9; }
.nav-icon { width: 18px; text-align: center; font-size: 17px; color: #87a1b5; }
.nav-item.active .nav-icon { color: #47d0ba; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid #ffffff18; padding: 17px 9px 0; }
.secure-label { font-size: 11px; color: #99adbc; display: flex; align-items: center; gap: 8px; margin-bottom: 15px; }
.secure-dot { width: 7px; height: 7px; background: #33c193; border-radius: 50%; box-shadow: 0 0 0 3px #33c19322; }
.logout-button { border: 0; padding: 7px 0; background: none; color: #c3d0db; font-size: 13px; }
.main-column { min-width: 0; flex: 1; }
.topbar { height: 84px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 37px; gap: 17px; }
.eyebrow { color: #93a0ad; font-size: 9px; font-weight: 700; letter-spacing: .8px; margin: 0 0 4px; }
.page-title { color: var(--navy); font: 700 17px Manrope, sans-serif; }
.user-chip { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { color: #31465b; font-size: 12px; }
.user-chip small { margin-top: 2px; color: #8b99a6; font-size: 10px; }
.avatar { width: 34px; height: 34px; background: #e9f4f2; color: #198f82; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.menu-button { display: none; border: 0; background: transparent; color: var(--navy); font-size: 20px; }
.content { max-width: 1480px; padding: 30px 37px 52px; margin: 0 auto; }
.welcome-row { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.welcome-row h1 { margin: 0; font: 700 23px Manrope, sans-serif; color: var(--navy); }
.welcome-row p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.button { border: 1px solid transparent; border-radius: 7px; padding: 10px 14px; font-weight: 600; font-size: 12px; display: inline-flex; gap: 9px; align-items: center; justify-content: center; transition: .15s ease; }
.button-primary { background: var(--navy); color: #fff; box-shadow: 0 4px 10px #102a4317; }
.button-primary:hover { background: var(--navy-light); transform: translateY(-1px); }
.button-secondary { background: white; color: #46596c; border-color: #e3e9ee; }
.button-secondary:hover { border-color: #b8c5ce; }
.button-danger { color: #b34953; background: #fff4f4; border-color: #f1d8da; }
.button-small { padding: 6px 9px; font-size: 10px; }
.button-wide { width: 100%; padding: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 21px; }
.stat-card { background: white; border: 1px solid #edf0f3; border-radius: 9px; padding: 17px; box-shadow: 0 3px 12px #16324b05; }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: #768797; font-size: 11px; }
.stat-icon { height: 30px; width: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 16px; background: #edf7f5; color: #208f83; }
.stat-card:nth-child(2) .stat-icon { background: #eff3fb; color: #5478ae; }
.stat-card:nth-child(3) .stat-icon { background: #fff5e8; color: #bd862a; }
.stat-card:nth-child(4) .stat-icon { background: #f3effa; color: #886bb2; }
.stat-value { color: var(--navy); font: 800 23px Manrope, sans-serif; margin-top: 13px; letter-spacing: -.5px; }
.stat-note { font-size: 10px; color: #95a1ad; margin-top: 5px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, .8fr); gap: 17px; }
.panel { background: #fff; border: 1px solid #edf0f3; border-radius: 9px; box-shadow: 0 3px 12px #16324b05; overflow: hidden; }
.panel-head { padding: 17px 19px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #f0f2f4; }
.panel-head h2 { margin: 0; font: 700 13px Manrope, sans-serif; color: #294056; }
.panel-head a, .text-link { color: #178f83; border: 0; background: transparent; font-size: 10px; font-weight: 600; text-decoration: none; }
.panel-body { padding: 18px 19px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 11px; }
th { padding: 11px 14px; background: #fafbfc; color: #8795a3; text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; white-space: nowrap; }
td { padding: 12px 14px; border-top: 1px solid #f0f2f4; color: #42566a; vertical-align: middle; }
td strong { color: #293d51; }
.status { display: inline-flex; align-items: center; border-radius: 20px; padding: 5px 8px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.status-paid, .status-approved { color: #178361; background: #eaf7f0; }
.status-unpaid, .status-pending { color: #b27b20; background: #fff5e4; }
.status-partial { color: #4971a1; background: #eef4fc; }
.status-rejected { color: #b65058; background: #fff0f1; }
.status-cancelled, .status-archived { color: #7d596b; background: #f4edf2; }
.activity-list { display: grid; }
.activity-item { display: flex; gap: 11px; padding: 12px 0; align-items: flex-start; border-bottom: 1px solid #f1f3f5; }
.activity-item:last-child { border-bottom: 0; }
.activity-bullet { width: 8px; height: 8px; border-radius: 50%; background: #21aa98; margin-top: 4px; box-shadow: 0 0 0 4px #21aa981a; }
.activity-item strong { display: block; color: #3b5064; font-size: 11px; font-weight: 600; }
.activity-item small { color: #98a4af; display: block; font-size: 10px; margin-top: 4px; }
.page-tools { display: flex; align-items: center; gap: 9px; }
.search-box { position: relative; }
.search-box input { width: 220px; padding: 9px 12px 9px 31px; border: 1px solid #e4e9ed; border-radius: 7px; outline: none; font-size: 11px; background: #fff; }
.search-box input:focus, input:focus, select:focus, textarea:focus { border-color: #43b9a8; box-shadow: 0 0 0 3px #43b9a815; outline: none; }
.search-box:before { content: "⌕"; position: absolute; left: 11px; top: 4px; color: #8494a2; font-size: 18px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toolbar h1 { margin: 0; font: 700 22px Manrope, sans-serif; color: var(--navy); }
.toolbar p { color: var(--muted); font-size: 11px; margin: 5px 0 0; }
.filter-select { border: 1px solid #e3e9ee; background: white; color: #526579; border-radius: 7px; padding: 9px 11px; font-size: 11px; }
.empty-state { text-align: center; color: #93a0ac; padding: 40px 15px; font-size: 12px; }
.empty-state strong { color: #566a7d; display: block; margin-bottom: 5px; }
.action-row { display: flex; gap: 5px; }
.balance-box { border-radius: 8px; background: linear-gradient(120deg, #113c54, #176b70); color: white; padding: 20px; margin-bottom: 18px; }
.balance-box span { color: #b1dbd7; font-size: 11px; }
.balance-box strong { display: block; font: 800 29px Manrope, sans-serif; margin: 6px 0 2px; }
.balance-box small { color: #c6e4df; font-size: 10px; }
.dialog { border: 0; border-radius: 12px; padding: 0; width: min(660px, calc(100vw - 28px)); max-height: 90vh; box-shadow: 0 18px 70px #081c2e55; }
.dialog::backdrop { background: #102a4378; backdrop-filter: blur(2px); }
.dialog-content { padding: 22px 24px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid #edf0f2; padding-bottom: 14px; margin-bottom: 17px; }
.dialog-head h2 { margin: 0; font: 700 17px Manrope, sans-serif; color: var(--navy); }
.dialog-head p { margin: 5px 0 0; font-size: 10px; color: var(--muted); }
.close-button { border: 0; background: transparent; color: #8493a0; font-size: 21px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.stack-form { display: grid; gap: 13px; }
.form-grid label, .stack-form label { display: grid; gap: 6px; color: #566a7d; font-size: 10px; font-weight: 600; }
.form-grid input, .form-grid select, .form-grid textarea, .stack-form input { width: 100%; border: 1px solid #e0e7eb; border-radius: 6px; padding: 9px 10px; color: #31475b; outline: none; font-size: 11px; background: white; }
.form-grid textarea { min-height: 65px; resize: vertical; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 19px; padding-top: 14px; border-top: 1px solid #edf0f2; }
.toast { position: fixed; bottom: 20px; right: 21px; background: #153950; color: white; padding: 12px 17px; border-radius: 8px; font-size: 12px; box-shadow: 0 8px 24px #102a4333; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; z-index: 20; }
.toast.show { transform: translateY(0); opacity: 1; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 75% 15%, #236c6d 0, transparent 38%), linear-gradient(145deg, #0d2539, #113d55); }
.login-card { background: white; border-radius: 14px; padding: 37px; width: min(410px, 100%); box-shadow: 0 25px 80px #06172455; }
.login-card .brand-mark { margin-bottom: 28px; }
.login-card .brand-logo { width: 52px; height: 52px; margin-bottom: 28px; }
.login-card h1 { margin: 0; color: var(--navy); font: 800 30px Manrope, sans-serif; }
.login-card h1 span { color: var(--teal); }
.login-card .muted { color: #8794a0; font-size: 12px; margin: 7px 0 24px; }
.login-foot { border-top: 1px solid #edf0f2; margin: 20px 0 0; padding-top: 14px; color: #9aa5ae; text-align: center; font-size: 10px; }
.invoice-lines { display: grid; gap: 8px; }
.invoice-line { display: grid; grid-template-columns: 72px minmax(150px, 1fr) 76px 110px 28px; gap: 7px; align-items: center; }
.invoice-line input, .invoice-line select { width: 100%; padding: 8px; border: 1px solid #e0e7eb; border-radius: 5px; font-size: 10px; }
.invoice-totals { display: grid; justify-content: end; gap: 6px; font-size: 11px; color: #66798a; margin: 14px 0; }
.invoice-totals strong { color: var(--navy); }
.print-invoice { display: none; }
.print-cancelled { margin: 0 0 14px; padding: 8px; border: 2px solid #b65058; color: #b65058; text-align: center; font-weight: 800; letter-spacing: 1.5px; }
.muted { color: var(--muted); }
.tiny-note { font-size: 10px; margin: 12px 2px; }
.compact-note { font-size: 10px; margin: 0; }
.profile-value { font-size: 12px; color: #31475b; margin-top: 5px; }
.mt-8 { margin-top: 8px; }
.signature-row { display: flex; justify-content: space-between; margin-top: 18mm; }

@media (max-width: 1000px) {
  .sidebar { width: 220px; flex-basis: 220px; }
  .topbar { padding: 0 23px; }
  .content { padding: 25px 23px 42px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  .sidebar { position: fixed; z-index: 12; left: 0; top: 0; bottom: 0; transform: translateX(-105%); transition: transform .2s; box-shadow: 10px 0 25px #0e263722; }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: block; }
  .topbar { height: 70px; padding: 0 15px; }
  .topbar .eyebrow { font-size: 7px; max-width: 220px; line-height: 1.4; }
  .page-title { font-size: 14px; }
  .user-chip strong, .user-chip small { display: none; }
  .content { padding: 21px 14px 35px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stat-grid { gap: 9px; }
  .stat-card { padding: 13px; }
  .stat-value { font-size: 19px; }
  .stat-top { font-size: 10px; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar .page-tools { width: 100%; }
  .search-box { flex: 1; }
  .search-box input { width: 100%; }
  .welcome-row { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .dialog-content { padding: 18px; }
  .invoice-line { grid-template-columns: 53px minmax(95px, 1fr) 56px 76px 24px; gap: 4px; }
}
@media print {
  body * { visibility: hidden !important; }
  .print-invoice, .print-invoice * { visibility: visible !important; }
  .print-invoice { display: block !important; position: absolute; inset: 0; width: 100%; padding: 10mm 12mm; color: #172b3b; font: 10pt Arial, sans-serif; }
  .print-invoice .print-cancelled { border-color: #b65058; color: #b65058; }
  .print-invoice h1 { font-size: 24pt; margin: 0; color: #12364d; }
  .print-invoice .print-head { display: flex; justify-content: space-between; border-bottom: 2px solid #178f83; padding-bottom: 10mm; }
  .print-invoice .print-brand { display: flex; align-items: center; gap: 5mm; }
  .print-invoice .print-logo { width: 27mm; height: 27mm; object-fit: contain; }
  .print-invoice .print-company p { margin: 2mm 0; font-size: 8pt; }
  .print-invoice .print-meta { text-align: right; }
  .print-invoice .print-details { margin: 8mm 0; font-size: 8pt; }
  .print-invoice .print-details th { width: 14%; background: #f5f7f8 !important; color: #23394d; }
  .print-invoice .print-details td { color: #25384a; }
  .print-invoice .print-items { font-size: 8pt; }
  .print-invoice .print-items th:nth-child(1) { width: 10%; }
  .print-invoice .print-items th:nth-child(2) { width: 49%; }
  .print-invoice .print-items th:nth-child(3) { width: 9%; }
  .print-invoice .print-items th:nth-child(4), .print-invoice .print-items th:nth-child(5) { width: 16%; }
  .print-invoice .print-items td:nth-child(2) { text-align: left; line-height: 1.35; }
  .print-invoice .print-items td:not(:nth-child(2)) { text-align: center; }
  .print-invoice th { background: #edf3f4 !important; color: #18384c; }
  .print-invoice td, .print-invoice th { padding: 3mm; }
  .print-invoice .print-total { margin: 8mm 0 4mm auto; width: 98mm; }
  .print-invoice .print-total div { display: flex; justify-content: space-between; padding: 2mm; border-bottom: 1px solid #dfe5e8; }
  .print-invoice .print-total .grand { font-size: 13pt; font-weight: 700; color: #12364d; border-bottom: 2px solid #12364d; }
  .print-invoice .print-words { display: grid; gap: 2mm; margin: 6mm 0; font-style: italic; }
  .print-invoice .signature-row { margin-top: 18mm; }
  .print-invoice .print-footer { border-top: 1px solid #b8c5cd; padding-top: 3mm; margin-top: 12mm; text-align: center; font-size: 7pt; line-height: 1.45; }
  @page { size: A4; margin: 12mm; }
}

:root {
  font-family: Inter, "Segoe UI Variable", "Segoe UI", sans-serif;
  color: #233447;
  background: #f3f6f8;
  --navy: #254c75;
  --navy-light: #3569a5;
  --teal: #73b52a;
  --ink: #1e3448;
  --muted: #78899a;
  --line: #e4eaf0;
  --surface: #fff;
  --green: #5e901f;
  --red: #c84e59;
  --gold: #80501f;
}

body {
  color: #233447;
  background: #f3f6f8;
  font-size: 13px;
  line-height: 1.5;
}

button, input, select, textarea { font-family: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #148a7938;
  outline-offset: 2px;
}

.sidebar {
  width: 258px;
  flex-basis: 258px;
  padding: 25px 14px 18px;
  border-right: 1px solid #e6ecf1;
  background: #fff;
  color: #526579;
  box-shadow: none;
}

.brand { padding: 2px 11px 33px; gap: 12px; color: #244361; }
.brand strong { font-size: 16px; letter-spacing: 1.2px; }
.brand small { color: #80909e; font-size: 10px; }
.brand-logo {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  object-fit: cover;
  border: 1px solid #e3eaf0;
  border-radius: 11px;
  box-shadow: 0 2px 7px #203f600d;
}

.nav-caption { padding: 0 12px 12px; color: #93a0ac; font-size: 9px; letter-spacing: 1.3px; }
.navigation { gap: 5px; scrollbar-width: thin; scrollbar-color: #c9d4df transparent; }
.nav-item {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #566b7f;
  font-size: 12px;
  font-weight: 500;
}
.nav-item:hover { color: #254c75; background: #f4f7fa; }
.nav-item.active {
  color: #2d5f98;
  background: #edf3fb;
  box-shadow: inset 3px 0 #73b52a;
}
.nav-icon { color: #8a9cac; font-size: 16px; }
.nav-item.active .nav-icon { color: #3569a5; }
.sidebar-bottom { padding: 15px 9px 0; border-top-color: #e6ecf1; }
.secure-label { color: #7e8d9a; font-size: 10px; }
.logout-button { color: #436383; font-size: 12px; }
.logout-button:hover { color: #254c75; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  height: 76px;
  padding: 0 38px;
  border-bottom-color: #e8edf1;
  box-shadow: 0 2px 10px #182f4006;
}
.topbar .eyebrow { color: #8291a0; font-size: 9px; letter-spacing: .85px; }
.page-title { color: #18374d; font-size: 16px; }
.user-chip { gap: 10px; }
.user-chip strong { color: #273f54; font-size: 11px; }
.user-chip small { color: #8796a4; font-size: 10px; }
.avatar { width: 36px; height: 36px; border: 1px solid #e0ebd5; background: #f0f7e8; color: #56851e; }

.content { max-width: 1500px; padding: 34px 40px 58px; }
.welcome-row { margin-bottom: 25px; }
.welcome-row h1 { color: #142f45; font-size: 25px; letter-spacing: -.5px; }
.welcome-row p { color: #78899a; font-size: 12px; }
.toolbar { align-items: center; margin-bottom: 21px; }
.toolbar h1 { color: #142f45; font-size: 23px; letter-spacing: -.45px; }
.toolbar p { color: #7d8c9a; font-size: 11px; }

.button { min-height: 37px; border-radius: 8px; padding: 9px 14px; font-size: 11px; font-weight: 650; }
.button-primary {
  color: #fff;
  background: #3569a5;
  box-shadow: 0 3px 8px #102b401b;
}
.button-primary:hover { background: #28578f; box-shadow: 0 5px 13px #102b4021; transform: translateY(-1px); }
.button-secondary { color: #40586b; background: #fff; border-color: #dfe6eb; }
.button-secondary:hover { color: #18374d; border-color: #bdcbd3; background: #fbfcfd; }
.button-danger { color: #a63e49; background: #fff6f6; border-color: #efd9dc; }
.button-danger:hover { background: #ffeded; }
.button:disabled { opacity: .58; cursor: wait; transform: none; }

.stat-grid { gap: 16px; margin-bottom: 20px; }
.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 19px 20px;
  border: 1px solid #e8edf1;
  border-radius: 12px;
  box-shadow: 0 4px 16px #18384c08;
}
.stat-card::after {
  position: absolute;
  top: -20px;
  right: -17px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: #f1f7e8;
  content: "";
}
.stat-top { position: relative; z-index: 1; color: #708191; font-size: 11px; font-weight: 550; }
.stat-icon { position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 10px; font-size: 17px; }
.stat-value { position: relative; z-index: 1; margin-top: 15px; color: #17364c; font-size: 25px; letter-spacing: -.7px; }
.stat-note { position: relative; z-index: 1; color: #82919d; font-size: 10px; }

.dashboard-grid { gap: 18px; }
.panel {
  border-color: #e7edf1;
  border-radius: 12px;
  box-shadow: 0 4px 16px #18384c07;
}
.panel-head { min-height: 54px; padding: 16px 19px; border-bottom-color: #edf1f4; }
.panel-head h2 { color: #263f54; font-size: 12px; }
.panel-head a, .text-link { color: #5d8e26; font-size: 10px; }
.panel-body { padding: 19px; }

.table-wrap { border-radius: 10px; }
table { font-size: 11px; }
th {
  padding: 12px 15px;
  border-bottom: 1px solid #e9eef2;
  background: #f8fafb;
  color: #778897;
  font-size: 9px;
  letter-spacing: .65px;
}
td { padding: 13px 15px; border-top-color: #edf1f4; color: #4a5d6e; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f8fbfb; }
td strong { color: #233b50; font-weight: 650; }
.status { padding: 5px 9px; font-size: 9px; letter-spacing: .1px; }
.status-paid, .status-approved { color: #107457; background: #e8f5ef; }
.status-unpaid, .status-pending { color: #946419; background: #fff4df; }
.status-partial { color: #426d9e; background: #edf3fa; }
.status-rejected { color: #a9434d; background: #fceef0; }
.empty-state { padding: 48px 18px; color: #8695a2; font-size: 11px; }
.empty-state strong { color: #455b6e; font-size: 12px; }
.activity-item { gap: 13px; padding: 13px 0; }
.activity-item strong { color: #344c60; font-size: 11px; }
.activity-item small { color: #8493a0; font-size: 10px; }

.search-box input, .filter-select {
  min-height: 37px;
  border: 1px solid #dfe6eb;
  border-radius: 8px;
  color: #40566a;
  font-size: 11px;
}
.search-box input::placeholder { color: #9aa7b2; }
.search-box input:focus, input:focus, select:focus, textarea:focus {
  border-color: #79b83a;
  box-shadow: 0 0 0 3px #73b52a24;
}

.form-grid { gap: 16px 18px; }
.form-grid label, .stack-form label { gap: 7px; color: #536779; font-size: 10px; font-weight: 600; }
.form-grid input, .form-grid select, .form-grid textarea, .stack-form input {
  min-height: 39px;
  padding: 10px 11px;
  border: 1px solid #dce5ea;
  border-radius: 8px;
  color: #273e52;
  font-size: 11px;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.form-grid textarea { min-height: 80px; line-height: 1.5; }
.form-actions { margin-top: 21px; padding-top: 16px; border-top-color: #e9eef1; }
.dialog {
  border-radius: 14px;
  box-shadow: 0 24px 80px #0b20345c;
}
.dialog::backdrop { background: #102b4080; backdrop-filter: blur(3px); }
.dialog-content { padding: 25px 27px; }
.dialog-head { margin-bottom: 20px; padding-bottom: 16px; border-bottom-color: #e8edf1; }
.dialog-head h2 { color: #18364c; font-size: 17px; letter-spacing: -.2px; }
.dialog-head p { color: #83919d; font-size: 10px; }
.close-button { color: #71818e; }
.close-button:hover { color: #20394c; }

.balance-box {
  position: relative;
  overflow: hidden;
  border: 1px solid #477f38;
  border-radius: 12px;
  background: linear-gradient(115deg, #28598e 0%, #4f872c 100%);
  box-shadow: 0 7px 20px #12364d1a;
}
.balance-box::after { position: absolute; top: -38px; right: 12%; width: 150px; height: 150px; border: 1px solid #ffffff22; border-radius: 50%; content: ""; }
.balance-box::before { position: absolute; top: -17px; right: 7%; width: 108px; height: 108px; border: 1px solid #ffffff18; border-radius: 50%; content: ""; }

.toast { z-index: 30; border: 1px solid #ffffff24; border-radius: 9px; font-size: 11px; }
.login-screen {
  background:
    radial-gradient(ellipse at 82% 18%, #73b52a55 0, transparent 34%),
    radial-gradient(ellipse at 10% 100%, #3569a570 0, transparent 45%),
    linear-gradient(140deg, #142d49, #254c75);
}
.login-card { border: 1px solid #e3eaf0; border-radius: 16px; box-shadow: 0 18px 48px #203b5517; }
.login-card .brand-logo { border: 1px solid #e7edf0; border-radius: 12px; }
.login-card h1 { letter-spacing: -.8px; }
.login-card .eyebrow { color: #728392; font-size: 9px; letter-spacing: 1px; }
.login-card .muted { color: #7e8d9a; }
.login-foot { color: #8d9aa5; }

@media (max-width: 1000px) {
  .content { padding-right: 25px; padding-left: 25px; }
  .topbar { padding-right: 25px; padding-left: 25px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.3fr) minmax(250px, .8fr); }
}

@media (max-width: 740px) {
  .sidebar { width: min(290px, 84vw); flex-basis: min(290px, 84vw); padding: 22px 13px 16px; }
  .brand { padding-bottom: 26px; }
  .topbar { height: 68px; padding: 0 14px; gap: 12px; }
  .topbar .eyebrow { max-width: 215px; font-size: 7px; }
  .content { padding: 23px 15px 40px; }
  .welcome-row h1 { font-size: 22px; }
  .toolbar h1 { font-size: 21px; }
  .stat-grid { gap: 10px; }
  .stat-card { min-height: 120px; padding: 15px; border-radius: 11px; }
  .stat-value { font-size: 21px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .panel-head { padding-right: 15px; padding-left: 15px; }
  .panel-body { padding: 16px; }
  .dialog-content { padding: 20px 17px; }
  .form-grid { gap: 13px; }
  .toolbar .page-tools { align-items: stretch; flex-wrap: wrap; }
  .toolbar .page-tools > .button { flex: 1 0 auto; }
  .invoice-line { grid-template-columns: 46px minmax(85px, 1fr) 52px 72px 22px; gap: 4px; }
  .invoice-line input, .invoice-line select { padding: 7px 5px; font-size: 9px; }
  .print-invoice { display: none; }
}

@media (max-width: 390px) {
  .stat-grid { grid-template-columns: 1fr; }
  .user-chip { margin-left: auto; }
  .topbar .eyebrow { max-width: 170px; }
  .invoice-line { grid-template-columns: 40px minmax(74px, 1fr) 45px 66px 20px; }
}

@media print {
  .print-invoice {
    position: absolute;
    inset: 0;
    width: 100%;
    padding: 5mm 4mm;
    background: #fff;
    color: #172b3b;
    font-size: 9pt;
  }
  .print-invoice .print-head { align-items: center; padding-bottom: 7mm; }
  .print-invoice .print-brand { min-width: 0; }
  .print-invoice .print-company { min-width: 0; }
  .print-invoice .print-company h1 { font-size: 21pt; line-height: 1.08; }
  .print-invoice .print-company p { font-size: 8.5pt; line-height: 1.35; }
  .print-invoice .print-meta { flex: 0 0 52mm; min-width: 52mm; }
  .print-invoice .print-meta strong { font-size: 8pt; letter-spacing: .5px; }
  .print-invoice .print-meta h2 { margin: 2mm 0 0; font-size: 14pt; white-space: nowrap; }
  .print-invoice .print-details {
    width: 100%;
    margin: 6mm 0;
    border: 1px solid #b8c8d0;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8.5pt;
  }
  .print-invoice .print-details th,
  .print-invoice .print-details td,
  .print-invoice .print-items th,
  .print-invoice .print-items td {
    border: 1px solid #c5d0d6;
    padding: 2.5mm 2mm;
    vertical-align: middle;
  }
  .print-invoice .print-details th { width: 14%; text-align: left; }
  .print-invoice .print-details td { overflow-wrap: anywhere; }
  .print-invoice .print-items {
    width: 100%;
    border: 1px solid #aebfc8;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8.5pt;
  }
  .print-invoice .print-items th { font-size: 7.8pt; line-height: 1.25; }
  .print-invoice .print-items th:nth-child(1) { width: 10%; }
  .print-invoice .print-items th:nth-child(2) { width: 40%; }
  .print-invoice .print-items th:nth-child(3) { width: 8%; }
  .print-invoice .print-items th:nth-child(4),
  .print-invoice .print-items th:nth-child(5) { width: 21%; }
  .print-invoice .print-items td:nth-child(2) { overflow-wrap: anywhere; }
  .print-invoice .print-total {
    width: 92mm;
    margin: 7mm 0 4mm auto;
    border: 1px solid #aebfc8;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8.5pt;
  }
  .print-invoice .print-total th,
  .print-invoice .print-total td {
    border: 1px solid #c5d0d6;
    padding: 2.5mm 2mm;
    vertical-align: middle;
  }
  .print-invoice .print-total th { width: 65%; text-align: left; }
  .print-invoice .print-total td { text-align: right; white-space: nowrap; font-weight: 650; }
  .print-invoice .print-total .grand th,
  .print-invoice .print-total .grand td {
    border-top: 2px solid #12364d;
    border-bottom: 2px solid #12364d;
    background: #edf3f4 !important;
    color: #12364d;
    font-size: 10pt;
    font-weight: 750;
  }
  .print-invoice .print-words { margin: 6mm 0; line-height: 1.4; }
  .print-invoice .signature-row { min-height: 28mm; margin-top: 14mm; }
  .print-invoice .print-footer { margin-top: 8mm; font-size: 7.5pt; line-height: 1.5; }
}

.stat-icon { background: #eff6e8; color: #5e901f; }
.stat-card:nth-child(2) .stat-icon { background: #edf3fb; color: #3569a5; }
.stat-card:nth-child(3) .stat-icon { background: #f7f0e8; color: #80501f; }
.stat-card:nth-child(4) .stat-icon { background: #f1f7e8; color: #5e901f; }
.activity-bullet { background: #73b52a; box-shadow: 0 0 0 4px #73b52a24; }
.secure-dot { background: #83c33b; box-shadow: 0 0 0 3px #83c33b24; }

@media print {
  .print-invoice .print-head { border-bottom-color: #178f83; }
  .print-invoice h1 { color: #12364d; }
  .print-invoice .print-details th { background: #f5f7f8 !important; color: #23394d; }
  .print-invoice .print-items th { background: #edf3f4 !important; color: #18384c; }
  .print-invoice .print-total .grand th,
  .print-invoice .print-total .grand td {
    border-color: #12364d;
    background: #edf3f4 !important;
    color: #12364d;
  }
  .print-invoice .print-footer { border-top-color: #b8c5cd; }
}

.stat-card::after { background: #f1f5f9; }
.stat-icon,
.stat-card:nth-child(n) .stat-icon { background: #edf3fb; color: #3569a5; }
.balance-box {
  border-color: #284f7a;
  background: linear-gradient(120deg, #28598e, #3569a5);
}
.balance-box span { color: #d7e4f2; }
.balance-box small { color: #e2ebf5; }
.login-screen { background: linear-gradient(145deg, #f8fafc, #edf2f7); }
