:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --ink2: #6e6e73;
  --line: #e5e5ea;
  --green: #1f5d3b;
  --green-soft: #e6f0ea;
  --amber: #d98a00;
  --red: #d6453d;
  --blue: #2f6fda;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 6px 20px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #1c1c1e;
    --ink: #f5f5f7;
    --ink2: #98989d;
    --line: #2c2c2e;
    --green: #4fae7b;
    --green-soft: #16271e;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --ink: #f5f5f7;
  --ink2: #98989d;
  --line: #2c2c2e;
  --green: #4fae7b;
  --green-soft: #16271e;
  --shadow: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea {
  font: inherit;
}
button {
  border: 0;
  cursor: pointer;
  transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
button.primary {
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  padding: 9px 18px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
button.ghost {
  background: transparent;
  color: var(--ink2);
  border-radius: 8px;
  padding: 8px 10px;
}
button.ghost:hover { color: var(--ink); }
button:disabled { opacity: .35; cursor: default; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 28px;
}
.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}
#logo {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f5c518;
  border: 2px solid #111;
  object-fit: cover;
}
.eyebrow { display: none; }
header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.segmented {
  display: inline-flex;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  border-radius: 10px;
  padding: 3px;
}
.segmented button {
  background: none;
  color: var(--ink2);
  font: inherit;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 8px;
}
.segmented .active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px 6px;
  flex-wrap: wrap;
}
#search {
  flex: 1;
  min-width: 180px;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--ink2);
  width: auto;
}
#search::placeholder { color: var(--ink2); }
#filter-status { min-width: 150px; }
#add-repair { margin-left: auto; }
#summary {
  display: flex;
  gap: 24px;
  padding: 14px 28px 0;
  color: var(--ink2);
  font-size: 13px;
  min-height: 40px;
}
#summary > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
#summary strong {
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
#summary strong.warn { color: var(--amber); }
#summary span { color: var(--ink2); }
#content { padding: 18px 28px 28px; }
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.col {
  min-height: 340px;
  border-radius: 16px;
  padding: 4px;
  transition: background .15s ease;
}
.col.dragover,
.col.over {
  background: color-mix(in srgb, var(--green) 9%, transparent);
}
.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 8px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.col-head span:last-child {
  color: var(--ink2);
  font-weight: 500;
}
.col-body {
  display: flex;
  flex-direction: column;
  min-height: 120px;
}
.card {
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
  transition: transform .15s ease;
}
.card:hover { transform: translateY(-1px); }
.card.dragging { opacity: .4; }
.card.is-urgent { border-color: rgba(214, 69, 61, .58); box-shadow: 0 0 0 1px rgba(214, 69, 61, .12), var(--shadow); }
.card.is-urgent:hover { border-color: var(--red); }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title-row .card-title { min-width: 0; }
.urgent-badge { flex: 0 0 auto; padding: 3px 8px; border-radius: 999px; background: #fbe5e3; color: var(--red); font-size: 11px; font-weight: 600; line-height: 1.2; }
.card-title {
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.need { color: var(--amber); font-weight: 600; }
.card-subtitle {
  color: var(--ink2);
  font-size: 13px;
  margin-top: 3px;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink2);
}
.dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink2);
}
.dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}
.dot.paid::before { background: var(--green); }
.dot.paid { color: var(--green); }
.late-text { color: var(--ink2); font-weight: 500; }
.late-text.is-late { color: var(--amber); font-weight: 600; }
.empty {
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 22px;
  text-align: center;
  color: var(--ink2);
  font-size: 13px;
}
.archive-dropzone {
  margin: 0 0 20px;
  border-radius: 14px;
  border: 1.5px dashed var(--line);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink2);
  font-size: 13px;
  transition: all .2s ease;
  opacity: .55;
}
.archive-dropzone.dragover,
.archive-dropzone.over {
  opacity: 1;
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}
.archive-message { display: flex; align-items: center; gap: 10px; }
.archive-icon {
  position: relative;
  width: 18px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.archive-icon::before {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 8px; height: 2px;
  background: currentColor;
}
.archive-icon::after {
  content: "";
  position: absolute;
  top: -5px; left: 3px;
  width: 8px; height: 3px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
}
.archive-actions { display: flex; align-items: center; gap: 10px; }
.archive-total {
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--ink2);
}
.archive-toggle {
  padding: 8px 12px;
  background: transparent;
  color: var(--ink2);
  font: inherit;
}
.archive-list { margin-top: 12px; }
.table-wrap {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  color: var(--ink2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
tbody tr:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
tr:last-child td { border-bottom: 0; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill.cin7 { background: #ece5ff; color: #5a3da0; }
.pill.in-lab { background: #fdf0d5; color: #8a5a00; }
.pill.prog { background: #e3edfc; color: #2458b0; }
.pill.ready { background: var(--green-soft); color: var(--green); }
.pill.done, .pill.waived { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink2); }
.pill.unpaid { background: #fbe5e3; color: var(--danger); }
.pill.partial { background: #fff0d6; color: #8f6100; }
.pill.paid { background: var(--green-soft); color: var(--green); }

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
}
.modal {
  width: min(480px, 100%);
  background: var(--surface);
  box-shadow: -10px 0 40px rgba(0,0,0,.15);
  transform: translateX(0);
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.drawer-modal {
  padding: 26px 28px 22px;
  overflow-y: auto;
}
.modal h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.drawer-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.18;
  letter-spacing: -0.04em;
  font-weight: 700;
}
.drawer-subtitle {
  margin-top: 4px;
  color: var(--ink2);
  font-size: 14px;
}
.drawer-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--ink2);
}
.drawer-banner {
  margin: 16px 0 18px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
  line-height: 1.5;
}
.drawer-section { margin-top: 10px; }
.drawer-label-row { margin-bottom: 8px; }
.drawer-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  text-transform: none;
}
.status-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.status-option {
  border: 1px solid var(--line);
  background: #f3f3f5;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}
.status-option.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(31,93,59,.08);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.drawer-meta-grid,
.drawer-order-grid,
.drawer-manual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}
.drawer-manual-grid {
  grid-template-columns: 1fr 1fr;
}
.drawer-manual-grid > :last-child {
  grid-column: 1 / -1;
}
.drawer-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drawer-field label {
  font-size: 12px;
  color: var(--ink2);
  font-weight: 500;
}
.drawer-field input,
.drawer-field select,
.drawer-field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: rgba(17,17,17,0.02);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
}
.drawer-field textarea {
  min-height: 82px;
}
.drawer-field-wide {
  margin-top: 18px;
}
.drawer-field .category-picker,
.drawer-field .product-row {
  width: 100%;
}
.drawer-field .product-row {
  display: flex;
  gap: 8px;
}
.drawer-field .product-row input,
.drawer-field .category-input-row input {
  flex: 1;
}
.drawer-field .product-row button,
.drawer-field .category-toggle {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink2);
}
.drawer-field .product-results {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 8px;
  background: var(--surface);
}
.drawer-field .money {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17,17,17,0.02);
}
.drawer-field .money span {
  padding-left: 12px;
  color: var(--ink2);
}
.drawer-field .money input {
  border: none;
  background: transparent;
  box-shadow: none;
}
.spacer {
  display: block;
  min-height: 42px;
}
.drawer-lower-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 12px;
}
.drawer-action-delete {
  background: transparent;
  color: var(--red);
  border: none;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
}
.drawer-action-save {
  min-width: 92px;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 600;
}
.modal h3 {
  margin: 18px 0 8px;
  font-size: 12px;
  color: var(--ink2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.facts {
  margin-top: 10px;
  display: flex;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--green-soft);
  border-radius: 10px;
  font-size: 13px;
}
.facts span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--ink2);
}
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 2px; }
.field label { font-size: .75rem; color: var(--ink2); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  outline: 0;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
textarea { min-height: 70px; resize: vertical; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field.wide { grid-column: 1 / -1; }
.banner {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
}

@media (max-width: 760px) {
  header { padding-left: 16px; padding-right: 16px; }
  .toolbar { padding-left: 16px; padding-right: 16px; }
  #summary { padding-left: 16px; padding-right: 16px; flex-wrap: wrap; }
  #content { padding-left: 16px; padding-right: 16px; }
  .board { grid-template-columns: repeat(4, 80%); }
  .modal { width: 100%; }
  .status-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-meta-grid, .drawer-order-grid, .drawer-manual-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
}

/* Screenshot-aligned application shell and repair workflow. */
.view-switcher {
  display: flex;
  justify-content: center;
  padding: 14px 28px 8px;
}
.view-switcher .segmented { max-width: 100%; }
.toolbar {
  flex-wrap: nowrap;
  padding-top: 0;
}
.toolbar #search {
  min-width: 120px;
  height: 48px;
  font-size: 16px;
}
.toolbar #force-sync {
  white-space: nowrap;
}
.toolbar #add-repair {
  white-space: nowrap;
}
.login-back {
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(20, 22, 24, .34);
}
.login-modal {
  width: min(380px, 100%);
  height: auto;
  min-height: 340px;
  padding: 32px;
  justify-content: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .2);
}
.login-modal h2 { margin-bottom: 8px; }
.login-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px;
}
.list-filters {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  overflow-x: auto;
}
.list-filter {
  flex: 0 0 auto;
  padding: 8px 15px;
  border-radius: 8px;
  background: transparent;
  color: var(--ink2);
  font-size: 14px;
  font-weight: 500;
}
.list-filter.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.list-count {
  flex: 0 0 auto;
  color: var(--ink2);
  font-size: 13px;
}
.table-wrap { border-radius: 14px; }
.table-wrap table { min-width: 980px; }
.table-wrap th {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}
.table-wrap td { padding: 14px 16px; }
.list-product { font-weight: 600; }
.list-category { min-height: 18px; color: var(--ink2); font-size: 12px; }
.list-payment { position: relative; padding-left: 15px; white-space: nowrap; }
.list-payment::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  content: "";
  transform: translateY(-50%);
}
.list-payment.is-paid::before { background: var(--green); }
.list-payment.is-partial::before { background: var(--amber); }
.repair-row { cursor: pointer; }

