﻿:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --panel: #ffffff;
  --ink: #15202b;
  --muted: #617080;
  --line: #d8e1e8;
  --line-strong: #c3d0da;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --blue: #1d4ed8;
  --amber: #b76116;
  --red: #b42318;
  --green-soft: #dff4ed;
  --amber-soft: #fff2df;
  --red-soft: #fde8e5;
  --soft: #eef3f6;
  --soft-2: #f8fafb;
  --shadow: 0 14px 34px rgba(29, 42, 55, 0.08);
  --shadow-soft: 0 8px 20px rgba(29, 42, 55, 0.05);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { min-height: 38px; border: 0; border-radius: 8px; padding: 0 14px; color: #fff; background: var(--teal); cursor: pointer; font-weight: 750; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
button:hover { background: var(--teal-dark); box-shadow: 0 8px 16px rgba(15, 118, 110, .14); }
button:active { transform: translateY(1px); }
button.muted { color: var(--ink); background: var(--soft); border: 1px solid var(--line); }
button.muted:hover { background: #e2ebf0; box-shadow: none; }
button.danger { background: var(--red); }
button.small { min-height: 30px; padding: 0 10px; font-size: 12px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; color: var(--ink); background: #fff; outline: none; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, .13); }
input::placeholder { color: #93a1ad; }

.topbar { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 12px clamp(16px, 3vw, 34px); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px); box-shadow: 0 1px 0 rgba(21, 32, 43, .03); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; white-space: nowrap; }
.brand span, .login-card .brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; color: #fff; background: linear-gradient(135deg, var(--teal), var(--blue)); font-weight: 850; }
.brand strong { font-size: 16px; }
.tabs { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.tab { flex: 0 0 auto; min-height: 34px; color: #506171; background: transparent; border: 1px solid transparent; padding: 0 11px; font-size: 13px; white-space: nowrap; }
.tab:hover, .tab.is-active { color: var(--ink); background: var(--soft); border-color: var(--line); box-shadow: none; }
.authbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.user-badge { display: inline-flex; align-items: center; min-height: 34px; max-width: 260px; border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; color: var(--ink); background: var(--soft-2); font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.shell { padding: clamp(16px, 3vw, 34px); }
.view { display: none; max-width: 1500px; margin: 0 auto; }
.view.is-active { display: block; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.view-head.compact { margin-bottom: 12px; }
.eyebrow { margin: 0 0 4px; color: var(--amber); font-size: 11px; font-weight: 850; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(23px, 2.4vw, 34px); line-height: 1.1; }
h2 { font-size: 17px; }
.status-line { min-height: 22px; margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.status-line.error { color: var(--red); }
.status-line.success { color: var(--teal); }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(156px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric, .panel-block, .form-panel, .list-panel { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow-soft); }
.metric { padding: 15px; border-left: 3px solid var(--teal); }
.metric span { display: block; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.metric strong { display: block; margin-top: 6px; font-size: 23px; line-height: 1.1; }
.metric.wide strong { color: var(--blue); }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel-block { padding: 16px; }
.panel-block h2 { margin-bottom: 12px; }
.split-layout { display: grid; grid-template-columns: minmax(320px, 430px) minmax(0, 1fr); gap: 18px; align-items: start; }
.form-panel, .list-panel { padding: 16px; }
.form-panel { position: sticky; top: 82px; }
.erp-form { display: grid; gap: 12px; }
.erp-form label span { display: block; margin-bottom: 6px; color: #40505e; font-size: 12px; font-weight: 800; }
.form-grid { display: grid; gap: 10px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.check { display: inline-flex; align-items: center; gap: 8px; width: fit-content; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft-2); }
.check.inline-check { align-self: end; width: 100%; }
.check input { width: 18px; height: 18px; accent-color: var(--teal); }
.check span { margin: 0; }
.actions, .row-actions, .tools { display: flex; gap: 8px; align-items: center; }
.actions { flex-wrap: wrap; }
.tools { margin-bottom: 12px; flex-wrap: wrap; }
.tools input { max-width: 280px; }
.tools button { margin-left: auto; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: var(--soft-2); font-size: 11px; font-weight: 850; text-transform: uppercase; }
tbody tr:hover td { background: #fbfdfe; }
tbody tr:last-child td { border-bottom: 0; }
.cell-title { display: block; font-weight: 850; }
.cell-sub { display: block; margin-top: 2px; max-width: 420px; color: var(--muted); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 0 9px; color: var(--teal); background: var(--green-soft); font-size: 11px; font-weight: 850; }
.badge.warn { color: #8f470f; background: var(--amber-soft); }
.badge.muted { color: var(--muted); background: var(--soft); }
.progress { width: 120px; height: 8px; overflow: hidden; border-radius: 999px; background: var(--soft); }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--blue)); }
.empty { padding: 28px; color: var(--muted); text-align: center; }
.table-stack { display: grid; gap: 18px; }
.table-stack h2 { margin: 0 0 10px; }
.soft-rule { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #edf7f4, #f6f8fb); }
.login-card { width: min(420px, 100%); display: grid; gap: 14px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.login-card .brand-mark { width: 48px; height: 48px; }
.login-card label span { display: block; margin-bottom: 6px; color: #40505e; font-size: 13px; font-weight: 800; }
.login-demo { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
body:not(.is-authenticated) .app-chrome, body:not(.is-authenticated) .shell { display: none; }
body.is-authenticated .login-screen { display: none; }
body:not(.is-admin) .admin-only { display: none !important; }
body.employee .form-panel { display: none; }
body.employee .split-layout { grid-template-columns: 1fr; }
body.employee .row-actions { display: none; }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: 1fr auto; }
  .tabs { grid-column: 1 / -1; justify-content: flex-start; order: 3; }
  .form-panel { position: static; }
  .metric-grid, .dashboard-grid, .split-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar, .view-head, .tools { align-items: stretch; }
  .topbar { display: flex; flex-direction: column; }
  .brand, .authbar { width: 100%; justify-content: space-between; }
  .tabs { width: 100%; }
  .tab { flex: 1 0 auto; }
  .tools input { max-width: none; }
  .tools button { margin-left: 0; }
  .form-grid.two, .form-grid.three, .form-grid.four { grid-template-columns: 1fr; }
  .metric strong { font-size: 21px; }
}


.retail-tab { color: var(--teal); border-color: rgba(15, 118, 110, .22); background: #edf8f5; }
.retail-tab.is-active, .retail-tab:hover { color: #063f3b; background: #dff4ed; border-color: rgba(15, 118, 110, .36); }
.module-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.module-link { display: inline-flex; align-items: center; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; color: var(--ink); background: var(--panel); text-decoration: none; font-size: 13px; font-weight: 800; box-shadow: var(--shadow-soft); }
.module-link:hover { border-color: var(--line-strong); background: var(--soft-2); }
.module-link.retail-link { color: var(--teal); border-color: rgba(15, 118, 110, .28); background: #edf8f5; }
