@charset "UTF-8";

:root {
  color-scheme: light;
  /* Evergreen Ford — green swoosh + navy star border */
  --brand-green: #206030;
  --brand-green-bright: #1f7a3d;
  --brand-navy: #285078;
  --brand-ink: #121820;
  --bg: #eef3f0;
  --aside: #f7faf8;
  --surface: #ffffff;
  --surface-2: #f1f6f3;
  --input-bg: #ffffff;
  --text: #152033;
  --muted: #5c6b7a;
  --border: #d3ddd6;
  --accent: var(--brand-green);
  --accent-soft: #e5f2e9;
  --nav-hover: #e5f0e9;
  --track: #dce6df;
  --ok: var(--brand-green-bright);
  --ok-soft: #e6f6ee;
  --warn: #9a6700;
  --warn-soft: #fff6e0;
  --bad: #c5221f;
  --bad-soft: #fce8e6;
  --shadow: 0 1px 2px rgba(18, 24, 32, 0.05), 0 10px 28px rgba(32, 96, 48, 0.07);
  --radius: 12px;
  font-family: "Manrope", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; overflow-x: hidden; }

/* Global dark form controls - prevents white browser defaults */
input, textarea, select, button {
  font: inherit;
  color: inherit;
}
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 10px;
  color-scheme: light;
}
input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}
input[type="time"],
input[type="date"],
input[type="datetime-local"] {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  color-scheme: light;
}
textarea { resize: vertical; min-height: 88px; width: 100%; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

.console {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  max-width: 100vw;
}

aside {
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  background: var(--aside);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 100vh;
  position: sticky;
  top: 0;
}

.brand {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 2px 12px;
  padding: 8px 10px 16px;
  min-width: 0;
  align-items: center;
}
.brand-logo {
  grid-row: 1 / 3;
  width: 52px;
  height: 52px;
  object-fit: contain;
  object-position: center;
  border-radius: 10px;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: block;
}
.brand-logo-lg {
  width: 120px;
  height: 60px;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  padding: 0;
  background: transparent;
}
.brand strong, .brand small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand small { color: var(--muted); }

nav {
  display: grid;
  gap: 4px;
  flex: 1;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
}
nav button {
  background: transparent;
  border: 0;
  color: var(--muted);
  text-align: left;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
}
nav button:hover,
nav button.active {
  background: var(--nav-hover);
  color: var(--text);
  font-weight: 600;
}

.auth {
  margin-top: auto;
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding: 18px 8px 8px;
  flex-shrink: 0;
}
.auth label { font-size: 12px; color: var(--muted); display: grid; gap: 6px; }
.auth input,
.auth select { width: 100%; }

main {
  padding: 28px 34px;
  min-width: 0;
  overflow-x: hidden;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
h1 { margin: 0; font-size: 25px; }
header p { margin: 5px 0; color: var(--muted); }
.badge {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 8px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.panel {
  background: var(--aside);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  min-height: 520px;
  min-width: 0;
  overflow-x: hidden;
}
.panel > h2 { margin: 0 0 10px; }
.panel > p { margin: 0 0 14px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.metrics article,
.cards article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.metrics b { font-size: 28px; display: block; }
.metrics span, .cards span { color: var(--muted); }

.table { display: grid; }
.tr {
  display: grid;
  grid-template-columns: 2fr 1.3fr 1fr 0.7fr 0.5fr;
  gap: 14px;
  padding: 13px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.tr.head { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.tr small { display: block; color: var(--muted); }
.tool-access .tr { grid-template-columns: 2fr 1fr; }

.tcx-table {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
}
.tcx-table .t-head,
.tcx-table .t-row {
  display: grid;
  grid-template-columns: 90px 1.4fr 1.4fr 80px;
  gap: 12px;
  padding: 12px 14px;
  align-items: center;
}
.tcx-table.tcx-users .t-head,
.tcx-table.tcx-users .t-row {
  grid-template-columns: 70px minmax(120px, 1.3fr) minmax(90px, 1fr) 78px 110px 90px 72px 80px minmax(120px, 1.2fr);
  min-width: 980px;
}
.tcx-table .t-head {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
.tcx-table .t-row { border-bottom: 1px solid var(--border); }
.tcx-table .t-row:last-child { border-bottom: 0; }
.tcx-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
}
.tcx-pill.on {
  color: var(--ok);
  border-color: #b7e0c8;
  background: var(--ok-soft);
}
.tcx-pill.off {
  color: var(--bad);
  border-color: #f5c2c0;
  background: var(--bad-soft);
}
.tcx-pill.warn {
  color: var(--warn);
  border-color: #f0d48a;
  background: var(--warn-soft);
}
.tcx-dept-list { display: grid; gap: 14px; margin-top: 12px; }
.tcx-dept-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 4px 0 12px;
}
.tcx-dept-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 14px;
  padding: 0 16px 12px;
  font-size: 13px;
}
.tcx-members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px;
}
.tcx-member {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  font-size: 13px;
}
.tcx-toolbar { margin-top: 12px; }
.tcx-main {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 14px;
}
.tcx-main code {
  color: var(--text);
  font-size: 15px;
}
.tcx-search {
  display: grid;
  gap: 8px;
  max-width: 520px;
}
.tcx-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tcx-search-row input { flex: 1; margin: 0; }
.tcx-search-row .primary { flex-shrink: 0; }

.tog { display: inline-flex; gap: 8px; align-items: center; color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions button:not(.primary) {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 18px;
  cursor: pointer;
}
.msg { color: var(--ok); }
.msg-error {
  color: var(--bad);
  background: var(--bad-soft);
  border: 1px solid #f5c2c0;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0;
}
.hint { color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table tr.row-fallback td { background: rgba(117, 223, 160, 0.08); }
.warn-cell { color: var(--warn); }
.risk { font-size: 12px; }
.risk.write, .risk.dangerous-write { color: var(--warn); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cards b, .cards span { display: block; }
.cards em { color: var(--ok); font-size: 12px; }

.empty {
  min-height: 420px;
  display: grid;
  place-content: center;
  text-align: center;
  font-size: 20px;
  color: var(--text);
}
.empty small { display: block; max-width: 520px; color: var(--muted); margin-top: 10px; }

.chat {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}
.chat input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
}
button.primary,
.chat button {
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
}
.chat button {
  height: 40px;
  flex: 0 0 auto;
  align-self: center;
}
button.primary:disabled,
.chat button:disabled { opacity: 0.6; cursor: wait; }

.guard { display: grid; gap: 8px; margin-bottom: 16px; }
.guard textarea { min-height: 80px; }

/* Multi-chat */
.multi-chat {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  min-height: 560px;
  min-width: 0;
}
.chat-aside {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  border-right: 1px solid var(--border);
  padding-right: 12px;
  min-width: 0;
}
.chat-side-list {
  display: grid;
  gap: 6px;
  align-content: start;
  overflow: auto;
  max-height: 520px;
}
.chat-side-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  align-items: stretch;
  min-width: 0;
}
.chat-side-open {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-align: left;
  padding: 10px;
  cursor: pointer;
  min-width: 0;
}
.chat-side-item.active .chat-side-open {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.chat-side-open span {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-side-open small { color: var(--muted); }
.chat-side-del {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 6px;
}
.chat-side-del:hover { color: var(--bad); }
.chat-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 560px;
  min-width: 0;
}
.chat-meta {
  flex: 0 0 auto;
}
.chat-meta label {
  font-size: 12px;
  color: var(--muted);
  display: grid;
  gap: 6px;
  max-width: 280px;
}
.chat-log {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
  max-height: 520px;
  display: grid;
  gap: 10px;
  align-content: start;
  padding-right: 4px;
  min-width: 0;
}
.bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
}
.bubble b { font-size: 12px; color: var(--muted); }
.bubble > b { display: block; margin-bottom: 6px; }
.bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.bubble-head b { margin: 0; }
.bubble.user { border-color: var(--accent); }
.bubble.assistant { border-color: var(--ok); }
.bubble.status { color: var(--muted); font-style: italic; }

.msg-menu { position: relative; }
.icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.msg-menu-pop {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.msg-menu.open .msg-menu-pop { display: grid; }
.msg-menu-pop button {
  background: transparent;
  border: 0;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.msg-menu-pop button:hover { background: var(--nav-hover); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.72);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  color: var(--text);
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.modal-head h3 { margin: 0; font-size: 18px; }

.action-step { display: inline-flex; align-items: center; gap: 8px; }
.action-step::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6ea8fe;
  box-shadow: 0 0 0 0 rgba(110, 168, 254, 0.7);
  animation: pulse 1.2s ease-out infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(110, 168, 254, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 168, 254, 0); }
}

.bubble.assistant.streaming .msg-text::after {
  content: "|";
  margin-left: 1px;
  opacity: 0.55;
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

.msg-text {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.empty-inline {
  text-align: center;
  color: var(--text);
  padding: 48px 12px;
}
.empty-inline small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
}
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  border: 1px solid #b7d9c2;
  border-radius: 8px;
  padding: 6px 10px;
  margin: 4px 6px 0 0;
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
}
.tool-chip code {
  color: var(--brand-navy);
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
}
.tool-row-inline {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tool-row-inline details { margin-top: 8px; width: 100%; }
.tool-row-inline pre,
.diag-detail pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  max-height: 320px;
  overflow: auto;
  font-size: 12px;
  color: var(--text);
}

/* Diagnostics */
.diag-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}
.diag-split {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.35fr);
  gap: 14px;
  min-height: 520px;
  align-items: stretch;
}
.diag-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 640px;
  overflow: auto;
  padding-right: 4px;
}
.diag-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  cursor: pointer;
}
.diag-item:hover { border-color: #3a5278; }
.diag-item.active { border-color: var(--accent); background: var(--accent-soft); }
.diag-item.bad { border-color: #7a3b3b; }
.diag-item-main { display: grid; gap: 4px; min-width: 0; }
.diag-item .t { font-weight: 700; display: block; color: var(--text); }
.diag-item .s {
  display: block;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diag-item-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.diag-item small { color: var(--muted); font-size: 12px; }
.diag-item .diag-tools { color: var(--accent); }
.diag-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  max-height: 640px;
  overflow: auto;
  color: var(--text);
}
.bad-tag { color: var(--bad); }
.transcript { white-space: pre-wrap; }

/* Tabs / tools */
.tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0 18px;
  border-bottom: 1px solid var(--border);
}
.tabs button {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 10px 14px;
  cursor: pointer;
  margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tool-cards { display: grid; gap: 12px; }
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 10px;
}
.tool-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.tool-card-top b { display: block; margin-bottom: 6px; }
.tool-card-top small { display: block; color: var(--muted); margin-bottom: 8px; }
.tool-card label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }

/* Guardrails / fine-tune cards */
.card-edit {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  display: grid;
  gap: 12px;
}
.card-edit-head {
  display: flex;
  gap: 10px;
  align-items: center;
}
.card-edit-head .cat-key,
.card-edit-head input {
  flex: 1;
  min-width: 0;
  width: auto;
}
.card-edit label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.card-edit textarea,
.cat-body {
  min-height: 120px;
  width: 100%;
  line-height: 1.45;
}
button.danger {
  background: #3a1d1d;
  color: #ffb4b4;
  border: 1px solid #5c2c2c;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  flex-shrink: 0;
}
button.danger:hover { background: #4a2424; }

.set-on { color: var(--ok); font-weight: 700; margin-right: 8px; }
.set-off { color: #ffb4b4; font-weight: 700; margin-right: 8px; }
.voice-status {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Departments */
.dept-list { display: grid; gap: 16px; }
.dept-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 12px;
}
.dept-head b { display: block; font-size: 16px; }
.dept-head small { color: var(--muted); }
.soft-sell {
  margin: 0;
  padding: 10px 12px;
  background: var(--input-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.people-list { display: grid; gap: 8px; }
.person-row,
.add-person {
  display: grid;
  grid-template-columns: 1.6fr auto auto auto;
  gap: 10px;
  align-items: center;
}
.person-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.person-row input,
.add-person input { width: 100%; }

/* Stores hours */
.store-hours-list { display: grid; gap: 16px; }
.store-hours-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 14px;
}
.store-hours-card .dept-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.store-meta {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.store-meta label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.store-meta .span-2 { grid-column: 1 / -1; }
.hours-categories {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #0f1622;
}
.hours-cat {
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 0;
  overflow: visible;
}
.hours-cat:last-child { border-bottom: 0; }
.hours-cat > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid transparent;
}
.hours-cat[open] > summary { border-bottom-color: var(--border); }
.hours-cat > summary::-webkit-details-marker { display: none; }
.hours-cat > summary::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.hours-cat[open] > summary::after { transform: rotate(180deg); }
.cat-summary-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
}
.cat-summary-left input.cat-name {
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  padding: 2px 4px;
  width: auto;
  min-width: 160px;
  max-width: 100%;
  color: var(--text);
}
.cat-summary-left input.cat-name:hover,
.cat-summary-left input.cat-name:focus {
  border-color: var(--border);
  background: var(--input-bg);
}
.cat-summary-left small {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hours-cat .hours-grid { padding: 8px 16px 4px; }
.hours-cat .actions { padding: 0 16px 14px; margin-top: 4px; }
.hours-grid { display: grid; gap: 6px; }
.hours-row {
  display: grid;
  grid-template-columns: 110px 100px minmax(110px, 1fr) minmax(110px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 4px 0;
}
.hours-row > span { color: var(--text); font-size: 14px; }

/* ---------- Calls review ---------- */
.calls-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100vh - 120px);
}
.calls-layout {
  grid-template-columns: minmax(280px, 320px) 1fr;
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100vh - 200px);
  align-items: stretch;
}
.call-aside {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.call-aside-head { display: flex; gap: 8px; }
.call-aside .chat-side-list,
.call-side-list {
  max-height: none !important;
  height: 100%;
  min-height: 0;
  overflow: auto;
  align-content: start;
  padding-right: 4px;
}
.call-side-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto auto;
  gap: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-align: left;
  padding: 14px 16px;
  cursor: pointer;
  min-width: 0;
}
.call-side-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.call-side-name {
  grid-column: 1;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call-side-dur {
  grid-column: 2;
  grid-row: 1;
  font-size: 11px;
  color: var(--muted);
  align-self: start;
}
.call-side-phone {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
}
.call-side-meta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.call-main {
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 4px 4px 24px 8px;
}
.call-review {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding-bottom: 24px;
}
.call-review-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.call-review-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
}
.call-review-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.call-stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.call-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}
.call-stat span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.call-stat strong { font-size: 14px; font-weight: 600; text-transform: capitalize; }
.call-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.call-download-msg {
  margin: -8px 0 0;
  font-size: 12px;
}
.call-player {
  display: grid;
  gap: 8px;
}
.call-player-head,
.call-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.call-player label { font-size: 12px; color: var(--muted); }
.call-player audio { width: 100%; max-width: 560px; }
.call-section {
  padding: 16px 18px;
}
.call-section h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}
.call-section-head {
  margin-bottom: 12px;
}
.call-section-head h3 { margin: 0; }
.call-summary {
  margin: 0;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
}
.call-transcript-log {
  max-height: 420px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface-2);
}
.call-transcript-raw {
  margin-top: 10px;
  white-space: pre-wrap;
  font-size: 12px;
}
.call-advanced {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.call-advanced details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.call-advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.call-advanced pre {
  margin: 10px 0 0;
  max-height: 280px;
  overflow: auto;
  font-size: 12px;
}
.call-tool-card {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.call-tool-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.call-tool-result { color: var(--muted); }
.call-diag-list { display: grid; gap: 6px; margin-top: 10px; }
.call-diag-row {
  display: grid;
  grid-template-columns: 150px 140px 120px 1fr;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
}
.call-diag-row.bad { color: var(--bad); }
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-transform: capitalize;
}
.pill.ok { background: var(--ok-soft); border-color: #b7e0c8; color: var(--ok); }
.pill.bad { background: var(--bad-soft); border-color: #f5c2c0; color: var(--bad); }
.pill.warn { background: var(--warn-soft); border-color: #f0d48a; color: var(--warn); }
.muted { color: var(--muted); font-size: 13px; }

/* Login gate */
.login-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 15% 0%, rgba(32, 96, 48, 0.14), transparent 60%),
    radial-gradient(700px 360px at 100% 100%, rgba(40, 80, 120, 0.10), transparent 55%),
    var(--bg);
}
/* class { display:grid } overrides the native [hidden] rule — force hide */
.login-gate[hidden],
#appShell[hidden] {
  display: none !important;
}
.login-card {
  width: min(420px, 100%);
  background: var(--aside);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  display: grid;
  gap: 16px;
}
.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
}
.login-brand strong { display: block; font-size: 18px; }
.login-brand small { color: var(--muted); }
.login-lead { margin: 0; color: var(--muted); line-height: 1.45; }
.login-card .primary { width: 100%; padding: 12px 14px; border-radius: 10px; }
.login-busy {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px 12px;
  border: 1px solid #b8c9db;
  background: #e8eef5;
  border-radius: 10px;
  color: var(--brand-navy);
  text-align: center;
}
.login-busy[hidden] { display: none !important; }
html.auth-returning #msLoginBtn { display: none !important; }
html.auth-returning #loginBusy { display: grid !important; }
html.auth-returning #loginError { display: none !important; }
.login-busy p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.login-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(40, 80, 120, 0.22);
  border-top-color: var(--brand-navy);
  animation: login-spin 0.8s linear infinite;
}
@keyframes login-spin {
  to { transform: rotate(360deg); }
}
.login-msg {
  margin: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
}
.login-msg-info {
  color: var(--brand-navy);
  background: #e8eef5;
  border: 1px solid #b8c9db;
}
.login-msg-error {
  color: var(--bad);
  background: var(--bad-soft);
  border: 1px solid #f5c2c0;
}

