:root {
  --bg: #f4f6f8;
  --card-bg: #ffffff;
  --border: #e1e5ea;
  --text: #1c2630;
  --muted: #6b7684;
  --primary: #0f6e5e;
  --primary-dark: #0b5447;
  --primary-light: #e6f3f0;
  --danger: #b3261e;
  --danger-light: #fbeae9;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--primary-dark);
  color: white;
}
.brand { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.session-info { font-size: 0.9rem; opacity: 0.9; }
.session-info strong { font-weight: 600; }

.status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.status-online { background: rgba(255,255,255,0.15); color: #a6f0d8; }
.status-offline { background: var(--danger); color: white; }
.status-syncing { background: #8a5a00; color: #ffe6b3; }

.outbox-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.outbox-badge-info { background: #ffe6b3; color: #8a5a00; }
.outbox-badge-warn { background: var(--danger-light); color: var(--danger); }

.outbox-panel {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px 0;
}
.outbox-entry {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}
.outbox-entry-warn { border-color: var(--danger); background: var(--danger-light); }
.outbox-status { color: var(--muted); }
.outbox-retry { margin-left: 8px; font-size: 0.8rem; }

main#app { padding: 24px; max-width: 1200px; margin: 0 auto; }

/* !important is deliberate: "hidden" must win no matter what other class
   (e.g. .selected-chip's display:flex) is applied alongside it, regardless
   of source order. Without it, any later same-specificity class with its
   own `display` quietly un-hides the element -- which is exactly the bug
   this replaced (see claude/intake-screens.md). */
.hidden { display: none !important; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(20, 30, 40, 0.04);
}
.card.narrow { max-width: 440px; margin: 40px auto; }

h1 { font-size: 1.4rem; margin: 0 0 6px; }
h2 { font-size: 1rem; margin: 0 0 12px; color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.95rem;
  margin-bottom: 10px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
label { font-size: 0.82rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 7px;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-bottom: 8px;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--primary-light); color: var(--primary-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-link { background: none; color: var(--primary); text-decoration: underline; width: auto; padding: 4px 0; }
.btn-large { font-size: 1.02rem; padding: 13px 16px; }
.switch-user-link { display: block; margin-top: 6px; }

.divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 14px 0;
  position: relative;
}

.error-text {
  color: var(--danger);
  font-size: 0.86rem;
  min-height: 0;
  margin: 6px 0 0;
  white-space: pre-wrap;
}

.staff-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.staff-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
}
.staff-option:hover { border-color: var(--primary); }
.staff-option.selected { border-color: var(--primary); background: var(--primary-light); }
.staff-role-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--primary-dark);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 20px;
}

.till-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .till-grid { grid-template-columns: 1fr; } }

.results-list { max-height: 220px; overflow-y: auto; border-top: 1px solid var(--border); margin-top: 4px; }
.result-item {
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9rem;
}
.result-item:hover { background: var(--primary-light); }
.result-item .result-main { font-weight: 600; }
.result-item .result-sub { color: var(--muted); font-size: 0.8rem; }
.result-item-disabled { cursor: not-allowed; opacity: 0.55; }
.result-item-disabled:hover { background: none; }
.category-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}
.cat-OTC { background: #e6f3f0; color: #0f6e5e; }
.cat-P { background: #fff4df; color: #8a5a00; }
.cat-RX { background: #e6edfb; color: #1a4fba; }
.cat-CONTROLLED { background: var(--danger-light); color: var(--danger); }

/* Owner console — license status badges (web/owner.html) */
.license-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.license-unrestricted { background: var(--primary-light); color: var(--primary-dark); }
.license-active { background: #e6f3f0; color: #0f6e5e; }
.license-expiring-soon { background: #fff4df; color: #8a5a00; }
.license-expired { background: var(--danger-light); color: var(--danger); }

.owner-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.owner-table th {
  text-align: left; color: var(--muted); font-size: 0.75rem; text-transform: uppercase;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.owner-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.owner-table tr:last-child td { border-bottom: none; }

.selected-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-weight: 600;
}
.btn-chip-x {
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  color: var(--primary-dark); line-height: 1;
}

.cart-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-bottom: 8px; }
.cart-table th { text-align: left; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.cart-table td { padding: 8px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cart-table select, .cart-table input { margin-bottom: 0; padding: 5px 6px; font-size: 0.85rem; }
.cart-table .qty-input { width: 60px; }
.remove-line { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1rem; }

.cart-totals { margin-top: 10px; }
.cart-totals div { display: flex; justify-content: space-between; padding: 3px 0; font-size: 0.9rem; }
.cart-totals .grand { font-weight: 700; font-size: 1.05rem; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }

.override-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  background: var(--danger-light);
}

.receipt-line { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.9rem; }
.receipt-total { display: flex; justify-content: space-between; padding: 8px 0; font-weight: 700; border-top: 1px solid var(--border); margin-top: 8px; }
.receipt-meta { color: var(--muted); font-size: 0.82rem; margin-top: 10px; }

.offline-receipt-banner {
  background: #ffe6b3;
  color: #8a5a00;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 0.85rem;
}
.offline-receipt-banner .small { font-weight: 400; display: block; margin-top: 4px; }

.safety-disclaimer {
  font-size: 0.75rem;
  color: #8a8a8a;
  text-align: center;
  margin: 10px 0 2px;
  line-height: 1.4;
}

.till-footer-links { display: flex; justify-content: space-between; }
.till-admin-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.till-admin-links .btn-link { width: auto; }
.till-admin-links .btn:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: none; }

.plain-list { list-style: none; padding: 0; margin: 0 0 10px; }
.plain-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

/* Controlled register: a 7-column table needs more room than .card.narrow
   gives the other intake screens, so this gets its own, wider max-width. */
.cr-card { max-width: 820px; margin: 30px auto; }
.cr-balance {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-weight: 700;
}
.cr-balance span:last-child { font-size: 1.3rem; }

.till-admin-links { flex-wrap: wrap; }

/* Purchase orders: a 5-column line table + list/new/detail sub-views need
   the same extra width as the controlled register. */
.po-card { max-width: 820px; margin: 30px auto; }
.po-line-row {
  display: grid;
  grid-template-columns: 1fr 110px 130px 32px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.po-line-row .po-line-name { font-size: 0.88rem; }
.po-list-row { cursor: pointer; }
.po-list-row:hover { background: var(--primary-light); }

.status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.status-DRAFT { background: #ececec; color: #555; }
.status-SENT { background: #e6edfb; color: #1a4fba; }
.status-PARTIALLY_RECEIVED { background: #fff4df; color: #8a5a00; }
.status-RECEIVED { background: #e6f3f0; color: #0f6e5e; }
.status-CANCELLED { background: var(--danger-light); color: var(--danger); }
