/* Enterprise application surface: shared tokens and component finishing. */
:root {
  --brand: #2457d6;
  --brand-d: #1847bd;
  --brand-soft: #edf3ff;
  --ink: #18243a;
  --muted: #69778e;
  --line: #e1e7f0;
  --line-strong: #d4dce8;
  --bg: #f4f6fa;
  --card: #fff;
  --side: #111c33;
  --ok: #16784c;
  --okbg: #e9f7ef;
  --warn: #a45b08;
  --warnbg: #fff5e5;
  --err: #b42318;
  --errbg: #fff0ee;
  --shadow-sm: 0 2px 7px rgba(19, 36, 66, .045);
  --shadow-md: 0 10px 28px rgba(19, 36, 66, .09);
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 17px;
}

html { background: var(--bg); scroll-padding-top: 78px; }
body {
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #dce8ff; color: #12234a; }
h1, h2, h3, h4 { color: #17243c; font-weight: 700; }
h1 { font-size: clamp(1.45rem, 2vw, 1.85rem); letter-spacing: -.035em; line-height: 1.2; }
h2 { font-size: 1.08rem; letter-spacing: -.015em; line-height: 1.3; }
h3 { font-size: .97rem; letter-spacing: -.01em; }
p { line-height: 1.55; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small, small { line-height: 1.45; }

/* Workspace frame */
.shell { min-height: 100dvh; background: var(--bg); }
.side {
  width: 258px;
  flex: 0 0 258px;
  padding: 15px 11px 12px;
  color: #d7e0ef;
  background: linear-gradient(180deg, #14213a 0%, #101b31 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: 5px 0 22px rgba(20,35,61,.07);
}
.side-brand { padding: 7px 9px 17px; gap: 11px; }
.side-company-logo { width: 38px; height: 38px; border-radius: 11px; }
.side-brand-copy strong { color: #fff; font-size: .98rem; letter-spacing: -.015em; }
.side-brand-copy small { color: #94a5c0; font-size: .61rem; letter-spacing: .12em; }
.nav-section { margin: 11px 8px 5px; padding: 13px 3px 0; color: #8296b8; border-top: 1px solid rgba(208,222,245,.1); font-size: .64rem; letter-spacing: .13em; }
.nav-item { min-height: 39px; padding: 0 11px; gap: 9px; border-radius: 9px; color: #cad5e7; font-size: .84rem; font-weight: 550; transition: background .16s,color .16s,transform .16s; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: linear-gradient(100deg,#2b61df,#2755c7); color: #fff; box-shadow: 0 5px 14px rgba(26,75,190,.28); }
.side-foot { margin: auto 5px 0; padding: 12px 8px 4px; border-top: 1px solid rgba(208,222,245,.1); }
.main { min-height: 100dvh; }
.top {
  min-height: 62px;
  padding: 8px clamp(16px,2.1vw,30px);
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 9px rgba(20,35,61,.025);
  backdrop-filter: blur(12px);
}
.top .who { gap: 2px; }
.top .who strong { font-size: .85rem; color: #1d2a40; }
.top .who .muted { font-size: .74rem; }
.content { width: 100%; max-width: 1720px; padding: clamp(18px,2.2vw,30px); }

/* Page titles, panels, controls */
.page-head { min-height: 54px; margin-bottom: 17px; gap: 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: .84rem; }
.page-head .row-gap, .head-actions { align-items: center; }
.eyebrow { color: #496cba; font-size: .66rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.card, fieldset.card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.page-head + .card, .page-head + .filters { margin-top: 0; }
.section-title { margin-bottom: 15px; }
.section-title h2 { margin: 0; }
.section-title p { margin: 4px 0 0; font-size: .8rem; }
.filters {
  gap: 9px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.filters input:not([type=checkbox]) { min-width: 190px; min-height: 40px; flex: 1 1 230px; }
.filters select { width: auto; min-width: 155px; min-height: 40px; }
label:not(.check) { margin: 13px 0 5px; color: #34445c; font-size: .81rem; font-weight: 650; }
label small { color: var(--muted); font-size: .72rem; font-weight: 450; }
input:not([type=checkbox]), select, textarea {
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: .86rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:not([type=checkbox]):hover, select:hover, textarea:hover { border-color: #aebbd0; }
input:focus, select:focus, textarea:focus { outline: 0!important; border-color: #5b82e1; box-shadow: 0 0 0 3px rgba(36,87,214,.13); }
input::placeholder, textarea::placeholder { color: #99a4b5; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); }
.check { min-height: 38px; gap: 8px; color: #47566e; font-size: .8rem; }
.form-grid { gap: 0 16px; }
fieldset.card { padding: 17px; }
fieldset[disabled] { opacity: .72; background: #fafbfd; }
.input-row { align-items: center; }

/* Buttons, feedback and status */
.btn {
  min-height: 39px;
  padding: 0 13px;
  border-color: var(--line-strong);
  border-radius: 9px;
  color: #34435b;
  background: #fff;
  font-size: .82rem;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(12,24,44,.025);
}
.btn:not(:disabled):hover { border-color: #b4c1d4; background: #f7f9fc; color: #192a46; }
.btn.primary { border-color: var(--brand); color: #fff; background: linear-gradient(100deg,#2e63dc,#2455c6); box-shadow: 0 3px 8px rgba(36,87,214,.16); }
.btn.primary:not(:disabled):hover { border-color: var(--brand-d); background: var(--brand-d); box-shadow: 0 5px 12px rgba(36,87,214,.23); }
.btn.danger { border-color: #f0c4c0; color: var(--err); background: #fff; }
.btn.danger:not(:disabled):hover { border-color: #e9a5a0; background: var(--errbg); }
.btn.ghost { box-shadow: none; }
.btn.small { min-height: 31px; padding: 0 9px; font-size: .74rem; }
.btn:disabled, button:disabled { opacity: .48; cursor: not-allowed; }
.pill { padding: 3px 8px; border: 1px solid transparent; border-radius: 999px; font-size: .68rem; font-weight: 700; white-space: nowrap; }
.pill.ok { color: #16784c; background: #eaf7f0; border-color: #d8eee1; }
.pill.off { color: #667085; background: #f1f3f6; border-color: #e7eaf0; }
.pill.warn { color: #99570c; background: #fff5e5; border-color: #f7e7c8; }
.alert, .toast { border: 1px solid transparent; border-radius: 10px; font-size: .84rem; }
.alert { margin: 12px 0; padding: 11px 13px; }
.alert.ok { border-color: #d1eade; }
.alert.err { border-color: #f0d1ce; }
.toast { box-shadow: var(--shadow-md); }
.pager { gap: 10px; color: var(--muted); font-size: .78rem; }

/* Data grids */
.table-wrap { max-width: 100%; overflow: auto; border-radius: var(--radius-md); scrollbar-color: #c4cede transparent; scrollbar-width: thin; }
.table-wrap::-webkit-scrollbar { width: 9px; height: 9px; }
.table-wrap::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 99px; background: #c4cede; background-clip: padding-box; }
.card.table-wrap { padding: 7px; }
table.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: .8rem; }
.grid thead { position: sticky; top: 0; z-index: 2; }
.grid th {
  padding: 10px 11px;
  color: #68778f;
  background: #f7f9fc;
  border-top: 1px solid #edf0f5;
  border-bottom: 1px solid #e4e9f1;
  font-size: .65rem;
  font-weight: 750;
  letter-spacing: .075em;
}
.grid th:first-child { border-left: 1px solid #edf0f5; border-top-left-radius: 8px; }
.grid th:last-child { border-right: 1px solid #edf0f5; border-top-right-radius: 8px; }
.grid td { padding: 9px 11px; color: #344259; border-bottom: 1px solid #edf0f4; font-size: .79rem; }
.grid td strong { color: #1d2d47; font-weight: 650; }
.grid tbody tr { transition: background .12s ease; }
.grid tbody tr:hover { background: #f8faff; }
.grid tbody tr:last-child td { border-bottom-color: transparent; }
.grid tfoot th, .grid tfoot td { background: #f8f9fc; border-top: 1px solid #e4e9f1; color: #263853; }
.grid.matrix td { padding-top: 7px; padding-bottom: 7px; }
.grid.matrix input[type=checkbox] { width: 16px; height: 16px; }
.actions { white-space: nowrap; }
.row-menu { z-index: auto; }
.row-menu[open] { z-index: 10000; }
.row-menu > summary { width: 34px; height: 34px; border-radius: 8px; color: #53627a; }
.row-menu-pop { min-width: 185px; max-width: min(280px,calc(100vw - 20px)); padding: 5px; border: 1px solid #dfe5ef; border-radius: 11px; box-shadow: 0 14px 36px rgba(16,31,58,.18); }
.row-menu-pop button { min-height: 35px; border-radius: 7px; font-size: .78rem; }

/* Dialogs and empty/loading states */
.modal-backdrop { background: rgba(13,24,43,.48); backdrop-filter: blur(3px); }
.modal { width: min(700px,94vw); border: 1px solid rgba(224,231,241,.9); border-radius: 16px; box-shadow: 0 28px 85px rgba(12,25,47,.26); }
.modal-head { min-height: 55px; padding: 12px 18px; border-bottom-color: #edf0f5; }
.modal-head h2 { color: #1d2b43; font-size: .98rem; }
.modal-body { padding: 12px 18px 18px; }
.modal-actions { gap: 8px; margin-top: 18px; }
.modal-actions .btn { min-width: 92px; }
.center-card { margin: 32px auto; padding: 28px; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.dashboard-empty, .report-empty { color: #33445e; }
.dashboard-empty p, .report-empty p { color: var(--muted); font-size: .81rem; }
.skeleton-card span, .skeleton-card i { background: linear-gradient(90deg,#edf1f7,#f8f9fc,#edf1f7); background-size: 200% 100%; }

/* Dashboard cards, KPI hierarchy and task shortcuts */
.dashboard-hero { border-radius: 17px; box-shadow: 0 12px 30px rgba(24,45,90,.13); }
.dashboard-kpis { gap: 11px; margin-bottom: 18px; }
.kpi-card { padding: 14px 15px 12px; border-radius: 13px; box-shadow: var(--shadow-sm); }
.kpi-card > strong { font-size: 1.55rem; letter-spacing: -.04em; }
.kpi-card > small { font-size: .75rem; }
.kpi-icon, .shortcut-icon, .quick-icon { border-radius: 10px; }
.dashboard-main-grid { gap: 13px; }
.dashboard-panel { padding: 16px; border-radius: 14px; box-shadow: var(--shadow-sm); }
.dashboard-section-head h2 { font-size: .96rem; }
.dashboard-section-head p { font-size: .74rem; }
.shortcut-card { border-radius: 12px; box-shadow: none; }
.quick-action { padding: 9px 0; }

/* POS touch surface */
.pos-shell { background: radial-gradient(ellipse at 12% 0%,#e8efff 0,transparent 35%),#f3f6fb; }
.pos-body { gap: 14px; padding: 14px; }
.pos-top { min-height: 48px; padding: 8px 16px; }
.scan-row, .cart, .totals { border-color: #e1e7f0; box-shadow: var(--shadow-sm); }
.scan-row { padding: 9px; border-radius: 13px; background: #fff; }
.scan { min-height: 46px!important; font-size: .96rem; }
.chips { gap: 7px; }
.chip { min-height: 39px; padding: 0 14px; font-size: .79rem; }
.tiles-grid { grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 10px; }
.item-tile { min-height: 156px; border-radius: 13px; }
.item-art { height: 88px; }
.cart-line { gap: 7px; padding: 8px 9px; }
.cl-main strong { font-size: .82rem; }
.cl-main small { font-size: .71rem; }
.qbtn, .qval { width: 37px; min-width: 37px; height: 37px; border-radius: 8px; }
.qval { width: 47px; min-width: 47px; }
.totals { padding: 9px 12px; border-radius: 13px; }
.t-row { font-size: .79rem; }
.t-row.grand { font-size: 1.35rem; }
.actions-grid { gap: 7px; }
.big-act { min-height: 46px; font-size: .82rem; }
.pay-btn { min-height: 57px; font-size: 1.08rem; }
.method { min-height: 51px; font-size: .94rem; }
.key { min-height: 54px; border-radius: 10px; font-size: 1.25rem; }

/* Brand and sign-in pages */
.login-body { background: radial-gradient(ellipse at 12% 12%,rgba(90,132,231,.2),transparent 30%),linear-gradient(145deg,#0d1830,#1a3261 60%,#244887); }
.login-shell { border-radius: 23px; }
.login-card { font-size: .9rem; }
.login-card input:not([type=checkbox]) { min-height: 46px; }
.password-card { border-radius: 18px; }

/* Predictable responsive behavior */
@media (min-width: 1500px) {
  .content { padding-inline: 34px; }
  .dashboard-kpis { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (max-width: 1000px) {
  .side { width: 246px; flex-basis: 246px; }
  .content { padding: 18px; }
  .dashboard-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pos-body { padding: 10px; }
}
@media (max-width: 820px) {
  .side { width: min(300px,86vw); flex-basis: auto; }
  .content { padding: 15px; }
  .page-head { align-items: flex-start; }
  .filters { align-items: center; }
  .filters input:not([type=checkbox]) { flex-basis: 100%; }
  .pos-body { flex-direction: column; }
  .pos-right { min-width: 0; max-width: none; }
  .tiles-grid { max-height: none; }
  .cart { max-height: 42vh; }
}
@media (max-width: 560px) {
  body { font-size: 13px; }
  .content { padding: 11px; }
  .top { min-height: 55px; padding: 7px 10px; }
  .page-head { gap: 9px; margin-bottom: 13px; }
  .page-head > .row-gap { width: 100%; }
  .page-head > .row-gap > .btn { flex: 1; }
  .filters { padding: 9px; gap: 7px; }
  .filters select, .filters .btn { flex: 1 1 auto; }
  .card { padding: 12px; }
  .card.table-wrap { padding: 5px; }
  .grid th { padding: 8px; font-size: .61rem; }
  .grid td { padding: 8px; font-size: .73rem; }
  .modal { width: 96vw; max-height: 96dvh; border-radius: 13px; }
  .modal-body { padding: 10px 13px 15px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 110px; }
  .dashboard-kpis { gap: 8px; }
  .kpi-card { padding: 11px; }
  .kpi-card > strong { font-size: 1.25rem; }
  .pos-shell-brand { padding: 7px 11px; }
  .pos-body { padding: 8px; }
  .tiles-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .item-tile { min-height: 140px; padding: 7px; }
  .item-art { height: 78px; }
  .cart { max-height: none; }
  .pos-maker > span:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto!important; animation-duration: .01ms!important; animation-iteration-count: 1!important; transition-duration: .01ms!important; }
}