.login-modal .field { margin: 0; }
.login-modal .field label { color: var(--ink2); }

.drawer-back {
  justify-content: flex-end;
  align-items: stretch;
  padding: 0;
  background: rgba(0, 0, 0, .32);
}
.drawer-modal {
  width: min(520px, 100%);
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: -8px 0 28px rgba(0, 0, 0, .12);
}
.drawer-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 32px 28px 30px;
}
.drawer-header {
  align-items: flex-start;
  margin: 0 0 16px;
}
.drawer-header h2 {
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: 0;
}
.drawer-subtitle { font-size: 14px; }
.drawer-close {
  flex: 0 0 34px;
  margin: 0 -8px 0 0;
  padding: 0;
  font-size: 25px;
  font-weight: 300;
}
.drawer-banner {
  margin: 16px 0 20px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
}
.drawer-section { margin-top: 22px; }
.drawer-label-row { margin-bottom: 8px; }
.drawer-label,
.drawer-field label,
.drawer-readonly label {
  color: var(--ink2);
  font-size: 12px;
  font-weight: 400;
}
.status-picker {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}
.status-option {
  min-height: 54px;
  padding: 8px 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink2);
  font-size: 13px;
  line-height: 1.25;
}
.status-option.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.drawer-meta-grid,
.drawer-order-grid,
.drawer-manual-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.drawer-meta-grid { grid-template-columns: 1fr; }
.drawer-order-grid { margin-top: 14px; }
.drawer-section-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}
.drawer-section-heading h3,
.drawer-section > h3,
.drawer-activity h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.order-source {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
}
.drawer-readonly {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drawer-readonly > div {
  min-height: 48px;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--ink2);
  background: var(--surface);
}
.drawer-wide { margin-top: 14px; }
.drawer-field { gap: 7px; margin: 14px 0 0; }
.drawer-field input,
.drawer-field select,
.drawer-field textarea {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  font-size: 15px;
}
.drawer-field textarea { min-height: 88px; }
.drawer-field input[readonly],
.drawer-field select:disabled { color: var(--ink2); opacity: 1; }
.drawer-field .product-row { gap: 0; }
.drawer-field .product-row input { border-radius: 12px 0 0 12px; }
.drawer-field .product-row button {
  min-height: 48px;
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}
.drawer-field .category-input-row { gap: 0; }
.drawer-field .category-input-row input {
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.drawer-field .category-toggle { display: none; }
.drawer-field .category-options { z-index: 10; }
.drawer-field .product-results { z-index: 10; position: relative; }
.drawer-field .money {
  min-height: 48px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}
.drawer-lab-numbers { margin-top: 16px; }
.drawer-comment { margin-top: 18px; }
.drawer-activity { margin-top: 28px; }
.drawer-activity h3 { margin-bottom: 14px; }
.drawer-activity .timeline { margin-top: 8px; }
.lab-notes { margin-top: 12px; }
.lab-notes h3 { margin: 0 0 14px; }
.drawer-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 76px;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.drawer-footer-actions { display: flex; align-items: center; gap: 16px; }
.drawer-action-archive {
  background: transparent;
  color: var(--ink2);
  border: none;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
}
.drawer-action-delete { color: var(--red); }
.drawer-action-save { min-width: 88px; border-radius: 999px; }
.urgent-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}
.urgent-setting > div { display: flex; flex-direction: column; gap: 3px; }
.urgent-setting strong { color: var(--ink); font-size: 14px; font-weight: 600; }
.urgent-setting > div > span { color: var(--ink2); font-size: 12px; }
.urgent-toggle { position: relative; flex: 0 0 48px; width: 48px; height: 28px; cursor: pointer; }
.urgent-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.urgent-switch { position: absolute; inset: 0; border-radius: 999px; background: #c7c7cc; transition: background-color .18s ease; }
.urgent-switch::after { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); content: ""; transition: transform .18s ease; }
.urgent-toggle input:checked + .urgent-switch { background: var(--red); }
.urgent-toggle input:checked + .urgent-switch::after { transform: translateX(20px); }
.urgent-toggle input:focus-visible + .urgent-switch { outline: 2px solid var(--blue); outline-offset: 2px; }

