/* Flat, modern look: neutral surfaces, thin borders, soft status tints, no gradients or shadows. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --line-2: #d1d5db;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #3730a3;

  --todo: #b45309;
  --todo-bg: #fef3c7;
  --todo-dot: #f59e0b;
  --sent: #047857;
  --sent-bg: #d1fae5;
  --sent-dot: #10b981;
  --changed: #6d28d9;
  --changed-bg: #ede9fe;
  --changed-dot: #8b5cf6;
  --warn: #92400e;
  --warn-bg: #fffbeb;
  --warn-line: #fde68a;
  --error: #b91c1c;
  --error-bg: #fef2f2;

  --radius: 14px;
  --radius-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 18px; font-weight: 650; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--muted); }
.error { color: var(--error); background: var(--error-bg); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------ controls */

button, .button {
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color .15s, color .15s;
}
button:hover, .button:hover { background: #e9eaee; text-decoration: none; }
button:focus-visible, .button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); }
button.ghost { background: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--surface-2); }
button.link { background: none; padding: 0; color: var(--accent); font-weight: 550; }
button.link:hover { background: none; text-decoration: underline; }
button.icon { width: 34px; height: 34px; padding: 0; justify-content: center; font-size: 18px; background: transparent; color: var(--text-2); }
button.icon:hover { background: var(--surface-2); }

input, textarea {
  font: inherit;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}
input:hover, textarea:hover { border-color: var(--line-2); }
input:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { background: var(--surface-2); border-color: transparent; color: var(--text-2); }
textarea { font: 14.5px/1.6 var(--font); resize: vertical; }

/* ------------------------------------------------ banner and header */

.banner {
  background: #fffbeb;
  color: #78350f;
  border-bottom: 1px solid #fde68a;
  padding: 8px 16px;
  font-size: 13px;
  text-align: center;
}
.banner-tag {
  display: inline-block;
  background: #f59e0b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 1px 8px;
  margin-right: 6px;
  vertical-align: 1px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 28px 4px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--text);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}
.brand-sub { font-size: 13px; color: var(--muted); }
.top-right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.today { font-size: 14px; color: var(--muted); }
.today strong { color: var(--text); font-weight: 600; }
.due-link {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
}
.due-link:hover { text-decoration: none; background: #e0e7ff; }

/* ------------------------------------------------ layout */

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 470px) minmax(0, 1fr);
  gap: 24px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px 28px 56px;
  align-items: start;
}

.calendar, .day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.calendar { position: sticky; top: 16px; }
.day { padding: 24px; min-height: 300px; }

/* ------------------------------------------------ calendar */

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head h2 { font-size: 17px; }
.cal-nav { display: flex; gap: 2px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.dow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: center;
  padding-bottom: 6px;
}

