:root {
  --ink: #17221f;
  --muted: #6f7e79;
  --faint: #9aa7a2;
  --line: #e4eae7;
  --canvas: #f4f7f5;
  --surface: #ffffff;
  --green-950: #12342d;
  --green-900: #173e35;
  --green-800: #205247;
  --green-700: #2e6d5e;
  --green-600: #418878;
  --green-100: #dff0e9;
  --green-50: #eff8f4;
  --orange: #d9822b;
  --orange-soft: #fff2df;
  --red: #c95650;
  --red-soft: #feeeec;
  --blue: #4e7eb4;
  --blue-soft: #eaf2fb;
  --purple: #8265a7;
  --purple-soft: #f1ecf7;
  --shadow-sm: 0 1px 2px rgba(18, 52, 45, .04), 0 4px 16px rgba(18, 52, 45, .035);
  --shadow-lg: 0 20px 60px rgba(14, 39, 33, .18);
  --radius: 16px;
  --sidebar: 248px;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .metric-value { font-family: "Manrope", "DM Sans", sans-serif; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar); display: flex; flex-direction: column;
  padding: 24px 14px 15px; background: var(--green-950); color: rgba(255,255,255,.76); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 28px; color: white; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; position: relative; border-radius: 11px; background: #f4faf7; overflow: hidden; }
.brand-mark span { position: absolute; width: 9px; height: 23px; border-radius: 9px 9px 2px 9px; background: var(--green-800); transform-origin: bottom center; bottom: 7px; }
.brand-mark span:nth-child(1) { transform: rotate(-47deg); left: 8px; height: 16px; }
.brand-mark span:nth-child(2) { transform: rotate(-8deg); left: 14px; height: 24px; }
.brand-mark span:nth-child(3) { transform: rotate(42deg); right: 7px; height: 18px; }
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-family: Manrope, sans-serif; font-size: 18px; letter-spacing: -.4px; }
.brand-copy small { color: #a7c6bd; font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; margin-top: 5px; }
.main-nav { flex: 1; }
.nav-label { margin: 0 12px 8px; color: #72978c; font-size: 10px; font-weight: 700; letter-spacing: 1.25px; text-transform: uppercase; }
.nav-label.spaced { margin-top: 24px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 44px; margin: 2px 0; padding: 0 12px; border-radius: 10px; font-size: 13px; font-weight: 500; transition: .18s ease; }
.nav-item:hover { color: white; background: rgba(255,255,255,.055); }
.nav-item.active { color: white; background: rgba(255,255,255,.105); box-shadow: inset 3px 0 0 #74b29f; }
.nav-icon { width: 18px; text-align: center; font-size: 18px; color: #9fc2b7; }
.nav-item.active .nav-icon { color: #d8efe8; }
.nav-count { margin-left: auto; min-width: 21px; padding: 2px 6px; border-radius: 10px; background: rgba(255,255,255,.12); color: white; font-size: 10px; text-align: center; }
.nav-count.danger { color: #ffd8d3; background: rgba(220,84,73,.28); }
.nav-count.warning { color: #ffe9bd; background: rgba(217,130,43,.23); }
.sidebar-footer { padding-top: 18px; }
.support-card { display: flex; align-items: center; gap: 9px; padding: 12px; margin-bottom: 12px; border: 1px solid rgba(255,255,255,.07); border-radius: 11px; background: rgba(255,255,255,.035); }
.support-card .support-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.1); color: white; }
.support-card div { display: grid; flex: 1; }
.support-card strong { color: white; font-size: 11px; }
.support-card small { color: #80a79c; font-size: 10px; margin-top: 2px; }
.support-card .icon-button { color: #a7c6bd; }
.profile-card { width: 100%; display: flex; align-items: center; gap: 9px; border: 0; border-top: 1px solid rgba(255,255,255,.08); padding: 15px 7px 2px; background: none; color: white; text-align: left; }
.avatar { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: #d9e9e3; color: var(--green-900); font-size: 11px; font-weight: 800; }
.profile-copy { display: grid; min-width: 0; flex: 1; }
.profile-copy strong, .profile-copy small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-copy strong { font-size: 11px; }
.profile-copy small { color: #82a99d; font-size: 9px; margin-top: 3px; }

.main-content { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { height: 72px; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 0 30px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.menu-toggle { display: none !important; }
.search-wrap { width: min(470px, 48vw); position: relative; display: flex; align-items: center; gap: 9px; padding: 0 13px; height: 39px; border: 1px solid #dce4e0; border-radius: 10px; background: #f8faf9; color: var(--faint); }
.search-wrap:focus-within { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(65,136,120,.12); background: white; }
.search-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search-wrap kbd { padding: 3px 5px; border: 1px solid #d8e0dd; border-radius: 5px; background: white; color: var(--muted); font-size: 9px; white-space: nowrap; }
.search-results { position: absolute; top: 47px; left: 0; right: 0; padding: 7px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); color: var(--ink); }
.search-result { width: 100%; display: flex; gap: 10px; padding: 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; }
.search-result:hover { background: var(--green-50); }
.search-result span:first-child { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; background: var(--green-100); color: var(--green-800); }
.search-result small { display: block; margin-top: 2px; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.period-chip { height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; background: white; color: var(--muted); font-size: 10px; }
.live-dot { width: 6px; height: 6px; display: inline-block; margin-right: 5px; border-radius: 50%; background: #47a27f; box-shadow: 0 0 0 3px #dff1e9; }
.icon-button { width: 35px; height: 35px; display: inline-grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--green-50); color: var(--green-800); }
.notification-button { position: relative; border: 1px solid var(--line); background: white; }
.notification-button b { position: absolute; top: -5px; right: -4px; min-width: 16px; height: 16px; display: grid; place-items: center; border: 2px solid white; border-radius: 9px; background: var(--red); color: white; font-size: 8px; }
.primary-button, .secondary-button { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 9px; padding: 0 14px; font-weight: 600; font-size: 11px; transition: .18s ease; }
.primary-button { border: 1px solid var(--green-900); background: var(--green-900); color: white; box-shadow: 0 2px 7px rgba(23,62,53,.18); }
.primary-button:hover { background: var(--green-800); transform: translateY(-1px); }
.secondary-button { border: 1px solid #dbe3df; background: white; color: #42534e; }
.secondary-button:hover { border-color: #bfcfc9; background: #fafcfb; }
.primary-button.compact { min-height: 36px; padding: 0 12px; }
.secondary-button.small { min-height: 34px; padding: 0 11px; }
.text-button { border: 0; background: none; color: var(--green-700); font-size: 10px; font-weight: 700; }

.page-container { max-width: 1540px; margin: 0 auto; padding: 28px 30px 50px; }
.page { display: none; animation: pageIn .28s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 23px; }
.page-heading .eyebrow { margin-bottom: 5px; }
.page-heading h1 { margin-bottom: 5px; font-size: clamp(22px, 2.2vw, 30px); letter-spacing: -.75px; }
.page-heading p:last-child { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.eyebrow { color: var(--green-600); font-size: 9px; font-weight: 800; letter-spacing: 1.25px; text-transform: uppercase; }
.heading-actions { display: flex; align-items: center; gap: 9px; }
.date-filter { height: 39px; display: flex; align-items: center; gap: 7px; border: 1px solid #dbe3df; border-radius: 9px; padding: 0 10px; background: white; color: var(--muted); }
.date-filter select, .table-select { border: 0; outline: 0; background: transparent; color: #42534e; font-size: 11px; }
.alert-banner { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 12px 15px; border: 1px solid #f1dfc7; border-radius: 11px; background: #fffaf2; }
.alert-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--orange-soft); color: var(--orange); font-weight: 800; }
.alert-banner div { flex: 1; }
.alert-banner strong { font-size: 11px; }
.alert-banner p { margin: 2px 0 0; color: #8c7251; font-size: 10px; }
.alert-banner button { border: 0; background: none; color: #9b641e; font-size: 10px; font-weight: 700; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.metric-card { min-height: 142px; position: relative; overflow: hidden; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.metric-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.metric-label { color: #5d6e68; font-size: 10px; font-weight: 600; }
.metric-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; font-size: 15px; }
.accent-green .metric-icon { background: var(--green-50); color: var(--green-700); }
.accent-blue .metric-icon { background: var(--blue-soft); color: var(--blue); }
.accent-orange .metric-icon { background: var(--orange-soft); color: var(--orange); }
.accent-purple .metric-icon { background: var(--purple-soft); color: var(--purple); }
.metric-value { display: block; margin-bottom: 10px; font-size: clamp(18px,2vw,23px); letter-spacing: -.65px; }
.metric-bottom { display: flex; align-items: center; gap: 7px; color: var(--faint); font-size: 9px; }
.trend { padding: 3px 6px; border-radius: 6px; font-size: 9px; font-weight: 700; }
.trend.up { background: var(--green-50); color: #3c866d; }
.trend.warning { background: var(--orange-soft); color: #b76f22; }
.trend.neutral { background: #f0f3f2; color: #677771; }
.mini-bars { position: absolute; right: 13px; bottom: 13px; width: 75px; height: 30px; display: flex; align-items: flex-end; gap: 3px; opacity: .42; }
.mini-bars i { flex: 1; border-radius: 3px 3px 0 0; background: #76a99a; }
.progress-line { height: 3px; margin-top: 15px; overflow: hidden; border-radius: 3px; background: #edf1ef; }
.progress-line i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.accent-orange .progress-line i { background: var(--orange); }
.stock-dots { display: flex; gap: 5px; margin-top: 14px; }
.stock-dots i { width: 8px; height: 8px; border-radius: 3px; background: var(--purple); }
.stock-dots i.pale { opacity: .18; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 14px; margin-bottom: 14px; }
.dashboard-grid.lower { grid-template-columns: minmax(0,1.35fr) minmax(300px, .85fr); }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 17px 18px 0; }
.panel-header h2, .table-toolbar h2 { margin-bottom: 3px; font-size: 13px; letter-spacing: -.15px; }
.panel-header p, .table-toolbar p { margin-bottom: 0; color: var(--muted); font-size: 9px; }
.sales-panel { min-height: 338px; }
.legend { display: flex; gap: 12px; color: var(--muted); font-size: 9px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 2px; }
.legend-factured { background: var(--green-700); }
.legend-collected { background: #a7c7bd; }
.chart-summary { display: flex; align-items: center; gap: 8px; padding: 13px 18px 0; }
.chart-summary strong { font-family: Manrope, sans-serif; font-size: 19px; }
.sales-chart { height: 225px; display: flex; align-items: flex-end; gap: 12px; padding: 12px 18px 22px 46px; position: relative; }
.chart-grid { position: absolute; inset: 8px 18px 30px 46px; display: flex; flex-direction: column; justify-content: space-between; }
.chart-grid span { border-top: 1px dashed #e9eeec; position: relative; }
.chart-grid small { position: absolute; right: calc(100% + 8px); top: -7px; color: #9ca8a4; font-size: 8px; }
.bar-group { flex: 1; height: 100%; position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 4px; z-index: 1; }
.bar-group i { width: min(16px, 34%); border-radius: 4px 4px 1px 1px; transition: height .5s ease; }
.bar-group i:first-child { background: var(--green-700); }
.bar-group i:nth-child(2) { background: #b8d3cb; }
.bar-group small { position: absolute; top: calc(100% + 7px); color: #7f8c88; font-size: 8px; white-space: nowrap; }
.treasury-total { margin: 15px 18px 4px; padding: 13px 15px; border-radius: 11px; background: var(--green-50); }
.treasury-total span, .treasury-total small { display: block; color: var(--green-700); font-size: 9px; }
.treasury-total strong { display: block; margin: 3px 0; font-family: Manrope, sans-serif; font-size: 20px; }
.account-list { padding: 3px 18px 10px; }
.account-row { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid #eef2f0; }
.account-row:last-child { border: 0; }
.account-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; font-size: 11px; font-weight: 700; }
.account-icon.cash { color: var(--green-700); background: var(--green-50); }
.account-icon.bank { color: var(--blue); background: var(--blue-soft); }
.account-icon.mobile { color: var(--purple); background: var(--purple-soft); }
.account-icon.cdf { color: var(--orange); background: var(--orange-soft); }
.account-row div { min-width: 0; flex: 1; }
.account-row strong, .account-row small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-row strong { font-size: 9px; }
.account-row small { margin-top: 2px; color: var(--faint); font-size: 8px; }
.account-row b { font-size: 9px; white-space: nowrap; }
.activity-list, .stock-alert-list { padding: 8px 18px 12px; }
.activity-item { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eef2f0; }
.activity-item:last-child { border: 0; }
.activity-symbol { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--green-50); color: var(--green-700); font-size: 12px; }
.activity-main strong, .activity-main small { display: block; }
.activity-main strong { font-size: 9px; font-weight: 600; }
.activity-main small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.activity-amount { text-align: right; }
.activity-amount strong, .activity-amount small { display: block; }
.activity-amount strong { font-size: 9px; }
.activity-amount small { margin-top: 2px; color: var(--faint); font-size: 8px; }
.stock-alert-item { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eef2f0; }
.stock-alert-item:last-child { border: 0; }
.product-thumb { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: linear-gradient(145deg,#eff8f4,#dbece6); color: var(--green-800); font-weight: 800; font-size: 9px; }
.stock-alert-item strong, .stock-alert-item small { display: block; }
.stock-alert-item strong { font-size: 9px; }
.stock-alert-item small { margin-top: 2px; color: var(--faint); font-size: 8px; }
.stock-status { text-align: right; }
.stock-status b { display: block; color: var(--red); font-size: 10px; }
.stock-status small { color: var(--faint); }

.sub-metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; margin-bottom: 14px; }
.sub-metric { padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: var(--shadow-sm); }
.sub-metric span { display: block; color: var(--muted); font-size: 9px; }
.sub-metric strong { display: block; margin: 7px 0 5px; font-family: Manrope, sans-serif; font-size: 19px; }
.sub-metric small { color: var(--faint); font-size: 8px; }
.sub-metric small.good { color: #3c866d; }
.sub-metric small.bad { color: var(--red); }
.table-panel { overflow: hidden; }
.table-toolbar { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.tab { min-height: 31px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 600; }
.tab span { margin-left: 4px; padding: 1px 5px; border-radius: 7px; background: #edf2ef; font-size: 8px; }
.tab.active { background: var(--green-50); color: var(--green-800); }
.toolbar-right { display: flex; align-items: center; gap: 7px; }
.table-search, .table-select { height: 34px; min-width: 180px; padding: 0 10px; outline: 0; border: 1px solid #dce4e0; border-radius: 8px; background: #fafcfb; color: var(--ink); font-size: 10px; }
.table-search:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(65,136,120,.1); }
.table-responsive { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th { padding: 11px 15px; background: #fbfcfc; color: #7b8984; font-size: 8px; font-weight: 700; letter-spacing: .35px; text-transform: uppercase; text-align: left; white-space: nowrap; }
td { padding: 12px 15px; border-top: 1px solid #edf1ef; vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fbfdfc; }
.table-primary { display: block; font-weight: 700; color: #263630; }
.table-secondary { display: block; margin-top: 3px; color: var(--faint); font-size: 8px; }
.amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 7px; font-size: 8px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.green { background: var(--green-50); color: #3b806b; }
.status.orange { background: var(--orange-soft); color: #b56c1f; }
.status.red { background: var(--red-soft); color: var(--red); }
.status.blue { background: var(--blue-soft); color: var(--blue); }
.status.gray { background: #f0f3f2; color: #6f7e79; }
.row-menu { border: 0; background: none; color: var(--muted); font-size: 17px; }
.product-cell { display: flex; align-items: center; gap: 9px; min-width: 180px; }
.product-progress { width: 72px; height: 4px; margin-top: 4px; border-radius: 3px; background: #e9eeec; overflow: hidden; }
.product-progress i { display: block; height: 100%; background: var(--green-600); }
.product-progress.low i { background: var(--red); }
.receivables-layout { grid-template-columns: minmax(0,1.6fr) minmax(250px,.7fr); }
.aging-panel { padding-bottom: 17px; }
.aging-row { padding: 9px 18px; }
.aging-label { display: flex; justify-content: space-between; margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.aging-label b { color: var(--ink); }
.aging-bar { height: 7px; border-radius: 6px; background: #edf1ef; overflow: hidden; }
.aging-bar i { display: block; height: 100%; border-radius: inherit; }
.cash-account-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; margin-bottom: 14px; }
.cash-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.cash-card-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 9px; }
.cash-card strong { display: block; margin: 14px 0 5px; font-family: Manrope,sans-serif; font-size: 19px; }
.cash-card small { color: var(--faint); font-size: 8px; }
.cash-card .account-icon { width: 32px; height: 32px; }
.income { color: #3c866d; }
.expense { color: var(--red); }
.report-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.report-card { min-height: 188px; display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: var(--shadow-sm); }
.report-icon { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 10px; background: var(--green-50); color: var(--green-700); font-size: 17px; }
.report-card:nth-child(3n+2) .report-icon { background: var(--blue-soft); color: var(--blue); }
.report-card:nth-child(3n+3) .report-icon { background: var(--orange-soft); color: var(--orange); }
.report-card h2 { margin-bottom: 7px; font-size: 13px; }
.report-card p { flex: 1; margin-bottom: 17px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.report-actions { display: flex; align-items: center; justify-content: space-between; }
.report-actions small { color: var(--faint); font-size: 8px; }
.user-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding: 15px; }
.user-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.user-card-head { display: flex; align-items: center; gap: 10px; }
.user-card .avatar { width: 39px; height: 39px; }
.user-card-head div { flex: 1; min-width: 0; }
.user-card strong, .user-card small { display: block; }
.user-card strong { font-size: 10px; }
.user-card small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.user-meta { display: flex; justify-content: space-between; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--faint); font-size: 8px; }
.status-key { display: flex; gap: 14px; color: var(--muted); font-size: 9px; }
.status-key i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; }
.online { background: #4b9e7c; }
.offline { background: #b3bdb9; }
.settings-layout { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 14px; }
.settings-nav { align-self: start; display: grid; gap: 3px; padding: 8px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.settings-nav button { min-height: 38px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); text-align: left; font-size: 10px; font-weight: 600; }
.settings-nav button.active { background: var(--green-50); color: var(--green-800); }
.settings-panel { padding: 22px; }
.settings-panel h2 { margin-bottom: 5px; font-size: 16px; }
.settings-intro { margin-bottom: 22px; color: var(--muted); font-size: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1/-1; }
.field label { font-size: 9px; font-weight: 700; color: #4f605a; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #dce4e0; border-radius: 9px; padding: 10px 11px; outline: 0; background: #fafcfb; color: var(--ink); font-size: 10px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(65,136,120,.1); background: white; }
.field small { color: var(--faint); font-size: 8px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.switch-row strong { display: block; font-size: 10px; }
.switch-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.toggle { width: 34px; height: 20px; position: relative; border: 0; border-radius: 12px; background: #cbd4d0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: white; transition: .2s; }
.toggle.on { background: var(--green-700); }
.toggle.on::after { left: 17px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(7,25,20,.52); backdrop-filter: blur(4px); }
.modal-backdrop[hidden], [hidden] { display: none !important; }
.modal { width: min(620px,100%); max-height: calc(100vh - 36px); overflow: auto; border-radius: 18px; background: white; box-shadow: var(--shadow-lg); animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-header .eyebrow { margin-bottom: 5px; }
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fbfcfc; }
.line-items { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.line-item { display: grid; grid-template-columns: minmax(0,1fr) 75px 110px 32px; gap: 7px; margin-bottom: 7px; }
.line-item input, .line-item select { min-width: 0; border: 1px solid #dce4e0; border-radius: 8px; padding: 8px; font-size: 9px; }
.line-item button { border: 0; background: var(--red-soft); color: var(--red); border-radius: 8px; }
.sale-total { display: flex; justify-content: flex-end; gap: 15px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 11px; }
.sale-total strong { font-family: Manrope,sans-serif; font-size: 15px; }
.notification-panel, .profile-menu { position: fixed; z-index: 80; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: var(--shadow-lg); }
.notification-panel { top: 64px; right: 22px; width: min(360px,calc(100vw - 30px)); }
.notification-head { display: flex; justify-content: space-between; padding: 14px; border-bottom: 1px solid var(--line); font-size: 11px; }
.notification-item { display: grid; grid-template-columns: 28px 1fr; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notification-item:last-child { border: 0; }
.notification-item > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--orange-soft); color: var(--orange); }
.notification-item strong { display: block; font-size: 9px; }
.notification-item p { margin: 3px 0 0; color: var(--muted); font-size: 8px; line-height: 1.4; }
.profile-menu { bottom: 75px; left: 15px; width: 218px; padding: 7px; }
.profile-menu button { width: 100%; padding: 9px; border: 0; border-radius: 7px; background: none; text-align: left; color: var(--ink); font-size: 10px; }
.profile-menu button:hover { background: var(--green-50); }
.profile-menu hr { border: 0; border-top: 1px solid var(--line); }
.danger-text { color: var(--red) !important; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 8px; }
.toast { min-width: 260px; display: flex; align-items: center; gap: 9px; padding: 12px 14px; border: 1px solid #cfe2da; border-radius: 11px; background: white; color: var(--ink); box-shadow: var(--shadow-lg); font-size: 10px; animation: toastIn .25s ease; }
.toast span { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; background: var(--green-100); color: var(--green-800); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.empty-state { padding: 38px; text-align: center; color: var(--muted); }

@media (max-width: 1150px) {
  .metrics-grid, .sub-metrics, .cash-account-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid, .dashboard-grid.lower { grid-template-columns: 1fr; }
  .report-grid, .user-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .period-chip { display: none; }
}

@media (max-width: 820px) {
  :root { --sidebar: 0px; }
  .sidebar { width: 248px; transform: translateX(-100%); transition: transform .25s ease; box-shadow: 20px 0 50px rgba(5,24,19,.2); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { padding: 0 16px; gap: 10px; }
  .menu-toggle { display: inline-grid !important; flex: 0 0 auto; }
  .search-wrap { width: auto; flex: 1; }
  .search-wrap kbd, .notification-button { display: none; }
  .page-container { padding: 22px 16px 40px; }
  .page-heading { align-items: flex-start; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { display: flex; overflow-x: auto; }
  .settings-nav button { min-width: max-content; }
}

@media (max-width: 620px) {
  .topbar .primary-button { width: 36px; padding: 0; font-size: 0; }
  .topbar .primary-button span { font-size: 17px; }
  .page-heading { display: grid; }
  .heading-actions { flex-wrap: wrap; }
  .metrics-grid, .sub-metrics, .cash-account-grid, .report-grid, .user-grid { grid-template-columns: 1fr; }
  .alert-banner { align-items: flex-start; }
  .alert-banner button { display: none; }
  .table-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-right { width: 100%; }
  .table-search { min-width: 0; flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .line-item { grid-template-columns: 1fr 60px 80px 32px; }
  .legend { display: none; }
  .sales-chart { padding-left: 38px; gap: 5px; }
  .chart-grid { left: 38px; }
  .notification-panel { right: 10px; }
}

@media print {
  .sidebar, .topbar, .heading-actions, .alert-banner, button { display: none !important; }
  .main-content { margin: 0; }
  .page-container { max-width: none; padding: 0; }
  .page { display: block !important; break-after: page; }
  .panel, .metric-card { box-shadow: none; }
}
