/* Slotly — iOS-style glass UI */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #eef2fb;
  --text: #1c1c1e;
  --text-2: rgba(60, 60, 67, .72);
  --text-3: rgba(60, 60, 67, .45);
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .78);
  --glass-border: rgba(255, 255, 255, .75);
  --hairline: rgba(60, 60, 67, .14);
  --fill: rgba(120, 120, 128, .12);
  --fill-2: rgba(120, 120, 128, .2);
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, .14);
  --green: #30b858;
  --red: #ff3b30;
  --orange: #ff9500;
  --shadow: 0 10px 40px -12px rgba(31, 38, 135, .22), 0 1px 2px rgba(0, 0, 0, .04);
  --inner: inset 0 1px 0 rgba(255, 255, 255, .7);
  --radius: 22px;
  --radius-sm: 12px;
  --blob-1: #8ec5ff;
  --blob-2: #ffb5e8;
  --blob-3: #b4f1d8;
  --blur: blur(28px) saturate(180%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07080d;
    --text: #f5f5f7;
    --text-2: rgba(235, 235, 245, .68);
    --text-3: rgba(235, 235, 245, .38);
    --glass: rgba(30, 32, 42, .55);
    --glass-strong: rgba(36, 38, 50, .78);
    --glass-border: rgba(255, 255, 255, .1);
    --hairline: rgba(255, 255, 255, .1);
    --fill: rgba(120, 120, 128, .22);
    --fill-2: rgba(120, 120, 128, .32);
    --accent-soft: rgba(10, 132, 255, .24);
    --shadow: 0 10px 40px -12px rgba(0, 0, 0, .6);
    --inner: inset 0 1px 0 rgba(255, 255, 255, .06);
    --blob-1: #1d4ed8;
    --blob-2: #7e22ce;
    --blob-3: #0f766e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .4em; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 1em; }
code { background: var(--fill); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.icon { width: 20px; height: 20px; flex: none; }

/* Soft colour blobs behind the glass */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.backdrop span {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: .75;
  animation: drift 26s ease-in-out infinite alternate;
}
.backdrop span:nth-child(1) { width: 55vmax; height: 55vmax; background: var(--blob-1); top: -18vmax; left: -12vmax; }
.backdrop span:nth-child(2) { width: 45vmax; height: 45vmax; background: var(--blob-2); bottom: -20vmax; right: -10vmax; animation-delay: -8s; }
.backdrop span:nth-child(3) { width: 35vmax; height: 35vmax; background: var(--blob-3); top: 30vh; left: 40vw; animation-delay: -16s; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .backdrop span { animation: none; } }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow), var(--inner);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

/* ---------- Admin shell ---------- */
.admin { display: grid; grid-template-columns: 248px 1fr; gap: 0; }
.sidebar {
  position: sticky; top: 14px; margin: 14px; height: calc(100vh - 28px);
  border-radius: var(--radius); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); padding: 4px 10px; letter-spacing: -.02em; }
