/* CareDenza Scheduling — admin uses corp-shared tokens; public is minimal */

:root {
  --fg: var(--corp-fg, #e2e8f0);
  --muted: var(--corp-fg-muted, #94a3b8);
  --bg: var(--corp-bg, #0f172a);
  --border: var(--corp-border, #334155);
  --surface: var(--corp-surface-alt, #1e293b);
  --link: var(--corp-link, #3b82f6);
  --pass: var(--corp-pass, #22c55e);
  --warn: var(--corp-warn, #f59e0b);
  --fail: var(--corp-fail, #ef4444);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, system-ui, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.45;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, .btn, .ghost { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.err { color: var(--fail); }
.warn { color: var(--warn); background: rgba(245,158,11,.1); padding: .75rem; border-radius: 8px; }
.spinner { color: var(--muted); padding: 1.5rem 0; }

main.content {
  padding: 1rem 1.5rem 3rem;
  max-width: 960px;
  margin: 0 auto;
}
.public-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}
.public-main-wide {
  max-width: min(1100px, 100%);
}
.content-wide {
  max-width: min(1100px, 100%);
}
.vote-identity {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}
@media (max-width: 560px) {
  .vote-identity { grid-template-columns: 1fr; }
}
.public-header {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.public-header h1 { margin: 0 0 .25rem; font-size: 1.35rem; }
.public-header .logo { width: 36px; height: 36px; }

.page-toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.page-toolbar h1 { margin: 0; font-size: 1.35rem; flex: 1; }

.btn, .ghost {
  border-radius: 6px;
  padding: .4rem .85rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  display: inline-block;
}
.btn.primary, .primary {
  background: var(--link);
  border-color: var(--link);
  color: #fff;
}
.btn.primary:hover { filter: brightness(1.08); text-decoration: none; }
.ghost:hover { background: var(--surface); }

.pill {
  display: inline-block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .15rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  vertical-align: middle;
}
.pill-open { color: var(--pass); border-color: var(--pass); }
.pill-closed { color: var(--muted); }
.pill-scheduled { color: var(--link); border-color: var(--link); }
.tag {
  font-size: .75rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1rem .35rem;
}

.event-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .85rem;
}
.event-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .85rem;
  background: var(--surface);
  color: inherit;
  display: block;
}
.event-card:hover { border-color: var(--link); text-decoration: none; }
.event-card-top { display: flex; gap: .4rem; margin-bottom: .4rem; }
.event-card-title { font-weight: 600; }

.wizard-steps { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.wstep {
  font-size: .75rem;
  text-transform: uppercase;
  color: var(--muted);
  padding: .2rem .5rem;
  border-radius: 4px;
  border: 1px solid transparent;
}
.wstep.active { color: var(--fg); border-color: var(--border); background: var(--surface); }

label {
  display: block;
  margin: .65rem 0;
  font-size: .9rem;
  color: var(--muted);
}
label input, label textarea, label select {
  display: block;
  width: 100%;
  margin-top: .25rem;
  padding: .45rem .55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
label textarea { min-height: 80px; resize: vertical; }
.chk { display: flex; align-items: center; gap: .4rem; color: var(--fg); }
.chk input { width: auto; margin: 0; }

.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }
.type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.type-card {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: var(--surface);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.type-card:hover { border-color: var(--link); }
.review { display: grid; grid-template-columns: 8rem 1fr; gap: .35rem .75rem; }
.review dt { color: var(--muted); }
.review dd { margin: 0; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: .5rem .85rem;
}
.tab.active { color: var(--fg); border-bottom-color: var(--link); }

.grid-tools { display: flex; gap: .5rem; align-items: center; margin: .75rem 0; flex-wrap: wrap; }

/* ── When2meet-style availability calendar ─────────────────── */
.cal-section-title {
  font-size: 1.05rem;
  margin: 1.25rem 0 0.5rem;
  font-weight: 600;
}
.cal-wrap {
  overflow: auto;
  max-height: min(70vh, 640px);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface, #fff);
  -webkit-overflow-scrolling: touch;
  user-select: none;
}
.cal-table {
  border-collapse: separate;
  border-spacing: 0;
  /* Shrink-wrap to columns — never stretch the time gutter across the page */
  width: max-content;
  max-width: none;
  table-layout: fixed;
  font-size: 0.8rem;
}
.cal-table th,
.cal-table td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}
/* Time gutter: fixed narrow column */
.cal-corner,
.cal-time {
  width: 4.5rem;
  min-width: 4.5rem;
  max-width: 4.5rem;
}
.cal-corner {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 3;
  background: var(--surface, #f8fafc);
  padding: 0.4rem 0.35rem;
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
}
/* Day columns: equal fixed width (scroll horizontally if many days) */
.cal-day {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface, #f8fafc);
  padding: 0.4rem 0.15rem;
  text-align: center;
  font-weight: 600;
  line-height: 1.15;
  width: 3.75rem;
  min-width: 3.75rem;
  max-width: 3.75rem;
}
.cal-dow {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 500;
}
.cal-dom {
  display: block;
  font-size: 0.78rem;
  color: var(--fg);
}
.cal-time {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface, #f8fafc);
  padding: 0 0.35rem;
  text-align: right;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
  height: 1.7rem;
  line-height: 1.7rem;
  overflow: hidden;
}
.cal-cell {
  width: 3.75rem;
  min-width: 3.75rem;
  max-width: 3.75rem;
  height: 1.7rem;
  padding: 0;
  text-align: center;
  vertical-align: middle;
  transition: background 0.08s ease;
}
.cal-cell.empty {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 3px,
    rgba(148, 163, 184, 0.12) 3px,
    rgba(148, 163, 184, 0.12) 6px
  );
}
.cal-cell.vote {
  cursor: pointer;
  background: var(--bg, #fff);
}
.cal-cell.vote:hover {
  background: color-mix(in srgb, var(--pass, #22c55e) 18%, var(--bg, #fff));
}
.cal-cell.vote.on {
  background: color-mix(in srgb, var(--pass, #22c55e) 72%, #166534);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pass, #22c55e) 80%, #000);
}
.cal-cell.vote.on .cal-dot {
  opacity: 1;
  background: #fff;
}
.cal-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  opacity: 0;
  background: transparent;
}
.cal-cell.heat {
  background: color-mix(in srgb, var(--pass, #22c55e) var(--i, 0%), var(--bg, #f1f5f9));
  cursor: default;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--fg);
}
.cal-cell.heat.has {
  cursor: pointer;
}
.cal-cell.heat.has:hover {
  outline: 2px solid var(--link);
  outline-offset: -2px;
}
.cal-n { opacity: 0.9; }
.cal-hint { margin: 0.5rem 0 0; }

/* Display timezone picker (Oodle-style) */
.tz-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  margin-top: 0.65rem;
}
.tz-picker-label {
  font-size: 0.8rem;
  color: var(--muted);
}
.tz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.tz-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg, #fff);
  color: var(--muted);
}
.tz-btn:hover { border-color: var(--link); color: var(--fg); }
.tz-btn.active {
  background: color-mix(in srgb, var(--link) 15%, var(--bg, #fff));
  border-color: var(--link);
  color: var(--link);
}
.tz-note { display: inline; }

/* Describe-in-English card */
.ai-card {
  margin: 0.85rem 0 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface, #f8fafc);
}
.ai-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}
.ai-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg);
}
.ai-card textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  resize: vertical;
  min-height: 2.75rem;
  background: var(--bg, #fff);
  color: var(--fg);
}
.ai-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.45rem;
}
.ai-card-foot p { margin: 0; flex: 1; min-width: 12rem; }
.ai-result {
  margin-top: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--pass, #22c55e) 12%, transparent);
}
.ai-result.err {
  background: color-mix(in srgb, var(--fail, #ef4444) 12%, transparent);
  color: var(--fail, #b91c1c);
}
.public-header-text { flex: 1; min-width: 0; }

/* Legacy chip grid (unused) kept harmless if any remnant */
.slot-grid { display: none; }

.leaderboard { padding-left: 1.25rem; }
.leaderboard li { margin: .45rem 0; }
.count { color: var(--pass); font-weight: 600; }

.heat {
  display: none; /* replaced by cal-table heat mode */
}
.heat-cell { display: none; }

.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data th, .data td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--border); }

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: .65rem 1rem;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  z-index: 100;
  max-width: 90vw;
}
.toast-err { border-color: var(--fail); color: #fecaca; }

body.public-shell #corp-nav { display: none !important; }

@media (max-width: 560px) {
  .type-cards { grid-template-columns: 1fr; }
  main.content { padding: 1rem; }
}
