/* Slots Picker – base theme.
   Direction "A+": light, native-to-Outlook, Segoe UI, confident blue accent.
   Event block colour is driven by each calendar's category colour (the --cat custom
   property set per event), never hardcoded here. The blue accent is for app chrome
   only – selection, active states, buttons, the brand mark. */

:root {
  --bg:#FFFFFF; --chrome:#EEF0F4; --ink:#1A1D21; --muted:#6B7280; --faint:#9AA1AC;
  --line:#E9EBEF; --line-soft:#F2F3F6;
  --accent:#2563EB; --accent-press:#1D4ED8; --accent-soft:#EEF2FF;
  --now:#E5484D;

  --font:"Segoe UI",-apple-system,system-ui,sans-serif;
  --hour:54px;          /* pixel height of one hour row */
  --gcol:50px;          /* width of one gutter / timezone column */
  --radius:9px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--chrome);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px; line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex; flex-direction: column; height: 100%;
  background: var(--bg);
  max-width: 480px; margin: 0 auto;
  box-shadow: 0 0 0 1px rgba(20,25,35,.04);
}

.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; flex-direction: column; min-height: 0; }

/* ---- sign-in screen (live: Microsoft sign-in gate) ------------------------ */
#signin-view.active { align-items: center; justify-content: center; padding: 24px; }
.signin-card { text-align: center; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.signin-card .mark { width: 46px; height: 46px; border-radius: 12px; }
.signin-title { font-size: 22px; font-weight: 720; letter-spacing: -0.3px; margin: 8px 0 0; }
.signin-sub { color: var(--muted); font-size: 13.5px; line-height: 1.55; margin: 0 0 6px; }
.signin-btn { width: 100%; padding: 11px 16px; font-size: 14px; }
.signin-error { color: var(--now); font-size: 12px; min-height: 16px; margin: 4px 0 0; word-break: break-word; }

/* ---- auth banner ---------------------------------------------------------- */
.auth-banner {
  display: none;
  padding: 9px 16px; background: var(--accent); color: #fff; font-size: 12.5px;
}
.auth-banner.show { display: block; }
.auth-banner a { color: #fff; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---- header --------------------------------------------------------------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--line); flex: none;
}
.brand { display: flex; align-items: center; gap: 9px; }
.app-title { font-size: 16px; font-weight: 680; letter-spacing: -0.3px; margin: 0; }
.mark {
  width: 22px; height: 22px; border-radius: 7px; flex: none; position: relative;
  background: linear-gradient(135deg, var(--accent), #4F46E5);
  box-shadow: 0 2px 6px rgba(37,99,235,.35);
}
.mark::after {
  content: ""; position: absolute; inset: 6px 6px auto 6px; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.9); box-shadow: 0 5px 0 rgba(255,255,255,.55);
}
.icon-btn {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 9px; width: 34px; height: 34px; cursor: pointer; font-size: 15px;
  transition: .15s; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: #F7F8FA; color: var(--ink); }

/* ---- schedule switcher (calendar filter) ---------------------------------- */
.switcher {
  display: flex; flex-wrap: wrap; gap: 3px; margin: 12px 16px 0; padding: 3px;
  background: #F1F3F7; border-radius: 11px; flex: none;
}
/* Chips fill each row evenly. `--cols` (the per-row count) is computed in ui-main.js so rows come
   out balanced – e.g. 10 chips as 4/4/2, not 3/3/3/1 – and recomputed on resize. The basis is each
   chip's share of the row (minus a margin so the next chip wraps); flex-grow:1 then stretches them
   to consume the whole row, so there's never dead space on the right. */
.seg {
  flex: 1 1 calc(100% / var(--cols, 3) - 6px);
  border: 0; background: transparent; color: var(--muted); border-radius: 8px;
  padding: 8px 6px; font-size: 12px; font-weight: 620; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: color .15s, background .15s, box-shadow .15s; min-width: 0; font-family: var(--font);
}
.seg:hover { color: var(--ink); }
.seg span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.switcher-empty { color: var(--muted); font-size: 12px; padding: 7px 8px; }
.seg.active {
  background: #fff; color: var(--accent);
  box-shadow: 0 1px 3px rgba(20,25,35,.12), 0 0 0 1px rgba(20,25,35,.03);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--accent)); flex: none; transition: opacity .15s; }