.brand-mark { width: 28px; height: 28px; border-radius: 22%; flex: none; display: block; box-shadow: 0 4px 12px rgba(255, 149, 0, .4); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a, .sidebar-foot a, .sidebar-foot .linklike {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px;
  color: var(--text); font-weight: 500; transition: background .15s;
}
.sidebar nav a:hover, .sidebar-foot a:hover, .sidebar-foot .linklike:hover { background: var(--fill); }
.sidebar nav a.active { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -6px rgba(10, 132, 255, .7); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.sidebar-foot form { margin: 0; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; width: 100%; text-align: left; }
.main { padding: 28px 28px 80px 14px; min-width: 0; max-width: 1240px; }

@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 30; top: auto; bottom: max(10px, env(safe-area-inset-bottom)); left: 10px; right: 10px;
    margin: 0; height: auto; padding: 6px; border-radius: 26px; flex-direction: row;
  }
  .sidebar .brand, .sidebar-foot { display: none; }
  .sidebar nav { flex-direction: row; justify-content: space-around; width: 100%; }
  .sidebar nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 10.5px; flex: 1; text-align: center; border-radius: 18px; }
  .sidebar nav a.active { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
  .main { padding: 18px 16px 110px; }
  h1 { font-size: 26px; }
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards & lists ---------- */
.card { border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.narrow { max-width: 560px; margin-inline: auto; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { border-radius: var(--radius); padding: 18px 20px; }
.stat .num { font-size: 32px; font-weight: 700; letter-spacing: -.03em; }
.stat .label { color: var(--text-2); font-size: 13px; font-weight: 500; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li, .list > a {
  display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--hairline); color: var(--text);
}
.list > :last-child { border-bottom: 0; }
.list > a:hover { background: var(--fill); border-radius: 12px; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .sub { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--c, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--accent)) 22%, transparent); }
.time-chip { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 74px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 650; font-size: 14px; color: #fff; background: linear-gradient(135deg, #64d2ff, #5e5ce6);
}
.empty { text-align: center; color: var(--text-2); padding: 28px 10px; }

.table-wrap { overflow-x: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: default; }
tbody tr[data-href] { cursor: pointer; }
tbody tr[data-href]:hover td { background: var(--fill); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--fill); color: var(--text-2); white-space: nowrap;
}
.badge-new { background: var(--accent-soft); color: var(--accent); }
.badge-active, .badge-completed { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.badge-cancelled, .badge-no_show { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.badge-portal { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 0; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--accent); background: var(--accent-soft);
  transition: transform .12s, filter .15s, background .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.97); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px -8px rgba(10, 132, 255, .8), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-ghost { background: var(--fill); color: var(--text); }
.btn-danger { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.btn-block { width: 100%; min-height: 50px; font-size: 16px; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.icon-btn { width: 40px; padding: 0; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px;
}

/* Segmented control */
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--fill); gap: 2px; }
.segmented a, .segmented label {
  padding: 6px 14px; border-radius: 9px; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer;
}
.segmented .on, .segmented label:has(input:checked) { background: var(--glass-strong); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
fieldset { border: 0; padding: 0; margin: 0 0 6px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
legend { font-weight: 650; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin-bottom: 8px; padding: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-3); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .row2, .row3 { grid-template-columns: 1fr; } }

input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea {
  width: 100%; font: inherit; color: var(--text); padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--hairline); background: var(--glass-strong); transition: border-color .15s, box-shadow .15s;
  min-height: 44px; appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238e8e93' stroke-width='2'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 14%, transparent); }
input[type=color] { width: 52px; height: 40px; border: 0; padding: 0; background: none; border-radius: 10px; cursor: pointer; }

/* iOS switch on a regular checkbox */
input.switch {
  appearance: none; -webkit-appearance: none; position: relative; width: 51px; height: 31px; margin: 0;
  border-radius: 999px; background: var(--fill-2); cursor: pointer; transition: background .2s; flex: none;
}
input.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .22s cubic-bezier(.3,.7,.4,1.2);
}
input.switch:checked { background: var(--green); }
input.switch:checked::after { transform: translateX(20px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0; }
.switch-row span { font-weight: 500; }

.check-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.check-pills label { position: relative; }
.check-pills input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.check-pills span { display: inline-block; padding: 7px 13px; border-radius: 999px; background: var(--fill); font-weight: 600; font-size: 13px; }
.check-pills input:checked + span { background: var(--accent); color: #fff; }
.check-pills input:focus-visible + span { outline: 3px solid var(--accent-soft); }

.alert { padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); font-weight: 500; margin-bottom: 12px; }
.note { padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--text); margin-bottom: 12px; }
.form-foot { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-top: 6px; }

/* Toasts */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow); animation: toast-in .35s cubic-bezier(.3,.7,.4,1.2), toast-out .4s 4s forwards;
}
.toast-error { color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); visibility: hidden; } }

/* Dialog sheet */
dialog.sheet {
  border: 1px solid var(--glass-border); border-radius: 26px; padding: 22px; width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 40px); overflow: auto; color: var(--text);
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .25); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog.sheet[open] { animation: sheet-in .3s cubic-bezier(.3,.7,.4,1.1); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }

/* ---------- Week calendar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-toolbar .range { font-weight: 650; font-size: 17px; margin: 0 6px; }
.cal-card { padding: 0; overflow: hidden; }
.cal-scroll { overflow-x: auto; }
.cal {
  --hour: 56px; display: grid; grid-template-columns: 56px repeat(var(--days, 7), minmax(110px, 1fr));
  min-width: calc(56px + var(--days, 7) * 110px); position: relative;
}
.cal-head { position: sticky; top: 0; z-index: 3; padding: 10px 6px; text-align: center; border-bottom: 1px solid var(--hairline); background: var(--glass-strong); }
.cal-head .dow { font-size: 12px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.cal-head .dnum { font-size: 20px; font-weight: 650; }
.cal-head.today .dnum { color: #fff; background: var(--red); border-radius: 50%; width: 34px; height: 34px; display: inline-grid; place-items: center; }
.cal-gutter { position: relative; }
.cal-gutter div { height: var(--hour); font-size: 11px; color: var(--text-3); text-align: right; padding-right: 8px; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.cal-col { position: relative; border-left: 1px solid var(--hairline); background-image: repeating-linear-gradient(to bottom, var(--hairline) 0 1px, transparent 1px var(--hour)); }
.cal-open { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--green) 10%, transparent); }
.cal-blocked { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, var(--fill) 0 6px, transparent 6px 12px); }
.cal-slot { position: absolute; left: 0; right: 0; height: calc(var(--hour) / 2); display: block; }
.cal-slot:hover { background: var(--accent-soft); }
.cal-event {
  position: absolute; left: 4px; right: 4px; border-radius: 10px; padding: 5px 8px; overflow: hidden;
  font-size: 12px; line-height: 1.25; color: var(--text); z-index: 2;
  background: color-mix(in srgb, var(--c) 22%, var(--glass-strong)); border-left: 3px solid var(--c);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--c) 60%, transparent);
}
.cal-event:hover { filter: brightness(1.03); z-index: 4; }
.cal-event strong { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event .t { color: var(--text-2); font-variant-numeric: tabular-nums; }
.cal-event.cancelled { opacity: .45; text-decoration: line-through; }
.cal-event.completed { opacity: .75; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 3; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }

/* Month grid (portal + admin) */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month .dow { text-align: center; font-size: 12px; color: var(--text-2); font-weight: 600; padding-bottom: 4px; }
.month button {
  aspect-ratio: 1; border: 0; border-radius: 50%; font: inherit; font-weight: 600; font-size: 16px; cursor: pointer;
  background: transparent; color: var(--text-3); max-width: 48px; width: 100%; justify-self: center;
}
.month button.has { color: var(--accent); background: var(--accent-soft); }
.month button.sel { color: #fff; background: var(--accent); box-shadow: 0 6px 16px -6px rgba(10,132,255,.8); }
.month button:disabled { cursor: default; }
.month-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

/* ---------- Portal ---------- */
.portal-top { display: flex; justify-content: center; padding: 22px 16px 6px; }
.portal-main { max-width: 760px; margin: 0 auto; padding: 12px 16px 40px; }
.portal-foot { text-align: center; color: var(--text-3); font-size: 12px; padding: 0 0 30px; }
.steps { display: flex; gap: 6px; justify-content: center; margin: 4px 0 18px; }
.steps i { width: 28px; height: 5px; border-radius: 3px; background: var(--fill-2); }
.steps i.on { background: var(--accent); }
.services { display: grid; gap: 12px; }
.service {
  display: flex; gap: 14px; align-items: center; text-align: left; width: 100%; padding: 16px 18px; border-radius: 18px;
  cursor: pointer; font: inherit; color: var(--text); border: 1px solid var(--glass-border); background: var(--glass);
  transition: transform .12s, box-shadow .15s;
}
.service:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.service.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.service .grow { flex: 1; }
.service .meta { color: var(--text-2); font-size: 13px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.slots button {
  min-height: 44px; border-radius: 12px; border: 1px solid var(--hairline); background: var(--glass-strong);
  font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; font-variant-numeric: tabular-nums;
}
.slots button.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
.booking-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 680px) { .booking-grid { grid-template-columns: 1fr; } }
.summary { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 16px; background: var(--fill); margin-bottom: 14px; }
.success-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; background: var(--green); color: #fff; box-shadow: 0 10px 30px -10px var(--green); }
.success-mark .icon { width: 34px; height: 34px; stroke-width: 2.4; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(400px, 100%); }
.login .brand { justify-content: center; margin-bottom: 14px; font-size: 22px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--text-2); font-size: 13px; font-weight: 600; }
.kv dd { margin: 0; white-space: pre-line; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 8px; } }
.search { position: relative; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search input { padding-left: 40px !important; border-radius: 999px !important; }
.inline-form { display: inline; margin: 0; }
.hide { display: none !important; }
.cal-event .icon { width: 12px; height: 12px; vertical-align: -1px; }
.swatches input:checked + span { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text); }
.list .title, .list .sub { display: block; }
.list .badge, .list strong { flex: none; }
.field > .segmented { align-self: flex-start; }
.grid-2 > :only-child { max-width: 780px; }
.cal-event.compact { padding: 2px 8px; display: flex; gap: 6px; align-items: center; }
.cal-event.compact strong { flex: 0 1 auto; }
.cal-event.compact .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 14px 16px; }
  .stat .num { font-size: 26px; }
}