.pill {
  min-height: 22px;
  padding: 2px 9px;
  font-size: 11px;
  line-height: 1.2;
}
.toolbar #search { height: 44px; }
.status-picker { padding: 3px; }
.status-option { min-height: 48px; padding: 6px 5px; }
.drawer-field .product-picker { position: relative; }
.drawer-field .product-row { position: relative; display: block; }
.drawer-field .product-row input {
  width: 100%;
  padding-right: 44px;
  border-radius: 12px;
}
.drawer-field .product-row .product-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink2);
  font-size: 20px;
  line-height: 1;
}
.drawer-field .product-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 15;
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .16);
}
.product-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font-size: 14px;
}
.product-result:last-child { border-bottom: 0; }
.product-result:hover,
.product-result:focus-visible { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.product-result-name { min-width: 0; overflow-wrap: anywhere; }
.product-result-category {
  flex: 0 0 auto;
  color: var(--ink2);
  font-size: 12px;
}
.product-add { justify-content: flex-start; color: var(--green); }
.product-add .product-result-name::before {
  content: "+";
  margin-right: 8px;
  font-size: 18px;
}
.product-result-message { padding: 12px 14px; color: var(--ink2); font-size: 13px; }
.drawer-field .category-input-row input:disabled {
  border-style: dashed;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink2);
  cursor: not-allowed;
  opacity: 1;
}
.drawer-field .category-picker { position: relative; }
.drawer-field .category-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 16;
  max-height: 220px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .16);
}
.drawer-field .category-options button {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 14px;
}
.drawer-field .category-options button:hover,
.drawer-field .category-options button[aria-selected="true"] {
  background: color-mix(in srgb, var(--green) 9%, transparent);
  color: var(--green);
}
.drawer-field .category-options .muted { padding: 9px 11px; }
.drawer-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.copy-cin7 {
  padding: 3px 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.copy-cin7:hover { background: var(--green-soft); }
.drawer-activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.drawer-activity-head h3 { margin: 0; }
.activity-toggle {
  padding: 5px 9px;
  border-radius: 7px;
  background: transparent;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}
.activity-toggle:hover { background: var(--green-soft); }
.drawer-activity #history { margin-top: 16px; }
.drawer-activity .timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0 0 0 6px;
  padding-left: 15px;
  border-left: 1px solid var(--line);
}
.drawer-activity .event {
  position: relative;
  font-size: 13px;
}
.drawer-activity .event::before {
  position: absolute;
  top: 4px;
  left: -21px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--green);
  border-radius: 50%;
  background: var(--surface);
  content: "";
}
.drawer-activity .event .text { color: var(--ink); font-weight: 500; }
.drawer-activity .event .who { margin-top: 3px; color: var(--ink2); font-size: 12px; }