/* off toggle: text already dims via .seg; fade the colour dot so on/off is unmistakable */
.seg:not(.active) .dot { opacity: .3; }
.seg:not(.active):hover .dot { opacity: .55; }

/* ---- week nav ------------------------------------------------------------- */
.weeknav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; flex: none;
}
.range { font-size: 13.5px; font-weight: 650; letter-spacing: -0.2px; font-variant-numeric: tabular-nums; }
.nav {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  width: 32px; height: 30px; cursor: pointer; color: var(--ink); font-size: 14px; transition: .15s;
}
.nav:hover { background: #F7F8FA; border-color: #DCDFE5; }

/* ---- weekday strip -------------------------------------------------------- */
.daystrip { display: flex; gap: 6px; padding: 0 16px 12px; border-bottom: 1px solid var(--line); flex: none; }
.day {
  flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 11px;
  padding: 7px 0 8px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 2px; position: relative; transition: .15s; font-family: var(--font);
}
.day:hover { border-color: #D5D9E0; background: #FBFBFD; }
.day b { font-size: 10px; color: var(--faint); font-weight: 680; text-transform: uppercase; letter-spacing: .5px; }
.day span { font-size: 16px; font-weight: 680; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }
.day.today::after {
  content: ""; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.day.active { background: var(--accent); border-color: var(--accent); box-shadow: 0 4px 12px rgba(37,99,235,.32); }
.day.active b, .day.active span { color: #fff; }
.day.active.today::after { background: rgba(255,255,255,.85); }

/* ---- timezone header row (above the gutter, one cell per zone column) ------ */
.tzhead {
  display: flex; flex: none; position: relative; height: 30px; background: #fff;
  border-bottom: 1px solid var(--line);
}
.tzh {
  width: var(--gcol); flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 720; letter-spacing: .4px; color: var(--muted);
  border-right: 1px solid var(--line-soft); position: relative;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.tzh.is-primary { color: var(--ink); }
.tzh.removable { cursor: pointer; }
.tzh .rm {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 400; color: var(--now);
}
.tzh.removable:hover { background: #FDECEC; }
.tzh.removable:hover .ab { visibility: hidden; }
.tzh.removable:hover .rm { display: flex; }
.tzadd {
  align-self: center; margin-left: 5px; width: 24px; height: 22px; flex: none;
  border: 1px dashed var(--line); border-radius: 7px; background: #fff; color: var(--muted);
  cursor: pointer; font-size: 15px; line-height: 1; display: inline-flex;
  align-items: center; justify-content: center; transition: .15s; font-family: var(--font);
}
.tzadd:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.tzsearch {
  position: absolute; top: 100%; left: 6px; margin-top: 5px; z-index: 20; width: 250px;
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  box-shadow: 0 10px 28px rgba(20,25,35,.18); padding: 8px; display: none;
}
.tzsearch.show { display: block; }
.tzsearch input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; font-family: var(--font); color: var(--ink); outline: none;
}
.tzsearch input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tzresults { list-style: none; margin: 6px 0 0; padding: 0; max-height: 210px; overflow: auto; }
.tzresults li {
  padding: 7px 9px; border-radius: 7px; cursor: pointer; font-size: 12.5px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.tzresults li:hover { background: var(--accent-soft); }
.tzresults li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tzresults .ra { color: var(--muted); font-size: 11px; font-weight: 720; flex: none; }
.tzresults .empty { padding: 8px 9px; color: var(--faint); font-size: 12px; cursor: default; }

/* ---- all-day band --------------------------------------------------------- */
/* The band wraps freely but is capped so a pile of all-day items (others' holidays, travel,
   conferences) scrolls instead of shoving the time grid off-screen. */
.allday { display: none; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap; flex: none; max-height: 88px; overflow-y: auto; align-content: flex-start; }
.allday.show { display: flex; }
.allday-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  font-size: 11px; font-weight: 640; padding: 4px 9px; border-radius: 7px;
  background: color-mix(in srgb, var(--cat) 12%, #fff);
  color: color-mix(in srgb, var(--cat) 72%, var(--ink));
  border: 1px solid color-mix(in srgb, var(--cat) 28%, #fff);
}
.allday-chip .ad-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* status tag (OOO / Tentative / …): the word carries the status; colour stays the owner's. */
.ad-tag {
  flex: none; font-size: 8.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 1px 4px; border-radius: 4px; line-height: 1.4;
  background: color-mix(in srgb, var(--cat) 26%, #fff);
  color: color-mix(in srgb, var(--cat) 82%, var(--ink));
}
/* OOO is the signal an EA scans for most – give it the strong hatch + a filled tag. */
.allday-chip.is-oof {
  border-color: color-mix(in srgb, var(--cat) 38%, #fff);
  background: repeating-linear-gradient(45deg,
    color-mix(in srgb, var(--cat) 20%, #fff) 0, color-mix(in srgb, var(--cat) 20%, #fff) 6px,
    color-mix(in srgb, var(--cat) 8%, #fff) 6px, color-mix(in srgb, var(--cat) 8%, #fff) 12px);
}
.allday-chip.is-oof .ad-tag { background: color-mix(in srgb, var(--cat) 78%, var(--ink)); color: #fff; }
.allday-chip.is-tentative {
  border-style: dashed; border-color: color-mix(in srgb, var(--cat) 45%, #fff);
  background: repeating-linear-gradient(45deg,
    color-mix(in srgb, var(--cat) 10%, #fff) 0, color-mix(in srgb, var(--cat) 10%, #fff) 5px,
    #fff 5px, #fff 10px);
}
.allday-chip.is-elsewhere { border-style: dotted; border-color: color-mix(in srgb, var(--cat) 45%, #fff); }
.allday-chip.is-free { background: #fff; opacity: .9; border-style: dashed; border-color: color-mix(in srgb, var(--cat) 35%, #fff); }

/* ---- time grid ------------------------------------------------------------ */
.grid { flex: 1; display: flex; overflow: auto; min-height: 0; }
.gutter { flex: none; display: flex; }
.gcol { width: var(--gcol); flex: none; border-right: 1px solid var(--line-soft); }
.gcol:last-child { border-right: 0; }
.hr {
  height: var(--hour); font-size: 10px; color: var(--faint); text-align: right;
  padding-right: 8px; transform: translateY(-6px); font-variant-numeric: tabular-nums;
}
.hr.off { opacity: .4; }
/* off-work shading: greys the hours outside the cross-zone working band */
.offwork {
  position: absolute; left: 0; right: 0; z-index: 0; pointer-events: none;
  background: rgba(120,130,145,.07);
}
.track {
  position: relative; flex: 1; touch-action: none;
  user-select: none; -webkit-user-select: none; /* dragging paints slots – never select text */
  background: repeating-linear-gradient(to bottom,
    transparent 0, transparent calc(var(--hour) - 1px),
    var(--line-soft) calc(var(--hour) - 1px), var(--line-soft) var(--hour));
}

/* event cards – colour comes from --cat (the calendar's category colour).
   pointer-events:none so a press/drag over a card falls through to the track and selects slots. */
.ev {
  position: absolute; border-radius: 9px; padding: 5px 9px; font-size: 11px; font-weight: 640;
  pointer-events: none;
  overflow: hidden; line-height: 1.25; box-shadow: 0 1px 3px rgba(20,25,35,.07);
  background: color-mix(in srgb, var(--cat) 12%, #fff);
  color: color-mix(in srgb, var(--cat) 72%, var(--ink));
  border: 1px solid color-mix(in srgb, var(--cat) 22%, #fff);
  border-left: 3px solid var(--cat);
}
.ev .s { display: block; }
.ev .t { display: block; font-weight: 500; opacity: .8; font-size: 10px; margin-top: 1px; }
/* short blocks (≈30 min) can't stack two lines – lay subject + time on one centred row,
   subject truncating so the time always stays visible. */
.ev.short { display: flex; align-items: center; gap: 6px; padding-top: 0; padding-bottom: 0; }
.ev.short .s { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.short .t { flex: none; margin-top: 0; }
.ev.is-tentative {
  border: 1px dashed color-mix(in srgb, var(--cat) 45%, #fff); border-left: 3px dashed var(--cat);
  box-shadow: none;
  background: repeating-linear-gradient(45deg,
    color-mix(in srgb, var(--cat) 10%, #fff) 0, color-mix(in srgb, var(--cat) 10%, #fff) 5px,
    #fff 5px, #fff 10px);
}
.ev.is-oof {
  background: repeating-linear-gradient(45deg,
    color-mix(in srgb, var(--cat) 18%, #fff) 0, color-mix(in srgb, var(--cat) 18%, #fff) 6px,
    color-mix(in srgb, var(--cat) 7%, #fff) 6px, color-mix(in srgb, var(--cat) 7%, #fff) 12px);
}
.ev.is-free { background: #fff; box-shadow: none; border: 1px dashed color-mix(in srgb, var(--cat) 35%, #fff); border-left: 3px solid color-mix(in srgb, var(--cat) 45%, #fff); opacity: .9; }
.ev.is-elsewhere { border-left-style: dotted; }

/* selection cells – granularity-sized segments; contiguous cells read as one block.
   Side borders always show; top/bottom borders + rounding only at a run's caps, with a faint
   tick line between internal cells so each toggleable 30-min unit is visible. */
.sel {
  position: absolute; box-sizing: border-box; background: rgba(37,99,235,.12);
  border-left: 1.5px solid var(--accent); border-right: 1.5px solid var(--accent);
  color: var(--accent); font-size: 11.5px; font-weight: 720;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  user-select: none; z-index: 2;
}
.sel:hover { background: rgba(37,99,235,.2); }
.sel:not(.cap-top) { border-top: 1px dashed rgba(37,99,235,.4); }
.sel.cap-top {
  border-top: 1.5px solid var(--accent);
  border-top-left-radius: 10px; border-top-right-radius: 10px;
}
.sel.cap-bot {
  border-bottom: 1.5px solid var(--accent);
  border-bottom-left-radius: 10px; border-bottom-right-radius: 10px;
  box-shadow: 0 4px 14px rgba(37,99,235,.22);
}
/* drag-grip handles only at the run's top and bottom */
.sel.cap-top::before, .sel.cap-bot::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  width: 30px; height: 4px; border-radius: 3px; background: var(--accent); opacity: .85;
}
.sel.cap-top::before { top: -2px; } .sel.cap-bot::after { bottom: -2px; }

/* empty / hint state */
.grid-hint {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex;
  align-items: center; justify-content: center; padding: 24px; text-align: center;
  color: var(--faint); font-size: 12px; pointer-events: none;
}

/* ---- bottom action deck --------------------------------------------------- */
.deck {
  border-top: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; background: #fff; flex: none;
  box-shadow: 0 -6px 18px rgba(20,25,35,.06);
}
.deck-info { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 4px; }
.deck-info b { font-size: 13px; letter-spacing: -0.1px; }
/* exact preview of the text the Insert button will copy – scrolls if the list is long */
.deck-preview {
  margin: 0; font-family: var(--font); font-size: 11.5px; line-height: 1.45; color: var(--ink);
  white-space: pre-wrap; word-break: break-word; max-height: 84px; overflow-y: auto;
  font-variant-numeric: tabular-nums;
}
.deck-preview.empty { color: var(--muted); }

/* output-zone pills stacked above the Insert button */
.deck-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; flex: none; }
.tz-pills { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.tz-pills-lbl { font-size: 10.5px; color: var(--faint); font-weight: 600; margin-right: 2px; }
.tz-pill {
  border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px;
  padding: 4px 11px; font-size: 11px; font-weight: 680; font-family: var(--font); cursor: pointer;
  transition: .15s; font-variant-numeric: tabular-nums;
}
.tz-pill:hover { border-color: var(--accent); color: var(--ink); }
.tz-pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.primary {
  border: 0; color: #fff; border-radius: 10px; padding: 11px 18px; font-size: 13px; font-weight: 680;
  cursor: pointer; letter-spacing: -0.1px; flex: none; font-family: var(--font);
  background: linear-gradient(180deg, var(--accent), var(--accent-press));
  box-shadow: 0 4px 12px rgba(37,99,235,.4); transition: .15s;
}
.primary:hover { filter: brightness(1.05); box-shadow: 0 6px 16px rgba(37,99,235,.45); }
.primary:disabled { background: #C7CBD3; box-shadow: none; cursor: default; filter: none; }

/* ---- generic content ------------------------------------------------------ */
.content { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.muted { color: var(--muted); }

/* ---- settings view -------------------------------------------------------- */
.settings-list { display: flex; flex-direction: column; gap: 22px; max-width: 520px; }
.set-group { display: flex; flex-direction: column; gap: 8px; }
.set-head { font-size: 13px; font-weight: 760; color: var(--ink); }
.set-desc { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }

/* display-timezone picker (reuses .tzsearch / .tzresults from the gutter) */
.tz-field { position: relative; max-width: 320px; margin-top: 2px; }
.tz-current {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--ink); font-size: 13px; font-weight: 640; font-family: var(--font); cursor: pointer; transition: .15s;
}
.tz-current:hover { border-color: var(--accent); }
.tz-current i { color: var(--faint); font-style: normal; font-size: 11px; }
.set-pop { left: 0; width: 100%; }

/* working hours */
.hours-row { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.hours-row .to { color: var(--muted); font-size: 12px; }
.set-select {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; background: #fff;
  font-size: 13px; font-family: var(--font); color: var(--ink); cursor: pointer; outline: none;
  font-variant-numeric: tabular-nums;
}
.set-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- settings: calendars list (editable-calendar roster) ------------------ */
.cal-list {
  display: flex; flex-direction: column; gap: 2px; margin-top: 8px;
  max-height: 340px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 12px; padding: 5px;
}
.cal-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 9px; }
.cal-row:hover { background: #F7F8FA; }
.cal-swatch-wrap { position: relative; flex: none; }
.cal-swatch {
  width: 22px; height: 22px; border-radius: 50%; padding: 0; cursor: pointer;
  background: var(--c, var(--accent)); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow .15s;
}
.cal-swatch:hover { box-shadow: 0 0 0 2px var(--c, var(--accent)); }
.cal-colors {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; display: none;
  grid-template-columns: repeat(5, 22px); gap: 7px; padding: 9px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(20,25,35,.16);
}
.cal-colors.show { display: grid; }
.cal-color {
  width: 22px; height: 22px; border-radius: 50%; padding: 0; cursor: pointer;
  background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
  transition: transform .12s, box-shadow .12s;
}
.cal-color:hover { transform: scale(1.1); }
.cal-color.on { box-shadow: 0 0 0 2px var(--accent); }
.cal-meta { flex: 1; min-width: 0; }
.cal-name { font-size: 13px; font-weight: 640; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-email { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-toggle { flex: none; position: relative; cursor: pointer; display: inline-flex; }
.cal-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.cal-track {
  display: inline-block; width: 38px; height: 22px; border-radius: 11px;
  background: #D2D6DE; position: relative; transition: background .15s;
}
.cal-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.28); transition: transform .15s;
}
.cal-toggle input:checked + .cal-track { background: var(--accent); }
.cal-toggle input:checked + .cal-track .cal-knob { transform: translateX(16px); }
.cal-toggle input:focus-visible + .cal-track { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- referral panel (understated, tucked at the bottom of settings) ------- */
.set-group.referral { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 18px; }
.ref-card { font-size: 12.5px; }
.ref-summary {
  list-style: none; cursor: pointer; color: var(--muted); font-weight: 620; font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 8px; user-select: none; padding: 2px 0;
}
.ref-summary::-webkit-details-marker { display: none; }
.ref-summary::before { content: "\203A"; color: var(--faint); transition: transform .15s; display: inline-block; }
.ref-card[open] .ref-summary::before { transform: rotate(90deg); }
.ref-summary:hover { color: var(--ink); }
.ref-perk {
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em; color: var(--accent);
  background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; text-transform: uppercase;
}
.ref-desc { color: var(--muted); margin: 8px 0 10px; max-width: 420px; line-height: 1.5; }
.ref-link { display: flex; gap: 6px; max-width: 420px; }
.ref-link input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  font-size: 12px; font-family: var(--font); color: var(--ink); background: #F7F8FA; outline: none;
}
.ref-copy {
  flex: none; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
  border-radius: 9px; padding: 8px 14px; font-size: 12px; font-weight: 640; font-family: var(--font);
  transition: .15s;
}
.ref-copy:hover { background: #F7F8FA; border-color: var(--accent); color: var(--accent); }
.ref-tally { color: var(--faint); font-size: 11.5px; margin: 9px 0 0; }

/* slot-size segmented control */
.seg-row { display: inline-flex; gap: 6px; width: fit-content; margin-top: 2px; padding: 4px; background: var(--chrome); border-radius: 11px; }
.seg-pill {
  border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 680;
  padding: 7px 16px; border-radius: 8px; cursor: pointer; font-family: var(--font); transition: .15s;
}
.seg-pill:hover { color: var(--ink); }
.seg-pill.active { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(20,25,35,.1); }

/* email-format custom template + live preview */
.set-textarea {
  margin-top: 4px; max-width: 420px; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; font-family: var(--font); color: var(--ink);
  line-height: 1.5; resize: vertical; outline: none; transition: .15s;
}
.set-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.set-hint { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.set-hint strong { color: var(--ink); font-weight: 640; }
.set-hint code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 11px;
  background: var(--chrome); color: var(--ink); padding: 1px 5px; border-radius: 5px;
}

/* insertable-detail chips + the pill editor */
.tmpl-tokens { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tmpl-tokens-label { font-size: 11.5px; color: var(--muted); margin-right: 2px; }
.token-chip {
  border: 1px solid var(--line); background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 640; font-family: var(--font); padding: 4px 11px;
  border-radius: 999px; cursor: pointer; transition: .15s;
}
.token-chip:hover { border-color: var(--accent); background: #E4EAFF; }
.token-chip:active { transform: translateY(.5px); }
.set-editor {
  margin-top: 6px; max-width: 420px; min-height: 96px; border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; font-size: 12.5px; font-family: var(--font);
  color: var(--ink); line-height: 1.8; outline: none; transition: .15s; cursor: text;
  white-space: pre-wrap; word-break: break-word;
}
.set-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.set-editor:empty:before { content: attr(data-placeholder); color: var(--faint); }
.tmpl-token {
  display: inline-block; background: var(--accent); color: #fff; font-size: 11px; font-weight: 640;
  padding: 1px 8px; border-radius: 6px; margin: 0 1px; user-select: none; white-space: nowrap;
}
.preview-head { margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.out-preview {
  margin: 0; max-width: 420px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--chrome); padding: 12px 14px; font-family: var(--font); font-size: 12.5px;
  color: var(--ink); line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  font-variant-numeric: tabular-nums;
}

.reset-btn {
  align-self: flex-start; margin-top: 4px; border: 1px solid var(--line); background: #fff;
  color: var(--muted); font-size: 12.5px; font-weight: 640; padding: 9px 14px; border-radius: 10px;
  cursor: pointer; font-family: var(--font); transition: .15s;
}
.reset-btn:hover { border-color: var(--now); color: var(--now); background: #FEF2F2; }
