/*
 * AutoHub DMV Appointments. Brand: AutoHub red; coral from the auto-hub.net car logo.
 * Red is the brand (header, active tab) and otherwise means "destructive" (withdraw,
 * deactivate, remove). The way forward is charcoal, never red.
 */
:root {
  --brand: #e00000; /* white text on it: about 5:1 */
  --brand-dark: #b00000;
  --action: #1d1d1f; /* primary buttons */
  --action-hover: #3c3c41;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --link: #174ea6;
  --coral: #fe6138; /* decorative only; too light for text */
  --ink: #1d1d1f;
  --muted: #5f6368;
  --line: #dadce0;
  --bg: #f6f6f7;
  --card: #ffffff;
  --ok: #137333;
  --ok-bg: #e6f4ea;
  --warn: #8a4b00;
  --warn-bg: #fef3e0;
  --info: #174ea6;
  --info-bg: #e8f0fe;
  --off: #5f6368;
  --off-bg: #f1f3f4;
  --radius: 12px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.boot {
  padding: 2rem;
  color: var(--muted);
}

/* ---- Layout */

.topbar {
  background: var(--brand);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 0.6rem) 1rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar img {
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
}
.topbar h1 {
  font-size: 1.15rem;
  margin: 0;
  font-weight: 700;
  flex: 1;
}
.topbar .who {
  font-size: 0.8rem;
  opacity: 0.95;
  text-align: right;
}

nav.tabs {
  display: flex;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  position: sticky;
  top: calc(env(safe-area-inset-top) + 3.2rem);
  z-index: 9;
}
nav.tabs a {
  flex: 1 0 auto;
  text-align: center;
  padding: 0.75rem 0.9rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
nav.tabs a.active {
  color: var(--ink);
  border-bottom-color: var(--brand);
}
a {
  color: var(--link);
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1rem calc(env(safe-area-inset-bottom) + 3rem);
}
h2 {
  font-size: 1.25rem;
  margin: 0.5rem 0 1rem;
}
h3 {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
}
p {
  margin: 0.4rem 0;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.875rem;
}
.row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
.spread {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ---- Cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.9rem;
}
.card.booked {
  border-left: 5px solid var(--ok);
}
.card.needs_attention {
  border-left: 5px solid #e8a33d;
}
.card.queued {
  border-left: 5px solid var(--info);
}
.card .actions {
  margin-top: 0.8rem;
}
dl.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 0.9rem;
  margin: 0.5rem 0;
}
dl.facts dt {
  color: var(--muted);
}
dl.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.chip {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.chip.queued {
  color: var(--info);
  background: var(--info-bg);
}
.chip.booked {
  color: var(--ok);
  background: var(--ok-bg);
}
.chip.needs_attention {
  color: var(--warn);
  background: var(--warn-bg);
}
.chip.withdrawn,
.chip.expired,
.chip.off {
  color: var(--off);
  background: var(--off-bg);
}

.notice {
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 0.9rem;
}
.notice.important {
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 600;
}
.notice.error {
  background: #fce8e6;
  color: #a50e0e;
}
.notice.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.notice.info {
  background: var(--info-bg);
  color: var(--info);
}

/* ---- Forms and buttons */

label {
  display: block;
  font-weight: 600;
  margin: 0.9rem 0 0.3rem;
}
.field-note {
  margin: 0.3rem 0 0;
}
label .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.875rem;
}
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="number"],
select {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid #b8bcc2;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 2.75rem;
}
input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0.9rem 0 0;
  padding: 0.4rem 0.9rem 0.8rem;
}
legend {
  font-weight: 600;
  padding: 0 0.3rem;
}
.weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
}
.weekdays label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 400;
  margin: 0.3rem 0 0;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.8rem;
}

button,
.button {
  font: inherit;
  font-weight: 700;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  min-height: 2.75rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
button.primary,
.button.primary {
  background: var(--action);
  color: #fff;
}
button.primary:hover,
.button.primary:hover {
  background: var(--action-hover);
}
button.secondary,
.button.secondary {
  background: #fff;
  color: var(--ink);
  border-color: #b8bcc2;
}
button.secondary:hover,
.button.secondary:hover {
  background: #f1f3f4;
}
/* Destructive actions: withdraw, deactivate, remove. */
button.danger {
  background: #fff;
  color: var(--danger);
  border-color: #e6a8a3;
}
button.danger:hover {
  background: var(--danger-bg);
}
button.danger-solid {
  background: var(--danger);
  color: #fff;
}
button.link {
  background: none;
  color: var(--link);
  padding: 0.4rem 0.2rem;
  min-height: auto;
  text-decoration: underline;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
.form-actions {
  margin-top: 1.2rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ---- Tables (owner screens) */

.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.925rem;
}
th,
td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  background: #fafafa;
  font-weight: 700;
  white-space: nowrap;
}
tr:last-child td {
  border-bottom: none;
}

/* ---- Login */

.login {
  max-width: 24rem;
  margin: 2.5rem auto;
  text-align: center;
}
.login img {
  width: 5rem;
  height: 5rem;
  border-radius: 16px;
}
.login form {
  text-align: left;
}

@media (min-width: 40rem) {
  main {
    padding-top: 1.5rem;
  }
}
.form-actions.center {
  justify-content: center;
}

/* Let form grids and fieldsets shrink to the screen (fieldsets default to min-content width). */
fieldset,
.two > * {
  min-width: 0;
}
.topbar a.who {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
