:root {
  --maroon: #b22b42;
  --maroon-dark: #8f1f33;
  --maroon-soft: #fbecef;
  --maroon-line: #f0cdd4;
  --ink: #1d1d1f;
  --muted: #6b6b73;
  --line: #e7e7ea;
  --bg: #ffffff;
  --page-bg: #e4e4e4;
  --bg-soft: #f7f7f8;
  --sidebar: #050505;
  --sidebar-hover: #1a1a1a;
  --ok: #1f7a4d;
  --ok-soft: #e7f5ee;
  --warn: #9a6400;
  --warn-soft: #fff5e0;
  --grey-soft: #efeff1;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Montserrat', system-ui, sans-serif;
  color: var(--ink);
  background: var(--page-bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--maroon); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--maroon); color: #fff; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--maroon-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.outline { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.outline:hover { border-color: #c9c9ce; background: var(--bg-soft); }
.btn.ghost { background: transparent; color: var(--maroon); }
.btn.ghost:hover { background: var(--maroon-soft); }
.btn.sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--ink);
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn.danger { color: var(--maroon); }
.icon-btn svg, .btn svg { width: 18px; height: 18px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.input, select.input, textarea.input {
  height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; width: 100%;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }

/* ---------- Dropdowns, themed to match the app ---------- */
select.input {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 40px; text-overflow: ellipsis;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%236b6b73' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center / 12px 12px;
}
select.input:hover:not(:disabled) { border-color: var(--maroon-line); }
select.input:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23b22b42' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
select.input:disabled { cursor: not-allowed; opacity: .65; background-color: var(--bg-soft); }

/* Browsers that allow styling the open list (Chrome/Edge 135+): rounded panel, maroon highlight, tick on the chosen option.
   Others keep their own list, with the styled box above. */
@supports (appearance: base-select) {
  select.input, select.input::picker(select) { appearance: base-select; }
  select.input { display: flex; align-items: center; gap: 8px; padding-right: 12px; background-image: none; }
  select.input::picker-icon {
    content: ''; width: 12px; height: 12px; margin-left: auto; flex-shrink: 0; transition: rotate .2s;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%236b6b73' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 12px 12px;
  }
  select.input, select.input:open { border-radius: 10px; } /* stays rounded on all four corners while open */
  select.input:open { border-color: var(--maroon); box-shadow: 0 0 0 3px var(--maroon-soft); }
  select.input:open::picker-icon { rotate: 180deg; }
  select.input::picker(select) {
    margin-block: 6px; padding: 6px; max-height: min(340px, 60vh); overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #d4d4d9 transparent;
    background: #fff; border: 1px solid var(--line); border-radius: 14px !important; /* all four corners, whichever side it opens on */
    box-shadow: 0 18px 44px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .06);
    opacity: 0; translate: 0 -4px;
    transition: opacity .16s, translate .16s, overlay .16s allow-discrete, display .16s allow-discrete;
  }
  select.input:open::picker(select) { opacity: 1; translate: 0 0; }
  @starting-style { select.input:open::picker(select) { opacity: 0; translate: 0 -4px; } }
  select.input option {
    display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px;
    border-radius: 10px; font-size: 14px; color: var(--ink); cursor: pointer; transition: background .12s, color .12s;
  }
  select.input option:hover, select.input option:focus-visible { background: var(--maroon-soft); color: var(--maroon-dark); outline: none; }
  select.input option:checked { background: var(--maroon); color: #fff; font-weight: 600; }
  select.input option::checkmark { display: none; content: none; } /* no tick: the maroon highlight shows the choice */
  select.input option:disabled { color: var(--muted); cursor: not-allowed; background: none; }
  select.input optgroup { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
}
.input:focus { border-color: var(--maroon); box-shadow: 0 0 0 3px var(--maroon-soft); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 600px) { .row, .row3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--maroon); width: 16px; height: 16px; }

/* ---------- misc ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.error-msg { background: var(--maroon-soft); color: var(--maroon-dark); border: 1px solid var(--maroon-line); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.hidden { display: none !important; }
.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.badge.confirmed { background: var(--maroon-soft); color: var(--maroon); }
.badge.completed { background: var(--ok-soft); color: var(--ok); }
.badge.cancelled { background: var(--grey-soft); color: var(--muted); }
.badge.no_show { background: var(--warn-soft); color: var(--warn); }
.badge.solid { background: var(--maroon); color: #fff; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 500;
  opacity: 0; transition: all .2s; z-index: 100; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spinner { width: 28px; height: 28px; border: 3px solid var(--maroon-soft); border-top-color: var(--maroon); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,10,12,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 18px; width: min(640px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 20px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }
