/*
  shadcn/ui-inspired visual layer for Lenzo Optique Gestion.
  The existing teal / green palette is preserved; layout primitives follow
  shadcn/ui: 36px controls, 8px control radius, 12px cards, semantic borders,
  muted surfaces, compact badges and a flat sidebar.
*/

:root {
  --bg: #f3f6f4;
  --panel: #ffffff;
  --panel-2: #f6f9f7;
  --line: #e4eae6;
  --line-strong: #d5dfd9;
  --ink: #0d1b17;
  --muted: #68766f;
  --muted-2: #7b8982;
  --brand: #0f766e;
  --brand-2: #115e59;
  --brand-soft: #e7f5f1;
  --nav: #091713;
  --nav-2: #0b1e19;
  --nav-text: #d6e3de;
  --amber: #a16207;
  --amber-soft: #fef3c7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --green: #15803d;
  --green-soft: #dcfce7;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(13, 27, 23, .05);
  --shadow-md: 0 12px 32px rgba(13, 27, 23, .12);
  --shadow-lg: 0 24px 64px rgba(13, 27, 23, .18);
  --ring: rgba(15, 118, 110, .22);
  --surface-muted: #f6f9f7;
  --surface-accent: #eef6f3;
  --font: "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Code", "Roboto Mono", monospace;
}

html { color-scheme: light; }
body { font-size: 14px; line-height: 1.5; letter-spacing: -.006em; }
h1, h2, h3, h4 { letter-spacing: -.025em; }
::selection { background: var(--brand-soft); color: var(--brand-2); }

/* ---------- Shell ---------- */
.sidebar {
  width: 256px;
  background: var(--nav);
  border-right: 1px solid rgba(255, 255, 255, .07);
  padding: 18px 12px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}