/* Calendar paint mode */
.paint-modes { margin-top: -4px; }
.segmented .on.mode-open { background: var(--green); color: #fff; }
.segmented .on.mode-blocked { background: var(--red); color: #fff; }
.cal.painting .cal-col { touch-action: none; user-select: none; -webkit-user-select: none; }
.cal.painting .cal-event { pointer-events: none; opacity: .55; }
.cal.painting .cal-slot { cursor: crosshair; border-top: 1px dashed transparent; }
.cal.painting .cal-slot:hover { background: color-mix(in srgb, var(--paint) 16%, transparent); }
.cal.paint-open { --paint: var(--green); }
.cal.paint-blocked { --paint: var(--red); }
.cal-slot.picked { background: color-mix(in srgb, var(--paint) 38%, transparent) !important; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--paint) 70%, transparent); z-index: 1; }
.paint-bar {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: max(20px, env(safe-area-inset-bottom)); width: min(520px, calc(100vw - 24px));
  border-radius: 22px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
  background: var(--glass-strong); animation: sheet-in .25s cubic-bezier(.3,.7,.4,1.1);
}
.paint-bar .actions { justify-content: flex-end; }
.btn-open { background: var(--green); color: #fff; }
@media (max-width: 860px) { .paint-bar { bottom: calc(96px + env(safe-area-inset-bottom)); } }

/* Portal header with account links */
.portal-top { justify-content: space-between; align-items: center; max-width: 760px; margin: 0 auto; gap: 12px; flex-wrap: wrap; }
.portal-nav { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glass-border); }
.portal-nav a { padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--text); }
.portal-nav a:hover { background: var(--fill); }
.invoice-table td:last-child, .invoice-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
[data-smtp-fields] { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 560px) { .change-hint { display: none; } }

/* Invoice editor */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.invoice-lines input { min-height: 38px !important; padding: 7px 10px !important; }
.invoice-lines td { padding: 6px 4px; }
.remove-line { position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--fill); cursor: pointer; color: var(--text-2); font-weight: 700; }
.remove-line input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.remove-line:has(input:checked) { background: var(--red); color: #fff; }
tr:has(.remove-line input:checked) td:not(:last-child) { opacity: .4; text-decoration: line-through; }
.totals { display: flex; flex-direction: column; gap: 6px; margin-left: auto; width: min(320px, 100%); }
.totals > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; }
.totals input { width: 130px !important; text-align: right; min-height: 36px !important; padding: 6px 10px !important; }
.totals .grand { border-top: 1px solid var(--hairline); padding-top: 8px; font-size: 17px; }

