:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f0f5f7;
  --text: #1d2730;
  --muted: #64717c;
  --line: #d8e0e6;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --secondary: #8f1d46;
  --blue: #2563eb;
  --amber: #b7791f;
  --danger: #b42318;
  --success: #147d54;
  --shadow: 0 18px 45px rgba(29, 39, 48, 0.1);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: var(--primary);
}

.svg-sprite {
  display: none;
}

.icon {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 420px);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: stretch;
  padding: clamp(1rem, 4vw, 3rem);
}

.auth-hero,
.auth-card,
.surface,
.event-card,
.mail-item,
.admin-table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-hero {
  padding: clamp(1.5rem, 4vw, 3rem);
  display: grid;
  align-content: space-between;
  gap: 2rem;
  min-height: 620px;
  overflow: hidden;
}

.brand-lockup {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: #e5f3f0;
  color: var(--primary);
  border: 1px solid #c3ded9;
  border-radius: var(--radius);
}

.brand-text strong {
  display: block;
  font-size: 1rem;
}

.brand-text span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

.auth-copy h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 1;
  font-weight: 760;
}

.auth-copy p {
  max-width: 650px;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.6;
}

.lab-visual {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  align-items: stretch;
}

.visual-board,
.visual-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  min-height: 220px;
  padding: 1rem;
}

.visual-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 36px;
  gap: 0.55rem;
}

.visual-cell {
  border-radius: 6px;
  border: 1px solid #cfd9df;
  background: #ffffff;
}

.visual-cell.is-on {
  background: #cdebe5;
  border-color: #8ccbc1;
}

.visual-cell.is-warn {
  background: #f8dfc0;
  border-color: #e0b16d;
}

.visual-panel {
  display: grid;
  align-content: center;
  gap: 0.75rem;
}

.visual-line {
  height: 12px;
  border-radius: 999px;
  background: #d8e0e6;
}

.visual-line.short {
  width: 58%;
  background: #0f766e;
}

.visual-line.mid {
  width: 76%;
  background: #8f1d46;
}

.visual-line.long {
  width: 92%;
}

.auth-card {
  padding: clamp(1.2rem, 3vw, 2rem);
  align-self: center;
}

.auth-card h2,
.surface h2,
.view-heading h1 {
  margin: 0;
}

.auth-card p,
.helper-text,
.empty-state,
.meta,
.small-note {
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field label,
.field .label {
  color: #34414c;
  font-weight: 680;
  font-size: 0.92rem;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd6dd;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0.65rem 0.75rem;
  outline: none;
}

.textarea {
  min-height: 112px;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.button,
.icon-button,
.nav-button {
  border: 1px solid transparent;
  border-radius: 7px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  white-space: nowrap;
}

.button {
  padding: 0.62rem 0.9rem;
  font-weight: 720;
}

.button.primary {
  background: var(--primary);
  color: #fff;
}

.button.primary:hover {
  background: var(--primary-strong);
}

.button.secondary {
  color: var(--primary);
  background: #e8f5f2;
  border-color: #b8ddd7;
}

.button.neutral {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.button.danger,
.icon-button.danger {
  color: var(--danger);
  background: #fff5f4;
  border-color: #f2bbb7;
}

.button.full {
  width: 100%;
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.demo-credentials {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.8rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 0.9rem;
}

.app-frame {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.nav-list {
  display: grid;
  gap: 0.4rem;
}

.nav-button {
  width: 100%;
  justify-content: flex-start;
  padding: 0.68rem 0.75rem;
  background: transparent;
  color: #34414c;
  font-weight: 680;
}

.nav-button.is-active,
.nav-button:hover {
  background: #ecf5f3;
  color: var(--primary);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 0.75rem;
}

.user-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem;
  display: grid;
  gap: 0.2rem;
}

.user-chip strong {
  overflow-wrap: anywhere;
}

.user-chip span {
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.main {
  min-width: 0;
  padding: clamp(1rem, 3vw, 2rem);
}

.view-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.view-heading h1 {
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.view-heading p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.schedule-grid {
  display: grid;
  grid-template-columns: minmax(320px, 470px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.surface,
.event-card,
.mail-item {
  padding: 1rem;
}

.surface-header,
.event-card-header,
.mail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.surface-header {
  margin-bottom: 1rem;
}

.surface-header p {
  margin: 0.25rem 0 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat {
  min-height: 86px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem;
  display: grid;
  align-content: space-between;
}

.stat span {
  color: var(--muted);
  font-size: 0.86rem;
}

.stat strong {
  font-size: 1.65rem;
}

.slot-builder {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 40px;
  gap: 0.5rem;
  align-items: end;
}

.slot-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.slot-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  padding: 0.45rem 0.45rem 0.45rem 0.75rem;
}

.slot-pill span {
  overflow-wrap: anywhere;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.checkbox-row input {
  margin-top: 0.22rem;
}

.events-stack,
.mail-list {
  display: grid;
  gap: 0.85rem;
}

.event-card {
  box-shadow: none;
}

.event-title {
  margin: 0;
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 28px;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 760;
  white-space: nowrap;
}

.badge.open {
  color: #1d4ed8;
  background: #e8f0ff;
}

.badge.ready {
  color: var(--primary);
  background: #e4f5f1;
}

.badge.confirmed {
  color: var(--success);
  background: #e8f6ed;
}

.badge.conflict {
  color: var(--danger);
  background: #fff0ef;
}

.badge.role-admin {
  color: #7c2d12;
  background: #fff1dc;
}

.badge.role-user {
  color: #1d4ed8;
  background: #e8f0ff;
}

.progress-wrap {
  margin: 0.9rem 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--primary);
}

.event-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.75rem 0;
}

.meta-box {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.65rem;
  background: #fbfcfd;
}

.meta-box strong {
  display: block;
  font-size: 0.86rem;
  margin-bottom: 0.25rem;
}

.meta-box span,
.meta-box a {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.slot-results {
  display: grid;
  gap: 0.45rem;
  margin: 0.9rem 0;
}

.slot-result-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0.55rem 0.65rem;
}

.answer-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.count {
  min-width: 38px;
  text-align: center;
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
  font-weight: 760;
  font-size: 0.8rem;
}

.count.yes {
  background: #e8f6ed;
  color: var(--success);
}

.count.maybe {
  background: #fff1dc;
  color: #9a5c00;
}

.count.no {
  background: #fff0ef;
  color: var(--danger);
}

.guest-list,
.link-list {
  display: grid;
  gap: 0.45rem;
  margin: 0.75rem 0;
  padding: 0;
  list-style: none;
}

.guest-row,
.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.55rem 0.65rem;
  background: #fbfcfd;
}

.guest-row span,
.link-row span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.guest-status {
  font-weight: 760;
  font-size: 0.82rem;
}

.guest-status.done {
  color: var(--success);
}

.guest-status.waiting {
  color: var(--amber);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.9rem;
}

details.response-links {
  margin-top: 0.75rem;
}

details.response-links summary {
  color: var(--primary);
  cursor: pointer;
  font-weight: 720;
}

.response-page {
  min-height: 100vh;
  padding: clamp(1rem, 4vw, 3rem);
  display: grid;
  place-items: center;
}

.response-panel {
  width: min(940px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 3vw, 2rem);
}

.response-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.response-header h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
}

.choice-grid {
  display: grid;
  gap: 0.8rem;
  margin: 1rem 0;
}

.choice-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(250px, 420px);
  gap: 1rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}

.choice-row strong {
  overflow-wrap: anywhere;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  min-height: 40px;
}

.segmented label {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0.55rem;
  background: #fff;
  border-right: 1px solid var(--line);
  color: #34414c;
  font-weight: 680;
}

.segmented label:last-child {
  border-right: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label:has(input:checked) {
  background: #e4f5f1;
  color: var(--primary);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.admin-table-wrap {
  overflow: auto;
  box-shadow: none;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  color: #34414c;
  background: #f8fafc;
  font-size: 0.86rem;
}

.table-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

.mail-item {
  box-shadow: none;
}

.mail-header h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.mail-body {
  margin: 0.75rem 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.empty-state {
  border: 1px dashed #b8c5ce;
  border-radius: var(--radius);
  padding: 1rem;
  background: #ffffff;
}

.toast-root,
#toast-root {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  display: grid;
  gap: 0.5rem;
  max-width: min(420px, calc(100vw - 2rem));
}

.toast {
  background: #1d2730;
  color: #fff;
  padding: 0.75rem 0.9rem;
  border-radius: 7px;
  box-shadow: var(--shadow);
}

@media (max-width: 1060px) {
  .auth-page,
  .schedule-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: auto;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-button {
    justify-content: center;
  }

  .lab-visual,
  .event-meta-grid,
  .choice-row {
    grid-template-columns: 1fr;
  }

  .slot-builder {
    grid-template-columns: 1fr 1fr;
  }

  .slot-builder .field:first-child {
    grid-column: 1 / -1;
  }

  .slot-builder .icon-button {
    width: 100%;
  }

  .response-header,
  .view-heading,
  .event-card-header,
  .surface-header,
  .mail-header {
    display: grid;
  }
}

@media (max-width: 520px) {
  .auth-page,
  .main,
  .response-page {
    padding: 0.75rem;
  }

  .stats-grid,
  .nav-list,
  .slot-builder {
    grid-template-columns: 1fr;
  }

  .guest-row,
  .link-row,
  .slot-result-row {
    grid-template-columns: 1fr;
  }

  .answer-counts {
    justify-content: flex-start;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .segmented label {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .segmented label:last-child {
    border-bottom: 0;
  }
}