.app-main { margin-left: 256px; }
.sidebar-top { padding: 2px 8px 18px; }
.brand-lockup { gap: 10px; }
.brand-lockup .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #14b8a6;
  color: #04211c;
  font-size: 16px;
  font-weight: 700;
  box-shadow: none;
}
.brand-lockup strong { font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.brand-lockup small { font-size: 10px; font-weight: 500; letter-spacing: .12em; }
.sidebar .brand-lockup small { color: rgba(214, 227, 222, .48); }
.store-chip {
  margin: 0 4px 20px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
}
.store-avatar {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: rgba(45, 212, 191, .12);
  color: #5eead4;
  font-size: 13px;
  font-weight: 600;
}
.store-meta strong, .user-meta strong { font-size: 12.5px; font-weight: 500; }
.store-meta small, .user-meta small { font-size: 11px; color: rgba(214, 227, 222, .46); }
.sidebar-nav { gap: 2px; }
.nav-link {
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 6px;
  gap: 10px;
  color: rgba(214, 227, 222, .66);
  font-size: 13.5px;
  font-weight: 500;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #f0fdfa; }
.nav-link.active {
  background: rgba(255, 255, 255, .08);
  color: #f0fdfa;
  box-shadow: none;
}
.nav-link.active .icon { color: #5eead4; }
.nav-dot { display: none; }
.sidebar-card {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .07);
  gap: 10px;
}
.sidebar-card strong { font-size: 12px; font-weight: 500; }
.sidebar-card small { font-size: 11px; line-height: 1.45; color: rgba(209, 250, 229, .42); }
.sidebar-user { padding: 10px 6px 2px; border-top: 1px solid rgba(255, 255, 255, .07); }
.user-avatar { width: 28px; height: 28px; background: rgba(255, 255, 255, .09); font-size: 11px; font-weight: 600; }
.sidebar-user .icon-btn { color: rgba(214, 227, 222, .5); }
.topbar {
  height: 64px;
  padding: 0 32px;
  background: rgba(243, 246, 244, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  gap: 20px;
}
.topbar-title span {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: none;
  color: var(--muted);
}
.topbar-title strong { font-size: 14px; font-weight: 600; margin-top: 2px; }
.topbar-right { gap: 16px; color: var(--muted); font-size: 12.5px; }
.topbar-store {
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
}
.content { padding: 32px 32px 56px; max-width: 1440px; }

/* ---------- Typography & page heading ---------- */
.page-head {
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.page-head h1, .client-hero h1, .order-hero h1 {
  font-size: clamp(26px, 2.2vw, 32px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.035em;
}
.page-head p, .client-hero p, .order-hero p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 5px;
}
.page-actions { gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 36px;
  height: 36px;
  padding: 0 14px;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(13, 27, 23, .04);
}
.btn:hover { background: var(--panel-2); border-color: #c3cfc8; }
.btn:active { transform: none; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: none;
}
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-quiet:hover { background: var(--panel-2); color: var(--ink); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }
.btn-danger-quiet { background: transparent; border-color: #fecaca; color: var(--red); box-shadow: none; }
.btn-danger-quiet:hover { background: var(--red-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; height: 32px; padding: 0 11px; border-radius: 7px; font-size: 12.5px; }
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  color: var(--muted);
}
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }
.text-link { gap: 5px; color: var(--brand); font-size: 12.5px; font-weight: 500; }
.back-link { font-size: 12.5px; font-weight: 500; margin-bottom: 16px; }
.btn:focus-visible, .icon-btn:focus-visible, .text-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

/* ---------- Cards ---------- */
.card {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.card-head {
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px 16px;
}
.card-head h2 { font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.card-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.card-head > .icon { color: var(--muted-2); margin-top: 2px; }
.card-chip {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-size: 11.5px;
  font-weight: 500;
}
.grid-2 { gap: 20px; }
.dash-grid { gap: 20px; margin-bottom: 20px; }
.kpi-grid { gap: 16px; margin-bottom: 20px; }

/* ---------- KPI / dashboard ---------- */
.kpi {
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  box-shadow: none;
}
.kpi:before { display: none; }
.kpi-top {
  gap: 10px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
}
.kpi-amber .kpi-icon { background: var(--amber-soft); color: var(--amber); }
.kpi-blue .kpi-icon { background: var(--blue-soft); color: var(--blue); }
.kpi-red .kpi-icon { background: var(--red-soft); color: var(--red); }
.kpi-green .kpi-icon { background: var(--green-soft); color: var(--green); }
.kpi strong {
  margin-top: 16px;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -.03em;
}
.kpi small { margin-top: 4px; font-size: 12px; color: var(--muted-2); }
.chart { height: 220px; gap: 8px; padding: 12px 24px 24px; }
.chart-col { gap: 6px; }
.chart-value { font-size: 10px; color: var(--muted-2); height: 14px; }
.chart-bar {
  width: min(32px, 72%);
  min-height: 4px;
  background: var(--brand);
  border-radius: 4px 4px 2px 2px;
}
.chart-bar:hover { filter: brightness(1.08); }
.chart-tip { padding: 6px 8px; border-radius: 6px; font-size: 11px; background: #10221d; }
.chart-day { font-size: 11px; color: var(--muted-2); }
.list { padding: 0 24px 20px; }
.list-row { min-height: 52px; border-bottom: 1px solid var(--line); gap: 10px; }
.list-main strong { font-size: 13px; font-weight: 500; }
.list-main small { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.list-meta { font-size: 12px; color: var(--muted); }
.list-avatar { width: 32px; height: 32px; font-size: 10px; font-weight: 600; }
.list-dot { width: 8px; height: 8px; }

/* ---------- Product categories ---------- */
.category-add-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-bottom: 16px; }
.category-add-form .field { margin: 0; }
.category-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.category-item { border-bottom: 1px solid var(--line); }
.category-item:last-child { border-bottom: 0; }
.category-row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px; }
.category-row-edit { background: var(--panel-2); }
.category-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; flex: none; }
.category-row-actions { display: flex; gap: 4px; margin-left: auto; }
.category-row-actions .icon-btn:disabled { opacity: .3; cursor: not-allowed; }
.category-edit-input { flex: 1; min-width: 0; height: 36px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; padding: 0 10px; font-size: 13.5px; color: var(--ink); }
.category-edit-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); outline: none; }
.category-delete { padding: 14px; background: var(--panel-2); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.category-delete-copy { flex: 1 1 220px; min-width: 0; font-size: 13px; color: var(--muted); }
.category-delete-copy strong { color: var(--ink); font-weight: 600; }
.category-delete .input-select { width: min(100%, 240px); }
.category-delete-actions { display: flex; gap: 8px; margin-left: auto; }
.category-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }
.category-note { margin-top: 12px; }
@media (max-width: 560px) {
  .category-add-form { grid-template-columns: 1fr; }
  .category-add-form .btn { width: 100%; }
  .category-row { gap: 9px; padding: 10px 12px; }
  .category-delete { align-items: stretch; }
  .category-delete .input-select, .category-delete-actions, .category-delete-actions .btn { width: 100%; }
  .category-delete-actions { margin-left: 0; }
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  height: 42px;
  padding: 0 20px;
  background: var(--panel-2);
  border-top: 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--panel-2); }
.table td strong { font-size: 13px; font-weight: 600; }
.table td small { font-size: 12px; color: var(--muted-2); margin-top: 3px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .row-arrow { width: 36px; padding-left: 4px; color: var(--muted-2); }
.table.compact td { padding: 10px 14px; font-size: 12.5px; }
.table.compact th { height: 36px; padding: 0 14px; }
.table td.rank { width: 32px; color: var(--muted-2); }
.table th.table-select, .table td.table-select { width: 46px; padding-left: 20px; padding-right: 0; }
.table th.table-select { padding-top: 0; padding-bottom: 0; }
.table td.table-select { padding-top: 0; padding-bottom: 0; }
.table-select input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.table tbody tr.selected-row, .table tbody tr.selected-row:hover { background: var(--brand-soft); }
.row-actions { gap: 4px; }
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.bulk-bar[hidden] { display: none; }
.bulk-bar-info { font-size: 12.5px; color: var(--muted); }
.bulk-bar-info strong { color: var(--ink); font-weight: 600; }
.bulk-bar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk-bar .btn { height: 30px; }
.bulk-bar .icon-btn { width: 30px; height: 30px; }
.person { gap: 10px; }
.avatar {
  width: 32px;
  height: 32px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-size: 10.5px;
  font-weight: 600;
}
.avatar-lg { width: 48px; height: 48px; font-size: 15px; }
.order-client { font-weight: 500; }
.order-client-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.badge {
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
}
.badge-success { background: var(--green-soft); color: var(--green); border-color: rgba(21, 128, 61, .12); }
.badge-warning { background: var(--amber-soft); color: var(--amber); border-color: rgba(161, 98, 7, .12); }
.badge-error { background: var(--red-soft); color: var(--red); border-color: rgba(185, 28, 28, .12); }
.badge-info { background: var(--blue-soft); color: var(--blue); border-color: rgba(29, 78, 216, .12); }
.badge-neutral { background: #f1f5f2; color: var(--muted); border-color: var(--line); }
.debt-amount.due { color: var(--red); font-weight: 600; }
.sort-label { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.sort-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 16px;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.table th.sortable { cursor: pointer; user-select: none; }

/* ---------- Table pagination ---------- */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 10px 20px;
  background: var(--panel);
}
.table-pagination-top { border-bottom: 1px solid var(--line); }
.table-pagination-bottom { border-top: 1px solid var(--line); }
.table-pagination-info {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table-pagination-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.table-page-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  color: var(--muted);
  font-size: 12px;
}
.table-page-size select {
  height: 30px;
  min-width: 64px;
  padding-left: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background-color: var(--panel);
  color: var(--ink);
  font-size: 12px;
}
.table-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.table-page-btn:hover:not(:disabled) { background: var(--panel-2); border-color: var(--muted-2); }
.table-page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.table-page-btn:disabled { opacity: .4; cursor: not-allowed; }
.table-page-nav { padding: 0 9px; font-size: 16px; line-height: 1; }
.table-page-ellipsis { padding: 0 2px; color: var(--muted-2); font-size: 12px; }
@media (max-width: 680px) {
  .table-pagination { align-items: flex-start; padding: 10px 14px; }
  .table-pagination-info { width: 100%; }
  .table-pagination-actions { width: 100%; }
}

/* ---------- Toolbar & forms ---------- */
.toolbar {
  padding: 14px 20px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.toolbar-meta { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.search-field {
  height: 36px;
  min-width: 220px;
  padding: 0 12px;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted-2);
  flex: 1 1 240px;
  max-width: 420px;
}
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.search-field input { font-size: 13.5px; color: var(--ink); }
.search-field input::placeholder { color: var(--muted-2); }
.input-select {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background-color: var(--panel);
  padding: 0 32px 0 11px;
  font-size: 13.5px;
  color: var(--ink);
}
.input-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); outline: none; }
.input-date {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  padding: 0 10px;
  font-size: 13px;
  color: var(--ink);
}
.input-date:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); outline: none; }
.field { gap: 6px; }
.field > span {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.field input, .field select, .field textarea {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  font-size: 13.5px;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(13, 27, 23, .03);
}
.field textarea { height: auto; min-height: 80px; padding: 9px 10px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--ring);
}
.field input:disabled, .field select:disabled, .field textarea:disabled { opacity: .5; cursor: not-allowed; background: var(--panel-2); }
.form-grid { gap: 16px; }
.check-field { gap: 8px; font-size: 13px; color: var(--ink); }
.check-field input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-section-title {
  margin: 24px 0 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.015em;
  text-transform: none;
  color: var(--ink);
}

/* ---------- Modal / toast ---------- */
.modal-backdrop {
  background: rgba(9, 23, 19, .45);
  backdrop-filter: blur(3px);
  padding: 20px;
}
.modal {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 40px);
}
.modal-head { padding: 24px 24px 0; gap: 12px; }
.modal-head h2 { font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.modal-head p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.modal-body { padding: 20px 24px 24px; }
.modal-foot { padding: 16px 24px 24px; border-top: 1px solid var(--line); gap: 8px; }
.confirm-text { font-size: 13.5px; color: var(--muted); line-height: 1.65; }
#toast-root { right: 24px; bottom: 24px; gap: 10px; }
.toast {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  font-size: 13px;
  max-width: 380px;
}
.toast span:first-child { color: var(--brand); }
.toast-error { background: var(--panel); border-color: #fecaca; color: var(--red); }
.toast-error span:first-child { color: var(--red); }

/* ---------- Client / order detail ---------- */
.client-hero, .order-hero { padding: 24px; margin-bottom: 20px; gap: 20px; }
.client-identity { gap: 14px; }
.client-hero h1, .order-hero h1 { font-size: 26px; font-weight: 600; }
.client-hero p, .order-hero p { font-size: 13px; }
.detail-stats { gap: 16px; margin-bottom: 20px; }
.detail-stat {
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: none;
}
.detail-stat span {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
.detail-stat strong { margin-top: 6px; font-size: 20px; font-weight: 600; letter-spacing: -.025em; }
.info-list { padding: 0 24px 20px; }
.info-list div { padding: 11px 0; border-bottom: 1px solid var(--line); }
.info-list span { font-size: 12.5px; color: var(--muted); }
.info-list strong { font-size: 13px; font-weight: 500; }
.note-box {
  margin: 0 24px 24px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.note-box strong { font-size: 11.5px; font-weight: 500; letter-spacing: .02em; text-transform: none; color: var(--muted); }
.note-box p { font-size: 13px; color: var(--muted); }
.client-summary { padding: 0 24px 18px; gap: 12px; }
.client-summary strong { font-size: 14px; font-weight: 500; }
.client-summary small { font-size: 12px; color: var(--muted); }
.order-hero-right > strong { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.order-status-card { margin-bottom: 20px; }
.status-steps { padding: 4px 24px 20px; }
.status-step { padding-top: 16px; font-size: 12px; font-weight: 500; }
.status-step:before { height: 2px; }
.order-update-grid { padding: 0 24px 24px; }
.totals-box { margin: 8px 24px 24px auto; }
.totals-box div { padding: 6px 0; font-size: 13px; }
.totals-box .grand { margin-top: 6px; padding-top: 10px; font-size: 18px; font-weight: 600; }
.payment-card { margin-bottom: 20px; }
.payment-summary { gap: 12px; padding: 0 24px 12px; }
.payment-summary > div { padding: 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.payment-summary span { font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.payment-summary strong { margin-top: 4px; font-size: 18px; font-weight: 600; }
.payment-progress { height: 8px; margin: 0 24px 12px; background: var(--line); }
.payment-progress span { background: var(--brand); }
.payment-actions { padding: 0 24px 16px; font-size: 12.5px; color: var(--muted); }

/* ---------- Order builder ---------- */
.sale-form { gap: 24px; padding-bottom: 72px; }
.sale-form .card-head { padding: 24px 24px 18px; }
.sale-form .card-head h2 { font-size: 16px; font-weight: 600; }
.sale-form .card-head p { font-size: 13px; }
.sale-form .field > span {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.sale-form .field input, .sale-form .field select, .sale-form .field textarea {
  height: 36px;
  padding: 0 10px;
  font-size: 13.5px;
  border-radius: 8px;
}
.sale-form .field textarea { height: auto; padding: 9px 10px; }
.sale-form .form-grid { gap: 16px; }
.sale-lens-details { margin-top: 16px; }
.form-grid.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sale-eq-prices, .sale-eq-geometry { margin-top: 16px; }
@media (max-width: 760px) {
  .form-grid.form-grid-3 { grid-template-columns: 1fr; }
}
.sale-eq-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.sale-eq-card-head strong { font-size: 14px; font-weight: 600; }
.sale-eq-card-head span { margin-left: 8px; font-size: 12px; color: var(--muted); }
.sale-eq-extra { display: grid; gap: 14px; margin-top: 18px; }
.sale-eq-extra-card { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.sale-eq-extra-card .form-grid { gap: 14px; }
.sale-eq-add { margin-top: 14px; }
.sale-eq-extra[hidden], .sale-eq-add[hidden] { display: none; }
.searchable-native { display: none !important; }
.searchable-select { position: relative; display: inline-block; width: 100%; min-width: 0; }
.searchable-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.searchable-trigger:hover { border-color: #c3cfc8; }
.searchable-trigger:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); outline: none; }
.searchable-trigger > .icon { flex: none; margin-left: auto; color: var(--muted-2); }
.searchable-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchable-value.is-placeholder { color: var(--muted); }
.searchable-popover {
  position: fixed;
  z-index: 130;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}
.searchable-input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.searchable-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); outline: none; }
.searchable-options { max-height: 240px; margin-top: 6px; overflow-y: auto; }
.searchable-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.searchable-option > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchable-option:hover, .searchable-option.active { background: var(--panel-2); }
.searchable-option.selected { background: var(--brand-soft); }
.searchable-option > .icon { flex: none; color: var(--brand); }
.searchable-empty { padding: 10px; color: var(--muted); font-size: 12.5px; text-align: center; }
.page-actions > .searchable-select { width: auto; min-width: 220px; }
.order-line .searchable-select, .order-edit-line .searchable-select { width: 100%; min-width: 0; }
.order-line .searchable-trigger { height: 32px; padding: 0 8px; border-radius: 6px; font-size: 12.5px; }
.order-edit-line .searchable-trigger { height: 32px; padding: 0 8px; border-radius: 6px; font-size: 13px; }
@media (max-width: 680px) {
  .order-line .searchable-select { grid-column: span 2; }
}
.sale-client-row, .sale-optical-fields, .sale-payment-grid { padding-left: 24px; padding-right: 24px; padding-bottom: 24px; }
.sale-client-row { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
.sale-payment-grid { gap: 24px; }
.rx-eye-fields label > span, .rx-lens-fields label > span {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
.rx-eye-fields input, .rx-lens-fields input, .rx-lens-fields select {
  height: 36px;
  padding: 0 9px;
  font-size: 14px;
  border-radius: 6px;
  background: var(--panel);
}
.rx-lens-fields { gap: 10px; margin-top: 14px; }
.rx-saved-head { padding: 0 24px 14px; }
.rx-saved-head span { font-size: 11.5px; font-weight: 500; letter-spacing: .02em; text-transform: none; color: var(--muted); }
.rx-saved-head strong { font-size: 15px; font-weight: 600; }
.rx-saved-head small { font-size: 12.5px; color: var(--muted); }
.rx-saved-note { margin: 0 24px 20px; padding: 12px 14px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.sale-form .order-line input, .sale-form .order-line select { height: 32px; padding: 0 8px; font-size: 12.5px; border-radius: 6px; }
.sale-form .order-line-head { padding-top: 9px; padding-bottom: 9px; font-size: 11px; font-weight: 500; letter-spacing: .01em; text-transform: none; color: var(--muted); }
.order-lines-head strong { font-size: 14px; font-weight: 600; }
.order-lines { border-radius: 8px; }
.sale-form #sale-lines { margin: 0 24px 24px; }
.order-line-head, .order-line { gap: 8px; padding: 7px 10px; }
.order-line-head { background: var(--panel-2); }
.line-total { font-size: 12.5px; font-weight: 500; }
.sale-savebar { bottom: 12px; gap: 8px; padding: 12px 0 4px; background: linear-gradient(180deg, rgba(243, 246, 244, 0), rgba(243, 246, 244, .95) 40%); }
.sale-totals { border-radius: 8px; padding: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.sale-totals > div { padding: 5px 0; font-size: 13px; }
.sale-totals strong { font-size: 14px; font-weight: 500; }
.sale-totals input { height: 32px; font-size: 13px; border-radius: 6px; }
.sale-totals .grand { font-size: 14px; font-weight: 500; }
.sale-totals .grand strong { font-size: 18px; font-weight: 600; }
.order-foot-grid { gap: 20px; margin-top: 20px; }
.order-totals { border-radius: 8px; padding: 14px; background: var(--panel-2); }
.order-totals div { padding: 5px 0; font-size: 13px; }
.order-totals .grand { font-size: 18px; font-weight: 600; }

/* Optical / prescription controls */
.rx-form-grid { margin-top: 16px; border-radius: 8px; border: 1px solid var(--line); }
.rx-form-toggle { margin: 16px 0 4px; }
.rx-shell { margin-top: 20px; padding: 20px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); }
.rx-toolbar-top { margin-bottom: 16px; gap: 12px; }
.rx-lens-tabs {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  gap: 2px;
}
.rx-lens-tabs button {
  min-height: 32px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.rx-lens-tabs button.active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(13, 27, 23, .06);
}
.rx-tab-dot { width: 5px; height: 5px; }
.rx-lens-tabs button.active .rx-tab-dot { background: var(--brand); }
.rx-mode-tabs { gap: 6px; margin-bottom: 16px; }
.rx-mode-tabs button {
  min-height: 36px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.rx-mode-tabs button.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-2);
  box-shadow: none;
}
.rx-mode-panel .rx-eye-grid { padding: 0; }
.rx-eye-grid { gap: 16px; padding: 0; }
.rx-eye { padding: 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.rx-eye h4, .rx-eye-head h4 { font-size: 16px; font-weight: 600; letter-spacing: -.02em; color: var(--brand-2); }
.rx-eye-head { margin-bottom: 12px; }
.rx-transpose-eye { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--panel); }
.rx-transpose-eye:hover { background: var(--panel-2); border-color: var(--brand); color: var(--brand); }
.rx-steppers { gap: 4px; }
.rx-steppers button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line-strong); font-size: 14px; }
.rx-eye-fields { gap: 12px; }
.rx-eye-fields input { height: 38px; font-size: 14px; font-variant-numeric: tabular-nums; }
.rx-ep-grid { gap: 14px; padding: 10px 0 2px; }
.rx-ep-grid label { gap: 6px; }
.rx-ep-grid label > span { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.rx-ep-grid input { height: 38px; padding: 0 11px; font-size: 14px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.rx-ecarts-row { margin-top: 14px; gap: 12px; }
.rx-ecarts-row span { font-size: 12.5px; color: var(--muted); }
.rx-cl-head { margin-bottom: 16px; }
.rx-cl-badge { padding: 4px 9px; font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.rx-cl-head p { font-size: 12.5px; }
.rx-cl-params { gap: 12px; }
.rx-cl-params label > span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.rx-cl-params input { height: 38px; font-size: 14px; border-radius: 6px; }
.rx-cl-note { font-size: 12.5px; }
.rx-kind-badge { padding: 3px 8px; font-size: 11px; font-weight: 500; letter-spacing: .02em; }
.rx-eye-extras { gap: 16px; padding: 0 0 16px; }
.rx-eye-extra { padding: 14px 16px 16px; border-radius: 0 0 8px 8px; border-color: var(--line); background: var(--panel); }
.rx-eye-extra label > span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.rx-eye-extra input { height: 38px; font-size: 14px; border-radius: 6px; }
.rx-mode-panel .rx-eye { border-radius: 8px 8px 0 0; }
.rx-row { grid-template-columns: 88px 1fr 1fr; gap: 8px; padding: 6px 10px; }
.rx-head { background: var(--panel-2); font-size: 11px; font-weight: 500; letter-spacing: .01em; text-transform: none; color: var(--muted); }
.rx-row label { font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.rx-row input { height: 32px; font-size: 12.5px; border-radius: 6px; }
.rx-table { font-size: 13px; }
.rx-table th { padding: 10px 20px; font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.rx-table td { padding: 10px 20px; font-size: 13px; }
.rx-table td:first-child { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.rx-table.rx-detail th, .rx-table.rx-detail td { padding: 9px 10px; font-size: 12.5px; }
.rx-lens-summary { padding: 10px 20px 14px; background: var(--panel-2); }
.rx-lens-summary span { font-size: 12px; }
.rx-lens-summary strong { font-size: 11.5px; font-weight: 600; }
.rx-footer { padding: 10px 20px 14px; font-size: 12px; }
.optical-history { padding: 10px 20px 16px; gap: 6px; }
.optical-history > span { font-size: 11px; font-weight: 500; letter-spacing: .02em; text-transform: none; }
.optical-history button { padding: 4px 8px; font-size: 11.5px; border-radius: 5px; }
.lens-hero { padding: 0 24px 14px; gap: 12px; }
.lens-mark { width: 36px; height: 36px; border-radius: 8px; }
.lens-name strong { font-size: 14px; font-weight: 500; }
.lens-name small { font-size: 12px; }
.lens-facts { padding: 0 24px 18px; gap: 0 20px; }
.lens-facts > div { padding: 8px 0; border-bottom: 1px solid var(--line); }
.lens-facts span { font-size: 12px; color: var(--muted); }
.lens-facts strong { font-size: 12.5px; font-weight: 500; }
.equipment-block + .equipment-block { margin-top: 4px; border-top: 1px solid var(--line); }
.equipment-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px 10px; }
.equipment-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

/* ---------- Settings / employees ---------- */
.settings-grid { gap: 20px; }
.settings-grid .form-grid { padding: 0 24px 24px; gap: 16px; }
.sync-box { margin: 0 24px 12px; padding: 12px 14px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.sync-box span { font-size: 11.5px; font-weight: 500; letter-spacing: .02em; margin-bottom: 4px; }
.sync-box code { font-size: 12.5px; }
.settings-grid .page-actions { padding: 0 24px; }
.settings-grid .muted-note { padding: 12px 24px 20px; }
.pdf-preview { margin: 0 24px 24px; padding: 16px; border-radius: 10px; border: 1px solid var(--line); box-shadow: none; }
.pdf-preview-head { gap: 10px; padding-bottom: 10px; }
.pdf-preview-mark { width: 30px; height: 30px; font-size: 12px; }
.pdf-preview-head strong { font-size: 13px; }
.pdf-preview-head small { font-size: 11px; }
.pdf-preview-tag { font-size: 10px; font-weight: 500; letter-spacing: .02em; }
.pdf-preview p { font-size: 12px; }
.pdf-preview-tax { font-size: 11.5px; }
.pdf-preview-foot { font-size: 10.5px; }
.lens-options-grid { gap: 16px; padding: 0 24px 12px; }
.lens-option-group { border-radius: 10px; padding: 16px; border: 1px solid var(--line); }
.lens-option-group h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }
.lens-option-chips { gap: 6px; margin-bottom: 12px; }
.lens-option-chip { padding: 4px 9px; font-size: 11.5px; font-weight: 500; }
.lens-option-add { gap: 8px; }
.lens-option-add input { height: 34px; font-size: 13px; border-radius: 7px; }
.permission-head { margin: 20px 0 12px; padding-top: 16px; }
.permission-head h3 { font-size: 15px; font-weight: 600; }
.permission-head p { font-size: 13px; }
.permission-presets { gap: 8px; }
.permission-groups { gap: 16px; }
.permission-group { padding: 16px; border-radius: 10px; border: 1px solid var(--line); }
.permission-group h4 { font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }
.permission-list { gap: 10px; }
.permission-list .check-field { font-size: 13px; }
.employee-permissions { gap: 6px; }

/* ---------- Empty & login ---------- */
.empty { padding: 56px 24px; color: var(--muted-2); }
.empty .icon { margin-bottom: 10px; }
.empty h3 { font-size: 16px; font-weight: 600; }
.empty p { font-size: 13px; margin: 6px 0 16px; }
.login-page { min-height: 100vh; background: var(--background); grid-template-columns: 1.05fr .95fr; }
.login-brand {
  background: var(--nav);
  padding: 48px clamp(32px, 6vw, 80px);
  color: #f0fdfa;
}
.login-brand:after {
  width: 560px;
  height: 560px;
  right: -240px;
  bottom: -280px;
  border-color: rgba(153, 246, 228, .10);
  box-shadow: 0 0 0 80px rgba(153, 246, 228, .025), 0 0 0 160px rgba(153, 246, 228, .015);
}
.login-brand h1 { margin: 40px 0 16px; font-size: clamp(36px, 4vw, 50px); font-weight: 600; line-height: 1.06; letter-spacing: -.045em; }
.login-brand p { max-width: 460px; font-size: 14.5px; line-height: 1.7; color: rgba(209, 250, 229, .68); }
.login-points { margin-top: 34px; gap: 12px 20px; font-size: 13px; font-weight: 500; }
.login-foot { font-size: 11px; letter-spacing: .12em; }
.login-panel { background: var(--background); padding: 32px; }
.login-card { width: min(100%, 400px); padding: 32px; border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-card-head { margin-bottom: 24px; }
.login-kicker { margin-bottom: 8px; font-size: 11px; font-weight: 600; letter-spacing: .1em; color: var(--brand); }
.login-card h2 { font-size: 26px; font-weight: 600; letter-spacing: -.03em; }
.login-card-head p { font-size: 13px; margin-top: 6px; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { margin-top: 8px; }
.login-hint { margin-top: 16px; font-size: 12px; line-height: 1.7; }
.login-copy { margin-top: 20px; font-size: 11px; }
.form-error { padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }

/* ---------- Orders date picker ---------- */
.order-date-trigger {
  max-width: 300px;
  font-weight: 500;
  overflow: hidden;
}
.order-date-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-date-trigger .icon { color: var(--muted); }
.order-date-trigger.is-active {
  background: var(--brand-soft);
  border-color: rgba(15, 118, 110, .35);
  color: var(--brand-2);
}
.order-date-trigger.is-active .icon { color: var(--brand); }
.date-popover {
  position: fixed;
  z-index: 70;
  width: min(360px, calc(100vw - 24px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  animation: date-pop .14s ease-out;
}
@keyframes date-pop { from { opacity: 0; transform: translateY(-4px) scale(.99); } }
.date-popover-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 0; }
.date-popover-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.date-popover-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.date-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.date-preset {
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .12s, border-color .12s, color .12s;
}
.date-preset:hover { background: var(--panel-2); border-color: #c3cfc8; color: var(--ink); }
.date-calendar { padding: 14px 18px 10px; }
.date-calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.date-calendar-head strong { font-size: 13.5px; font-weight: 600; text-transform: capitalize; }
.date-calendar-head .icon-btn { width: 28px; height: 28px; }
.date-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.date-weekdays span { padding: 4px 0; text-align: center; font-size: 10.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2); }
.date-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-day, .date-day-empty { min-height: 36px; aspect-ratio: 1; }
.date-day {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.date-day:hover { background: var(--panel-2); }
.date-day.today { color: var(--brand); font-weight: 600; }
.date-day.in-range { border-radius: 0; background: var(--brand-soft); color: var(--brand-2); }
.date-day.selected { background: var(--brand); color: #fff; }
.date-day.selected.today { color: #fff; }
.date-day.range-start { border-radius: 6px 0 0 6px; }
.date-day.range-end { border-radius: 0 6px 6px 0; }
.date-day.range-start.range-end { border-radius: 6px; }
.date-popover-foot { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.date-popover-foot > span { font-size: 12px; color: var(--muted); }
.date-popover-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.date-popover-actions .btn { flex: 0 0 auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .app-main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); box-shadow: 0 24px 64px rgba(0, 0, 0, .28); }
  .sidebar.open { transform: translateX(0); }
  .topbar { padding: 0 20px; }
  .content { padding: 24px 20px 48px; }
  .dash-grid, .order-detail-grid { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; }
}
@media (max-width: 760px) {
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 26px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .detail-stats { grid-template-columns: 1fr 1fr; }
  .payment-summary { grid-template-columns: 1fr; }
  .sale-payment-grid, .sale-client-row { grid-template-columns: 1fr; }
  .sale-client-row .btn { width: 100%; }
  .rx-eye-grid, .rx-eye-extras { 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-lens-fields { grid-template-columns: 1fr 1fr; }
  .rx-cl-params { grid-template-columns: 1fr 1fr; }
  .permission-groups { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar { height: 60px; padding: 0 16px; }
  .topbar-date { display: none; }
  .topbar-store { font-size: 11.5px; }
  .content { padding: 20px 16px 44px; }
  .page-head { margin-bottom: 20px; gap: 14px; }
  .page-head h1 { font-size: 24px; }
  .page-head p { font-size: 13px; }
  .card { border-radius: 10px; }
  .card-head { padding: 18px 16px 14px; }
  .card-head h2 { font-size: 15px; }
  .card-head p { font-size: 12.5px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 16px; }
  .kpi strong { font-size: 22px; }
  .table th, .table td { padding: 11px 12px; }
  .table th.table-select, .table td.table-select { width: 38px; padding-left: 12px; padding-right: 0; }
  .table-wrap { margin: 0 -1px; }
  .bulk-bar { padding: 10px 14px; }
  .bulk-bar-actions { width: 100%; margin-left: 0; }
  .toolbar { padding: 12px 14px; gap: 8px; align-items: stretch; }
  .search-field { max-width: none; flex: 1 1 100%; }
  .toolbar-meta { width: 100%; margin-left: 0; text-align: right; }
  #order-status { width: 100%; }
  .order-date-trigger { width: 100%; max-width: none; justify-content: flex-start; }
  .date-presets { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 12px 14px; }
  .date-calendar { padding: 12px 14px 8px; }
  .date-popover-head { padding: 16px 14px 0; }
  .date-popover-foot { padding: 12px 14px 16px; }
  .clients-table .col-phone, .clients-table .col-orders,
  .clients-table .col-measure, .clients-table .col-total { display: none; }
  .orders-table .col-date, .orders-table .col-created-by, .orders-table .col-updated-by, .orders-table .row-arrow { display: none; }
  .orders-table .order-author-mobile { display: block; }
  .orders-table .col-total { display: table-cell; }
  .orders-table .col-order strong { white-space: nowrap; font-size: 11px; }
  .orders-table .order-client-meta { margin-top: 4px; }
  .products-table .col-ref, .products-table .col-category,
  .products-table .col-tax, .products-table .col-actions,
  .measurements-table th:nth-child(3), .measurements-table td:nth-child(3),
  .measurements-table th:nth-child(5), .measurements-table td:nth-child(5),
  .equipment-table th:nth-child(3), .equipment-table td:nth-child(3),
  .equipment-table th:nth-child(4), .equipment-table td:nth-child(4),
  .equipment-table th:nth-child(7), .equipment-table td:nth-child(7) { display: none; }
  .client-hero, .order-hero { padding: 18px; flex-direction: column; align-items: flex-start; }
  .client-hero h1, .order-hero h1 { font-size: 24px; }
  .order-hero-right { text-align: left; width: 100%; }
  .info-list { padding: 0 18px 18px; }
  .note-box { margin: 0 18px 18px; }
  .client-summary { padding: 0 18px 16px; }
  .status-steps { padding: 4px 18px 18px; }
  .order-update-grid { padding: 0 18px 18px; }
  .totals-box { margin: 8px 18px 18px auto; }
  .payment-summary { padding: 0 18px 12px; }
  .payment-progress { margin: 0 18px 12px; }
  .payment-actions { padding: 0 18px 16px; flex-direction: column; align-items: flex-start; }
  .sale-form { gap: 18px; }
  .sale-form .card-head { padding: 20px 16px 16px; }
  .sale-client-row, .sale-optical-fields, .sale-payment-grid { padding-left: 16px; padding-right: 16px; }
  .rx-saved-head { padding: 0 16px 12px; }
  .rx-saved-note { margin: 0 16px 18px; }
  .rx-shell { padding: 14px; }
  .rx-eye { padding: 14px; }
  .rx-table th, .rx-table td { padding-left: 12px; padding-right: 12px; }
  .settings-grid .form-grid { padding: 0 16px 20px; }
  .settings-grid .page-actions { padding: 0 16px; }
  .settings-grid .muted-note { padding: 12px 16px 18px; }
  .lens-options-grid { padding: 0 16px 12px; }
  .pdf-preview { margin: 0 16px 20px; }
  .modal-backdrop { padding: 12px; }
  .modal { max-height: calc(100vh - 24px); }
  .modal-head { padding: 20px 18px 0; }
  .modal-body { padding: 16px 18px 20px; }
  .modal-foot { padding: 14px 18px 20px; }
  #toast-root { right: 16px; bottom: 16px; left: 16px; align-items: stretch; }
  .toast { max-width: none; }
  .login-panel { padding: 24px 16px; }
  .login-card { padding: 24px; }
  .empty { padding: 44px 20px; }
}

/* Consistency pass: one control size, one label size, one input size. */
.login-kicker { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--brand); }
.kpi strong { font-size: 22px; white-space: normal; overflow: visible; text-overflow: clip; }
.card-head .btn-sm { height: 36px; min-height: 36px; }
.field input, .field select, .field textarea,
.sale-form .field input, .sale-form .field select, .sale-form .field textarea { font-size: 14px; }
.rx-eye-fields label > span, .rx-lens-fields label > span,
.rx-ep-grid label > span, .rx-cl-params label > span,
.rx-eye-extra label > span { font-size: 13px; }
.rx-eye-fields input, .rx-lens-fields input, .rx-lens-fields select,
.rx-ep-grid input, .rx-cl-params input, .rx-eye-extra input { height: 36px; font-size: 14px; }
.sale-totals input { height: 36px; font-size: 14px; }
.order-edit-lines { border-radius: 8px; border: 1px solid var(--line); }
.order-edit-head { font-size: 11px; font-weight: 500; letter-spacing: .01em; text-transform: none; color: var(--muted); }
.order-edit-line input, .order-edit-line select { height: 32px; padding: 0 8px; font-size: 13px; border-radius: 6px; }
.order-edit-line [data-line-total] { font-size: 12.5px; font-weight: 500; }
.invoice-price-note { padding: 0 0 12px; font-size: 12.5px; }
.invoice-price-table th { height: 36px; padding: 0 10px; }
.invoice-price-table td { padding: 10px; vertical-align: middle; }
.invoice-price-table td:first-child small { display: block; margin-top: 2px; }
.invoice-price-table input { width: 110px; height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; text-align: right; }
.invoice-price-table input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); outline: none; }
.invoice-price-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-strong); font-size: 13px; color: var(--muted); }
.invoice-price-total strong { color: var(--ink); font-size: 18px; font-variant-numeric: tabular-nums; }
.invoice-preview { height: min(70vh, 780px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.invoice-preview iframe { display: block; width: 100%; min-width: 720px; height: 100%; border: 0; background: #fff; }
@media (max-width: 680px) {
  .invoice-price-table input { width: 90px; }
  .invoice-preview { height: 60vh; }
  .invoice-preview iframe { min-width: 700px; }
}
.lens-option-add input { height: 32px; font-size: 13px; }
.products-table td code { white-space: nowrap; font-size: 12px; }

/* Final consistency corrections from page-by-page review */
.settings-grid { align-items: start; }
.report-row-head { font-size: 13px; margin-bottom: 8px; }
.report-track { height: 8px; background: var(--line); border-radius: 999px; }
.report-track span { background: var(--brand); }
.equipment-table th:nth-child(7), .equipment-table td:nth-child(7) { white-space: nowrap; }
@media (max-width: 680px) {
  .kpi strong { font-size: 20px; white-space: nowrap; letter-spacing: -.035em; }
  .sale-form { padding-bottom: 96px; }
  .sale-form .card-head:has(.page-actions) { flex-wrap: wrap; }
  .sale-form .card-head:has(.page-actions) > div:first-child { flex: 1 1 100%; }
  .sale-form .card-head:has(.page-actions) .page-actions { width: 100%; }
  .sale-form .card-head .page-actions .input-select { flex: 1 1 100%; max-width: none; }
  .sale-form .card-head .page-actions .btn { flex: 1 1 auto; }
  .sale-savebar {
    bottom: 0;
    margin: 0 -16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(243, 246, 244, .96);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(8px);
  }
}
.card-note { margin: 0; padding: 0 24px 20px; }
@media (max-width: 680px) {
  .card-note { padding: 0 16px 18px; }
}
.muted-note { font-size: 13px; line-height: 1.6; color: var(--muted); }
.lens-options-grid { align-items: start; }
.lens-option-add input { height: 36px; font-size: 14px; }
.lens-option-add .btn { height: 36px; min-height: 36px; }
.date-popover { max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 680px) {
  .card-head:has(.page-actions) { flex-wrap: wrap; }
  .card-head:has(.page-actions) > div:first-child { flex: 1 1 100%; }
  .card-head:has(.page-actions) .page-actions { width: 100%; }
  .card-head:has(.page-actions) .page-actions .input-select { flex: 1 1 100%; max-width: none; }
}

/* ---------- Restored Lenzo Optique brand treatment ---------- */
.sidebar {
  background: linear-gradient(180deg, var(--nav), #0b1e19 70%, #0c211c);
  border-right: 1px solid rgba(255, 255, 255, .07);
}
.brand-lockup .brand-mark {
  background: linear-gradient(145deg, #2dd4bf, #0f766e);
  color: #04211c;
  box-shadow: 0 8px 24px rgba(45, 212, 191, .24);
}
.sidebar .brand-mark { box-shadow: 0 6px 18px rgba(45, 212, 191, .20); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(45, 212, 191, .16), rgba(45, 212, 191, .07));
  color: #f0fdfa;
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, .12);
}
.nav-link.active .icon { color: #5eead4; }
.nav-dot {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2dd4bf;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, .10);
  margin-left: auto;
  flex: none;
}
.store-chip { background: rgba(255, 255, 255, .055); }
.sidebar-card {
  background: rgba(45, 212, 191, .06);
  border-color: rgba(45, 212, 191, .10);
}
.sidebar-card-icon { color: #5eead4; }
.sidebar-export { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.sidebar-export:hover { background: rgba(45, 212, 191, .1); border-color: rgba(45, 212, 191, .18); }
.sidebar-export:focus-visible { outline: 2px solid #5eead4; outline-offset: 2px; }
.sidebar-export:disabled { opacity: .65; cursor: wait; }
.sidebar-user-push { margin-top: auto; }

.card, .kpi, .detail-stat {
  box-shadow: 0 1px 2px rgba(13, 27, 23, .04), 0 10px 30px rgba(13, 27, 23, .04);
}
.kpi {
  border-radius: 13px;
  position: relative;
  overflow: hidden;
}
.kpi:before {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #2dd4bf, #0f766e);
  opacity: .8;
}
.kpi-amber:before { background: linear-gradient(180deg, #fbbf24, #d97706); }
.kpi-blue:before { background: linear-gradient(180deg, #60a5fa, #2563eb); }
.kpi-red:before { background: linear-gradient(180deg, #f87171, #dc2626); }
.kpi-green:before { background: linear-gradient(180deg, #4ade80, #16a34a); }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 5px 14px rgba(15, 118, 110, .16);
}
.btn-primary:hover {
  background: var(--brand-2);
  border-color: var(--brand-2);
  box-shadow: 0 5px 14px rgba(15, 118, 110, .20);
}
.chart-bar { background: linear-gradient(180deg, #2dd4bf, #0f766e); }
.payment-progress span,
.report-track span { background: linear-gradient(90deg, #2dd4bf, #0f766e); }
.login-brand {
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(45, 212, 191, .16), transparent 55%),
    linear-gradient(145deg, #06120f, #0d211c 62%, #102a24);
}
.login-panel { background: linear-gradient(180deg, #fbfdfc, #f2f6f3); }
.login-card { box-shadow: 0 1px 2px rgba(13, 27, 23, .04), 0 10px 30px rgba(13, 27, 23, .04); }

/* ---------- Facebook-Ads-style date range picker ---------- */
.date-popover { width: min(560px, calc(100vw - 24px)); }
.date-popover-body {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  align-items: stretch;
}
.date-presets {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 0;
  background: var(--panel-2);
}
.date-preset {
  width: 100%;
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.date-preset:hover {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand-2);
}
.date-preset.active {
  background: var(--brand-soft);
  border-color: rgba(15, 118, 110, .16);
  color: var(--brand-2);
  font-weight: 600;
}
.date-calendar { padding: 16px; }
.date-calendar-head { margin-bottom: 12px; }
.date-weekdays { margin-bottom: 6px; }
.date-popover-foot {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
}
@media (max-width: 680px) {
  .date-popover-body { grid-template-columns: 1fr; }
  .date-presets {
    flex-direction: row;
    gap: 6px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .date-presets::-webkit-scrollbar { display: none; }
  .date-preset {
    flex: 0 0 auto;
    width: auto;
    height: 30px;
    min-height: 30px;
    padding: 0 10px;
    border-color: var(--line-strong);
    background: var(--panel);
    text-align: center;
  }
  .date-preset.active { border-color: var(--brand); }
  .date-calendar { padding: 14px; }
}
.date-preset { font-size: 13px; }
.date-popover-foot > span { font-size: 12.5px; }

/* Reports — status split */
.report-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 0 24px 20px; }
.report-status-grid h3 { margin: 0 0 2px; font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.report-status-grid .info-list { padding: 0; }
.report-status-grid .info-list div { padding: 10px 0; }
.report-status-grid .info-list strong { font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .report-status-grid { grid-template-columns: 1fr; gap: 14px; padding: 0 18px 18px; }
}

/* Dashboard 6 KPI cards: 3 x 2 */
.kpi-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 980px) { .kpi-grid-6 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .kpi-grid-6 { grid-template-columns: 1fr; } }

/* Dashboard 4 KPI cards: 4 x 1 */
.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpi-grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .kpi-grid-4 { grid-template-columns: 1fr; } }

/* Dashboard 8 KPI cards: 4 x 2 */
.kpi-grid-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpi-grid-8 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .kpi-grid-8 { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .report-kpi-primary { grid-template-columns: 1fr; }
}

/* Sales chart with collected cash overlay */
.chart-cash {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 3px 3px 2px 2px;
  background: linear-gradient(180deg, #fbbf24, #d97706);
  pointer-events: none;
  z-index: 0;
}
.chart-head-meta { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.chart-key { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.chart-key > span { display: inline-flex; align-items: center; gap: 4px; }
.chart-key-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-key-sales { background: linear-gradient(180deg, #2dd4bf, #0f766e); }
.chart-key-cash { background: linear-gradient(180deg, #fbbf24, #d97706); }
@media (max-width: 700px) {
  .chart-head-meta { align-items: flex-start; justify-content: flex-start; }
  .chart-key { font-size: 10px; gap: 8px; }
}

/* Expenses: keep the category visible on narrow screens; hide payment method instead */
@media (max-width: 680px) {
  .expenses-table th:nth-child(3), .expenses-table td:nth-child(3) { display: table-cell; }
  .expenses-table th:nth-child(5), .expenses-table td:nth-child(5) { display: none; }
}

@media (max-width: 700px) {
  .sale-form #sale-lines { margin-left: 16px; margin-right: 16px; margin-bottom: 16px; }
}

.orders-table .order-author { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; line-height: 1.35; }
.orders-table .order-author-mobile { display: none; }
.orders-table .col-created-by, .orders-table .col-updated-by { white-space: nowrap; }

.order-cancelled-badge { display: inline-flex; margin-left: 20px; margin-bottom: 20px; }

/* Order traceability */
.order-trace-card { margin-bottom: 20px; }
.order-trace-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0 24px 20px; }
.order-trace-grid > div { padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.order-trace-grid span { display: block; color: var(--muted); font-size: 12px; }
.order-trace-grid strong { display: block; margin-top: 3px; color: var(--ink); font-size: 14px; font-weight: 600; }
.order-trace-grid small { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; }
@media (max-width: 680px) {
  .order-trace-grid { grid-template-columns: 1fr; padding: 0 16px 18px; }
  .orders-table .order-author-mobile { display: block; }
}

/* Audit log */
.audit-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; }
.audit-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.audit-meta strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.audit-json { margin: 0; padding: 14px; max-height: 55vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