.nav-group {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5f6b80;
  padding: 12px 12px 4px;
}
.user-chip { display: grid; gap: 2px; }
.user-chip strong { font-size: 13px; }
.user-chip small { color: var(--muted); font-size: 12px; }
button.ghost,
.ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
}
button.ghost:hover:not(:disabled),
.ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}
button.ghost:disabled,
.ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.auth .ghost { width: 100%; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.filter-bar label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.filter-bar label.grow { flex: 1; min-width: 160px; }
.filter-bar input,
.filter-bar select { min-width: 120px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}
.chip-row button.active,
.chip-row button:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.kpi-row-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 6px;
}
.kpi span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi strong { font-size: 28px; font-weight: 650; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.chart-card {
  grid-column: span 2;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px 10px;
  min-height: 220px;
  min-width: 0;
}
.chart-card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.chart-body { min-height: 150px; }
.chart-empty {
  display: grid;
  place-items: center;
  min-height: 140px;
  color: var(--muted);
  font-size: 13px;
}
.chart-svg { width: 100%; height: 150px; display: block; }
.chart-axis { fill: var(--muted); font-size: 9px; }
.donut-wrap {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: center;
}
.donut-svg { width: 160px; height: 160px; }
.donut-total { fill: var(--text); font-size: 22px; font-weight: 700; }
.donut-sub { fill: var(--muted); font-size: 11px; }
.chart-legend { display: grid; gap: 8px; }
.chart-legend-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.chart-legend-item strong { color: var(--text); font-weight: 600; }
.chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.hbar-chart { display: grid; gap: 10px; padding-top: 6px; }
.hbar-row {
  display: grid;
  grid-template-columns: 110px 1fr 28px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.hbar-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track {
  height: 10px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}
.hbar-fill { height: 100%; border-radius: 999px; min-width: 2px; transition: width 0.25s ease; }
.hbar-val { text-align: right; color: var(--text); }
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.dash-list { display: grid; gap: 8px; }
.dash-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto 1fr;
  gap: 10px 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
}
button.dash-row.dash-link {
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
button.dash-row.dash-link:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}
.bq-focus-row td { background: var(--accent-soft); }
.dash-booking-row {
  grid-template-columns: 1.6fr 1fr auto 1fr;
  align-items: start;
}
.dash-booking-row strong { display: block; margin-bottom: 2px; }
.dash-booking-row .muted { font-size: 12px; line-height: 1.35; }
.dash-row.bad { border-color: var(--bad); }

.bookings-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  min-height: 560px;
}
.booking-agenda { display: grid; gap: 10px; max-height: calc(100vh - 280px); overflow: auto; padding: 2px; }
.book-source-hint { margin: 0 0 12px; }
.booking-agenda-item,
.booking-cal-item {
  display: grid;
  grid-template-columns: 1.4fr auto 1fr;
  gap: 10px 12px;
  align-items: center;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: inherit;
  cursor: pointer;
  width: 100%;
}
.booking-agenda-item > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.booking-agenda-item .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.booking-agenda-item.active,
.booking-cal-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.booking-cal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  max-height: 640px;
  overflow: auto;
}
.booking-cal-day {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 6px;
  align-content: start;
}
.booking-cal-day header {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.booking-cal-item {
  grid-template-columns: 1fr;
  padding: 8px;
  font-size: 12px;
}
.booking-detail {
  background: var(--aside);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.users-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  min-height: 560px;
}
.page-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
}
.page-check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--text);
}
.calls-page { display: grid; gap: 4px; }

