/* Example Motors admin demo. Mobile first: tabs sit at the bottom on phones, at the top from 800px. */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --line: #dde1e6;
  --ink: #121820;
  --muted: #535d6a;
  --primary: #1c4e80;
  --primary-ink: #ffffff;
  --primary-soft: #e6eef7;
  --accent: #ff8a1f;
  --new: #9a4a00; --new-bg: #fff1e3;
  --replied: #1c4e80; --replied-bg: #e6eef7;
  --booked: #17663a; --booked-bg: #e3f4ea;
  --done: #4b5563; --done-bg: #eceef1;
  --bad: #b42318;
  --dark: #0f141b;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(15 20 27 / .06), 0 4px 14px rgb(15 20 27 / .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
@media (min-width: 800px) { body { padding-bottom: 0; } }
h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--primary); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--primary); color: #fff; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--dark); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }

/* demo bar */
.demo-bar { background: var(--dark); color: #e9edf2; font-size: 14px; }
.demo-bar { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; justify-content: space-between; padding: 8px 16px; }
.demo-bar b { color: #fff; }
.demo-bar .link-btn { color: #fff; }

/* header + tabs */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1120px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .02em; }
.brand b { display: block; }
.brand-sub { display: block; font-size: 13px; color: var(--muted); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.tabs a[aria-current="page"] { color: var(--primary); }
.tabs a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
.tabs .count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--dark); font-size: 12px; line-height: 20px; text-align: center; }
@media (min-width: 800px) {
  .tabs { position: static; display: flex; gap: 4px; border: 0; padding: 0; background: none; }
  .tabs a { flex-direction: row; gap: 8px; min-height: 60px; padding: 0 14px; font-size: 15px; }
  .tabs svg { width: 18px; height: 18px; }
  .tabs a[aria-current="page"]::before { top: auto; bottom: 0; left: 10px; right: 10px; border-radius: 3px 3px 0 0; }
  .tabs .count { position: static; }
  .tabs a:hover { color: var(--ink); }
}

/* layout */
main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 40px; outline: none; }
@media (min-width: 800px) { main { padding: 32px 24px 56px; } }
.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; }
.view-head h1 { font-size: clamp(1.5rem, 3vw, 2rem); }
.view-head p { color: var(--muted); margin-top: 4px; }
.grid-2 { display: grid; gap: 20px; }
.grid-2 > * { min-width: 0; }
@media (min-width: 960px) { .grid-2 { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; }
.panel-head h2 { font-size: 1.1rem; }
.panel-body { padding: 0 18px 18px; }
.empty { padding: 20px 18px 24px; color: var(--muted); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; transition: background-color 140ms ease, border-color 140ms ease, transform 100ms ease; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #163f68; }
.btn-line { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-line:hover { border-color: #b8c0ca; }
.btn-quiet { background: none; color: var(--primary); padding: 0 10px; }
.btn-quiet:hover { background: var(--primary-soft); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; border: 0; background: none; cursor: pointer; }
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; }
a.stat:hover { border-color: #b8c0ca; }
.stat b { display: block; font-size: 1.75rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
.stat.warn b { color: var(--new); }

/* try-this card */
.tryit { background: var(--primary-soft); border: 1px solid #c9d9ea; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; }
.tryit h2 { font-size: 1.05rem; }
.tryit ol { margin: 10px 0 12px; padding-left: 0; list-style: none; display: grid; gap: 8px; }
.tryit li { display: flex; gap: 10px; align-items: flex-start; }
.tryit li .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--primary); display: grid; place-items: center; margin-top: 1px; }
.tryit li.done .tick { background: var(--primary); }
.tryit li.done .tick::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.tryit li.done span:last-child { text-decoration: line-through; color: var(--muted); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-btn { display: contents; }
.row.clickable { cursor: pointer; }
.row.clickable:hover { background: #f8f9fb; }
.row .time { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3.2rem; }
.row .main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .main span { display: block; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .side { display: flex; align-items: center; gap: 8px; }
.row .main .reg { display: inline-block; }
.row.is-new { animation: newrow 2.2s ease-out; }
@keyframes newrow { 0%, 40% { background: #fff3c4; } 100% { background: transparent; } }
.row.is-done .main b { color: var(--muted); text-decoration: line-through; }
.reg { display: inline-block; font-weight: 700; font-size: 13px; letter-spacing: .04em; background: #ffd400; color: #111; border-radius: 3px; padding: 0 5px; margin-right: 6px; font-variant-numeric: tabular-nums; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.new { color: var(--new); background: var(--new-bg); }
.pill.replied { color: var(--replied); background: var(--replied-bg); }
.pill.booked { color: var(--booked); background: var(--booked-bg); }
.pill.done, .pill.closed { color: var(--done); background: var(--done-bg); }
.src { font-size: 13px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { font-variant-numeric: tabular-nums; opacity: .75; margin-left: 4px; }

/* diary */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; padding: 0 18px 16px; }
.day-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; min-height: 72px; }
.day-btn .dn { font-size: 12px; color: var(--muted); font-weight: 600; }
.day-btn .dd { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-btn .dots { display: flex; gap: 3px; height: 6px; }
.day-btn .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--booked); }
.day-btn.is-today .dd { color: var(--primary); }
.day-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.day-btn[aria-pressed="true"] .dn { color: #c8ced6; }
.day-btn[aria-pressed="true"] .dd { color: #fff; }
.day-btn[aria-pressed="true"] .dots i { background: #7ee2a8; }
.day-btn.closed-day { background: repeating-linear-gradient(135deg, var(--surface) 0 6px, var(--bg) 6px 12px); }
.week-nav { display: flex; align-items: center; gap: 4px; }

/* sheet (dialog) */
.sheet { border: 0; padding: 0; width: min(560px, 100%); max-height: min(92dvh, 820px); border-radius: 14px 14px 0 0; margin: auto auto 0; box-shadow: 0 -8px 40px rgb(15 20 27 / .25); background: var(--surface); color: var(--ink); }
@media (min-width: 800px) { .sheet { margin: auto; border-radius: 14px; } }
.sheet::backdrop { background: rgb(15 20 27 / .45); }
.sheet[open] { display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 10px 8px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 1.15rem; }
.sheet-body { padding: 16px 20px 24px; overflow-y: auto; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 16px; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.msg { background: var(--bg); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; white-space: pre-wrap; }
.sheet h3 { font-size: 1rem; margin: 20px 0 10px; }

/* forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .field .label { font-size: 14px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 8px; border: 1px solid #c3cad3; background: var(--surface); transition: border-color 140ms ease; }
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { border-color: var(--primary); outline: 2px solid color-mix(in oklab, var(--primary) 25%, transparent); outline-offset: 0; }
.input[aria-invalid="true"] { border-color: var(--bad); }
.err { color: var(--bad); font-size: 14px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid #c3cad3; border-radius: 8px; overflow: hidden; }
.seg label { display: grid; place-items: center; min-height: 42px; font-weight: 600; font-size: 14px; cursor: pointer; border-left: 1px solid #c3cad3; }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: #fff; }
.seg label:has(input:checked) { background: var(--ink); color: #fff; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: -3px; }

/* website editor */
.hours-edit { display: grid; gap: 8px; }
.hours-edit .h-row { display: grid; grid-template-columns: 3.2rem 1fr; gap: 10px; align-items: center; }
.hours-edit .h-times { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px 6px; align-items: center; }
.hours-edit .h-times .closed-lbl { grid-column: 1 / -1; }
@media (min-width: 560px) { .hours-edit .h-times { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; } .hours-edit .h-times .closed-lbl { grid-column: auto; } }
.hours-edit .h-times .input { min-width: 0; }
.hours-edit .h-times .input { min-height: 40px; padding: 6px 8px; }
.hours-edit .closed-lbl { display: flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.hours-edit input[type=checkbox], .toggle input { width: 20px; height: 20px; accent-color: var(--primary); }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 10px; }
.price-edit { display: grid; gap: 8px; }
.price-edit .p-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 7rem); gap: 8px; }
.save-bar { flex-wrap: wrap; position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
@media (min-width: 800px) { .save-bar { bottom: 0; } }
.save-bar p { font-size: 14px; color: var(--muted); }
.save-bar p.dirty { color: var(--new); font-weight: 600; }

/* live preview of the public website */
.preview { position: sticky; top: 84px; }
.preview-frame { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.pv-chrome { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #eceef1; font-size: 12px; color: var(--muted); }
.pv-chrome i { width: 9px; height: 9px; border-radius: 50%; background: #c7ccd3; }
.pv-chrome span { margin-left: 6px; background: #fff; border-radius: 5px; padding: 2px 10px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-notice { background: var(--accent); color: var(--dark); font-weight: 700; font-size: 14px; padding: 8px 16px; text-align: center; }
.pv-hero { background: var(--dark); color: #fff; padding: 22px 18px 20px; }
.pv-hero small { color: #b9c3cf; font-size: 12px; }
.pv-hero h3 { font-size: 1.35rem; margin-top: 4px; font-weight: 800; }
.pv-hero h3 em { font-style: normal; color: var(--accent); }
.pv-hero p { color: #d3dae3; font-size: 14px; margin-top: 8px; }
.pv-open { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; font-weight: 600; background: rgb(255 255 255 / .1); border-radius: 14px; padding: 4px 10px; }
.pv-open i { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }
.pv-open.shut i { background: #f87171; }
.pv-sec { padding: 14px 18px; border-top: 1px solid var(--line); }
.pv-sec h4 { margin: 0 0 8px; font-size: 14px; }
.pv-hours, .pv-prices { width: 100%; border-collapse: collapse; font-size: 13px; }
.pv-hours td, .pv-prices td { padding: 3px 0; }
.pv-hours td:last-child, .pv-prices td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.pv-hours tr.today td { font-weight: 700; color: var(--primary); }
.pv-flash { animation: flash 900ms ease-out; }
@keyframes flash { from { background: #fff3c4; } to { background: transparent; } }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--dark); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 8px 30px rgb(15 20 27 / .3); z-index: 60; font-weight: 600; max-width: calc(100% - 32px); }
@media (min-width: 800px) { .toast { bottom: 24px; } }

.foot { max-width: 1120px; margin: 0 auto; padding: 0 16px 32px; font-size: 14px; color: var(--muted); }
@media (min-width: 800px) { .foot { padding: 0 24px 40px; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
