:root {
  --bg: #f3f6f4;
  --panel: #ffffff;
  --panel-2: #f8faf9;
  --line: #e4eae6;
  --line-strong: #d3ddd7;
  --ink: #0d1b17;
  --muted: #68766f;
  --muted-2: #93a099;
  --brand: #0f766e;
  --brand-2: #115e59;
  --brand-soft: #e7f5f1;
  --nav: #091713;
  --nav-2: #10221d;
  --nav-text: #d6e3de;
  --amber: #a16207;
  --amber-soft: #fef3c7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --green: #15803d;
  --green-soft: #dcfce7;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(13, 27, 23, .04), 0 10px 30px rgba(13, 27, 23, .04);
  --font: "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Code", "Roboto Mono", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
select { appearance: none !important; -webkit-appearance: none !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%2368766f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important; background-repeat: no-repeat !important; background-position: right 12px center !important; background-size: 12px !important; padding-right: 34px !important; }

html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
code { font-family: var(--mono); font-size: .9em; }
.icon { flex: none; display: inline-block; vertical-align: middle; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--panel); }
.login-brand { position: relative; overflow: hidden; background: radial-gradient(900px 500px at 20% 0%, rgba(45, 212, 191, .16), transparent 55%), linear-gradient(145deg, #06120f, #0d211c 62%, #102a24); color: #f0fdfa; padding: 48px clamp(32px, 6vw, 88px); display: flex; flex-direction: column; justify-content: center; }
.login-brand:after { content: ""; position: absolute; width: 540px; height: 540px; right: -220px; bottom: -260px; border: 1px solid rgba(153, 246, 228, .14); border-radius: 50%; box-shadow: 0 0 0 80px rgba(153, 246, 228, .03), 0 0 0 160px rgba(153, 246, 228, .02); }
.login-brand-inner { position: relative; z-index: 1; max-width: 520px; }
.brand-lockup { display: inline-flex; align-items: center; gap: 11px; }
.brand-lockup .brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(145deg, #2dd4bf, #0f766e); color: #04211c; font-weight: 850; font-size: 19px; box-shadow: 0 8px 24px rgba(45, 212, 191, .24); }
.brand-lockup > span:last-child { display: flex; flex-direction: column; line-height: 1.1; }
.brand-lockup strong { font-size: 17px; letter-spacing: -.03em; }
.brand-lockup small { font-size: 9.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .18em; opacity: .56; margin-top: 3px; }
.brand-lockup-light { color: #f0fdfa; }
.login-brand h1 { margin: 38px 0 14px; font-size: clamp(35px, 4vw, 54px); line-height: 1.04; letter-spacing: -.055em; font-weight: 720; }
.login-brand p { max-width: 440px; color: rgba(209, 250, 229, .7); font-size: 15px; line-height: 1.65; }
.login-points { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 34px; color: rgba(209, 250, 229, .88); font-size: 12.5px; font-weight: 550; }
.login-points span { display: inline-flex; align-items: center; gap: 7px; }
.login-points .icon { color: #5eead4; }
.login-foot { position: absolute; left: clamp(32px, 6vw, 88px); bottom: 34px; z-index: 1; font-size: 10px; text-transform: uppercase; letter-spacing: .18em; color: rgba(209, 250, 229, .38); }
.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; background: linear-gradient(180deg, #fbfdfc, #f2f6f3); }
.login-card { width: min(100%, 380px); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 30px; }
.login-card-head { margin-bottom: 20px; }
.login-kicker { display: block; font-size: 9.5px; font-weight: 750; letter-spacing: .17em; text-transform: uppercase; color: var(--brand); margin-bottom: 7px; }
.login-card h2 { font-size: 27px; letter-spacing: -.04em; line-height: 1.1; }
.login-card-head p { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.login-card .field { margin-bottom: 13px; }
.login-card .btn { margin-top: 8px; }
.login-hint { text-align: center; color: var(--muted-2); font-size: 10.5px; margin-top: 14px; }
.login-hint code { background: var(--panel-2); border: 1px solid var(--line); padding: 2px 5px; border-radius: 4px; }
.login-copy { margin-top: 18px; font-size: 10px; color: var(--muted-2); }
.form-error { background: var(--red-soft); color: var(--red); border: 1px solid #fecaca; border-radius: 9px; padding: 9px 11px; font-size: 12px; margin-bottom: 14px; }

/* ---------- Shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 256px; background: linear-gradient(180deg, var(--nav), #0b1e19 70%, #0c211c); color: var(--nav-text); padding: 20px 14px 14px; display: flex; flex-direction: column; z-index: 40; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 18px; }
.sidebar .brand-lockup strong { font-size: 16px; }
.sidebar .brand-lockup small { color: rgba(214, 227, 222, .5); }
.sidebar .brand-mark { width: 34px; height: 34px; background: linear-gradient(145deg, #2dd4bf, #0f766e); color: #04211c; box-shadow: 0 6px 18px rgba(45, 212, 191, .2); }
.sidebar-close { display: none !important; color: var(--nav-text); }
.store-chip { display: flex; align-items: center; gap: 10px; margin: 0 4px 18px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .055); border: 1px solid rgba(255, 255, 255, .07); }
.store-avatar { width: 32px; height: 32px; border-radius: 9px; background: rgba(45, 212, 191, .12); color: #5eead4; display: grid; place-items: center; font-weight: 750; font-size: 14px; flex: none; }
.store-meta, .user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.store-meta strong, .user-meta strong { font-size: 12px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-meta small, .user-meta small { font-size: 9.5px; color: rgba(214, 227, 222, .48); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 48px; padding: 10px 12px; border-radius: 9px; color: rgba(214, 227, 222, .66); font-size: 12.5px; font-weight: 530; transition: background .15s ease, color .15s ease; }
.nav-link:hover { background: rgba(255, 255, 255, .055); color: #f0fdfa; }
.nav-link.active { background: rgba(45, 212, 191, .11); color: #f0fdfa; box-shadow: inset 0 0 0 1px rgba(45, 212, 191, .1); }
.nav-link.active .icon { color: #5eead4; }
.nav-dot { margin-left: auto; width: 5px; height: 5px; border-radius: 50%; background: #2dd4bf; box-shadow: 0 0 0 4px rgba(45, 212, 191, .1); }
.sidebar-card { display: flex; gap: 10px; margin-top: auto; margin-bottom: 12px; padding: 11px; border-radius: 11px; background: rgba(45, 212, 191, .06); border: 1px solid rgba(45, 212, 191, .1); }
.sidebar-card-icon { color: #5eead4; padding-top: 1px; }
.sidebar-card strong { display: block; font-size: 10.5px; color: #ecfdf5; }
.sidebar-card small { display: block; font-size: 9.5px; line-height: 1.4; color: rgba(209, 250, 229, .45); margin-top: 2px; }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 8px 6px 2px; border-top: 1px solid rgba(255, 255, 255, .07); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .09); color: #ecfdf5; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.sidebar-user .icon-btn { margin-left: auto; color: rgba(214, 227, 222, .5); }
.sidebar-user .icon-btn:hover { color: #fecaca; background: rgba(254, 202, 202, .08); }
.app-main { margin-left: 256px; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; height: 66px; display: flex; align-items: center; gap: 16px; padding: 0 30px; background: rgba(243, 246, 244, .86); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(211, 221, 215, .6); }
.topbar-title { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-title span { font-size: 9.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); }
.topbar-title strong { font-size: 14px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 11.5px; }
.topbar-date { text-transform: capitalize; }
.topbar-store { padding: 5px 9px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); font-size: 10.5px; font-weight: 600; color: var(--ink); }
.topbar-menu { display: none !important; }
.sidebar-scrim { display: none; }
.content { padding: 28px 30px 54px; max-width: 1440px; margin: 0 auto; }

/* ---------- Generic ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1, .client-hero h1, .order-hero h1 { font-size: clamp(25px, 2.4vw, 34px); line-height: 1.08; letter-spacing: -.045em; font-weight: 710; }
.page-head p, .client-hero p, .order-hero p { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font-size: 12px; font-weight: 620; box-shadow: 0 1px 1px rgba(13, 27, 23, .03); transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { background: var(--panel-2); border-color: #c3cfc8; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 5px 14px rgba(15, 118, 110, .16); }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-quiet { background: transparent; box-shadow: none; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--panel-2); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-quiet { background: transparent; color: var(--red); border-color: #fecaca; box-shadow: none; }
.btn-danger-quiet:hover { background: var(--red-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 31px; padding: 0 10px; font-size: 11px; border-radius: 7px; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 7px; padding: 0; }
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }
.text-link { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-size: 11px; font-weight: 650; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.back-link { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11.5px; font-weight: 600; margin-bottom: 14px; }
.back-link:hover { color: var(--ink); }
.muted-note { color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.muted-row { opacity: .48; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 14px; }
.card-head h2 { font-size: 14px; font-weight: 680; letter-spacing: -.02em; }
.card-head p { color: var(--muted-2); font-size: 10.5px; margin-top: 3px; }
.card-head > .icon { color: var(--muted-2); margin-top: 2px; }
.card-chip { padding: 4px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-2); font-size: 10px; font-weight: 700; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 13px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 15px 16px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi:before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); opacity: .75; }
.kpi-amber:before { background: #f59e0b; } .kpi-blue:before { background: #3b82f6; } .kpi-red:before { background: #ef4444; } .kpi-green:before { background: #22c55e; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.kpi-icon { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--panel-2); color: var(--brand); }
.kpi strong { display: block; margin-top: 10px; font-size: clamp(21px, 1.8vw, 27px); line-height: 1.05; letter-spacing: -.045em; font-weight: 720; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi small { display: block; margin-top: 6px; color: var(--muted-2); font-size: 10px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 9px 14px; background: var(--panel-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted-2); font-size: 9px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid #eef2ef; font-size: 12px; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfcfb; }
.table .clickable { cursor: pointer; }
.table td strong { display: block; font-weight: 640; font-size: 12px; color: var(--ink); }
.table td small { display: block; color: var(--muted-2); font-size: 9.5px; margin-top: 2px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .row-arrow { width: 28px; text-align: right; color: var(--muted-2); }
.table.compact td { padding: 9px 12px; }
.table.compact th { padding: 8px 12px; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.person { display: flex; align-items: center; gap: 9px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); font-size: 10.5px; font-weight: 750; flex: none; }
.avatar-lg { width: 52px; height: 52px; font-size: 16px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 5px; font-size: 9.5px; font-weight: 700; white-space: nowrap; letter-spacing: .01em; }
.badge-success { background: var(--green-soft); color: var(--green); }
.badge-warning { background: var(--amber-soft); color: var(--amber); }
.badge-error { background: var(--red-soft); color: var(--red); }
.badge-info { background: var(--blue-soft); color: var(--blue); }
.badge-neutral { background: #f1f5f2; color: var(--muted); }

/* ---------- Toolbar & forms ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar-wrap { flex-wrap: wrap; }
.toolbar-meta { margin-left: auto; color: var(--muted-2); font-size: 10.5px; white-space: nowrap; }
.toolbar-check { white-space: nowrap; }
.search-field { display: flex; align-items: center; gap: 8px; height: 35px; min-width: 240px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel-2); color: var(--muted-2); flex: 1 1 240px; max-width: 440px; }
.search-field input { width: 100%; border: 0; background: transparent; outline: none; font-size: 12px; color: var(--ink); }
.search-field input::placeholder { color: var(--muted-2); }
.input-select { height: 35px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); padding: 0 30px 0 10px; font-size: 11.5px; color: var(--ink); outline: none; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel-2); padding: 9px 10px; font-size: 12.5px; outline: none; transition: border .15s, box-shadow .15s, background .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(15, 118, 110, .55); background: #fff; box-shadow: 0 0 0 3px rgba(15, 118, 110, .09); }
.field input:disabled { opacity: .55; cursor: not-allowed; }
.field textarea { resize: vertical; min-height: 70px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.span-2 { grid-column: span 2; }
.check-field { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); }
.check-field input { accent-color: var(--brand); width: 15px; height: 15px; }
.form { padding: 2px 0; }
.form .btn-block { margin-top: 4px; }

/* ---------- Modal / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(5, 15, 12, .52); display: flex; align-items: center; justify-content: center; padding: 22px; animation: fade .15s ease-out; }
.modal { width: min(100%, 520px); max-height: calc(100vh - 44px); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 30px 90px rgba(5, 15, 12, .28); display: flex; flex-direction: column; animation: pop .16s ease-out; }
.modal-lg { width: min(100%, 720px); }
.modal-xl { width: min(100%, 900px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 20px 0; }
.modal-head h2 { font-size: 19px; letter-spacing: -.03em; }
.modal-head p { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.confirm-text { color: var(--muted); font-size: 12.5px; line-height: 1.65; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } }
#toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; background: #10221d; color: #ecfdf5; border: 1px solid rgba(45, 212, 191, .18); padding: 10px 13px; border-radius: 9px; font-size: 11.5px; box-shadow: 0 14px 40px rgba(5, 15, 12, .26); opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; max-width: 360px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: #2b1113; border-color: rgba(252, 165, 165, .25); color: #fee2e2; }
.toast span:first-child { display: inline-flex; color: #5eead4; }
.toast-error span:first-child { color: #fca5a5; }

/* ---------- Dashboard ---------- */
.chart { height: 205px; display: flex; align-items: flex-end; gap: 7px; padding: 10px 20px 20px; }
.chart-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.chart-value { font-size: 8px; color: var(--muted-2); font-variant-numeric: tabular-nums; height: 12px; }
.chart-bar { width: min(30px, 76%); min-height: 3px; background: linear-gradient(180deg, #2dd4bf, #0f766e); border-radius: 4px 4px 2px 2px; position: relative; transition: height .3s ease; }
.chart-bar:hover { filter: brightness(1.08); }
.chart-tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #10221d; color: #ecfdf5; padding: 4px 6px; border-radius: 4px; font-size: 9px; white-space: nowrap; z-index: 2; }
.chart-bar:hover .chart-tip { display: block; }
.chart-day { font-size: 8.5px; color: var(--muted-2); text-transform: capitalize; }
.list { padding: 2px 20px 12px; }
.list-row { display: flex; align-items: center; gap: 9px; min-height: 48px; border-bottom: 1px solid #eff3f0; }
.list-row:last-child { border-bottom: 0; }
.list-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; }
.list-dot.danger { background: var(--red); }
.list-main { min-width: 0; flex: 1; }
.list-main strong { display: block; font-size: 11.5px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-main small { display: block; color: var(--muted-2); font-size: 9.5px; margin-top: 1px; }
.list-meta { color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list-avatar { width: 27px; height: 27px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; font-size: 9px; font-weight: 750; flex: none; }

/* ---------- Client / order detail ---------- */
.client-hero, .order-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; margin-bottom: 14px; }
.client-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.client-name-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.detail-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.detail-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; box-shadow: 0 1px 2px rgba(13,27,23,.02); }
.detail-stat span { display: block; color: var(--muted-2); font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.detail-stat strong { display: block; margin-top: 5px; font-size: 17px; letter-spacing: -.03em; }
.info-list { display: grid; gap: 0; padding: 0 20px 16px; }
.info-list div { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 8px 0; border-bottom: 1px solid #eff3f0; }
.info-list div:last-child { border-bottom: 0; }
.info-list span { color: var(--muted-2); font-size: 10px; }
.info-list strong { text-align: right; font-size: 11.5px; font-weight: 580; }
.info-list a { color: var(--brand); font-weight: 650; }
.note-box { margin: 0 20px 20px; padding: 11px 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.note-box strong { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); margin-bottom: 4px; }
.note-box p { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.client-summary { display: flex; align-items: center; gap: 10px; padding: 0 20px 14px; }
.client-summary strong { display: block; font-size: 13px; }
.client-summary small { display: block; color: var(--muted-2); font-size: 10.5px; margin-top: 1px; }
.order-hero-right { text-align: right; }
.order-hero-right > strong { display: block; font-size: 25px; letter-spacing: -.04em; margin-bottom: 8px; }
.order-status-card { margin-bottom: 16px; }
.status-steps { display: flex; gap: 0; padding: 4px 20px 16px; }
.status-step { flex: 1; position: relative; padding-top: 14px; font-size: 9.5px; font-weight: 650; color: var(--muted-2); }
.status-step:before { content: ""; position: absolute; top: 4px; left: 0; right: 0; height: 2px; background: var(--line); }
.status-step:first-child:before { border-radius: 2px 0 0 2px; }
.status-step:last-child:before { border-radius: 0 2px 2px 0; }
.status-step.done { color: var(--brand-2); }
.status-step.done:before { background: #2dd4bf; }
.status-step.current { color: var(--ink); }
.order-update-grid { grid-template-columns: 1fr 1.6fr auto; align-items: end; padding: 0 20px 20px; }
.order-update-grid .btn { justify-self: start; }
.order-detail-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr); }
.totals-box { margin: 8px 20px 20px auto; width: min(100%, 310px); }
.totals-box div { display: flex; justify-content: space-between; padding: 5px 0; font-size: 11.5px; color: var(--muted); }
.totals-box .grand { border-top: 1px solid var(--line-strong); margin-top: 5px; padding-top: 9px; font-size: 15px; font-weight: 750; color: var(--ink); }
.payment-card { margin-bottom: 16px; }
.payment-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 20px 10px; }
.payment-summary > div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.payment-summary span { display: block; color: var(--muted-2); font-size: 8.5px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.payment-summary strong { display: block; margin-top: 4px; font-size: 16px; font-variant-numeric: tabular-nums; }
.payment-progress { height: 6px; margin: 0 20px 10px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.payment-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2dd4bf, #0f766e); }
.payment-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px 14px; color: var(--muted); font-size: 10.5px; }
.sale-form { display: flex; flex-direction: column; gap: 20px; padding-bottom: 58px; }.sale-form .card-head { padding: 20px 22px 16px; }
.sale-form .card-head h2 { font-size: 18px; }
.sale-form .card-head p { font-size: 12px; }
.sale-form .field > span { font-size: 11.5px; letter-spacing: .06em; }
.sale-form .field input, .sale-form .field select, .sale-form .field textarea { font-size: 13px; padding: 10px 11px; }
.sale-form .form-grid { gap: 16px; }
.sale-client-row { padding: 0 22px 22px; }
.sale-optical-fields { padding: 0 22px 22px; }
.sale-payment-grid { padding: 0 22px 22px; gap: 24px; }
.rx-eye-fields label > span, .rx-lens-fields label > span { font-size: 10.5px; letter-spacing: .02em; }
.rx-eye-fields input, .rx-lens-fields input, .rx-lens-fields select { font-size: 12.5px; padding: 8px 7px; }
.rx-lens-fields { gap: 8px; margin-top: 12px; }
.rx-saved-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 0 22px 14px; }
.rx-saved-head > div { display: flex; flex-direction: column; gap: 3px; }
.rx-saved-head span { font-size: 9px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.rx-saved-head strong { font-size: 15px; font-weight: 700; }
.rx-saved-head small { font-size: 11px; color: var(--muted); }
.rx-saved-note { margin: 0 22px 18px; padding: 10px 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.rx-table.rx-detail th { font-size: 10.5px; padding: 9px 10px; }
.rx-table.rx-detail td { font-size: 12.5px; padding: 9px 10px; }
.rx-lens-summary span { font-size: 10.5px; }
.sale-form .order-line input, .sale-form .order-line select { font-size: 12.5px; padding: 8px 7px; }
.sale-form .order-line-head { font-size: 9px; padding-top: 8px; padding-bottom: 8px; }

.sale-savebar { position: sticky; bottom: 10px; z-index: 15; display: flex; justify-content: flex-end; gap: 8px; padding: 10px 0 4px; background: linear-gradient(180deg, rgba(243,246,244,0), rgba(243,246,244,.92) 35%); }

.sale-section { overflow: visible; }
.sale-client-row { grid-template-columns: minmax(0, 1fr) auto; align-items: end; padding: 0 20px 20px; }
.sale-optical-fields { padding: 0 20px 20px; }
.sale-optical-fields[hidden] { display: none; }
.sale-payment-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; padding: 0 20px 20px; }
.sale-totals { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.sale-totals > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 11.5px; color: var(--muted); }
.sale-totals strong { color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.sale-totals input { width: 120px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; padding: 6px 8px; font-size: 11.5px; text-align: right; }
.sale-totals .grand { border-top: 1px solid var(--line-strong); margin-top: 5px; padding-top: 9px; font-size: 14px; font-weight: 750; color: var(--ink); }
.sale-totals .grand strong { font-size: 18px; }
.report-list { padding: 2px 20px 18px; display: flex; flex-direction: column; gap: 12px; }
.report-row-head { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; margin-bottom: 5px; }
.report-row-head span { color: var(--muted); font-variant-numeric: tabular-nums; }
.report-track { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.report-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2dd4bf, #0f766e); }
.table td.rank { width: 28px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.optical-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.optical-card { overflow: hidden; }
.rx-table { width: 100%; border-collapse: collapse; margin: 0; }
.rx-table th { padding: 8px 20px; background: var(--panel-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted-2); font-size: 9px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; text-align: center; }
.rx-table th:first-child { text-align: left; }
.rx-table td { padding: 8px 20px; border-bottom: 1px solid #eef2ef; font-size: 12px; font-variant-numeric: tabular-nums; text-align: center; }
.rx-table td:first-child { text-align: left; color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .08em; }
.rx-table td:not(:first-child) { color: var(--ink); font-weight: 600; }
.rx-table.rx-detail th, .rx-table.rx-detail td { padding: 7px 8px; font-size: 10.5px; }
.rx-lens-summary { display: flex; flex-direction: column; gap: 3px; padding: 8px 20px 12px; border-top: 1px dashed var(--line); background: #fbfdff; }
.rx-lens-summary span { color: var(--muted); font-size: 9.5px; }
.rx-lens-summary strong { color: var(--brand-2); font-size: 9px; margin-right: 4px; }
.rx-footer { display: flex; justify-content: space-between; gap: 10px; padding: 9px 20px 12px; color: var(--muted-2); font-size: 9.5px; }
.optical-history { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 9px 20px 14px; border-top: 1px solid var(--line); }
.optical-history > span { font-size: 8.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); margin-right: 3px; }
.optical-history button { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 5px; padding: 3px 7px; font-size: 9.5px; cursor: pointer; }
.optical-history button:hover { border-color: var(--brand); color: var(--brand); }
.lens-hero { display: flex; align-items: center; gap: 10px; padding: 0 20px 12px; }
.lens-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.lens-name { min-width: 0; flex: 1; }
.lens-name strong { display: block; font-size: 13px; font-weight: 680; }
.lens-name small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.lens-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; padding: 0 20px 16px; }
.lens-facts > div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #eff3f0; }
.lens-facts span { color: var(--muted-2); font-size: 9.5px; }
.lens-facts strong { font-size: 10.5px; font-weight: 580; text-align: right; }
.rx-form-grid { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.rx-form-toggle { margin: 14px 0 2px; }
.rx-shell { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.rx-toolbar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.rx-lens-tabs { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; }
.rx-lens-tabs button { min-height: 38px; padding: 0 17px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.rx-lens-tabs button.active { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(15,118,110,.16); }
.rx-tab-dot { display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; background: var(--brand); vertical-align: middle; }
.rx-tab-dot[hidden] { display: none; }
.rx-lens-tabs button.active .rx-tab-dot { background: #fff; }
.rx-mode-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.rx-mode-tabs button { min-height: 44px; padding: 0 19px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; color: var(--muted); font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.rx-mode-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 5px 14px rgba(15,118,110,.17); }
.rx-mode-panel .rx-eye-grid { padding: 0; }
.rx-eye-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 0; }
.rx-eye { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 14px 15px 16px; min-width: 0; }
.rx-eye h4 { margin: 0 0 9px; font-size: 18px; line-height: 1.1; font-weight: 780; letter-spacing: -.02em; color: var(--brand-2); }
.rx-eye-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding-bottom: 0; border-bottom: 0; }
.rx-eye-fields.rx-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rx-eye-fields.rx-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rx-eye-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.rx-eye-head h4 { font-size: 20px; }
.rx-transpose-eye { width: 28px; height: 28px; border: 1px solid var(--line-strong); border-radius: 50%; background: #fff; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.rx-transpose-eye:hover { border-color: var(--brand); color: var(--brand); }
.rx-step-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rx-step-label { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 26px; }
.rx-step-label > label { font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.rx-steppers { display: inline-flex; gap: 3px; }
.rx-steppers button { width: 25px; height: 25px; border: 1px solid var(--line-strong); border-radius: 50%; background: #fff; color: var(--ink); font: inherit; font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.rx-steppers button:hover,
.rx-steppers button:focus-visible { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.rx-steppers button:focus-visible { outline: 2px solid rgba(15, 118, 110, .35); outline-offset: 1px; }
.rx-eye-fields label > span, .rx-lens-fields label > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.rx-eye-fields input { width: 100%; min-width: 0; font-size: 15px; padding: 10px 9px; min-height: 43px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; outline: none; }
.rx-eye-fields input:focus { border-color: rgba(15,118,110,.55); box-shadow: 0 0 0 3px rgba(15,118,110,.08); }
.rx-ep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 8px 0 2px; }
.rx-ep-grid label { display: flex; flex-direction: column; gap: 6px; }
.rx-ep-grid label > span { font-size: 12px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.rx-ep-grid input { height: 48px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; padding: 0 13px; font-size: 16px; font-variant-numeric: tabular-nums; outline: none; }
.rx-ep-grid input:focus { border-color: rgba(15,118,110,.55); box-shadow: 0 0 0 3px rgba(15,118,110,.08); }
.rx-import { margin-left: auto; }
.rx-ecarts-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.rx-ecarts-row span { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.rx-cl-panel { margin-top: 2px; }
.rx-cl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.rx-cl-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 10.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.rx-cl-head p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.rx-cl-params { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rx-cl-params label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rx-cl-params label > span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.rx-cl-params input { height: 48px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; padding: 0 12px; font-size: 15px; font-variant-numeric: tabular-nums; outline: none; }
.rx-cl-params input:focus { border-color: rgba(15,118,110,.55); box-shadow: 0 0 0 3px rgba(15,118,110,.08); }
.rx-cl-note { margin: 10px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.rx-kind-badge { display: inline-flex; align-items: center; padding: 3px 8px; margin-bottom: 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 9.5px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 760px) {
  .rx-cl-params { grid-template-columns: 1fr 1fr; }
}
.rx-row { display: grid; grid-template-columns: 88px 1fr 1fr; gap: 7px; align-items: center; padding: 5px 8px; border-bottom: 1px solid #eef2ef; }
.rx-row:last-child { border-bottom: 0; }
.rx-head { background: var(--panel-2); color: var(--muted-2); font-size: 9px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.rx-row label { color: var(--muted); font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.rx-row input { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; padding: 7px 8px; font-size: 11.5px; outline: none; font-variant-numeric: tabular-nums; }
.rx-row input:focus { border-color: rgba(15, 118, 110, .55); box-shadow: 0 0 0 2px rgba(15, 118, 110, .07); }
.form-section-title { margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 9px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.measurement-detail { }
.measurement-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.measurement-hero h3 { font-size: 20px; letter-spacing: -.03em; }
.measurement-hero p { color: var(--muted); font-size: 11px; margin-top: 3px; }
.mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.mini-grid > div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
.mini-grid span { display: block; color: var(--muted-2); font-size: 8.5px; text-transform: uppercase; letter-spacing: .08em; }
.mini-grid strong { display: block; margin-top: 4px; font-size: 13px; }

/* ---------- Orders builder ---------- */
.order-head-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
.order-lines-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 7px; }
.order-lines-head strong { font-size: 12px; }
.order-lines { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.order-line-head, .order-line { display: grid; grid-template-columns: minmax(0, 2.2fr) .6fr .8fr .6fr .9fr 32px; gap: 6px; align-items: center; padding: 6px 8px; }
.order-line-head { background: var(--panel-2); border-bottom: 1px solid var(--line); color: var(--muted-2); font-size: 8px; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; }
.order-line input, .order-line select { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 7px 7px; background: #fff; font-size: 11px; outline: none; min-width: 0; }
.order-line input:focus, .order-line select:focus { border-color: rgba(15,118,110,.55); box-shadow: 0 0 0 2px rgba(15,118,110,.07); }
.line-total { text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); }
.order-foot-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; margin-top: 16px; align-items: start; }
.order-totals { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.order-totals div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 11px; color: var(--muted); }
.order-totals .grand { border-top: 1px solid var(--line-strong); margin-top: 4px; padding-top: 7px; font-size: 15px; color: var(--ink); font-weight: 750; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-grid .card:first-child, .settings-grid .card:nth-child(2) { grid-row: span 1; }
.settings-grid .form-grid { padding: 0 20px 20px; }
.sync-box { margin: 0 20px 10px; padding: 9px 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; }
.sync-box span { display: block; color: var(--muted-2); font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 3px; }
.sync-box code { display: block; font-size: 10.5px; overflow-wrap: anywhere; color: var(--ink); }
.settings-grid .page-actions { padding: 0 20px; }
.settings-grid .muted-note { padding: 10px 20px 18px; }
.pdf-preview { margin: 0 20px 20px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(180deg,#fff,#fbfdfc); padding: 14px; box-shadow: 0 8px 22px rgba(13,27,23,.05); }
.pdf-preview-head { display: flex; align-items: center; gap: 8px; border-bottom: 1.5px solid var(--brand); padding-bottom: 9px; }
.pdf-preview-mark { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 750; }
.pdf-preview-head strong { display: block; font-size: 12px; }
.pdf-preview-head small { display: block; color: var(--muted-2); font-size: 8.5px; }
.pdf-preview-tag { margin-left: auto; font-size: 8px; font-weight: 750; letter-spacing: .1em; color: var(--muted-2); border: 1px solid var(--line); padding: 2px 4px; border-radius: 3px; }
.pdf-preview p { color: var(--muted); font-size: 9px; line-height: 1.5; margin-top: 8px; }
.pdf-preview-tax { margin-top: 8px; padding: 6px 7px; background: var(--panel-2); border-radius: 4px; color: var(--muted); font-size: 8.5px; }
.pdf-preview-foot { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 8px; line-height: 1.45; }

/* ---------- Empty ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 46px 22px; color: var(--muted-2); }
.empty .icon { color: var(--muted-2); margin-bottom: 8px; }
.empty h3 { color: var(--ink); font-size: 15px; letter-spacing: -.02em; }
.empty p { font-size: 11.5px; margin: 4px 0 14px; max-width: 340px; line-height: 1.55; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .order-update-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .app-main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 60px rgba(0,0,0,.3); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-grid !important; }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(5,15,12,.42); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar-scrim.show { opacity: 1; pointer-events: auto; }
  .topbar-menu { display: inline-grid !important; }
  .topbar { padding: 0 18px; }
  .content { padding: 20px 16px 44px; }
  .dash-grid, .order-detail-grid { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; }
  .order-head-grid { grid-template-columns: 1fr 1fr; }
  .order-foot-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .table-wrap { margin: 0 -1px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .kpi strong { font-size: 22px; }
  .detail-stats { grid-template-columns: 1fr 1fr; }
  .client-hero, .order-hero { align-items: flex-start; flex-direction: column; }
  .order-hero-right { text-align: left; width: 100%; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 26px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .mini-grid { grid-template-columns: 1fr 1fr; }
  .optical-grid { grid-template-columns: 1fr; }
  .lens-facts { grid-template-columns: 1fr; }
  .sale-client-row, .sale-payment-grid, .payment-summary { grid-template-columns: 1fr; }
  .payment-actions { align-items: flex-start; flex-direction: column; }
  .sale-client-row .btn { width: 100%; }
  .sale-optical-fields, .sale-payment-grid, .sale-client-row { padding-left: 12px; padding-right: 12px; }
  .sale-totals > div { flex-wrap: wrap; }
  .sale-totals input { width: 100%; }
  .rx-table th, .rx-table td { padding-left: 12px; padding-right: 12px; }
  .rx-row { grid-template-columns: 70px 1fr 1fr; }
  .rx-eye-grid { grid-template-columns: 1fr; }
  .rx-eye-fields, .rx-eye-fields.rx-4, .rx-eye-fields.rx-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rx-ep-grid { grid-template-columns: 1fr; }
  .rx-mode-tabs button { flex: 1 1 40%; padding: 0 10px; }
  .rx-lens-fields { grid-template-columns: 1fr 1fr; }
  .order-line-head { display: none; }
  .order-line { grid-template-columns: 1fr 1fr; padding: 8px; border-bottom: 1px solid var(--line); }
  .order-line [data-product] { grid-column: span 2; }
  .order-line .line-total { text-align: left; align-self: center; }
  .order-update-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; }
  .search-field { max-width: none; }
  .toolbar-meta { margin-left: 0; }
  .topbar-date { display: none; }
  .table th, .table td { padding: 9px 10px; }
}

.order-edit-lines { min-width: 780px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.order-edit-head, .order-edit-line { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.55fr) 62px 100px 66px 104px 34px; gap: 6px; align-items: center; padding: 6px 8px; }
.order-edit-head { background: var(--panel-2); border-bottom: 1px solid var(--line); color: var(--muted-2); font-size: 8px; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; }
.order-edit-line { border-bottom: 1px solid #eef2ef; }
.order-edit-line:last-child { border-bottom: 0; }
.order-edit-line input, .order-edit-line select { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 8px 7px; background: #fff; font-size: 11.5px; outline: none; }
.order-edit-line input:focus, .order-edit-line select:focus { border-color: rgba(15,118,110,.55); box-shadow: 0 0 0 2px rgba(15,118,110,.07); }
.order-edit-line [data-line-total] { text-align: right; font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-edit-totals { margin-top: 16px; }
.employee-permissions { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 3px; }
.permission-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 18px 0 10px; padding-top: 15px; border-top: 1px solid var(--line); }
.permission-head h3 { margin: 0 0 3px; font-size: 14px; }
.permission-head p { margin: 0; color: var(--muted); font-size: 11.5px; }
.permission-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.permission-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.permission-group { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
.permission-group h4 { margin: 0 0 8px; font-size: 9px; font-weight: 780; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.permission-list { display: flex; flex-direction: column; gap: 7px; }
.permission-list .check-field { align-items: flex-start; color: var(--ink); font-size: 11.5px; line-height: 1.35; }
.permission-list .check-field input { flex: 0 0 auto; margin-top: 1px; }
@media (max-width: 760px) {
  .permission-groups { grid-template-columns: 1fr; }
  .order-edit-lines { min-width: 680px; }
}

.rx-ep-grid label[hidden] { display: none; }

.rx-ep-grid label.ep-disabled { opacity: .58; }
.rx-ep-grid label.ep-disabled input { background: #eef3f0; color: #5b6b63; border-style: dashed; cursor: not-allowed; }

.rx-mode-panel .rx-eye-grid { padding-bottom: 0; }
.rx-mode-panel .rx-eye { border-radius: 10px 10px 0 0; border-bottom: 0; padding-bottom: 12px; }
.rx-eye-extras { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 0 0 14px; }
.rx-eye-extra { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px 15px 14px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; background: #fff; }
.rx-eye-extra label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rx-eye-extra label > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.rx-eye-extra input { width: 100%; min-width: 0; font-size: 15px; padding: 10px 9px; min-height: 43px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; outline: none; }
.rx-eye-extra input:focus { border-color: rgba(15,118,110,.55); box-shadow: 0 0 0 3px rgba(15,118,110,.08); }
.rx-eye-extra label.ep-disabled { opacity: .58; }
.rx-eye-extra label.ep-disabled input { background: #eef3f0; color: #5b6b63; border-style: dashed; cursor: not-allowed; }
@media (max-width: 760px) {
  .rx-eye-extras { grid-template-columns: 1fr; }
}

.lens-options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 20px 10px; }
.lens-option-group { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; min-width: 0; }
.lens-option-group h3 { margin: 0 0 9px; font-size: 9px; font-weight: 780; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.lens-option-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; min-height: 24px; }
.lens-option-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-2); font-size: 11px; line-height: 1.2; }
.lens-option-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; display: grid; place-items: center; padding: 0; opacity: .65; }
.lens-option-chip button:hover { opacity: 1; }
.lens-option-add { display: flex; gap: 6px; align-items: center; }
.lens-option-add input { flex: 1; min-width: 0; height: 32px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; padding: 0 9px; font: inherit; font-size: 11.5px; outline: none; }
.lens-option-add input:focus { border-color: rgba(15,118,110,.55); box-shadow: 0 0 0 2px rgba(15,118,110,.07); }
.lens-option-add .btn { flex: 0 0 auto; }
@media (max-width: 760px) {
  .lens-options-grid { grid-template-columns: 1fr; }
}

#lens-options { margin-top: 20px; scroll-margin-top: 84px; }

/* Clients: sortable Total / Dette columns */
.sort-label { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.sort-arrows { display: inline-flex; align-items: center; gap: 1px; }
.sort-arrow { display: inline-grid; place-items: center; width: 15px; height: 15px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: var(--muted-2); font: inherit; font-size: 10px; line-height: 1; cursor: pointer; transition: color .12s, background .12s; }
.sort-arrow:hover { color: var(--brand-2); background: var(--brand-soft); }
.sort-arrow.active { color: var(--brand-2); background: var(--brand-soft); font-weight: 800; }
.sort-arrow:focus-visible { outline: 2px solid rgba(15, 118, 110, .35); outline-offset: 1px; }
.debt-amount.due { color: var(--red); font-weight: 700; }
