:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #68748a;
  --line: #dfe5ef;
  --accent: #1769e0;
  --accent-dark: #0e4fb0;
  --good: #11845b;
  --warn: #b76e00;
  --bad: #b42318;
  --shadow: 0 12px 30px rgba(31, 45, 70, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 188px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

.app-shell { display: contents; }
.auth-screen {
  grid-column: 1 / -1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px 24px 24px;
  display: grid;
  gap: 14px;
  position: relative;
}
.auth-card-wide {
  width: min(720px, 100%);
}
.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.auth-grid .full,
.terms-check {
  grid-column: 1 / -1;
}
.auth-card textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  resize: vertical;
}
.terms-check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: flex-start;
  gap: 10px !important;
  color: var(--ink) !important;
  font-weight: 600 !important;
}
.terms-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
}
.terms-check a {
  color: var(--accent);
}
.subscription-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
}
.subscription-note strong {
  color: var(--ink);
}
.subscription-note small {
  grid-column: 2;
}
.early-access-plan {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #eff6ff;
}
.early-access-plan strong { color: var(--ink); }
.early-access-plan span { color: var(--muted); line-height: 1.45; }
.account-type-switch {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.account-type-switch legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.account-type-switch label {
  display: block !important;
  cursor: pointer;
}
.account-type-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.account-type-switch span {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}
.account-type-switch input:checked + span {
  border-color: var(--accent);
  background: #eff6ff;
  color: #174ea6;
  font-weight: 800;
}
.account-type-switch input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.billing-card { margin-top: 18px; }
.subscription-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 16px;
}
.subscription-feature-list span {
  padding: 5px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #174ea6;
  font-size: 12px;
  font-weight: 700;
}
.auth-brand { color: var(--ink); margin-bottom: 4px; }
.auth-language {
  position: absolute;
  top: 18px;
  right: 18px;
  display: inline-flex !important;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: #f4f7fb;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.auth-language button {
  min-width: 34px;
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 0 9px;
}
.auth-language button:hover {
  color: var(--accent-dark);
  background: #eaf1ff;
}
.auth-language button.active {
  color: white;
  background: var(--accent);
  box-shadow: 0 5px 12px rgba(23, 105, 224, 0.22);
}
.auth-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.auth-card input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
}
@media (max-width: 680px) {
  .auth-grid { grid-template-columns: 1fr; }
  .auth-card { padding-top: 70px; }
}
.auth-card .link-button {
  justify-self: center;
}
.auth-card small {
  color: var(--muted);
}
.caps-warning {
  margin-top: 2px;
  color: var(--bad) !important;
  font-size: 12px;
  font-weight: 800;
}
.caps-warning::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border-radius: 50%;
  background: #fee2e2;
  color: var(--bad);
  font-size: 11px;
}
.auth-card .auth-feedback {
  display: block;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.35;
}
.auth-card .auth-feedback.error {
  color: var(--bad);
  background: #fff1f0;
  border: 1px solid #ffd4cf;
  font-weight: 700;
}
.auth-card .auth-feedback.success {
  color: var(--good);
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  font-weight: 700;
}
.auth-card .auth-feedback:empty {
  display: none;
}
#reset-code-fields {
  display: grid;
  gap: 14px;
}
#reset-code-fields[hidden] {
  display: none !important;
}
.link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 4px;
  cursor: pointer;
  font-weight: 700;
}
.link-button:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}
[hidden] { display: none !important; }

button, input, select, textarea {
  font: inherit;
}

.button-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}
.button-like:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sidebar {
  background: #121826;
  color: white;
  padding: 18px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
}
.brand-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.brand-button:hover .brand-mark {
  transform: scale(1.04);
}
.brand-button .brand-mark {
  transition: transform 0.15s ease;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand small {
  display: block;
  color: #a9b5c8;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav button {
  border: 0;
  width: 100%;
  text-align: left;
  color: #d9e2f1;
  background: transparent;
  padding: 10px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #1769e0;
  color: white;
  font-size: 12px;
  line-height: 1;
}
.nav-count.urgent { background: #d92d20; }

.generated-code-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--accent);
  background: #eff6ff;
  border-radius: 8px;
}
.generated-code-panel strong {
  font-size: 26px;
  color: #0e4fb0;
  overflow-wrap: anywhere;
}