/* Printable invoice */
.invoice-page { padding: 24px max(16px, env(safe-area-inset-left)) 40px; }
.invoice-actions { max-width: 820px; margin: 0 auto 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.invoice-sheet {
  --ink: #1c1c1e; --muted: #6e6e73; --line: #e5e5ea;
  max-width: 820px; margin: 0 auto; background: #fff; color: var(--ink); border-radius: 22px; padding: 44px;
  box-shadow: var(--shadow); font-size: 14px;
}
.invoice-sheet .badge { margin-top: 6px; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 30px; }
.inv-brand { display: flex; gap: 12px; align-items: flex-start; }
.inv-brand img { border-radius: 22%; }
.inv-brand strong { font-size: 18px; }
.inv-title { text-align: right; }
.inv-title h1 { font-size: 30px; margin: 0; letter-spacing: -.02em; }
.inv-muted { color: var(--muted); }
.inv-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.inv-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.inv-big { font-size: 22px; letter-spacing: -.02em; }
.inv-table { width: 100%; border-collapse: collapse; }
.inv-table th { color: var(--muted); border-bottom: 1px solid var(--line); }
.inv-table td { border-bottom: 1px solid var(--line); }
.inv-table th:nth-child(n+2), .inv-table td:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-totals { margin: 16px 0 0 auto; width: min(300px, 100%); display: flex; flex-direction: column; gap: 6px; font-variant-numeric: tabular-nums; }
.inv-totals > div { display: flex; justify-content: space-between; }
.inv-totals .grand { font-weight: 700; font-size: 16px; border-top: 1px solid var(--line); padding-top: 8px; }
.inv-notes, .inv-pay { margin-top: 24px; padding: 14px 16px; border-radius: 12px; background: #f5f5f7; white-space: normal; }
.inv-foot { margin-top: 28px; color: var(--muted); font-size: 12px; text-align: center; }
@media (max-width: 640px) {
  .invoice-sheet { padding: 22px 18px; border-radius: 18px; }
  .inv-meta { grid-template-columns: 1fr 1fr; }
  .inv-table th:nth-child(3), .inv-table td:nth-child(3) { display: none; }
}
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; padding: 0 !important; }
  .no-print, .toasts { display: none !important; }
  .invoice-sheet { box-shadow: none; border-radius: 0; padding: 0; max-width: none; }
  .invoice-sheet .badge { border: 1px solid #ccc; }
}
a.stat { display:block; color:inherit; text-decoration:none; } a.stat:hover { transform: translateY(-1px); }
@media (max-width: 560px) { .hide-sm { display: none; } }
@media (max-width: 560px) { .table-wrap th, .table-wrap td { padding-left: 8px; padding-right: 8px; } .table-wrap td strong { white-space: nowrap; } }
.backup-codes { font: 600 15px/1.8 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--fill, rgba(120,120,128,.12)); border-radius: 12px; padding: 12px 16px; columns: 2; margin: 10px 0 16px; user-select: all; }
.setup-key { display: inline-block; margin-top: 6px; font: 600 15px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; user-select: all; word-break: break-all; }
ol.steps { padding-left: 1.2em; display: grid; gap: 8px; margin: 0 0 14px; }
/* Payments */
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
label.check { display: flex; gap: 8px; align-items: center; margin: -6px 0 12px; color: var(--text-2); }
.pm-rows { display: grid; gap: 10px; margin-bottom: 16px; }
.pm-row { border: 1px solid var(--border, rgba(120,120,128,.18)); border-radius: 16px; padding: 12px 14px 2px; margin: 0; }
.pm-row .switch-row { margin-bottom: 8px; }
.pm-custom-label { flex: 1; margin-right: 12px; font-weight: 600; }
.card-fields { border-top: 1px solid var(--border, rgba(120,120,128,.18)); padding-top: 14px; margin-top: 4px; }
.pay-methods { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.pay-methods li { display: grid; grid-template-columns: 8.5em 1fr; gap: 10px; }
.pm-label { font-weight: 600; }
.pm-value { word-break: break-word; }
.pm-note { display: block; color: var(--text-2); font-size: 13px; }
.pay-extra { margin: 10px 0 0; color: var(--text-2); }
.pay-card { margin: 14px 0 4px; }
@media (max-width: 560px) { .pay-methods li { grid-template-columns: 1fr; gap: 0; } }
@media print { .pay-card { display: none; } }
/* Reports */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat .num small { font-size: 15px; font-weight: 600; color: var(--text-2); letter-spacing: 0; }
.stat-warn .num { color: var(--red, #d70015); }
.tabs-scroll { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; }
.tabs-scroll a { white-space: nowrap; }
.report-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.report-filters .field { margin: 0; min-width: 170px; }
.custom-range { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.table-tools { display: flex; justify-content: flex-end; margin: -6px 0 4px; }
.report-table th.num, .report-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.report-table tbody tr:last-child td { border-bottom: 0; }

/* Single-series bar charts: one hue, thin marks, rounded data ends, values on hover/focus. */
.chart { margin: 6px 0 14px; position: relative; }
.chart .bar { display: block; background: var(--accent); border-radius: 4px; }
.chart-cols { display: flex; align-items: flex-end; gap: 2px; height: 180px; padding-top: 22px; border-bottom: 1px solid var(--hairline); }
.chart-cols .bar-item { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; align-items: center; position: relative; outline: none; }
.chart-cols .bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart-cols .bar { width: min(70%, 28px); height: var(--v); border-radius: 4px 4px 0 0; }
.chart-cols .bar-label { font-size: 11px; color: var(--text-2); padding-top: 6px; position: absolute; bottom: -22px; white-space: nowrap; }
.chart-cols { margin-bottom: 34px; }
.chart-rows { display: grid; gap: 8px; }
.chart-rows .bar-item { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; gap: 10px; align-items: center; outline: none; }
.chart-rows .bar-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-rows .bar-track { height: 10px; }
.chart-rows .bar { height: 10px; width: var(--v); border-radius: 0 4px 4px 0; }
.chart-rows .bar-value { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-cols .bar-item:hover .bar, .chart-cols .bar-item:focus-visible .bar, .chart-rows .bar-item:hover .bar, .chart-rows .bar-item:focus-visible .bar { filter: brightness(1.12); }
.chart-cols .bar-item:hover::after, .chart-cols .bar-item:focus-visible::after {
  content: attr(data-tip); position: absolute; top: -26px; left: 50%; transform: translateX(-50%); z-index: 2;
  background: var(--text); color: var(--bg, #fff); font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 8px; white-space: nowrap; pointer-events: none;
}
.chart-cols .bar-item:first-child:hover::after, .chart-cols .bar-item:first-child:focus-visible::after { left: 0; transform: none; }
.chart-cols .bar-item:last-child:hover::after, .chart-cols .bar-item:last-child:focus-visible::after { left: auto; right: 0; transform: none; }
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .chart-cols .bar-label { font-size: 10px; }
  .chart-dense .bar-item:nth-child(even) .bar-label { visibility: hidden; }
}
.report-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); align-items: start; }
.report-table td.num { white-space: nowrap; }
/* Phone tab bar: five tabs plus More */
.nav-more { display: none; }
@media (max-width: 860px) {
  .sidebar nav a.nav-extra { display: none; }
  .nav-more { display: block; flex: 1; position: relative; }
  .nav-more summary { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; font-size: 10.5px; font-weight: 500; border-radius: 18px; cursor: pointer; color: var(--text); }
  .nav-more summary::-webkit-details-marker { display: none; }
  .nav-more summary.active, .nav-more[open] summary { background: var(--accent-soft); color: var(--accent); }
  .nav-more-menu { position: absolute; right: 0; bottom: calc(100% + 12px); min-width: 210px; padding: 8px; border-radius: 20px; display: flex; flex-direction: column; gap: 2px; background: var(--bg); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); border: 1px solid var(--hairline); box-shadow: 0 12px 40px rgba(0,0,0,.22); }
  .sidebar .nav-more-menu a, .nav-more-menu .linklike { flex: none; display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 11px 12px; font-size: 15px; text-align: left; border-radius: 12px; color: var(--text); text-decoration: none; }
  .nav-more-menu a[aria-current] { color: var(--accent); }
  .nav-more-menu form { margin: 0; }
}

/* Payment types */
.pay-flag { display: inline-block; font-size: 10px; font-weight: 700; line-height: 1; padding: 2px 5px; border-radius: 6px; background: var(--red); color: #fff; vertical-align: 1px; }
.paytype-help { margin: -4px 0 12px; padding-left: 18px; display: grid; gap: 4px; }