@media (max-width: 900px) {
  .console { grid-template-columns: 1fr; }
  aside {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  main { padding: 18px 16px; }
  .metrics, .cards, .multi-chat, .diag-split, .calls-layout,
  .dash-grid, .bookings-layout, .users-layout { grid-template-columns: 1fr; }
  .kpi-row, .kpi-row-5 { grid-template-columns: 1fr 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-card,
  .chart-card:nth-child(4),
  .chart-card:nth-child(5) { grid-column: span 1; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .dash-row { grid-template-columns: 1fr; }
  .call-stat-row { grid-template-columns: 1fr 1fr; }
  .call-diag-row { grid-template-columns: 1fr; }
  .tr { grid-template-columns: 1fr; }
  .tr.head { display: none; }
  .chat-aside {
    border-right: 0;
    padding-right: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
  }
  .person-row, .add-person, .person-fields, .store-meta { grid-template-columns: 1fr; }
  .hours-row { grid-template-columns: 1fr 1fr; }
  .store-meta .span-2 { grid-column: auto; }
}


/* ---- Ops light UI polish (Evergreen Ford) ---- */
body {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(32, 96, 48, 0.10), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(40, 80, 120, 0.07), transparent 50%),
    var(--bg);
}
aside {
  background: rgba(247, 250, 248, 0.94);
  backdrop-filter: blur(8px);
  box-shadow: inset -1px 0 0 var(--border);
}
main header {
  margin-bottom: 18px;
}
main header h1 {
  font-weight: 750;
  letter-spacing: -0.02em;
}
.badge {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
}
.user-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
button.primary {
  background: var(--brand-green);
  border-color: var(--brand-green);
  box-shadow: 0 6px 14px rgba(32, 96, 48, 0.28);
}
button.primary:hover { background: var(--brand-green-bright); }
.kpi, .chart-card, .call-section, .attention-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.kpi-row-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.attention-panel {
  padding: 16px 18px;
  margin-bottom: 16px;
  border-color: #f0c2bf;
  background: linear-gradient(180deg, #fff8f7 0%, #ffffff 70%);
}
.attention-panel h3 {
  margin: 0 0 4px;
  color: var(--bad);
  font-size: 15px;
}
.attention-panel .hint { margin: 0 0 12px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
}
.tag-chip.service { background: #e5f2e9; border-color: #b7d9c2; color: #206030; }
.tag-chip.sales { background: #e8eef5; border-color: #b8c9db; color: #285078; }
.tag-chip.parts { background: #eef3f7; border-color: #c5d2df; color: #3d6a8f; }
.tag-chip.inquiry { background: #f3f6fa; border-color: #d5dde7; color: #45566a; }
.tag-chip.transfer { background: #fff6e0; border-color: #f0d48a; color: #9a6700; }
.tag-chip.flag { background: var(--bad-soft); border-color: #f5c2c0; color: var(--bad); }
.dash-row .tag-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
button.dash-row.dash-link {
  border-color: var(--border);
  background: var(--surface);
}
button.dash-row.dash-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.chart-axis { fill: var(--muted); }
.donut-total { fill: var(--text); }
.donut-sub { fill: var(--muted); }
.call-side-item { margin-bottom: 8px; }
.call-side-item .tag-row { grid-column: 1 / -1; }
.sentiment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}
.sentiment-chip.ok { color: var(--ok); }
.sentiment-chip.bad { color: var(--bad); }
.sentiment-chip.warn { color: var(--warn); }
.sentiment-emoji { font-size: 1.05em; line-height: 1; }
.booking-detail {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.booking-detail h2 { margin: 0 0 8px; }
.bookings-side { min-width: 0; }
.panel { padding: 4px 2px 28px; }
.calls-page .filter-bar,
.dash .filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.chip-row button {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
}
.chip-row button.active,
.chip-row button:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.login-gate {
  background:
    radial-gradient(900px 420px at 15% 0%, rgba(32, 96, 48, 0.14), transparent 60%),
    radial-gradient(700px 360px at 100% 100%, rgba(40, 80, 120, 0.10), transparent 55%),
    var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
}
.chart-empty { color: var(--muted); }
.nav-group {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 12px 8px 4px;
  font-weight: 700;
}
@media (max-width: 1100px) {
  .kpi-row-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .kpi-row-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .console { grid-template-columns: 1fr; }
  aside { position: relative; max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