.nav button.active,
.nav button:hover {
  background: #22304a;
  color: white;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 92px;
  padding: 20px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-left { min-width: 0; }
.topbar-brand {
  margin-bottom: 0;
  color: var(--ink);
  padding-right: 16px;
  border-right: 1px solid var(--line);
  width: auto;
}
.topbar-brand small { color: var(--muted); }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 26px; margin-bottom: 5px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; margin-bottom: 10px; }
p, small { color: var(--muted); }

.content {
  padding: 24px 28px 40px;
  display: grid;
  gap: 18px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.order-toolbar {
  align-items: flex-start;
}
.order-toolbar-actions {
  align-items: center;
  justify-content: flex-end;
}

.order-stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}
.order-stat {
  min-height: 78px;
  border: 0;
  color: white;
  display: grid;
  align-content: center;
  justify-items: start;
  padding: 14px 18px;
}
.order-stat strong { font-size: 24px; }
.order-stat span { font-size: 16px; }
.order-stat { cursor: pointer; }
.order-stat.active {
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.72), 0 10px 22px rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
}
.order-stat.green { background: #0f9d58; }
.order-stat.red { background: #f5222d; }
.order-stat.blue { background: #1769e0; }
.order-stat.dark { background: #252b31; }

.order-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1 1 620px;
}
.order-filters select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px 11px;
}
.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3fb;
}
.segmented-control button {
  border: 0;
  background: transparent;
  padding: 8px 11px;
  color: var(--muted);
  font-weight: 700;
}
.segmented-control button.active {
  background: white;
  color: var(--accent-dark);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
}
.filter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 26px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
}
button.filter-chip {
  cursor: pointer;
}
.filter-chip.strong {
  border-color: #bfdbfe;
  background: #eaf2ff;
  color: var(--accent-dark);
}
.filter-chip.danger-chip {
  border-color: #fecaca;
  background: #fff1f0;
  color: var(--bad);
}
.filter-chip.dark-chip {
  border-color: #cbd5e1;
  background: #26303d;
  color: white;
}
.stock-page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}
.stock-page-size select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 9px 10px;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 12px 4px;
  flex-wrap: wrap;
}
.pagination-pages {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pagination-pages button {
  min-width: 38px;
  padding: 8px 11px;
}
.pagination-pages button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pagination-pages button:disabled {
  opacity: .45;
  cursor: default;
}
.pagination-gap {
  color: var(--muted);
  padding: 0 4px;
}
.stock-load-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  color: var(--muted);
}
.stock-load-status button {
  padding: 8px 12px;
}
.stock-load-sentinel {
  height: 1px;
}
.finance-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}
.finance-card strong {
  display: block;
  font-size: 28px;
  color: var(--ink);
  margin: 10px 0 4px;
}
.finance-card {
  text-align: left;
  width: 100%;
}
.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.analytics-kpi {
  min-height: 120px;
}
.analytics-kpi span,
.analytics-kpi small {
  color: var(--muted);
}
.analytics-kpi strong {
  display: block;
  font-size: 30px;
  margin: 10px 0 6px;
  color: var(--ink);
}
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.analytics-card {
  display: grid;
  gap: 12px;
  overflow: hidden;
}
.analytics-wide {
  grid-column: 1 / -1;
}
.analytics-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.analytics-card-head h4 {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}
.analytics-card-head button {
  padding: 4px 10px;
  font-size: 13px;
  background: white;
}
.chart-svg {
  width: 100%;
  height: 240px;
}
.chart-grid line {
  stroke: #dbe4f0;
  stroke-dasharray: 3 4;
}
.chart-grid text,
.chart-axis text {
  fill: var(--muted);
  font-size: 12px;
}
.chart-line-area {
  fill: rgba(37, 99, 235, .10);
}
.chart-line {
  fill: none;
  stroke: #2574d8;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-points circle {
  fill: white;
  stroke: #2574d8;
  stroke-width: 2;
}
.chart-hit {
  fill: transparent;
  pointer-events: all;
}
.chart-crosshair,
.chart-focus-dot,
.chart-tooltip {
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
.chart-crosshair {
  stroke: rgba(37, 99, 235, .32);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}
.chart-focus-dot {
  fill: #2574d8;
  stroke: #fff;
  stroke-width: 2.5;
}
.chart-tooltip rect {
  fill: #0f172a;
  filter: drop-shadow(0 8px 18px rgba(15, 23, 42, .22));
}
.chart-tooltip text {
  fill: #fff;
  font-size: 13px;
  font-weight: 700;
}
.chart-tooltip text:first-of-type {
  fill: #bfdbfe;
  font-size: 12px;
  font-weight: 600;
}
.chart-hover-point:hover .chart-crosshair,
.chart-hover-point:hover .chart-focus-dot,
.chart-hover-point:hover .chart-tooltip {
  opacity: 1;
}
.chart-empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.analytics-bars {
  display: grid;
  gap: 10px;
}
.analytics-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 220px) minmax(120px, 1fr) minmax(58px, auto);
  align-items: center;
  gap: 12px;
}
.analytics-bar-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}
.analytics-bar-row div {
  height: 12px;
  border-radius: 999px;
  background: #eef4fb;
  overflow: hidden;
}
.analytics-bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.analytics-bar-row strong {
  text-align: right;
  color: var(--ink);
}
.employee-roles-card,
.trash-lock-card {
  margin-bottom: 16px;
}
.compact-toolbar {
  margin-bottom: 10px;
}
.compact-toolbar h3,
.compact-toolbar p {
  margin: 0;
}
.role-template-list {
  display: grid;
  gap: 8px;
}
.role-template-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}
.role-template-item div:first-child {
  display: grid;
  gap: 3px;
}
.trash-lock-card {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  align-items: end;
  gap: 12px;
  max-width: 560px;
}
.good-text { color: var(--good); }
.bad-text { color: var(--bad); }
.status-filter-menu {
  position: relative;
}
.status-filter-menu summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px 12px;
  min-width: 190px;
}
.status-filter-menu summary::-webkit-details-marker {
  display: none;
}
.status-filter-menu summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
}
.status-filter-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  min-width: 250px;
  display: grid;
  gap: 6px;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.status-filter-all {
  padding: 7px 8px;
  border: 0;
  background: #edf3ff;
  color: var(--accent-dark);
  font-weight: 700;
  text-align: left;
}
.status-filter-all.muted-action {
  background: #f3f5f8;
  color: var(--muted);
}
.status-filter-panel label,
.status-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
}
.status-filter-option:hover {
  background: #f5f8fc;
}
.status-filter-option input {
  flex: 0 0 auto;
}
.status-filter-option .badge {
  max-width: 210px;
  white-space: normal;
  line-height: 1.2;
}
.th-sort {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font-weight: 700;
}
.urgent-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  margin-right: 6px;
  font-size: 22px;
  vertical-align: middle;
}
.link-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent-dark);
  cursor: pointer;
}
.strong-link {
  font-weight: 800;
  color: var(--ink);
}
.product-title-link {
  font-weight: 800;
  text-align: left;
}
.money-link {
  font-weight: 800;
}

