:root {
  color-scheme: light;
  --blue-950: #102a56;
  --blue-900: #15396f;
  --blue-800: #17468f;
  --blue-700: #1d5fc4;
  --blue-600: #2875dc;
  --blue-100: #eaf3ff;
  --blue-50: #f5f9ff;
  --ink: #172b4d;
  --muted: #71819a;
  --line: #e5ebf4;
  --white: #fff;
  --green: #15805d;
  --red: #bd3c49;
  --shadow: 0 16px 42px rgba(24, 62, 116, .09);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f7f9fc; color: var(--ink); font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.app { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { background: var(--white); border-right: 1px solid var(--line); padding: 22px 15px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 7px 27px; }
.brand-mark { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(145deg, var(--blue-600), var(--blue-800)); color: white; font-weight: 850; letter-spacing: -.04em; box-shadow: 0 7px 15px rgba(40,117,220,.2); }
.brand-name { font-size: 14px; font-weight: 800; line-height: 1.2; }
.brand-caption { margin-top: 4px; color: var(--muted); font-size: 11px; }
.nav-label { padding: 0 11px; margin: 7px 0 9px; color: #9aa7b9; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav-item { border: 0; width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; background: transparent; color: #596b85; text-align: left; font-weight: 650; }
.nav-item .icon { width: 20px; text-align: center; font-size: 17px; }
.nav-item:hover { background: #f6f9fd; }
.nav-item.active { background: var(--blue-100); color: var(--blue-800); }
.sidebar-bottom { margin-top: auto; }
.help-card { background: var(--blue-50); border: 1px solid #e3efff; border-radius: 14px; padding: 13px; }
.help-card strong { display: block; margin-bottom: 5px; font-size: 12px; }
.help-card span { color: var(--muted); font-size: 11px; }
.main { min-width: 0; }
.topbar { min-height: 72px; background: var(--white); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 0 32px; }
.breadcrumbs { color: var(--muted); font-size: 12px; }
.breadcrumbs b { color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 13px; }
.profile { display: flex; align-items: center; gap: 9px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--blue-800); background: var(--blue-100); font-weight: 800; font-size: 12px; }
.profile-name { font-size: 12px; font-weight: 700; }
.profile-role { margin-top: 2px; color: var(--muted); font-size: 10px; }
.content { width: min(1320px, 100%); margin: 0 auto; padding: 28px 32px 42px; }
.welcome { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 21px; }
h1 { margin: 0; color: var(--blue-950); font-size: clamp(23px, 3vw, 30px); letter-spacing: -.035em; }
h2, h3, p { margin-top: 0; }
.subtitle { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.date { color: var(--muted); font-size: 11px; }
.action-row { display: flex; gap: 9px; margin-bottom: 19px; }
.btn { border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 720; transition: .15s ease; }
.btn-primary { color: white; background: var(--blue-700); box-shadow: 0 5px 12px rgba(29,95,196,.16); }
.btn-primary:hover { background: var(--blue-800); }
.btn-secondary { color: var(--blue-800); background: white; border: 1px solid #d8e4f2; }
.btn-secondary:hover { background: var(--blue-50); }
.btn-danger { color: #a63240; background: #fff2f3; border: 1px solid #f6d6d9; }
.btn-small { padding: 7px 10px; font-size: 11px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.metric { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; box-shadow: 0 3px 10px rgba(24,62,116,.025); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 650; }
.metric-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: var(--blue-50); color: var(--blue-700); font-size: 15px; }
.metric-value { margin-top: 12px; color: var(--blue-950); font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.metric-note { margin-top: 3px; color: #94a0b1; font-size: 10px; }
.panels { display: grid; grid-template-columns: 1.2fr .9fr; gap: 14px; }
.panel { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.panel-head { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px; border-bottom: 1px solid #edf1f6; }
.panel-title { margin: 0; font-size: 13px; font-weight: 780; }
.panel-link { border: 0; background: transparent; color: var(--blue-700); font-size: 11px; font-weight: 700; }
.panel-body { padding: 15px; }
.empty { min-height: 175px; padding: 25px 18px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-illustration { width: 49px; height: 49px; border-radius: 15px; display: grid; place-items: center; margin: 0 auto 10px; background: var(--blue-50); color: var(--blue-700); font-size: 21px; }
.empty strong { display: block; color: var(--ink); font-size: 12px; }
.empty p { max-width: 285px; margin: 5px auto 12px; font-size: 11px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; }
.toolbar h1 { font-size: 24px; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; }
.search-input { width: min(300px, 38vw); padding: 10px 12px; border: 1px solid var(--line); background: white; border-radius: 10px; outline: none; }
.search-input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: #9fc4f8; box-shadow: 0 0 0 3px rgba(40,117,220,.1); outline: none; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 13px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td { padding: 11px 13px; border-bottom: 1px solid #edf1f6; text-align: left; vertical-align: middle; }
th { color: #7d8ba0; background: #fbfcfe; font-size: 10px; font-weight: 750; white-space: nowrap; }
td { color: #314560; font-size: 11px; }
tr:last-child td { border-bottom: 0; }
.cell-strong { color: var(--ink); font-weight: 720; }
.muted { color: var(--muted); }
.badge { display: inline-flex; align-items: center; border-radius: 99px; padding: 4px 8px; background: var(--blue-50); color: var(--blue-800); font-size: 10px; font-weight: 700; }
.badge.warning { background: #fff6e8; color: #a66600; }
.badge.danger { background: #fff0f1; color: #a63240; }
.badge.success { background: #effaf6; color: #147955; }
.empty-row { padding: 35px; color: var(--muted); text-align: center; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { color: #536782; font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid #dfe7f1; border-radius: 9px; background: white; color: var(--ink); }
.field textarea { min-height: 75px; resize: vertical; }
.field small { color: var(--muted); font-size: 10px; }
.section-title { grid-column: 1 / -1; margin: 8px 0 -4px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--blue-900); font-size: 12px; font-weight: 800; }
.pos-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 15px; align-items: start; }
.pos-products, .cart-panel { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.pos-products h2, .cart-panel h2 { margin: 0 0 13px; color: var(--blue-950); font-size: 14px; }
.pos-add { display: grid; grid-template-columns: 1fr 105px auto; gap: 8px; margin: 13px 0 6px; }
.pos-add select, .pos-add input { width: 100%; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 0; border-bottom: 1px solid #edf1f6; }
.cart-line:last-child { border-bottom: 0; }
.cart-line-name { font-weight: 720; font-size: 11px; }
.cart-line-sub { margin-top: 3px; color: var(--muted); font-size: 10px; }
.cart-actions { display: flex; align-items: center; gap: 4px; }
.icon-button { width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--blue-800); }
.totals { display: grid; gap: 8px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.total-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.total-row.grand { color: var(--blue-950); font-size: 16px; font-weight: 820; }
.cart-discount { width: 110px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; text-align: right; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 10%, #e4f0ff, transparent 38%), #f5f8fc; }
.auth-card { width: min(420px, 100%); padding: 30px; background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 23px; }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card .subtitle { margin-bottom: 21px; }
.auth-card form { display: grid; gap: 13px; }
.auth-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--blue-700); font-size: 11px; font-weight: 700; }
.message { padding: 10px 12px; border-radius: 9px; background: var(--blue-50); color: var(--blue-800); font-size: 11px; }
.message.error { background: #fff1f2; color: #a63240; }
.modal-backdrop { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(13, 31, 58, .36); }
.modal { width: min(560px, 100%); max-height: min(90vh, 820px); overflow: auto; background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.modal-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 18px; background: white; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; color: var(--blue-950); font-size: 15px; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--line); }
.close-button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--blue-50); color: var(--blue-800); font-size: 18px; }
.toast { position: fixed; z-index: 30; right: 18px; bottom: 18px; max-width: min(420px, calc(100vw - 36px)); padding: 11px 14px; background: var(--blue-950); color: white; border-radius: 11px; box-shadow: var(--shadow); font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #9d3440; }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.report-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.report-card span { display: block; color: var(--muted); font-size: 10px; }
.report-card strong { display: block; margin-top: 8px; color: var(--blue-950); font-size: 20px; }
.bottom-nav { display: none; }
.loading { padding: 28px; color: var(--muted); text-align: center; }
.connection { display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px; border: 1px solid #d8f0e7; border-radius: 99px; background: #effaf6; color: var(--green); font-size: 10px; font-weight: 700; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #22a477; }
.print-only { display: none; }
@media (max-width: 1000px) {
  .app { grid-template-columns: 215px minmax(0, 1fr); }
  .content { padding: 24px 22px 35px; }
  .topbar { padding: 0 22px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .app { display: block; padding-bottom: 67px; }
  .sidebar { display: none; }
  .topbar { min-height: 62px; padding: 0 15px; }
  .breadcrumbs { display: none; }
  .top-actions { gap: 8px; }
  .profile-name, .profile-role { display: none; }
  .content { padding: 22px 15px 28px; }
  .welcome { align-items: start; flex-direction: column; gap: 7px; margin-bottom: 16px; }
  .action-row { display: grid; grid-template-columns: 1fr 1fr; }
  .btn { padding: 10px; font-size: 11px; }
  .cards { gap: 9px; margin-bottom: 13px; }
  .metric { padding: 12px; border-radius: 12px; }
  .metric-top { font-size: 10px; }
  .metric-icon { width: 28px; height: 28px; }
  .metric-value { font-size: 19px; margin-top: 9px; }
  .panels { grid-template-columns: 1fr; gap: 12px; }
  .toolbar { align-items: start; flex-direction: column; }
  .toolbar-actions, .search-input { width: 100%; }
  .toolbar-actions .search-input { flex: 1; }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-add { grid-template-columns: minmax(0, 1fr) 75px; }
  .pos-add .btn { grid-column: 1 / -1; }
  .report-grid { grid-template-columns: 1fr 1fr; }
  .bottom-nav { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: white; border-top: 1px solid var(--line); padding: 6px 3px max(6px, env(safe-area-inset-bottom)); }
  .bottom-nav button { border: 0; background: transparent; color: #8290a4; font-size: 9px; font-weight: 650; display: grid; justify-items: center; gap: 3px; padding: 3px 1px; }
  .bottom-nav button span { font-size: 17px; line-height: 1; }
  .bottom-nav button.active { color: var(--blue-700); }
}
@media print {
  body * { visibility: hidden !important; }
  .print-only, .print-only * { visibility: visible !important; }
  .print-only { display: block; position: absolute; inset: 0; width: 72mm; padding: 3mm; color: #000; background: #fff; font: 10pt/1.35 monospace; }
}