body.dashboard-active .toolbar { display: none; }
.insights-page { display: flex; flex-direction: column; gap: 18px; }
.insights-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.insights-period { width: fit-content; }
.insights-period button { min-width: 94px; }
.insights-export {
  padding: 7px 10px;
  border-radius: 8px;
  background: transparent;
  color: var(--ink2);
  font-size: 13px;
}
.insights-export:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.insights-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}
.insights-metric,
.insights-panel {
  min-width: 0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.insights-metric {
  min-height: 124px;
  padding: 25px 24px 21px;
}
.insights-metric strong {
  display: block;
  color: var(--ink);
  font-size: 36px;
  font-weight: 650;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.insights-metric strong span {
  margin-left: 4px;
  color: var(--ink2);
  font-size: 14px;
  font-weight: 500;
}
.insights-metric > div {
  margin-top: 9px;
  color: var(--ink2);
  font-size: 13px;
}
.insights-primary-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 18px;
}
.insights-panel { padding: 24px; }
.insights-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}
.weekly-panel { min-height: 356px; }
.weekly-chart { margin-top: 18px; }
.weekly-bars {
  display: flex;
  align-items: stretch;
  gap: 9px;
  height: 210px;
  overflow-x: auto;
  padding: 0 0 2px;
}
.week-column {
  flex: 1 0 52px;
  min-width: 52px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  text-align: center;
}
.week-bar-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: flex-end;
}
.week-bar {
  width: 100%;
  min-height: 0;
  border-radius: 7px 7px 2px 2px;
  background: var(--green);
}
.week-column > span {
  flex: 0 0 16px;
  color: var(--ink2);
  font-size: 11px;
}
.attention-panel { min-height: 356px; }
.attention-list { margin-top: 18px; }
.attention-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.attention-row:last-child { border-bottom: 0; }
.attention-row strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attention-row span { color: var(--amber); font-size: 12px; }
.insights-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.breakdown-panel { min-height: 180px; }
.breakdown-list { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; }
.breakdown-row {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(50px, 1.5fr) 28px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.breakdown-row > span { overflow: hidden; color: var(--ink2); text-overflow: ellipsis; white-space: nowrap; }
.breakdown-row > div { height: 8px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.breakdown-row i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.breakdown-row b { color: var(--ink2); text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.insights-empty { margin-top: 18px; color: var(--ink2); font-size: 13px; }

@media (max-width: 760px) {
  .view-switcher { padding: 12px 12px 8px; }
  .view-switcher .segmented button { padding-right: 8px; padding-left: 8px; font-size: 13px; }
  .toolbar { flex-wrap: wrap; padding: 0 12px 6px; }
  .toolbar #search { flex: 1 0 100%; }
  .toolbar #force-sync,
  .toolbar #add-repair { flex: 1; }
  .list-toolbar { align-items: flex-start; }
  .list-filters { max-width: calc(100vw - 100px); }
  .list-filter { padding-right: 10px; padding-left: 10px; }
  .drawer-scroll { padding: 24px 20px 28px; }
  .drawer-modal { width: 100%; }
  .status-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .drawer-meta-grid { grid-template-columns: 1fr; }
  .drawer-order-grid,
  .drawer-manual-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-modal { min-height: 320px; padding: 26px; }
  .insights-page { gap: 12px; }
  .insights-controls { align-items: flex-start; }
  .insights-period button { min-width: 0; padding-right: 10px; padding-left: 10px; }
  .insights-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .insights-metric { min-height: 106px; padding: 18px 16px; border-radius: 14px; }
  .insights-metric strong { font-size: 30px; }
  .insights-primary-grid,
  .insights-breakdown-grid { grid-template-columns: 1fr; gap: 12px; }
  .insights-panel { padding: 18px; border-radius: 14px; }
  .weekly-panel { min-height: 300px; }
  .attention-panel { min-height: auto; }
  .weekly-bars { height: 180px; }
}

.settings-view {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: min(850px, 100%);
  margin: 0 auto;
  padding-bottom: 12px;
}
.settings-card {
  min-width: 0;
  padding: 24px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.settings-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}
.settings-connection,
.settings-code-setting,
.settings-preference-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  align-items: center;
  gap: 20px;
}
.settings-connection {
  min-height: 82px;
  margin-top: 14px;
  border-bottom: 1px solid var(--line);
}
.settings-connection strong { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.settings-connection p,
.settings-description span,
.settings-intro {
  display: block;
  margin: 4px 0 0;
  color: var(--ink2);
  font-size: 13px;
  line-height: 1.45;
}
.connection-indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.settings-link,
.settings-add-link,
.settings-remove-text {
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: var(--ink2);
  text-align: left;
  font-size: 14px;
}
.settings-link { justify-self: end; }
.settings-link:hover,
.settings-add-link:hover { color: var(--green); }
.settings-code-setting { align-items: start; padding-top: 14px; }
.settings-description { display: flex; flex-direction: column; gap: 2px; }
.settings-description strong { font-size: 14px; font-weight: 600; }
.settings-code-list { display: flex; flex-direction: column; gap: 8px; }
.settings-code-row { display: flex; align-items: center; gap: 8px; }
.settings-code-row input,
.settings-product-row input,
.settings-product-row select,
.settings-invite-form input,
.settings-invite-form select,
.settings-threshold input {
  min-width: 0;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink);
  font-size: 14px;
}
.settings-code-row input { flex: 1; }
.settings-remove {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--red);
  font-size: 20px;
}
.settings-remove:hover { background: color-mix(in srgb, var(--red) 8%, transparent); }
.settings-add-link { align-self: flex-start; margin-top: 4px; }
.settings-intro { margin: 14px 0 16px; }
.settings-product-list { display: flex; flex-direction: column; }
.settings-product-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 180px) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.settings-product-name { min-width: 0; }
.settings-product-name input { width: 100%; }
.settings-product-name small { display: block; padding: 3px 3px 0; color: var(--ink2); font-size: 11px; }
.settings-row-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.settings-row-save {
  padding: 6px 9px;
  border-radius: 7px;
  background: transparent;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}