.cell {
  min-height: 64px;
  padding: 5px 4px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  background: transparent;
  color: var(--text);
}
.cell:hover { background: var(--surface-2); }
.cell.empty { pointer-events: none; }
.cell .num {
  font-size: 13px;
  font-weight: 600;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.cell .count { line-height: 1.2; padding-left: 2px; font-size: 10.5px; letter-spacing: -.01em; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cell .due {
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: .02em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  white-space: nowrap;
}

.cell.todo { background: var(--todo-bg); }
.cell.todo .count { color: var(--todo); font-weight: 650; }
.cell.sent { background: var(--sent-bg); }
.cell.sent .count { color: var(--sent); }
.cell.changed { background: var(--changed-bg); }
.cell.changed .count { color: var(--changed); font-weight: 650; }
.cell.none .count { color: var(--faint); }
.cell.nodata { color: var(--faint); }
.cell.nodata .num { font-weight: 500; }
.cell.todo:hover { background: #fde68a; }
.cell.sent:hover { background: #a7f3d0; }
.cell.changed:hover { background: #ddd6fe; }

.cell.today .num { background: var(--text); color: #fff; }
.cell.selected { box-shadow: inset 0 0 0 2px var(--accent); }

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 14px 0 0;
  margin: 14px 0 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.dot.todo { background: var(--todo-dot); }
.dot.sent { background: var(--sent-dot); }
.dot.changed { background: var(--changed-dot); }
.dot.none { background: var(--line-2); }
.dot.nodata { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); }

/* ------------------------------------------------ day view */

.day-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }
.day-head + p { margin: 4px 0 20px; color: var(--muted); font-size: 14px; }

.source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px 12px 4px 10px;
}
.source.live, .source.sample { background: #ecfdf5; color: var(--sent); }
.source button.link { font-size: 12px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.source.live .live-dot, .source.sample .live-dot { background: var(--sent-dot); box-shadow: 0 0 0 3px #a7f3d0; }

.note {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}

.section {
  margin: 28px 0 10px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.no-email { list-style: none; margin: 0; padding: 0; }
.no-email > li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--text-2);
}
.no-email > li:first-child { border-top: 0; padding-top: 0; }
.no-email strong { color: var(--text); font-weight: 600; }

/* ------------------------------------------------ job card */

.job {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.job-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.job-title { font-size: 17px; }
.job-meta {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px 10px;
}

.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.todo { background: var(--todo-bg); color: var(--todo); }
.badge.sent { background: var(--sent-bg); color: var(--sent); }
.badge.changed { background: var(--changed-bg); color: var(--changed); }

.facts {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px 16px;
  margin: 18px 0 4px;
  font-size: 14px;
}
.facts dt {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 2px;
}
.facts dd { margin: 0; }
.facts ul { margin: 0; padding: 0; list-style: none; }
.facts li + li { margin-top: 4px; }
.vin {
  font: 12px var(--mono);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 6px;
  padding: 1px 6px;
  margin: 0 2px;
  white-space: nowrap;
}
.cars li.cancelled { text-decoration: line-through; color: var(--faint); }

.flags { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.flags li {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 34px;
  font-size: 13.5px;
  position: relative;
}
.flags li::before {
  content: "!";
  position: absolute;
  left: 11px;
  top: 9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f59e0b;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.sent-box, .changes-box {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 12px 0 0;
  font-size: 14px;
}
.sent-box { background: #ecfdf5; }
.sent-box .sent-line { color: var(--sent); font-weight: 600; margin-bottom: 6px; }
.sent-box details { margin-bottom: 6px; }
.sent-box summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
.sent-box pre {
  white-space: pre-wrap;
  font: 13px/1.55 var(--mono);
  background: var(--surface);
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0 0;
}
.sent-box button.link { font-size: 13px; }

.changes-box { background: var(--changed-bg); }
.changes-box .changes-title { color: var(--changed); font-weight: 600; margin-bottom: 6px; }
.changes-box ul { margin: 0 0 8px; padding-left: 18px; color: var(--text); }
.changes-box li + li { margin-top: 2px; }
.changes-box p { margin-bottom: 6px; font-size: 13px; }
.changes-box button.link { color: var(--changed); font-size: 13px; }
.no-email .changes-box { margin-top: 10px; }

.actions { margin-top: 16px; }

/* ------------------------------------------------ draft */

.draft {
  margin-top: 18px;
  background: #fafafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.field {
  display: block;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 14px;
}
.field input, .field textarea {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.working { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.draft-flags { margin: 0 0 16px; }

.questions { margin: 4px 0 16px; display: grid; gap: 8px; }
.q-intro { font-size: 13px; }
.question {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 10px 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.choices { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.choice { padding: 5px 14px; font-size: 13px; background: transparent; border-radius: 7px; color: var(--text-2); }
.choice:hover { background: var(--surface); }
.choice.chosen { background: var(--accent); color: #fff; }
.choice .now { color: var(--sent); font-weight: 700; }

.ask-row { display: flex; gap: 8px; margin-top: 6px; }
.ask-row input { margin-top: 0; }

.buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 4px; }
.buttons .mark-sent { margin-left: auto; }
.copied { font-size: 13px; }

/* ------------------------------------------------ login */

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  display: grid;
  gap: 14px;
}
.login h1 { font-size: 20px; }
.login label { display: grid; gap: 6px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.login button { justify-content: center; padding: 10px; }

/* ------------------------------------------------ narrow screens */

@media (max-width: 860px) {
  .top { padding: 16px 16px 0; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 40px; gap: 16px; }
  .calendar { position: static; padding: 16px; }
  .day { padding: 16px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts dt { margin-top: 10px; }
  .buttons .mark-sent { margin-left: 0; }
}
