:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif;
  color: #1c1c1e;
  background: #f2f2f7;
  font-synthesis: none;
  --background: #f2f2f7;
  --primary: #007aff;
  --primary-dark: #0062cc;
  --surface: #ffffff;
  --surface-soft: #f7f7fa;
  --input-surface: #ffffff;
  --glass-surface: rgba(255, 255, 255, .76);
  --glass-border: rgba(255, 255, 255, .64);
  --label: #1c1c1e;
  --muted: #6e6e73;
  --border: rgba(60, 60, 67, .14);
  --danger: #ff3b30;
  --warning: #ff9500;
  --success: #248a3d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .03), 0 8px 24px rgba(28, 28, 30, .05);
  --shadow-lg: 0 24px 70px rgba(28, 28, 30, .16);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --glass-filter: saturate(180%) blur(24px);
  --motion-fast: 180ms;
  --motion-base: 280ms;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  color: #f5f5f7;
  background: #000000;
  --background: #000000;
  --primary: #0a84ff;
  --primary-dark: #409cff;
  --surface: #1c1c1e;
  --surface-soft: #2c2c2e;
  --input-surface: #2c2c2e;
  --glass-surface: rgba(28, 28, 30, .76);
  --glass-border: rgba(255, 255, 255, .12);
  --label: #f5f5f7;
  --muted: #aeaeb2;
  --border: rgba(84, 84, 88, .58);
  --danger: #ff453a;
  --warning: #ff9f0a;
  --success: #30d158;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .24), 0 10px 30px rgba(0, 0, 0, .18);
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, .46);
}

* { box-sizing: border-box; }
html { background: var(--background); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--background); color: var(--label); line-height: 1.45; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.center-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 34%), radial-gradient(circle at 86% 86%, color-mix(in srgb, #af52de 9%, transparent), transparent 30%); }
.auth-card { width: min(460px, 100%); background: var(--glass-surface); padding: 28px; border: 1px solid var(--glass-border); border-radius: 28px; box-shadow: var(--shadow-lg); backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter); }
.auth-card h1 { margin: 0 0 6px; }
.auth-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.auth-brand { min-width: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 750; }
.auth-heading { margin: 34px 0 20px; }
.auth-heading h1 { margin-top: 4px; font-size: 34px; letter-spacing: -.035em; }
.auth-heading p { margin: 0; }
.muted { color: var(--muted); }
.field { min-width: 0; display: grid; gap: 7px; margin: 14px 0; }
.field-label, .field > span { color: var(--muted); font-size: 13px; font-weight: 650; }
.field input, .field select, .field textarea { min-height: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--input-surface); color: var(--label); }
.field textarea { min-height: 96px; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover, .toolbar input:hover, .toolbar select:hover { border-color: color-mix(in srgb, var(--primary) 34%, var(--border)); }
.field input:focus, .field select:focus, .field textarea:focus, .toolbar input:focus, .toolbar select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); outline: 0; }
.button { min-height: 44px; border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 10px 16px; background: var(--surface); color: var(--label); transition: transform var(--motion-fast) ease, background-color var(--motion-fast) ease, border-color var(--motion-fast) ease, opacity var(--motion-fast) ease; }
.button:hover { background: var(--surface-soft); }
.button:active { transform: scale(.98); }
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 36%, transparent); outline-offset: 2px; }
.theme-toggle { min-width: 68px; }
.error { color: var(--danger); margin-top: 10px; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; width: 264px; overflow-y: auto; background: var(--glass-surface); color: var(--label); padding: 18px 14px; border-right: 1px solid var(--glass-border); backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 24px; font-weight: 750; letter-spacing: -.015em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #fff; background: linear-gradient(145deg, #34aadc, var(--primary)); box-shadow: 0 7px 20px color-mix(in srgb, var(--primary) 28%, transparent); }
.nav { display: grid; gap: 5px; }
.nav button { min-height: 46px; display: flex; align-items: center; gap: 12px; color: var(--muted); background: transparent; border: 0; padding: 10px 12px; border-radius: var(--radius-sm); text-align: left; font-weight: 600; }
.nav button.active, .nav button:hover { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--primary); }
.nav-icon { display: inline-grid; place-items: center; width: 24px; min-width: 24px; font-size: 19px; line-height: 1; }
.mobile-more-head, .mobile-more-nav { display: none; }
.sidebar-scrim { display: none; }
.main { min-width: 0; width: calc(100% - 264px); margin-left: 264px; }
.topbar { position: sticky; top: 0; z-index: 40; min-height: 64px; display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: var(--glass-surface); border-bottom: 1px solid var(--glass-border); backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter); }
.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-actions, .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-button { width: 44px; padding: 0; display: inline-grid; place-items: center; font-size: 20px; }
#menu-toggle { display: none; }
.content { width: 100%; max-width: 1680px; margin: 0 auto; padding: 28px clamp(20px, 3vw, 44px) 44px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: clamp(28px, 3vw, 34px); line-height: 1.12; letter-spacing: -.025em; }
.page-head h2 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.page-head .eyebrow { display: block; margin-bottom: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; box-shadow: var(--shadow-sm); }
.card h2, .card h3 { margin-top: 0; }
.content > .card + .card { margin-top: 14px; }
.metric { font-size: 26px; font-weight: 700; margin-top: 8px; }
.section { margin-top: 20px; }
.section > h2 { margin: 0 0 14px; font-size: 21px; letter-spacing: -.02em; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); background: var(--surface-soft); font-size: 12px; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
tbody tr { transition: background-color var(--motion-fast) ease; }
tbody tr:hover { background: color-mix(in srgb, var(--primary) 3%, var(--surface)); }
tr:last-child td { border-bottom: 0; }
.status { display: inline-block; padding: 4px 10px; border-radius: var(--radius-pill); background: var(--surface-soft); }
.status.danger { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.status.success { background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); }
.warning-box { padding: 12px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--warning) 17%, var(--surface)); color: color-mix(in srgb, var(--warning) 78%, var(--label)); margin: 12px 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid > .actions { align-self: end; min-height: 44px; margin: 14px 0; }
.full { grid-column: 1 / -1; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.toolbar input, .toolbar select { min-height: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--input-surface); color: var(--label); }
.toast { position: fixed; right: 18px; bottom: 18px; padding: 12px 16px; background: var(--glass-surface); color: var(--label); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter); z-index: 50; }
.metric-card { min-height: 118px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; border: 1px solid var(--border); color: inherit; width: 100%; }
.permission-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; max-height: 280px; overflow-y: auto; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.form-check { min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface); }
.form-check input { width: 18px; height: 18px; }
.sales-filter-card { padding: 20px; }
.sales-filter-card .section-heading { margin-bottom: 2px; }
.sales-filter-card .section-heading h2 { font-size: 18px; }
.result-count { flex: 0 0 auto; padding: 7px 11px; border-radius: var(--radius-pill); color: var(--muted); background: var(--surface-soft); font-size: 12px; font-weight: 700; }
.sales-records td:first-child .table-cell-value { color: var(--primary); font-weight: 700; }
.sale-dialog { width: min(820px, calc(100% - 32px)); }
.sale-section { margin-bottom: 24px; }
.sale-section .section-heading { margin-bottom: 10px; }
.sale-section .section-heading > div { display: flex; align-items: center; gap: 10px; }
.sale-section h3 { margin: 0; font-size: 18px; }
.sale-step { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 10px; color: var(--primary); background: color-mix(in srgb, var(--primary) 11%, var(--surface)); font-size: 13px; font-weight: 800; }
.sale-items { display: grid; gap: 10px; }
.sale-item { position: relative; align-items: end; gap: 10px 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.sale-item .field { margin: 0; }
.sale-item .remove-item { justify-self: start; }
.sale-payment-summary { margin-top: 8px; padding: 18px; border-color: color-mix(in srgb, var(--primary) 20%, var(--border)); background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.sale-payment-summary input[readonly] { background: var(--surface-soft); font-weight: 700; }
.sale-total-row { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.sale-total-row > div { display: grid; gap: 3px; }
.sale-total-row output { color: var(--primary); font-size: clamp(30px, 5vw, 42px); font-weight: 800; line-height: 1; letter-spacing: -.035em; }
.sale-note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 2px 0; font-size: 13px; }
.invoice-actions-dialog { width: min(620px, calc(100% - 32px)); }
.invoice-success { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.invoice-success h2 { margin: 2px 0 0; }
.invoice-success-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 15px; color: #fff; background: var(--success); box-shadow: 0 8px 20px color-mix(in srgb, var(--success) 26%, transparent); font-size: 23px; font-weight: 800; }
dialog { border: 1px solid var(--glass-border); border-radius: var(--radius-lg); width: min(680px, calc(100% - 32px)); padding: 0; color: var(--label); background: var(--surface); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(0, 0, 0, .42); backdrop-filter: blur(4px); }
.dialog-body { max-height: min(76dvh, 760px); overflow-y: auto; padding: 24px; }
.dialog-heading { margin-bottom: 18px; }
.dialog-title { margin: 3px 0 0; font-size: 26px; letter-spacing: -.025em; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--glass-surface); backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter); }
.empty-state { min-height: 150px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 24px; border: 1px dashed var(--border); border-radius: var(--radius-md); color: var(--muted); background: color-mix(in srgb, var(--surface) 76%, transparent); text-align: center; }
.empty-state-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); font-size: 22px; }
.pagination { justify-content: flex-end; margin-top: 14px; }
.pagination .button { min-width: 44px; padding-inline: 12px; }
input[type="file"] { max-width: 100%; padding: 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); background: var(--input-surface); }
#report-result { min-height: 120px; margin-top: 14px; }
#report-result > .table-wrap { margin-top: 0; }
.section .cards > .card { min-width: 0; }
.content p { overflow-wrap: anywhere; }
.invoice-share-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 52vh; overflow-y: auto; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); font: 13px/1.5 Consolas, monospace; }
.mobile-tabbar { display: none; }
.quick-action-sheet { width: min(520px, calc(100% - 32px)); padding: 22px; background: var(--glass-surface); backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter); }
.quick-action-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 18px; }
.quick-action-head h2 { margin: 2px 0 0; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.quick-action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-action { min-height: 112px; display: grid; place-items: center; align-content: center; gap: 10px; padding: 14px 10px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--label); background: var(--surface); font-weight: 650; }
.quick-action:hover { background: var(--surface-soft); }
.quick-action-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: color-mix(in srgb, var(--primary) 13%, var(--surface)); color: var(--primary); font-size: 23px; }
.dashboard-welcome { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 8px 0 24px; }
.dashboard-welcome h1 { margin: 4px 0 2px; font-size: clamp(30px, 4vw, 42px); line-height: 1.08; letter-spacing: -.035em; }
.dashboard-welcome p { margin: 0; font-size: 16px; }
.date-chip { flex: 0 0 auto; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 650; }
.dashboard-overview { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(0, 1.8fr); gap: 14px; }
.dashboard-hero { min-height: 234px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; padding: 24px; border: 0; border-radius: var(--radius-lg); color: #fff; text-align: left; background: linear-gradient(145deg, #0a84ff, #0055d4 64%, #172f8e); box-shadow: 0 22px 48px color-mix(in srgb, var(--primary) 24%, transparent); }
.dashboard-hero strong { margin: 8px 0; font-size: clamp(34px, 4.5vw, 52px); line-height: 1; letter-spacing: -.035em; }
.dashboard-card-label { color: inherit; opacity: .72; font-size: 13px; font-weight: 700; letter-spacing: .015em; }
.dashboard-link { margin-top: 20px; font-size: 13px; font-weight: 700; opacity: .84; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dashboard-metric { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--label); background: var(--surface); text-align: left; box-shadow: var(--shadow-sm); }
.dashboard-metric strong { max-width: 100%; font-size: clamp(20px, 2.4vw, 29px); line-height: 1.05; letter-spacing: -.025em; overflow-wrap: anywhere; }
.dashboard-metric.cash { --metric-color: var(--success); }
.dashboard-metric.credit, .dashboard-metric.expense { --metric-color: var(--warning); }
.dashboard-metric.repayment, .dashboard-metric.balance { --metric-color: var(--primary); }
.dashboard-metric.receivable { --metric-color: #af52de; }
.dashboard-metric::before { content: ''; width: 28px; height: 4px; border-radius: var(--radius-pill); background: var(--metric-color, var(--primary)); }
.metric-arrow { position: absolute; right: 14px; top: 12px; color: var(--muted); font-size: 22px; }
.dashboard-section { margin-top: 28px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.section-heading h2 { margin: 2px 0 0; font-size: 21px; letter-spacing: -.02em; }
.dashboard-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dashboard-plan { min-height: 74px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--label); background: var(--surface); text-align: left; box-shadow: var(--shadow-sm); }
.dashboard-plan:hover, .dashboard-metric:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.dashboard-plan small, .dashboard-plan strong { display: block; }
.dashboard-plan small { margin-top: 2px; color: var(--muted); }
.plan-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: var(--primary); background: color-mix(in srgb, var(--primary) 11%, var(--surface)); font-size: 19px; }
.plan-count { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: var(--radius-pill); color: var(--primary); background: color-mix(in srgb, var(--primary) 11%, var(--surface)); font-weight: 750; }
.dashboard-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 28px; }
.dashboard-panel, .dashboard-filter { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.dashboard-filter { margin-bottom: 14px; }
.dashboard-filter .field { margin: 0; }
.inventory-list, .activity-list { display: grid; }
.inventory-row, .activity-row { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--border); }
.inventory-row:first-child, .activity-row:first-child { border-top: 0; }
.inventory-row > div, .activity-copy { min-width: 0; display: grid; gap: 2px; }
.quantity-pill { flex: 0 0 auto; padding: 6px 10px; border-radius: var(--radius-pill); color: var(--success); background: color-mix(in srgb, var(--success) 11%, var(--surface)); font-weight: 750; }
.quantity-pill.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 11%, var(--surface)); }
.activity-value { min-width: 130px; display: grid; justify-items: end; gap: 7px; }
.activity-bar { width: 100%; height: 5px; overflow: hidden; border-radius: var(--radius-pill); background: var(--surface-soft); }
.activity-bar span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.salesperson-overview .dashboard-hero { background: linear-gradient(145deg, #34c759, #13843a 72%, #075e28); }

@media (max-width: 900px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  body { min-width: 0; }
  .app-shell, .main, .content, .section, .card { min-width: 0; max-width: 100%; }
  .main { width: 100%; margin-left: 0; }
  .sidebar { display: none; inset: auto 8px calc(82px + env(safe-area-inset-bottom)); width: calc(100% - 16px); max-height: min(70dvh, 620px); padding: 18px; border: 1px solid var(--glass-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
  .sidebar.is-open { display: block; }
  .sidebar.is-open + .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 55; width: 100%; border: 0; background: rgba(0, 0, 0, .22); }
  .brand, .desktop-nav { display: none; }
  .mobile-more-head { display: grid; gap: 2px; padding: 2px 4px 14px; }
  .mobile-more-head strong { font-size: 24px; }
  .mobile-more-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .topbar { min-height: 0; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; }
  .topbar-title, .topbar-actions { width: 100%; justify-content: space-between; }
  .topbar-title strong, .topbar-actions span { min-width: 0; overflow-wrap: anywhere; }
  .topbar-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions .button { flex: 0 0 auto; }
  .user-label { display: none; }
  #menu-toggle { display: inline-grid; }
  .content { padding: 16px 12px calc(112px + env(safe-area-inset-bottom)); }
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-head > .actions { width: 100%; }
  .page-head > .actions .button { flex: 1 1 auto; }
  .page-head h1, .page-head h2 { overflow-wrap: anywhere; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .field input, .field select, .field textarea, .toolbar input, .toolbar select { width: 100%; min-width: 0; max-width: 100%; }
  .toolbar > * { flex: 1 1 100%; }
  .actions { min-width: 0; }
  .actions .button { max-width: 100%; white-space: normal; }
  .pagination { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); width: 100%; }
  .pagination .muted { grid-column: 1 / -1; overflow-wrap: anywhere; }
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  table, thead, tbody, tr, th, td { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  tbody { display: grid; gap: 12px; }
  tbody tr { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
  tbody td { min-height: 48px; display: grid; grid-template-columns: minmax(88px, .8fr) minmax(0, 1.2fr); gap: 10px; padding: 12px 14px; overflow-wrap: anywhere; }
  tbody td::before { content: attr(data-label); min-width: 0; color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
  .table-cell-value { min-width: 0; overflow-wrap: anywhere; }
  tbody td:last-child { border-bottom: 0; }
  dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; }
  .dialog-body { max-height: calc(100dvh - 96px); padding: 18px 16px; }
  .dialog-actions { padding: 12px 16px; flex-wrap: wrap; }
  .toast { left: 12px; right: 12px; bottom: calc(88px + env(safe-area-inset-bottom)); overflow-wrap: anywhere; }
  .mobile-tabbar { position: fixed; z-index: 50; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); min-height: 68px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; padding: 7px 6px; border: 1px solid var(--glass-border); border-radius: 24px; background: var(--glass-surface); box-shadow: var(--shadow-lg); backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter); }
  .mobile-tab { min-width: 0; min-height: 52px; display: grid; place-items: center; align-content: center; gap: 3px; padding: 4px 2px; border: 0; border-radius: 16px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; }
  .mobile-tab.active { color: var(--primary); background: color-mix(in srgb, var(--primary) 11%, transparent); }
  .mobile-tab .nav-icon { height: 24px; font-size: 20px; }
  .quick-tab { position: relative; color: var(--primary); }
  .quick-plus { display: grid; place-items: center; width: 44px; height: 44px; margin-top: -18px; border: 4px solid var(--background); border-radius: 50%; color: #fff; background: var(--primary); box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 34%, transparent); font-size: 28px; font-weight: 400; line-height: 1; }
  .quick-action-sheet { inset: auto 8px calc(8px + env(safe-area-inset-bottom)); width: calc(100% - 16px); max-height: calc(100dvh - 24px - env(safe-area-inset-bottom)); margin: 0; overflow-y: auto; border-radius: 28px; }
  .quick-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-action { min-height: 98px; }
  .sales-filter-card { padding: 16px; }
  .sale-dialog { width: calc(100% - 12px); max-height: calc(100dvh - 12px); }
  .sale-section .section-heading { align-items: center; flex-direction: row; }
  .sale-section .section-heading .button { flex: 0 0 auto; }
  .sale-item { padding: 13px; }
  .sale-item .remove-item { width: 100%; }
  .sale-total-row { align-items: flex-start; flex-direction: column; }
  .dashboard-welcome { align-items: flex-start; margin-top: 2px; }
  .date-chip { display: none; }
  .dashboard-overview, .dashboard-columns { grid-template-columns: 1fr; }
  .dashboard-hero { min-height: 204px; }
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-plans { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .dashboard-metrics { grid-template-columns: 1fr; }
  .dashboard-metric { min-height: 116px; }
}

@media (prefers-reduced-transparency: reduce) {
  :root { --glass-surface: var(--surface); --glass-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  body { background: #fff; }
  .app-shell, .no-print { display: none !important; }
}