.search-wrap {
  position: relative;
  display: block;
  width: min(420px, 100%);
}
.search {
  width: 100%;
  padding: 10px 42px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}
.search-clear:hover {
  background: #eef3fb;
  color: var(--ink);
}

.grid {
  display: grid;
  gap: 16px;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.settings-tabs button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.settings-pane.hidden { display: none; }
.profile-form-actions {
  display: flex;
  justify-content: flex-end;
}
.profile-export-panel {
  margin-top: 18px;
}
.profile-export-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.profile-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.profile-export-grid button {
  justify-content: center;
  min-height: 46px;
}
.profile-modal {
  padding: 20px;
  display: grid;
  gap: 16px;
}
.profile-summary-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.profile-summary-card h3,
.profile-summary-card p {
  margin: 0 0 4px;
}
.profile-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 22px;
}
.profile-payroll-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
}
.profile-payroll-head h3,
.profile-payroll-head p {
  margin: 0 0 4px;
}
.profile-payroll-head select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px 12px;
}
.profile-payroll-cards {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.check-grid label {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}
.permission-search {
  margin: 0 0 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
}
.permission-groups {
  display: grid;
  gap: 14px;
}
.permission-group {
  display: grid;
  gap: 8px;
}
.permission-group h4 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.template-print-modal {
  display: grid;
  gap: 14px;
}
.template-print-modal .muted {
  margin: 0;
}
.template-print-list {
  display: grid;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}
.template-print-option {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  background: white;
}
.template-print-option:hover {
  border-color: var(--blue);
  background: #f7fbff;
}
.template-print-option input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--blue);
  flex: 0 0 auto;
}

