:root {
  --navy: #2b6777;
  --navy-2: #3a8494;
  --ink: #1a1f2b;
  --paper: #f2f2f2;
  --card: #ffffff;
  --line: #c8d8e4;
  --muted: #5d7480;
  --accent: #52ab98;
  --accent-ink: #ffffff;
  --gold: #52ab98;
  --green: #1e8e5a;
  --green-bg: #e6f5ee;
  --red: #c8442c;
  --red-bg: #fbeae6;
  --amber: #b8860b;
  --amber-bg: #fbf3df;
  --blue-bg: #e4edf1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,25,45,.06), 0 6px 20px rgba(20,25,45,.06);
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; min-height: 100vh; }
#app.app-hidden { display: none; }

/* ---------- Material Symbols ---------- */
.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
}
.icon-inline {
  font-size: 15px;
  margin-right: 5px;
  vertical-align: -3px;
}

/* ---------- Login screen ---------- */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(circle at 20% 15%, var(--navy-2), var(--navy) 60%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-screen.hidden { display: none; }
.login-card {
  background: var(--card); border-radius: 14px; padding: 32px 30px;
  width: min(380px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: flex; flex-direction: column; gap: 14px;
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-mark {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), #7fcab8);
  color: #ffffff; font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.login-title { font-size: 19px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.login-tagline { font-size: 12px; color: var(--muted); }
.login-sub { margin: -4px 0 2px; color: var(--muted); font-size: 13px; }
.login-hint { font-size: 11px; color: var(--muted); margin: 2px 0 0; line-height: 1.4; text-align: center; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--navy);
  color: #dfe4f5;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), #7fcab8);
  color: #ffffff; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: #fff; font-size: 14.5px; }
.brand-text span { color: #9aa8cf; font-size: 11.5px; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; flex: 1; overflow-y: auto; }
.nav-section { margin-top: 16px; margin-bottom: 4px; padding: 0 10px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #7f8dbb; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; color: #c9d2ec;
  text-decoration: none; font-size: 13.6px; cursor: pointer;
  border: 1px solid transparent;
}
.nav-item .ic { width: 18px; display: inline-flex; justify-content: center; font-size: 19px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--navy-2); color: #fff; border-color: rgba(255,255,255,.08); }
.nav-item .badge {
  margin-left: auto; background: var(--gold); color: #ffffff;
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 20px;
}

.sidebar-footer { border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; margin-top: 10px; }
.sidebar-note { font-size: 11px; color: #7f8dbb; margin-bottom: 10px; line-height: 1.4; }

/* ---------- Topbar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.role-switch { display: flex; flex-direction: column; gap: 2px; }
.role-switch label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.role-switch select {
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; font-size: 12.5px;
  background: var(--paper); color: var(--ink); min-width: 130px;
}
.icon-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  width: 34px; height: 34px; font-size: 15px; cursor: pointer; position: relative;
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.icon-btn:hover { background: var(--paper); }
.notif-dot { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--card); }
#menuToggle { display: none; }

.content { padding: 22px 26px 60px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ---------- Generic building blocks ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; margin: 0 0 4px; }
.page-head p.sub { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 640px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font-size: 13.2px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: var(--paper); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #3350df; }
.btn-danger { background: var(--red-bg); border-color: #f0c7bb; color: var(--red); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.18); color: #c9d2ec; }
.btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 20px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.kpi .kpi-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.kpi .kpi-value { font-size: 26px; font-weight: 800; }
.kpi .kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.section-title { font-size: 14.5px; font-weight: 700; margin: 28px 0 12px; display: flex; align-items: center; justify-content: space-between; }

table { width: 100%; border-collapse: collapse; font-size: 13.2px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  font-size: 11.3px; font-weight: 700; white-space: nowrap;
}
.pill-gray { background: #eef0f5; color: #565f74; }
.pill-blue { background: var(--blue-bg); color: #2b6777; }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-gold { background: #fbf1dd; color: #90691a; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.person { display: flex; align-items: center; gap: 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--accent); border-color: var(--accent); }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .ic { font-size: 30px; margin-bottom: 10px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.span2 { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: #47506a; }
.field .hint { font-size: 11px; color: var(--muted); }
input, select, textarea {
  font-family: inherit; font-size: 13.3px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; color: var(--ink); width: 100%;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b8dcd3; border-color: var(--accent); }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkbox-row input { width: auto; }
.err { color: var(--red); font-size: 11.5px; min-height: 14px; }

/* ---------- Calendar / planning ---------- */
.week-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.week-nav .label { font-weight: 700; font-size: 14.5px; }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.day-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 160px; display: flex; flex-direction: column; }
.day-col.today { border-color: var(--accent); box-shadow: 0 0 0 2px #d3e9e3 inset; }
.day-head { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.day-head b { display: block; color: var(--ink); font-size: 15px; }
.day-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.svc-chip {
  background: var(--blue-bg); border: 1px solid #cbe0da; border-radius: 7px; padding: 6px 8px;
  font-size: 11.6px; cursor: pointer; line-height: 1.35;
}
.svc-chip:hover { filter: brightness(0.97); }
.svc-chip.conflict { border-color: #f0c7bb; background: var(--red-bg); }
.svc-chip .t { font-weight: 700; }
.svc-chip .m { color: var(--muted); }
.day-add { border: 1px dashed var(--line); border-radius: 7px; padding: 6px; font-size: 11.5px; color: var(--muted); text-align: center; cursor: pointer; background: transparent; }
.day-add:hover { background: var(--paper); color: var(--ink); }

.view-toggle { display: flex; gap: 4px; margin-right: 8px; }

.month-grid-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 6px; }
.month-grid-head div { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; text-align: center; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.month-day-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 92px; min-width: 0; display: flex; flex-direction: column; padding: 6px; }
.month-day-col.today { border-color: var(--accent); box-shadow: 0 0 0 2px #d3e9e3 inset; }
.month-day-col.other-month:not(.today) { opacity: 0.45; }
.month-day-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.month-day-add { border: none; background: transparent; color: var(--muted); cursor: pointer; padding: 0 2px; line-height: 1; }
.month-day-add:hover { color: var(--ink); }
.month-day-add .icon-inline { font-size: 15px; }
.month-day-body { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; flex: 1; }
.month-svc-chip {
  background: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px;
  font-size: 10.8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.month-svc-chip:hover { filter: brightness(0.97); }
.month-svc-chip .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; background: currentColor; }
.month-day-more { font-size: 10.5px; color: var(--muted); cursor: pointer; margin-top: 1px; }
.month-day-more:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Stage tracker ---------- */
.stage-tracker { display: flex; flex-direction: column; gap: 0; }
.stage-row { display: flex; gap: 12px; position: relative; padding-bottom: 20px; }
.stage-row:last-child { padding-bottom: 0; }
.stage-line { display: flex; flex-direction: column; align-items: center; }
.stage-dot { width: 24px; height: 24px; border-radius: 50%; background: #eef0f5; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: var(--muted); flex-shrink: 0; }
.stage-dot.done { background: var(--green); border-color: var(--green); color: #fff; }
.stage-dot.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.stage-dot.overdue { background: var(--red); border-color: var(--red); color: #fff; }
.stage-connector { width: 2px; flex: 1; background: var(--line); margin-top: 2px; min-height: 16px; }
.stage-connector.done { background: var(--green); }
.stage-content { flex: 1; padding-top: 2px; }
.stage-content .name { font-weight: 700; font-size: 13.6px; }
.stage-content .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stage-content .actions { margin-top: 8px; display: flex; gap: 8px; }

/* ---------- Workflow template builder ---------- */
.wf-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap: 14px; }
.wf-card { cursor: pointer; }
.wf-card:hover { border-color: #b8dcd3; }
.wf-card .name { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.wf-card .desc { font-size: 12.3px; color: var(--muted); margin-bottom: 10px; min-height: 32px; }
.wf-card .stagecount { font-size: 11.5px; color: var(--accent); font-weight: 700; }

.stage-builder-item {
  background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 12px;
  display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px;
}
.stage-builder-item .handle { color: var(--muted); font-size: 13px; padding-top: 8px; cursor: grab; user-select: none; }
.stage-builder-item .num { width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-top: 6px; flex-shrink: 0; }
.stage-builder-item .body { flex: 1; display: grid; grid-template-columns: 1.4fr 1fr .8fr; gap: 8px; }
.stage-builder-item .flags { grid-column: 1 / -1; display: flex; gap: 16px; margin-top: 2px; flex-wrap: wrap; }
.stage-builder-item .remove { color: var(--red); background: none; border: none; cursor: pointer; font-size: 13px; padding-top: 8px; }
.order-btns { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.order-btns button { border: 1px solid var(--line); background: #fff; width: 22px; height: 20px; font-size: 10px; cursor: pointer; border-radius: 4px; line-height: 1; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,20,35,.45); display: none; z-index: 40; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: #fff; border-radius: 12px; width: min(620px, 92vw); max-height: 88vh; overflow-y: auto;
  display: none; z-index: 41; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal.wide { width: min(760px, 94vw); }
.modal.open, .modal-backdrop.open { display: block; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-head h2 { font-size: 16px; margin: 0; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: #fff; }
.modal-close { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }

/* ---------- Onboarding tour ---------- */
.ob-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); display: inline-block; }
.ob-dot.done { background: var(--accent); }
.ob-dot.active { background: var(--accent); width: 18px; border-radius: 4px; }

/* ---------- Help search ---------- */
.help-article { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; }
.help-article-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.help-article-head strong { font-size: 13.8px; }
.help-article-body { margin: 0 0 8px; font-size: 12.8px; color: var(--muted); line-height: 1.5; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 9px; font-size: 13px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 60;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Misc ---------- */
.role-slot-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--paper); }
.role-slot-row .fn { font-weight: 700; font-size: 13px; min-width: 130px; }
.role-slot-row .who { flex: 1; font-size: 13px; color: var(--muted); }
.role-slot-row select { max-width: 200px; }

.notif-panel { position: absolute; top: 54px; right: 22px; width: 340px; max-height: 420px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 30; display: none; }
.notif-panel.open { display: block; }
.notif-item { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 12.6px; }
.notif-item:last-child { border-bottom: none; }
.notif-item .t { font-weight: 700; margin-bottom: 2px; }
.notif-item .d { color: var(--muted); font-size: 11px; margin-top: 3px; }
.notif-item.unread { background: #f4f6ff; }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }

.small-muted { color: var(--muted); font-size: 12px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.link-btn { background: none; border: none; color: var(--accent); font-weight: 600; cursor: pointer; font-size: 12.8px; padding: 0; }

/* ---------- Tenant switcher ---------- */
.tenant-switch { display: flex; gap: 6px; padding: 0 8px 14px; }
.tenant-switch select {
  flex: 1; min-width: 0; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  color: #dfe4f5; border-radius: 7px; padding: 6px 8px; font-size: 12.4px;
}
.tenant-switch select option { color: #1a1f2b; }
.tenant-switch .icon-btn { width: 30px; height: 30px; flex-shrink: 0; background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14); color: #dfe4f5; font-size: 13px; }
.tenant-switch .icon-btn:hover { background: rgba(255,255,255,.14); }

/* ---------- Multi-person role groups ---------- */
.role-group { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 10px; background: var(--paper); }
.role-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.role-group-head .fn { font-weight: 700; font-size: 13.4px; }
.role-group .role-slot-row { background: #fff; margin-bottom: 6px; }
.role-group .role-slot-row:last-of-type { margin-bottom: 8px; }

/* ---------- Metadata / custom fields editor ---------- */
.meta-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.meta-row input { flex: 1; min-width: 0; }
.meta-row .remove { color: var(--red); background: none; border: none; cursor: pointer; font-size: 13px; flex-shrink: 0; }

/* ---------- Volunteer profile ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar-lg { width: 54px; height: 54px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 18px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; font-size: 13.2px; }
.info-grid .k { color: var(--muted); font-size: 11.3px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.info-grid .v { font-weight: 600; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s ease; box-shadow: 0 0 0 9999px rgba(0,0,0,0); }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  #menuToggle { display: flex; }
  .content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: 1fr 1fr; }
  .month-grid, .month-grid-head { grid-template-columns: 1fr 1fr; }
  .topbar-actions { gap: 8px; }
  .role-switch select { min-width: 100px; }
}

/* ---------- Matching screen (optional swipe + drag-and-drop) ---------- */
body.no-scroll { overflow: hidden; }
.match-overlay { position: fixed; inset: 0; background: rgba(15,20,35,.55); z-index: 35; display: none; overflow-y: auto; padding: 24px; }
.match-overlay.open { display: flex; justify-content: center; }
.match-overlay-inner { background: var(--paper); border-radius: var(--radius); width: min(1000px, 100%); height: fit-content; min-height: calc(100vh - 48px); box-shadow: var(--shadow); overflow: hidden; }
.match-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 22px; background: var(--card); border-bottom: 1px solid var(--line); }
.match-header h2 { margin: 0 0 4px; font-size: 18px; }
.match-slots-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 22px 0; }
.match-slot-chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.match-slot-chip .count { color: var(--muted); font-weight: 500; }
.match-slot-chip.active { border-color: var(--accent); background: var(--blue-bg); color: var(--ink); }
.match-columns { display: grid; grid-template-columns: 1fr 1.1fr; gap: 20px; padding: 20px 22px 26px; align-items: start; }
.match-swipe-col { display: flex; flex-direction: column; align-items: center; gap: 18px; position: sticky; top: 20px; }
.match-card-stack { width: 100%; max-width: 320px; min-height: 340px; display: flex; align-items: center; justify-content: center; }
.match-card {
  width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  padding: 32px 22px; text-align: center; cursor: grab; user-select: none; touch-action: none;
}
.match-card:active { cursor: grabbing; }
.match-card.swipe-right { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.match-card.swipe-left { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.match-card-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 22px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.match-card-name { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.match-card-fns { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-bottom: 10px; }
.match-card-warning { color: var(--red); font-size: 12px; font-weight: 600; margin-top: 4px; }
.match-card-hint { color: var(--muted); font-size: 11.5px; margin-top: 14px; }
.match-empty { text-align: center; color: var(--muted); }
.match-empty .material-symbols-outlined { font-size: 40px; opacity: .5; }
.match-swipe-actions { display: flex; gap: 16px; }
.match-action-btn { width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.match-action-btn.skip { color: var(--red); }
.match-action-btn.shortlist { color: var(--green); }
.match-action-btn:hover { filter: brightness(0.97); }
.match-planner-col { display: flex; flex-direction: column; gap: 6px; }
.match-shortlist-tray { display: flex; flex-wrap: wrap; gap: 8px; min-height: 40px; padding: 10px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); margin-bottom: 6px; }
.match-chip {
  display: flex; align-items: center; gap: 6px; background: var(--blue-bg); border: 1px solid #cbe0da; border-radius: 999px;
  padding: 5px 8px 5px 5px; font-size: 12.5px; font-weight: 600; cursor: grab;
}
.match-chip .avatar { width: 22px; height: 22px; font-size: 10.5px; }
.match-chip-remove { border: none; background: none; color: var(--muted); cursor: pointer; display: flex; padding: 0; }
.match-chip-remove .material-symbols-outlined { font-size: 15px; }
.match-role-list { display: flex; flex-direction: column; gap: 10px; }
.match-role-drop { background: var(--card); border: 2px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; transition: border-color .15s, background .15s; }
.match-role-drop.full { border-style: solid; }
.match-role-drop.drag-over { border-color: var(--accent); background: var(--blue-bg); }
.match-role-drop-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.match-role-assignment { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.match-role-drop-placeholder { font-size: 11.5px; color: var(--muted); text-align: center; padding: 6px 0; }
.icon-btn-sm { border: none; background: none; color: var(--muted); cursor: pointer; display: flex; padding: 2px; }
.icon-btn-sm .material-symbols-outlined { font-size: 16px; }
.icon-btn-sm:hover { color: var(--red); }

@media (max-width: 800px) {
  .match-columns { grid-template-columns: 1fr; }
  .match-swipe-col { position: static; }
}

/* ---------- Forms — Google Forms–style builder & viewer ---------- */
.gf-form {
  max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px;
}
.gf-header-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  border-top: 10px solid var(--accent); padding: 22px 24px; box-shadow: var(--shadow);
}
.gf-header-card .gf-title {
  font-size: 22px; font-weight: 700; color: var(--ink); border: none; border-bottom: 2px solid transparent;
  width: 100%; padding: 4px 0; font-family: inherit; background: transparent;
}
.gf-header-card .gf-title:hover, .gf-header-card .gf-title:focus { border-bottom-color: var(--line); outline: none; }
.gf-header-card .gf-title-static { font-size: 22px; font-weight: 700; color: var(--ink); margin: 0 0 6px; text-wrap: balance; }
.gf-header-card .gf-desc {
  font-size: 13.5px; color: var(--muted); border: none; border-bottom: 1px solid transparent;
  width: 100%; padding: 4px 0; font-family: inherit; background: transparent; resize: none; margin-top: 6px;
}
.gf-header-card .gf-desc:hover, .gf-header-card .gf-desc:focus { border-bottom-color: var(--line); outline: none; }
.gf-header-card .gf-desc-static { font-size: 13.5px; color: var(--muted); margin: 0; }
.gf-header-meta { display: flex; gap: 10px; margin-top: 14px; }
.gf-header-meta .field { flex: 1; }

.gf-question-card {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid transparent; border-radius: var(--radius);
  padding: 18px 20px 12px; box-shadow: 0 1px 2px rgba(20,25,45,.05); transition: border-color .12s;
}
.gf-question-card:focus-within { border-left-color: var(--accent); }
.gf-question-card.gf-required-empty { border-left-color: var(--red); }
.gf-question-top { display: flex; gap: 12px; align-items: flex-start; }
.gf-question-title {
  flex: 1; font-size: 15.5px; font-weight: 500; color: var(--ink); border: none; border-bottom: 1px solid var(--line);
  padding: 6px 2px; font-family: inherit; background: transparent;
}
.gf-question-title:focus { outline: none; border-bottom-color: var(--accent); }
.gf-question-title.gf-empty-label { border-bottom-color: var(--red); }
.gf-type-select { width: 190px; flex-shrink: 0; }
.gf-question-view-label { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.gf-question-view-label .req-star { color: var(--red); margin-left: 3px; }
.gf-options-editor { margin: 14px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.gf-option-row { display: flex; align-items: center; gap: 10px; }
.gf-option-bullet { width: 16px; height: 16px; border: 1.5px solid var(--muted); border-radius: 50%; flex-shrink: 0; }
.gf-option-row input { flex: 1; border: none; border-bottom: 1px solid var(--line); padding: 5px 2px; font-family: inherit; font-size: 13.8px; }
.gf-option-row input:focus { outline: none; border-bottom-color: var(--accent); }
.gf-option-row .icon-btn-sm:hover { color: var(--red); }
.gf-add-option { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; cursor: pointer; padding: 4px 0; background: none; border: none; font-family: inherit; }
.gf-add-option .gf-option-bullet { border-style: dashed; }
.gf-add-option:hover { color: var(--ink); }
.gf-question-footer { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.gf-icon-btn { border: none; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 6px; display: flex; }
.gf-icon-btn:hover { background: var(--paper); color: var(--ink); }
.gf-icon-btn.gf-delete:hover { color: var(--red); }
.gf-footer-divider { width: 1px; align-self: stretch; background: var(--line); margin: 0 6px; }
.gf-required-toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.gf-switch { position: relative; display: inline-block; width: 34px; height: 20px; flex-shrink: 0; }
.gf-switch input { opacity: 0; width: 0; height: 0; }
.gf-switch .gf-slider { position: absolute; inset: 0; background: var(--line); border-radius: 999px; cursor: pointer; transition: background .15s; }
.gf-switch .gf-slider::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.gf-switch input:checked + .gf-slider { background: var(--accent); }
.gf-switch input:checked + .gf-slider::before { transform: translateX(14px); }
.gf-add-question-bar { display: flex; justify-content: center; }
.gf-add-question-bar .btn { border-radius: 999px; }
.gf-answer-static { border: none; border-bottom: 1px solid var(--line); padding: 8px 2px; font-size: 13.8px; width: 100%; background: transparent; font-family: inherit; color: var(--ink); }
.gf-answer-static:focus { outline: none; border-bottom-color: var(--accent); }
.gf-radio-option { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13.8px; }
.gf-view-meta { font-size: 11.5px; color: var(--muted); margin-top: -4px; }

/* ---------- Print style settings ---------- */
.print-style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.print-style-editor textarea { width: 100%; height: 480px; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12.3px; line-height: 1.5; resize: vertical; }
.print-preview-frame-wrap { background: #6b6b6b; border-radius: var(--radius); padding: 16px; }
.print-preview-frame-wrap iframe { width: 100%; height: 480px; border: none; border-radius: 4px; background: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.35); }
@media (max-width: 900px) {
  .print-style-grid { grid-template-columns: 1fr; }
}
