:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #20242d;
  --border: #2b303b;
  --text: #e7e9ee;
  --muted: #9aa1ad;
  --accent: #6c8cff;
  --accent-hover: #5a7bf0;
  --works: #2ea66b;
  --works-bg: rgba(46, 166, 107, 0.16);
  --maybe: #d9a13a;
  --maybe-bg: rgba(217, 161, 58, 0.16);
  --no: #d2495b;
  --no-bg: rgba(210, 73, 91, 0.16);
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1a1e27 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 920px; margin: 0 auto; padding: 28px 20px 80px; }
.narrow { max-width: 620px; }

header.site {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 28px;
}
header.site .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
header.site .brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px var(--accent); }

h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 19px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
p.lead { color: var(--muted); margin-top: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
input[type="text"], input[type="time"], input[type="date"], textarea, input[type="password"], select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  outline: none;
}
select { appearance: none; cursor: pointer; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,140,255,0.18); }
textarea { resize: vertical; min-height: 72px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

button, .btn {
  font: inherit; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .04s;
}
button:hover, .btn:hover { background: #272c37; }
button:active { transform: translateY(1px); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); }
button.danger { border-color: var(--no); color: var(--no); }
button.danger:hover { background: var(--no-bg); }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 13px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.stack > * + * { margin-top: 10px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.spacer { flex: 1; }
.hidden { display: none !important; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow);
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.err { border-color: var(--no); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.pill.green { color: var(--works); border-color: var(--works); background: var(--works-bg); }
.pill.amber { color: var(--maybe); border-color: var(--maybe); background: var(--maybe-bg); }

/* event list */
.event-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.event-item:first-child { border-top: none; }
.event-item .title { font-weight: 600; }
.event-item .meta { color: var(--muted); font-size: 13px; }

/* candidate day chips in editor */
.day-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.day-chip { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px; }
.day-chip .d { font-weight: 600; }
.day-chip .dow { color: var(--muted); font-size: 13px; }
.day-chip button { margin-left: auto; padding: 4px 9px; font-size: 12px; }

/* candidate-day week calendar (organizer editor) */
.cal { border: 1px solid var(--border); border-radius: 11px; overflow: hidden; margin-top: 6px; }
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { text-align: center; }
.cal-head .cal-cell { padding: 8px 0; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); border-left: 1px solid var(--border); }
.cal-head .cal-cell:first-child { border-left: none; }
button.cal-cell.day {
  border: none; border-left: 1px solid var(--border); border-top: 1px solid var(--border); border-radius: 0;
  background: var(--surface); color: var(--text); padding: 9px 0 11px; min-height: 48px; font-size: 15px;
  font-family: inherit; cursor: pointer; transition: background .1s;
}
button.cal-cell.day:first-child { border-left: none; }
button.cal-cell.day:not(.works):not(.maybe):hover:not(:disabled) { background: var(--surface-2); }
button.cal-cell.day.works { background: var(--works); color: #fff; font-weight: 700; }
button.cal-cell.day.maybe { background: var(--maybe); color: #1a1300; font-weight: 700; }
button.cal-cell.day.works:hover, button.cal-cell.day.maybe:hover { filter: brightness(1.07); }
button.cal-cell.day.muted { opacity: .38; cursor: not-allowed; }
button.cal-cell.day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell .mlbl { display: block; font-size: 10px; line-height: 1.1; opacity: .75; text-transform: uppercase; letter-spacing: .03em; }

/* 3-part time picker */
.timegrp { display: flex; gap: 8px; align-items: center; }
.timegrp input { width: 64px; text-align: center; flex: 0 0 auto; }
.timegrp .tcolon { color: var(--muted); font-weight: 700; }
.timegrp select { flex: 0 0 auto; width: auto; text-align: center; padding-left: 10px; padding-right: 10px; }
.timegrp .minsel { width: 58px; }
.timegrp .apsel { width: 66px; }

/* inline text-button (e.g. week-start toggle) */
.linklike { background: none; border: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.linklike:hover { text-decoration: underline; }

/* attendee day picker */
.pick { border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.pick.chosen { border-color: var(--works); box-shadow: 0 0 0 2px var(--works-bg); }
.pick .dayhdr { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.pick .dayhdr .d { font-weight: 700; font-size: 16px; }
.pick .dayhdr .dow { color: var(--muted); }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  flex: 1; min-width: 96px; padding: 9px 8px; border-radius: 9px; font-size: 14px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.seg button .dotc { width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: .55; }
.seg button[data-s="works"] { color: var(--works); }
.seg button[data-s="maybe"] { color: var(--maybe); }
.seg button[data-s="no"] { color: var(--no); }
.seg button.active { color: #fff; }
.seg button.active .dotc { opacity: 1; }
.seg button[data-s="works"].active { background: var(--works); border-color: var(--works); }
.seg button[data-s="maybe"].active { background: var(--maybe); border-color: var(--maybe); }
.seg button[data-s="no"].active { background: var(--no); border-color: var(--no); }

/* matrix */
.matrix-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.matrix { border-collapse: collapse; width: 100%; font-size: 14px; }
table.matrix th, table.matrix td { padding: 9px 11px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.matrix thead th { background: var(--surface-2); position: sticky; top: 0; font-weight: 600; }
table.matrix th.daycol, table.matrix td.daycol { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.matrix thead th.daycol { background: var(--surface-2); z-index: 2; }
table.matrix tr.is-chosen td { background: var(--works-bg); }
.cell { display: inline-flex; width: 22px; height: 22px; border-radius: 6px; align-items: center; justify-content: center; font-size: 12px; }
.cell.works { background: var(--works); color: #fff; }
.cell.maybe { background: var(--maybe); color: #1a1300; }
.cell.no { color: var(--muted); }
.cell.none { color: var(--muted); }
.tally { font-variant-numeric: tabular-nums; }
.tally b { font-weight: 700; }
.choose-btn { font-size: 12px; padding: 5px 10px; }

.banner { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.banner.ok { background: var(--works-bg); border: 1px solid var(--works); color: var(--works); }
.banner.warn { background: var(--maybe-bg); border: 1px solid var(--maybe); color: var(--maybe); }

.copyrow { display: flex; gap: 8px; align-items: center; }
.copyrow input { flex: 1; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin: 10px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