.settings-row-save:hover { background: var(--green-soft); }
.settings-remove-text { color: var(--red); font-size: 13px; }
.settings-new-product { border-bottom: 0; }
.settings-section-head { display: flex; align-items: center; justify-content: space-between; }
.settings-count { color: var(--ink2); font-size: 12px; }
.settings-people-list { margin-top: 14px; }
.settings-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}
.settings-person-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.settings-person-name strong { font-size: 14px; font-weight: 600; }
.settings-person-name span { overflow: hidden; color: var(--ink2); font-size: 12px; text-overflow: ellipsis; }
.settings-role-state,
.settings-static-segmented {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}
.settings-role-state button,
.settings-static-segmented span {
  min-width: 62px;
  padding: 7px 11px;
  border: 0;
  border-radius: 8px;
  color: var(--ink2);
  text-align: center;
  font-size: 13px;
}
.settings-role-state button { background: transparent; }
.settings-role-state .selected,
.settings-static-segmented .selected {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.settings-role-state button:disabled { cursor: wait; opacity: .65; }
.settings-invite-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
}
.settings-invite-form label { display: flex; flex-direction: column; gap: 5px; color: var(--ink2); font-size: 12px; }
.settings-invite-form button { justify-self: start; }
.settings-preference-row {
  min-height: 80px;
  grid-template-columns: minmax(0, 1fr) auto;
  border-bottom: 1px solid var(--line);
}
.settings-preference-row:last-child { border-bottom: 0; }
.settings-threshold { display: flex; align-items: center; gap: 8px; }
.settings-threshold input { width: 88px; text-align: center; }
.settings-footer {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  padding: 12px 0 4px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px);
}
.settings-footer .primary { min-width: 92px; }
.settings-empty,
.settings-loading { padding: 12px 0; color: var(--ink2); font-size: 13px; }
.settings-error { margin: 8px 0; color: var(--red); font-size: 13px; }

@media (max-width: 760px) {
  .settings-view { gap: 12px; }
  .settings-card { padding: 18px; border-radius: 14px; }
  .settings-connection { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .settings-code-setting { grid-template-columns: 1fr; gap: 10px; }
  .settings-product-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .settings-product-row select { grid-column: 1; }
  .settings-row-actions { grid-column: 2; grid-row: 1 / span 2; }
  .settings-person { align-items: flex-start; flex-direction: column; padding: 12px 0; }
  .settings-invite-form { grid-template-columns: 1fr; }
  .settings-preference-row { min-height: 72px; gap: 12px; }
  .settings-static-segmented span { min-width: 48px; padding: 7px 8px; }
}
