/* CutDoc Scheduler. Mobile-first. Colour is never the only signal: every status has an icon. */
:root {
  --ink: #1b2d28; --muted: #5f6f69; --line: #d9e2dc; --bg: #f4f6f3; --card: #fff;
  --accent: #1f5a47; --accent-ink: #fff; --accent-soft: #e6efe9;
  --red-bg: #fbe3e0; --red-ink: #8a2f27; --red-strong: #c9554a;
  --yellow-bg: #fdf0c7; --yellow-ink: #7a5a0c; --yellow-strong: #d9a63a;
  --green-bg: #d9efdd; --green-ink: #255c36; --green-strong: #4f9b63;
  --purple-bg: #ebe1fa; --purple-ink: #5c3b8a; --purple-strong: #8f63c2;
  --radius: 12px; --tap: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; padding-bottom: env(safe-area-inset-bottom); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 8px; }
h3 { font-size: 15px; margin: 0; }
p { margin: 4px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; letter-spacing: .06em; font-weight: 700; color: var(--muted); text-transform: uppercase; }
p.small, span.small, .small.muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.right { text-align: right; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

/* buttons and fields */
button, .button { color: var(--ink); min-height: var(--tap); border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 10px 14px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
button:hover, .button:hover { border-color: #a9bcb2; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #6fae95; outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.primary:hover { background: #184a3a; }
.secondary { background: var(--accent-soft); border-color: #c7d9ce; }
.text-button { border: none; background: transparent; color: var(--accent); padding: 8px; min-height: 36px; }
.text-button.inline { display: inline; padding: 0; min-height: 0; text-decoration: underline; }
.full { width: 100%; }
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0; color: #3f5349; }
input, select, textarea { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: 6px; }
textarea { resize: vertical; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.banner { border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.banner.warning { background: var(--yellow-bg); color: var(--yellow-ink); }
.pill { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 10px; font-weight: 700; font-size: 13px; }
.badge { display: inline-block; padding: 3px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--green-bg); color: var(--green-ink); }
.badge.warning { background: var(--yellow-bg); color: var(--yellow-ink); }

/* top bar and tabs */
.topbar { height: 56px; background: var(--card); border-bottom: 1px solid var(--line); padding: 0 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { text-decoration: none; color: var(--ink); font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.logo { background: var(--accent); border-radius: 8px; color: #fff; padding: 2px 7px; font-size: 16px; }
.identity { font-size: 13px; color: var(--muted); text-align: right; }
.tabs { display: flex; align-items: center; gap: 2px; background: var(--card); border-bottom: 1px solid var(--line); padding: 0 8px; position: sticky; top: 0; z-index: 20; }
.nav { border: none; border-radius: 0; background: transparent; padding: 12px 10px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; min-height: 48px; }
.nav.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs-end { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.tabs-end select { width: auto; max-width: 110px; min-height: 36px; padding: 4px 6px; margin: 0; font-size: 12px; }
.nav { white-space: nowrap; }
@media (max-width: 480px) { .nav { padding: 12px 8px; font-size: 14px; } .tabs-end .text-button { padding: 6px 4px; font-size: 13px; white-space: nowrap; } .tabs-end select { max-width: 84px; } }
.workspace { padding: 16px 16px 150px; max-width: 1400px; margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.page-heading p { margin: 0; font-size: 14px; }
.quarter-label { margin: 0; min-width: 120px; }

/* login */
.login { max-width: 440px; margin: 32px auto; padding: 0 16px; }
.login h1 { font-size: 28px; }
.demo-note { background: var(--yellow-bg); color: var(--yellow-ink); padding: 12px; border-radius: 10px; margin-top: 20px; font-size: 13px; }
.demo-note p { font-size: 12px; margin: 4px 0 8px; }

/* availability layout */
.avail-layout { display: grid; grid-template-columns: 1fr; gap: 12px; }
.status-card .status-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.status-card strong { display: block; font-size: 18px; margin-top: 2px; line-height: 1.2; }
.status-card .right .small.muted { display: block; margin-top: 2px; }
.progress-bar { height: 8px; background: #e6ebe8; border-radius: 999px; overflow: hidden; margin: 6px 0 14px; }
.progress-bar > div { height: 100%; background: var(--yellow-strong); border-radius: 999px; transition: width .3s; }
.progress-bar > div.done { background: var(--green-strong); }
#fill-block { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
#fill-block p, #submit-block p, #submitted-block p { margin: 8px 0 0; }
.submitted-pill { display: inline-block; background: var(--green-bg); color: var(--green-ink); font-weight: 700; padding: 8px 14px; border-radius: 999px; }

.brush-card { position: sticky; top: 49px; z-index: 15; }
.brushes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.brush { min-width: 0; }
.brush { border: 2px solid transparent; font-size: 14px; padding: 8px 10px; justify-content: flex-start; }
.brush .icon, .choice .icon { font-size: 16px; width: 20px; text-align: center; }
.brush.red { background: var(--red-bg); color: var(--red-ink); }
.brush.yellow { background: var(--yellow-bg); color: var(--yellow-ink); }
.brush.green { background: var(--green-bg); color: var(--green-ink); }
.brush.purple { background: var(--purple-bg); color: var(--purple-ink); }
.brush.active { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.brush.active::after { content: '●'; margin-left: auto; font-size: 10px; }
.hint { margin: 10px 0 0; }

.tools summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.tools button.full { margin-top: 8px; }
.tools button.active { border-color: var(--accent); background: var(--accent-soft); }
.natural-box { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
#preview-box { background: var(--accent-soft); padding: 10px; border-radius: 10px; margin-top: 8px; }
#preview-box p { margin: 0 0 8px; font-weight: 600; }
.privacy { margin: 4px 2px 12px; }

.calendar-card { padding: 12px; }
.calendar-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
#save-status { min-width: 60px; text-align: right; }
.month { margin-top: 12px; }
.month-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.weekdays, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekdays { font-size: 11px; text-align: center; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.weekdays span:nth-child(n+6) { color: #8a9a93; }

/* day cells */
.day { position: relative; min-height: 56px; padding: 4px 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; font-size: 13px; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.day .num { font-weight: 700; line-height: 1; }
.day .mark { font-size: 18px; line-height: 1; margin-top: 2px; }
.day .blank-mark { height: 18px; }
.day.blank { background: #fff; border-style: dashed; color: var(--muted); }
.day.weekend { background: #f6f8f6; }
.day.red { background: var(--red-bg); color: var(--red-ink); border-color: #efc4bf; }
.day.yellow { background: var(--yellow-bg); color: var(--yellow-ink); border-color: #efd999; }
.day.green { background: var(--green-bg); color: var(--green-ink); border-color: #b5dcbf; }
.day.purple { background: var(--purple-bg); color: var(--purple-ink); border-color: #d4c3ee; }
.day.split { background: linear-gradient(to right, #fff 50%, #fff 50%); }
.day .halves { display: flex; gap: 2px; margin-top: 2px; }
.day .halves .h { font-size: 12px; line-height: 1; padding: 3px 4px; border-radius: 4px; font-weight: 700; }
.h.red { background: var(--red-bg); color: var(--red-ink); } .h.yellow { background: var(--yellow-bg); color: var(--yellow-ink); } .h.green { background: var(--green-bg); color: var(--green-ink); } .h.purple { background: var(--purple-bg); color: var(--purple-ink); } .h.blank { background: #eef1ef; color: var(--muted); }
.day.holiday::before { content: '•'; position: absolute; top: 1px; right: 5px; font-size: 14px; color: var(--accent); }
.day .hol { display: none; font-size: 9px; line-height: 1.1; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day.today .num { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 2px; }
.day.flash { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .day:hover { border-color: var(--accent); } }

.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.chip { display: inline-flex; width: 20px; height: 20px; border-radius: 5px; align-items: center; justify-content: center; font-style: normal; font-weight: 700; font-size: 12px; border: 1px solid var(--line); }
.chip.red { background: var(--red-bg); color: var(--red-ink); } .chip.yellow { background: var(--yellow-bg); color: var(--yellow-ink); } .chip.green { background: var(--green-bg); color: var(--green-ink); } .chip.purple { background: var(--purple-bg); color: var(--purple-ink); } .chip.blank { border-style: dashed; } .chip.hol { color: var(--accent); }

/* fixed bottom bar (phone) */
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); z-index: 30; box-shadow: 0 -6px 20px #1b2d2814; }
.bottom-brushes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.brush.mini { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 11px; min-height: 48px; line-height: 1.1; justify-content: center; }
.brush.mini .icon { font-size: 16px; width: auto; }
.brush.mini.active::after { content: none; }
.bottom-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bottom-text { display: flex; flex-direction: column; }
.bottom-text strong { font-size: 15px; }
.bottom-bar .primary { min-width: 120px; }

/* day sheet */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 20px; max-width: 460px; width: calc(100% - 32px); }
dialog::backdrop { background: #1b2d2880; }
dialog.sheet { margin: auto auto 0; border-radius: 16px 16px 0 0; width: 100%; max-width: 100%; max-height: 88vh; overflow: auto; box-sizing: border-box; }
@media (min-width: 700px) { dialog.sheet { max-width: 560px; border-radius: 16px; margin: auto; } }
.half-row { margin: 12px 0; }
.half-label { font-weight: 700; margin-bottom: 6px; }
.half-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.half-choices .choice { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 8px 10px; }
.choice { border: 2px solid transparent; justify-content: flex-start; font-size: 14px; }
.choice.red { background: var(--red-bg); color: var(--red-ink); } .choice.yellow { background: var(--yellow-bg); color: var(--yellow-ink); } .choice.green { background: var(--green-bg); color: var(--green-ink); } .choice.purple { background: var(--purple-bg); color: var(--purple-ink); }
.choice.active { border-color: var(--ink); }

/* schedule */
.next-call strong { display: block; font-size: 20px; margin: 2px 0 6px; }
.next-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.seg { display: inline-flex; background: #e9eeeb; border-radius: 10px; padding: 3px; }
.seg-btn { border: none; background: transparent; min-height: 36px; padding: 6px 14px; border-radius: 8px; color: var(--muted); }
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #0001; }
.call-list { list-style: none; padding: 0; margin: 8px 0 0; }
.call-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.call-list li.past { opacity: .5; }
.hol-tag { display: block; font-size: 12px; color: var(--muted); }
.hol-dot { color: var(--accent); }
.two-cols { display: grid; grid-template-columns: 1fr; gap: 12px; }
.instructions { margin-top: 12px; }
.instructions summary { cursor: pointer; font-weight: 600; }
.instructions p { font-size: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
tr.mine td { background: #f3f8f4; }
td.me { font-weight: 700; color: var(--accent); }
tr.past td { color: var(--muted); }
td select { font-size: 13px; padding: 7px; margin: 0; min-width: 140px; min-height: 36px; }
.table-scroll { overflow: auto; max-height: 70vh; }

/* admin bits (unchanged behaviour) */
.progress-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.issue { background: var(--yellow-bg); color: var(--yellow-ink); padding: 8px 10px; margin: 4px 0; border-radius: 6px; font-size: 13px; }
details.card summary { cursor: pointer; font-weight: 600; }

#toast { position: fixed; bottom: 136px; left: 16px; right: 16px; background: var(--ink); color: #fff; border-radius: 10px; padding: 12px 16px; z-index: 100; box-shadow: 0 8px 30px #1b2d2840; display: none; font-size: 14px; }

@media (max-width: 699px) { .desktop-only { display: none !important; } .hint.phone-only { margin-top: 4px; } }
@media (min-width: 700px) { .phone-only { display: none !important; } }

/* ---------- tablet and up ---------- */
@media (min-width: 700px) {
  .workspace { padding: 24px 24px 40px; }
  h1 { font-size: 28px; }
  .two-cols { grid-template-columns: 1fr 1fr; gap: 16px; }
  .day { min-height: 64px; }
  .day .hol { display: block; }
  #toast { left: auto; right: 24px; bottom: 24px; max-width: 420px; }
  .bottom-bar { display: none; }
  .workspace { padding-bottom: 40px; }
}

/* ---------- desktop: side panel + calendar ---------- */
@media (min-width: 960px) {
  .avail-layout { grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
  .avail-side { position: sticky; top: 64px; }
  .brush-card { position: static; }
  .brushes { grid-template-columns: 1fr; }
  .calendar-card { padding: 16px; }
  .topbar { padding: 0 24px; }
  .tabs { padding: 0 16px; }
}
@media (min-width: 1240px) {
  #calendar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .month { margin-top: 0; }
  .day { min-height: 60px; }
}