.stats {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.two {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.order-table-wrap {
  max-height: none;
  min-height: 0;
  overflow-x: auto;
  overflow-y: visible;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

table.is-resizable-table {
  table-layout: fixed;
}

th, td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  position: relative;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: #fafbfd;
}
.order-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 4;
  box-shadow: inset 0 -1px 0 var(--line);
}
.order-table-wrap.compact th,
.order-table-wrap.compact td {
  padding: 11px 14px;
}
.order-table-wrap.comfortable th,
.order-table-wrap.comfortable td {
  padding: 15px 16px;
}
.order-table-wrap tbody tr {
  transition: background .12s ease, box-shadow .12s ease;
}
.order-table-wrap tbody tr:hover {
  background: #f8fbff;
}
.urgent-order-row {
  background: #fffaf0;
}
.order-number-cell,
.customer-cell,
.device-cell,
.status-cell {
  vertical-align: middle;
}
.device-cell {
  color: var(--ink);
  font-weight: 650;
}
.customer-cell .link-button {
  font-weight: 800;
}
.empty-table-state {
  min-height: 150px;
  display: grid;
  place-items: center;
  gap: 4px;
  color: var(--muted);
  text-align: center;
}
.empty-table-state strong {
  color: var(--ink);
}

.resizable-th {
  min-width: 72px;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
  z-index: 3;
}

.column-resizer::after {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 3px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background .15s ease;
}

.resizable-th:hover .column-resizer::after,
.column-resizer:hover::after,
.column-resizer.active::after {
  background: #c9d6ea;
}

.column-resize-guide {
  position: fixed;
  z-index: 10000;
  top: 0;
  left: 0;
  width: 0;
  height: 100vh;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-1px);
  transition: opacity .12s ease;
}
.column-resize-guide.active {
  opacity: 1;
}
.column-resize-guide::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 999px;
  background: rgba(23, 105, 224, .35);
  box-shadow: 0 0 0 1px rgba(23, 105, 224, .12);
}
.column-resize-guide span {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(23, 32, 51, .82);
  color: white;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

body.is-resizing-columns {
  cursor: col-resize;
  user-select: none;
}

tr:last-child td { border-bottom: 0; }

.muted { color: var(--muted); }
.money { font-weight: 700; white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf3ff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.good { background: #e8f6ef; color: var(--good); }
.badge.warn { background: #fff4df; color: var(--warn); }
.badge.bad { background: #fdeceb; color: var(--bad); }
.badge.blue { background: #e8f1ff; color: var(--accent-dark); }
.badge.gray { background: #eef1f4; color: #4b5563; }

.status-picker {
  position: relative;
  display: inline-block;
}
.status-picker summary {
  list-style: none;
  cursor: pointer;
}
.status-picker summary::-webkit-details-marker {
  display: none;
}
.status-picker summary .badge::after {
  content: "⌄";
  margin-left: 6px;
  font-size: 12px;
}
.status-picker[open] summary .badge::after {
  content: "⌃";
}
.status-picker-menu {
  position: absolute;
  z-index: 2000;
  top: calc(100% + 6px);
  left: 0;
  width: 260px;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.status-picker-menu button {
  display: block;
  width: 100%;
  padding: 5px 6px;
  border: 0;
  background: transparent;
  text-align: left;
}
.status-picker-menu button:hover,
.status-picker-menu button.active {
  background: #f1f5fb;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 13px;
  background: white;
  cursor: pointer;
}

button:hover { border-color: #b9c5d8; }
.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  font-weight: 700;
}
.primary:hover { background: var(--accent-dark); }
.ghost { background: transparent; }
.danger { color: var(--bad); }
.icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.print-control {
  display: inline-grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 6px;
}

.print-control select {
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: white;
}

dialog {
  width: min(780px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}
#sub-modal {
  width: min(520px, calc(100vw - 32px));
  z-index: 10001;
}
.order-dialog {
  width: min(1320px, calc(100vw - 28px));
}
.order-dialog .modal-card {
  max-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.customer-dialog {
  width: min(1100px, calc(100vw - 28px));
}

dialog::backdrop { background: rgba(13, 20, 33, 0.46); }
.modal-card { padding: 0; }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; }
.form-grid {
  padding: 20px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid > .full {
  grid-column: 1 / -1;
}
.settings-subsection-title {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.settings-subsection-title h3 {
  margin: 0 0 4px;
  font-size: 17px;
}
.settings-subsection-title p {
  margin: 0;
}
.field.full { grid-column: 1 / -1; }
.form-section {
  grid-column: 1 / -1;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.form-section:first-child {
  padding-top: 0;
  border-top: 0;
}
.form-section h3 {
  margin: 0 0 4px;
  font-size: 18px;
}
.form-section p {
  margin: 0;
}
.field-section {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.field-section h3 {
  margin: 0 0 4px;
}
.field-section p {
  margin: 0;
}
.checkbox-line {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
}
.checkbox-line input {
  width: auto !important;
}
.field label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.form-grid > label {
  display: block;
}
.form-grid > label > span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.form-grid > label input,
.form-grid > label select,
.form-grid > label textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: white;
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: white;
}
.checkbox-field {
  display: flex;
  align-items: flex-end;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}
.checkbox-label input {
  width: 18px;
  height: 18px;
  margin: 0;
}
.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}
.inline-field button {
  min-width: 44px;
  padding-left: 0;
  padding-right: 0;
  font-weight: 800;
}
.field textarea { min-height: 88px; resize: vertical; }
.field-inline-button {
  margin-top: 8px;
  width: fit-content;
}
.profit-preview {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}
.profit-preview strong {
  color: var(--good);
  font-size: 22px;
}
.profit-preview small {
  color: var(--muted);
}
.password-rule {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}
.sale-product-picker {
  position: relative;
}
.sale-product-selected {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.sale-product-results {
  margin-top: 8px;
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}
.sale-product-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}
.sale-product-option:hover {
  border-color: var(--accent);
  background: #f8fbff;
}
.sale-product-option span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}
.sale-product-option em {
  align-self: start;
  color: var(--accent-dark);
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}
.sale-product-empty {
  padding: 10px 12px;
}
.sale-new-customer-fields {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.sale-customer-create {
  border-style: dashed;
}
.field-helper-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.field textarea.tall {
  min-height: 420px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.35;
}
.modal-actions {
  margin: 0;
  padding: 16px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
}
.customer-form-shell {
  padding: 0;
  display: block;
}
.customer-editor {
  display: grid;
}
.customer-tabs {
  padding: 16px 20px 0;
}
.customer-pane.hidden {
  display: none;
}
.customer-grid {
  padding-top: 18px;
  grid-template-columns: 1fr;
}
.customer-orders-pane {
  padding: 18px 20px 20px;
  display: grid;
  gap: 14px;
}
.product-profit-preview {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}
.product-profit-preview strong {
  display: block;
  color: var(--accent-dark);
  font-size: 24px;
  margin: 4px 0;
}
.customer-orders-head h3 {
  margin: 0 0 4px;
}
.customer-orders-head p {
  margin: 0;
  color: var(--muted);
}
.money-cell {
  text-align: right;
  white-space: nowrap;
}
.order-editor {
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: min(720px, calc(100vh - 170px));
  overflow: hidden;
}
.order-editor-main {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 0;
  background: white;
  overflow: auto;
}
.order-editor-side {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: #f0f5ff;
  min-width: 0;
  overflow: hidden;
}
.order-tabs,
.side-switch {
  display: flex;
  gap: 8px;
  padding: 16px 18px 0;
  flex-wrap: wrap;
}
.order-tabs button.active,
.side-switch button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.order-summary-strip {
  margin: 14px 18px 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.order-summary-strip div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.order-summary-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.order-summary-strip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-grid {
  padding-top: 16px;
  grid-template-columns: 1fr;
}
.order-services-pane {
  padding: 18px;
  display: grid;
  gap: 16px;
}
.order-service-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.inline-service-form {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 95px 120px 130px auto;
  gap: 10px;
  align-items: end;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.inline-service-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}
.inline-service-form input {
  width: 100%;
}
.inline-service-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.service-suggestions {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
}
.service-suggestion-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.service-suggestion-tabs span {
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 9px;
}
.service-suggestion-tabs span.active {
  border-color: var(--accent);
  color: var(--accent);
}
.service-suggestion {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}
.service-suggestion:hover {
  border-color: var(--accent);
}
.service-suggestion.typed {
  justify-content: flex-start;
  color: var(--accent);
}
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.row-actions button {
  white-space: nowrap;
}
.order-totals {
  margin-left: auto;
  width: min(340px, 100%);
  display: grid;
  gap: 8px;
}
.order-totals div,
.sum-lines p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.order-totals strong,
.total-line strong,
.total-line span {
  font-size: 18px;
}
.side-scroll {
  padding: 18px;
  overflow: auto;
}
.order-side-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px 18px 0;
}
.order-side-head strong {
  color: var(--ink);
}
.order-side-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.comment-item,
.activity-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}
.comment-item small,
.activity-item small {
  display: block;
  margin-top: 4px;
}
.comment-item p,
.activity-item p {
  margin: 8px 0 0;
  color: var(--ink);
}
.comment-attachments {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.comment-attachments a,
.comment-attachment-pending {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
  color: var(--accent-dark);
  text-decoration: none;
}
.comment-attachments small {
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
}
.comment-form {
  padding: 0 18px 18px;
  display: grid;
  gap: 10px;
}
.comment-form textarea {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
}
.comment-file-picker {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}
.comment-file-picker input {
  width: 100%;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}
.sum-breakdown,
.close-order-modal {
  padding: 20px;
  display: grid;
  gap: 16px;
}
.sum-lines {
  display: grid;
  gap: 10px;
}
.close-order-summary {
  display: grid;
  gap: 6px;
}
.finance-detail {
  padding: 20px;
  display: grid;
  gap: 16px;
}
.finance-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 12px;
}
.finance-detail-stats p {
  margin: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.finance-detail-stats strong,
.finance-detail-stats span {
  display: block;
}
.finance-detail-stats span {
  margin-top: 6px;
  font-size: 20px;
  color: var(--ink);
}
.placeholder-list {
  display: grid;
  gap: 10px;
}
.placeholder-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.placeholder-item code {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.placeholder-item span {
  color: var(--muted);
  line-height: 1.45;
}

.customer-editor .table-wrap,
.order-services-pane .table-wrap,
.close-order-modal .table-wrap,
.finance-detail .table-wrap {
  overflow-x: auto;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #121826;
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 20;
}

/* Fast daily-work surface */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
}

.global-search-trigger {
  min-width: 220px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  background: #f8fafc;
  text-align: left;
}
.global-search-trigger:hover {
  color: var(--ink);
  border-color: #b9c8df;
  background: white;
}
.global-search-trigger kbd {
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 6px;
  background: white;
  color: var(--muted);
  padding: 3px 7px;
  font: 700 11px/1.2 Inter, Segoe UI, Arial, sans-serif;
  white-space: nowrap;
}

.command-palette {
  width: min(720px, calc(100vw - 28px));
  margin-top: min(12vh, 110px);
  border-radius: 8px;
  overflow: hidden;
}
.command-palette::backdrop {
  background: rgba(15, 23, 42, .52);
  backdrop-filter: blur(2px);
}
.command-palette-card {
  display: grid;
  background: white;
}
.command-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.command-search-row input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  padding: 7px 4px;
  font-size: 18px;
}
.command-results {
  max-height: min(62vh, 520px);
  overflow: auto;
  padding: 8px;
}
.command-result {
  width: 100%;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  border: 0;
  padding: 11px 12px;
  text-align: left;
  background: white;
}
.command-result:hover,
.command-result:focus-visible {
  outline: 0;
  background: #eef5ff;
}
.command-result-type {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}
.command-result-type.order { background: #e8f1ff; color: #0e4fb0; }
.command-result-type.customer { background: #e8f7ef; color: #087552; }
.command-result-type.device { background: #fff3dc; color: #9a5b00; }
.command-result-type.product { background: #f2ecff; color: #6941c6; }
.command-result-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.command-result-copy strong,
.command-result-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.command-result-copy small { color: var(--muted); }
.command-result-arrow { color: var(--accent); font-size: 18px; }
.command-empty {
  min-height: 150px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
}
.command-empty span { color: var(--muted); }
.command-empty.error-state strong { color: var(--bad); }
.command-hint {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.order-toolbar {
  position: sticky;
  top: 92px;
  z-index: 24;
  margin: 0 -8px;
  padding: 10px 8px;
  background: rgba(245, 247, 251, .96);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(8px);
}
.order-table-wrap {
  max-height: none;
  min-height: 0;
  overflow-x: auto;
  overflow-y: visible;
  background: white;
}
.order-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 8;
  box-shadow: inset 0 -1px var(--line);
}
.order-table-wrap tbody tr {
  transition: background-color .12s ease;
}
.th-sort {
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.th-sort:hover { color: var(--accent-dark); }
.order-edit-state {
  margin-left: auto;
  align-self: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.order-edit-state.dirty {
  background: #fff3dc;
  color: #9a5b00;
}
.order-lookup-input {
  position: relative;
  min-width: 0;
}
.order-lookup-input > input[type="search"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 38px 10px 11px;
  background: white;
}
.order-lookup-clear {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 28px !important;
  min-width: 28px !important;
  height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0 !important;
  color: var(--muted);
  background: transparent;
  font-size: 18px;
  line-height: 1;
}
.order-lookup-clear:hover { background: #eef3fb; color: var(--ink); }
.order-lookup-results {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 330px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 16px 36px rgba(31, 45, 70, .16);
}
.order-lookup-option {
  width: 100%;
  display: grid;
  gap: 3px;
  border: 0;
  padding: 9px 10px;
  background: white;
  text-align: left;
}
.order-lookup-option:hover,
.order-lookup-option:focus-visible {
  background: #eef5ff;
}
.order-lookup-option span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-lookup-empty {
  padding: 12px;
  color: var(--muted);
  text-align: center;
}
.confirm-card {
  padding: 20px;
}
.confirm-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

button,
.nav button,
.link-button {
  transition: border-color .12s ease, background-color .12s ease, color .12s ease, box-shadow .12s ease;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(23, 105, 224, .20);
  outline-offset: 2px;
}

@media (max-width: 980px) {
  .global-search-trigger { min-width: 44px; }
  .global-search-trigger span { display: none; }
  .order-toolbar { position: static; }
  .order-table-wrap { max-height: none; }
  .order-edit-state { width: 100%; margin-left: 0; }
}

@media (max-width: 680px) {
  .topbar { position: static; }
  .topbar-actions { margin-left: auto; }
  .global-search-trigger kbd { font-size: 0; padding: 6px; }
  .global-search-trigger kbd::after { content: "K"; font-size: 11px; }
  .command-result { grid-template-columns: 78px minmax(0, 1fr); }
  .command-result-arrow { display: none; }
  .command-hint { display: none; }
}
.toast.toast-in-dialog {
  position: fixed;
  z-index: 100000;
  right: 34px;
  bottom: 34px;
  max-width: min(420px, calc(100vw - 68px));
}

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 50; padding: 10px 12px; }
  .sidebar > .brand { margin-bottom: 8px; width: auto; }
  .nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 3px; }
  .nav button { width: auto; flex: 0 0 auto; padding: 9px 11px; white-space: nowrap; }
  .topbar { min-height: 72px; padding-top: 14px; padding-bottom: 14px; }
  .topbar,
  .topbar-left { align-items: center; flex-direction: row; }
  .topbar-actions { align-items: center; flex-direction: row; }
  .stats, .two { grid-template-columns: 1fr; }
  .finance-cards,
  .order-editor,
  .inline-service-form { grid-template-columns: 1fr; }
  .order-editor-main { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .sidebar > .brand small { display: none; }
  .topbar-brand { display: none; }
  .topbar h1 { font-size: 21px; }
  .topbar p { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .auth-screen { padding: 12px; }
  .auth-card { padding: 22px 18px 18px; }
  .auth-grid, .account-type-switch { grid-template-columns: 1fr; }
  .toolbar.page-toolbar { align-items: stretch; }
  .toolbar.page-toolbar > button { width: 100%; }

  .responsive-table { overflow: visible; border: 0; background: transparent; }
  .responsive-table table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table thead { display: none; }
  .responsive-table tr { margin-bottom: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
  .responsive-table td { display: grid; grid-template-columns: minmax(92px, 34%) minmax(0, 1fr); gap: 10px; padding: 7px 0; border: 0; overflow-wrap: anywhere; }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; }
  .responsive-table td.actions { display: flex; grid-template-columns: none; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); }
  .responsive-table td.actions::before { display: none; }
  .responsive-table td.actions button { flex: 1 1 140px; }
}
