:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --text: #17202a;
  --muted: #667085;
  --line: #d7dee8;
  --primary: #24546f;
  --primary-dark: #193b4e;
  --primary-soft: #e6f1f6;
  --danger: #a93636;
  --success: #27734d;
  --shadow: 0 18px 45px rgba(24, 38, 52, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

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

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

.sidebar {
  background: #12202b;
  color: #f7fbff;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand-mark {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #dfeaf1;
  color: #12202b;
  font-weight: 800;
}

.logo-icon {
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.logo-icon img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}

.brand-mark strong,
.brand-mark small {
  display: block;
}

.brand-mark small,
.side-note p {
  color: #b9c5d0;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #d9e4ec;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-tab.active,
.nav-tab:hover {
  background: #203343;
  border-color: #385366;
  color: #ffffff;
}

.nav-tab:hover {
  transform: translateX(2px);
}

.side-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid #2b4356;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.side-note p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.auth-box {
  display: grid;
  gap: 8px;
  border: 1px solid #2b4356;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
}

.auth-box strong,
.auth-box small {
  display: block;
}

.auth-box small {
  color: #b9c5d0;
}

.workspace {
  padding: 34px;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.institution-header {
  display: none;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: 0 10px 28px rgba(24, 38, 52, 0.06);
}

.institution-logo {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  flex: 0 0 auto;
}

.institution-logo img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.institution-header span,
.institution-header strong {
  display: block;
}

.institution-header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.institution-header strong {
  color: var(--primary-dark);
  font-size: 20px;
  margin-top: 3px;
}

body.public-only .app-shell,
body.gate-only .app-shell {
  display: block;
}

body.public-only .sidebar,
body.gate-only .sidebar {
  display: none;
}

body.public-only .workspace,
body.gate-only .workspace {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 18px;
}

body.public-only .institution-header,
body.gate-only .institution-header {
  display: flex;
}

body.public-only #booking .view-header {
  align-items: start;
}

body.public-only #booking-title::after {
  content: "";
  display: block;
  width: 72px;
  height: 4px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--primary);
}

body.gate-only #gate {
  max-width: 1180px;
  margin: 0 auto;
}

.view {
  display: none;
  min-width: 0;
  opacity: 0;
  transform: translateY(10px);
}

.view.active {
  display: block;
  animation: viewEnter 0.24s ease forwards;
}

@keyframes viewEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  min-width: 0;
}

.agenda-switcher {
  display: grid;
  gap: 8px;
  min-width: min(420px, 100%);
}

.agenda-switcher label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.agenda-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.agenda-actions .ghost-action {
  min-height: 38px;
  padding: 0 10px;
}

.agenda-home-active .agenda-switcher {
  display: none;
}

.builder-intro {
  display: none;
}

.builder-active .builder-intro {
  display: block;
}

.builder-active .teacher-tabs {
  display: none;
}

.builder-active .teacher-panel-layout {
  display: grid;
  gap: 16px;
}

.builder-active #teacher-agendas {
  display: none;
}

.builder-active .teacher-pane:not(#teacher-agendas) {
  display: block;
}

.builder-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.builder-summary span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: #344054;
  padding: 12px;
}

.builder-summary strong {
  display: block;
  color: var(--primary-dark);
  font-size: 22px;
}

.agenda-home-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 240px));
  gap: 10px;
  margin-bottom: 16px;
}

.agenda-home-actions .primary-action {
  margin-top: 0;
}

.agenda-home-actions .ghost-action.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.agenda-card-grid {
  display: grid;
  gap: 12px;
}

.agenda-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.agenda-card:hover {
  border-color: color-mix(in srgb, var(--primary) 46%, var(--line));
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.agenda-card.open {
  border-left: 5px solid #23905a;
}

.agenda-card.closed {
  border-left: 5px solid #9aa7b4;
}

.agenda-card.trashed {
  border-left: 5px solid #8c2d2d;
  background: #fbf7f7;
  opacity: 0.92;
}

.agenda-trash-title {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}

.agenda-card h3 {
  margin: 8px 0 6px;
  font-size: 20px;
}

.agenda-card p {
  margin-bottom: 8px;
  color: #526174;
}

.agenda-card small {
  color: var(--muted);
}

.agenda-card-qr {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.agenda-card-qr img {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 6px;
}

.agenda-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.agenda-metrics span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: #344054;
  padding: 8px 10px;
}

.agenda-metrics strong {
  color: var(--primary-dark);
  font-size: 18px;
}

.agenda-access-actions,
.agenda-card-actions {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.agenda-access-actions {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.agenda-card-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.agenda-access-actions .primary-action,
.agenda-access-actions .ghost-action,
.agenda-card-actions .primary-action,
.agenda-card-actions .ghost-action {
  width: 100%;
  margin-top: 0;
}

.date-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.date-choice {
  display: grid;
  gap: 4px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #243244;
  cursor: pointer;
  padding: 12px;
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.date-choice strong {
  color: var(--primary-dark);
  font-size: 17px;
}

.date-choice span {
  color: var(--muted);
  font-weight: 700;
}

.date-choice.active,
.date-choice:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.date-choice:hover {
  transform: translateY(-1px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
}

h2 {
  font-size: 19px;
}

.panel,
.banner-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: panelEnter 0.28s ease both;
}

.panel {
  padding: 22px;
}

.login-panel {
  max-width: 520px;
  margin-bottom: 22px;
}

.login-panel form {
  display: grid;
  gap: 14px;
}

.credential-card {
  display: grid;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line));
  border-radius: 8px;
  background: var(--primary-soft);
  padding: 14px;
}

.credential-card span {
  color: #344054;
  font-weight: 700;
}

.link-action {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.gate-list {
  display: grid;
  gap: 12px;
}

.gate-date-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto)) minmax(160px, 220px);
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.gate-date-option {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--primary-dark);
  cursor: pointer;
  font-weight: 800;
  padding: 0 12px;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.gate-date-option.active,
.gate-date-option:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.gate-date-option:hover {
  transform: translateY(-1px);
}

.gate-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.gate-card strong,
.gate-card span,
.gate-card small {
  display: block;
}

.gate-card span,
.gate-card small {
  color: var(--muted);
  margin-top: 4px;
}

.gate-card.next {
  border-color: #23905a;
  background: #e9f9ef;
  box-shadow: 0 12px 28px rgba(35, 144, 90, 0.16);
}

.gate-card.today,
.gate-card.ontime {
  border-color: #78b996;
  background: #f1fbf5;
}

.gate-card.other {
  border-color: #e2c26b;
  background: #fffaf0;
}

.gate-card.late {
  border-color: #e6a23c;
  background: #fff7e8;
}

.gate-card.overdue {
  border-color: #d34b4b;
  background: #fff0f0;
}

.gate-card.arrived {
  border-color: #9cb8ce;
  background: #f1f6fa;
}

.gate-card.cancelled {
  background: #f4f6f8;
  opacity: 0.72;
}

.gate-status {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.gate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: end;
}

.consult-list {
  display: grid;
  gap: 10px;
}

.consult-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1.2fr) minmax(180px, 0.9fr);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.consult-card.cancelled {
  background: #f4f6f8;
  opacity: 0.72;
}

.consult-time {
  display: grid;
  gap: 6px;
}

.consult-time strong {
  color: var(--primary-dark);
  font-size: 22px;
  line-height: 1;
}

.consult-time span {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.consult-main,
.consult-meta {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.consult-main strong,
.consult-main span,
.consult-meta span,
.consult-meta small {
  overflow-wrap: anywhere;
}

.consult-main span,
.consult-meta span,
.consult-meta small {
  color: var(--muted);
}

.print-report {
  display: none;
}

.print-report-head {
  border-bottom: 2px solid #17202a;
  margin-bottom: 16px;
  padding-bottom: 10px;
}

.print-report-head p,
.print-report-head h1,
.print-report-head span {
  margin: 0;
}

.print-report-head p {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.print-report-head h1 {
  margin-top: 4px;
  font-size: 22px;
}

.print-report-head span {
  display: block;
  margin-top: 6px;
  color: #344054;
  font-size: 12px;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.print-table th,
.print-table td {
  border: 1px solid #9aa7b5;
  padding: 7px 6px;
  text-align: left;
  vertical-align: top;
}

.print-table th {
  background: #eef2f6;
  font-weight: 800;
}

.print-check {
  display: inline-block;
  width: 17px;
  height: 17px;
  border: 2px solid #17202a;
}

.print-empty {
  border: 1px solid #9aa7b5;
  padding: 16px;
  font-weight: 800;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

@keyframes panelEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.banner-card {
  padding: 12px;
  margin-bottom: 22px;
}

.banner {
  min-height: 220px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(12, 24, 36, 0.82), rgba(12, 24, 36, 0.18)),
    linear-gradient(135deg, var(--primary), #6d8797);
  background-size: cover;
  background-position: center;
  color: #ffffff;
  display: flex;
  align-items: end;
  padding: 30px;
  overflow: hidden;
}

.banner p {
  margin-bottom: 8px;
  color: #eaf3f8;
  font-weight: 700;
}

.banner h2 {
  margin: 0;
  font-size: 34px;
  max-width: 820px;
}

.banner .banner-description {
  max-width: 760px;
  margin: 12px 0 0;
  color: #f4f8fb;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
}

.small-banner {
  min-height: 130px;
  margin: 14px 0 2px;
}

.small-banner h2 {
  font-size: 24px;
}

.small-banner .banner-description {
  font-size: 14px;
}

.booking-grid,
.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 22px;
  align-items: start;
  min-width: 0;
}

.teacher-panel-layout {
  min-width: 0;
}

.teacher-pane {
  display: none;
}

.teacher-pane.active {
  display: block;
  animation: panelEnter 0.24s ease both;
}

.teacher-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 18px;
  min-width: 0;
}

.teacher-tab {
  max-width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  cursor: pointer;
  font-weight: 800;
  padding: 0 14px;
  overflow-wrap: anywhere;
  white-space: normal;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.teacher-tab.active,
.teacher-tab:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.teacher-tab:hover {
  transform: translateY(-1px);
}

.section-title {
  margin-bottom: 18px;
}

.section-title p,
.compact-panel p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0;
}

.tighter {
  margin-top: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-weight: 700;
}

.field-row {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  min-width: 0;
}

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

.field-row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
}

.control:focus {
  outline: 3px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-color: var(--primary);
}

.compact {
  max-width: 360px;
}

.color-control {
  padding: 4px;
}

.compact-color {
  max-width: 210px;
  margin: 14px 0 0;
}

.file-control {
  padding: 9px;
}

.image-bank {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.image-choice {
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 8px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.image-choice.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.image-choice:hover {
  transform: translateY(-1px);
}

.image-choice img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 8px;
}

.image-choice strong {
  display: block;
  color: #344054;
  font-size: 13px;
}

.block-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  margin-bottom: 12px;
}

.block-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.availability-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 16px;
  margin-bottom: 14px;
  display: grid;
  gap: 14px;
}

.mini-label {
  display: block;
  color: #344054;
  margin-bottom: 8px;
}

.day-mode-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  min-width: 0;
}

.day-mode {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  cursor: pointer;
  font-weight: 800;
  padding: 0 10px;
  overflow-wrap: anywhere;
  white-space: normal;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.day-mode.active,
.day-mode:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.day-mode:hover {
  transform: translateY(-1px);
}

.compact-days {
  display: none;
  margin-top: 4px;
}

.compact-days.visible {
  display: grid;
}

.advanced-dates {
  margin-top: 10px;
}

.advanced-dates summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 800;
}

.advanced-dates .field-row {
  margin-top: 12px;
}

.quick-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.quick-block {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  cursor: pointer;
  font-weight: 800;
  padding: 0 12px;
}

.quick-block:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.visual-block-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  color: #344054;
  font-weight: 800;
}

.slot-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.slot-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.slot-legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--line);
}

.legend-free {
  background: #ffffff;
}

.legend-blocked {
  background: var(--primary);
}

.legend-booked {
  background: #f4d7d7;
}

.visual-block-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
}

#visual-block-grid {
  grid-template-columns: 1fr;
}

.visual-slot {
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.visual-slot.blocked {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.visual-slot.booked {
  background: #f4d7d7;
  border-color: #d89a9a;
  color: #8c2d2d;
  cursor: not-allowed;
}

.visual-slot:not(.booked):hover {
  transform: translateY(-1px);
}

.full-width {
  width: 100%;
  margin-top: 12px;
}

.align-end {
  align-self: end;
}

.weekday-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.date-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  margin-top: 10px;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  min-height: 34px;
  padding: 0 8px 0 12px;
  font-weight: 700;
}

.date-chip button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: #f4e8e8;
  color: #8c2d2d;
  cursor: pointer;
  font-weight: 800;
}

.calendar-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  margin-bottom: 14px;
}

.calendar-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.calendar-preview-head span {
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 800;
}

.planner-calendar {
  display: grid;
  gap: 10px;
  max-width: 470px;
}

.planner-calendar-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
}

.planner-calendar-head strong {
  color: var(--primary-dark);
  font-size: 17px;
  text-align: center;
}

.planner-calendar-head .ghost-action {
  min-height: 38px;
  padding: 0 10px;
  font-size: 0;
}

.planner-calendar-head .ghost-action::first-letter {
  font-size: 0;
}

#calendar-prev::after,
#calendar-next::after {
  display: inline;
  font-size: 18px;
  line-height: 1;
}

#calendar-prev::after {
  content: "<";
}

#calendar-next::after {
  content: ">";
}

.planner-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.quick-date {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--primary-dark);
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}

.quick-date:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.planner-weekdays,
.planner-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.planner-weekdays span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #243244;
  cursor: pointer;
  font-weight: 900;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.calendar-day span {
  font-size: 13px;
}

.calendar-day.empty {
  border: 0;
  background: transparent;
  pointer-events: none;
}

.calendar-day.today {
  border-color: #9cb8ce;
}

.calendar-day.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.calendar-day:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

#teacher-availability .field-row.three label:nth-child(1),
#teacher-availability .field-row.three label:nth-child(2),
#teacher-availability .day-mode-group,
#teacher-availability .mini-label,
#teacher-availability #custom-weekdays,
#teacher-availability .advanced-dates,
#teacher-availability .calendar-preview,
#teacher-availability .block-panel > .field-row,
#teacher-availability .quick-blocks {
  display: none;
}

#teacher-availability .field-row.three {
  grid-template-columns: minmax(160px, 260px);
}

#teacher-availability .field-row.two {
  margin-top: 0;
}

.blocked-day {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.blocked-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.blocked-day-head span {
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.visual-block-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
}

.blocked-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 4px;
}

.blocked-group {
  display: grid;
  gap: 10px;
}

.blocked-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #344054;
  font-weight: 800;
}

.blocked-count {
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 5px 10px;
  font-size: 13px;
}

.blocked-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.blocked-item strong,
.blocked-item span {
  display: block;
}

.blocked-item span {
  color: var(--muted);
  margin-top: 4px;
}

.remove-block {
  border: 0;
  border-radius: 8px;
  background: #f4e8e8;
  color: #8c2d2d;
  cursor: pointer;
  font-weight: 800;
  min-height: 36px;
  padding: 0 12px;
}

.inline-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 10px;
  color: #344054;
}

.inline-heading span {
  color: var(--muted);
}

.slot-list {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.slot-period {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  animation: panelEnter 0.22s ease both;
}

.slot-period-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.slot-period-header strong {
  color: #344054;
}

.slot-period-header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}

.slot-card {
  min-height: 58px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, var(--surface-soft));
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
  display: grid;
  align-content: center;
  gap: 2px;
  text-align: left;
  padding: 10px 12px;
  box-shadow: 0 8px 18px rgba(24, 38, 52, 0.05);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.slot-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.slot-card.active,
.slot-card:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.slot-card.active small,
.slot-card:hover small {
  color: #eaf3f8;
}

.empty-state {
  padding: 14px;
  border-radius: 8px;
  background: #fff7ed;
  color: #8a4b12;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state span {
  margin-top: 4px;
}

.dynamic-fields {
  display: grid;
  gap: 14px;
}

.booking-summary {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: #344054;
}

.booking-summary strong {
  color: var(--text);
  margin-bottom: 2px;
}

.primary-action,
.ghost-action,
.mini-action {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.primary-action {
  width: 100%;
  min-height: 46px;
  background: var(--primary);
  color: #ffffff;
  margin-top: 18px;
}

.save-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin-top: 18px;
}

.editor-save-bar {
  position: sticky;
  bottom: 14px;
  z-index: 5;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 12px;
}

.editor-save-bar .form-message {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.agenda-home-active .editor-save-bar {
  display: none;
}

.save-actions .primary-action {
  margin-top: 0;
}

.primary-action:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.primary-action:disabled,
.ghost-action:disabled,
.mini-action:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.ghost-action:hover,
.mini-action:hover {
  transform: translateY(-1px);
}

.ghost-action {
  min-height: 42px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--primary);
  border: 1px solid var(--line);
}

.mini-action {
  min-height: 32px;
  padding: 0 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  white-space: nowrap;
}

.form-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--success);
  font-weight: 700;
}

.form-message.error {
  color: var(--danger);
}

.booking-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.booking-progress {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.booking-progress li {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.booking-progress li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 38px;
  right: 12px;
  top: 15px;
  height: 2px;
  background: var(--line);
  z-index: 0;
}

.booking-progress li > span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}

.booking-progress strong {
  position: relative;
  z-index: 1;
  display: block;
  overflow: hidden;
  background: var(--surface);
  padding-right: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.booking-progress li.active {
  color: var(--primary-dark);
}

.booking-progress li.active > span {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.booking-progress li.completed {
  color: var(--primary-dark);
}

.booking-progress li.completed > span {
  border-color: #b8d8c7;
  background: #effaf3;
  color: var(--success);
}

.booking-progress li.completed > span::before {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
}

.booking-progress li.completed > span {
  font-size: 0;
}

.mode-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  cursor: pointer;
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.mode-button.active,
.mode-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.manage-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  margin-bottom: 18px;
}

.danger-action {
  color: #8c2d2d;
  background: #f4e8e8;
}

.accent-action {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.accent-action:hover {
  background: var(--primary-dark);
  color: #ffffff;
}

.manage-current {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #c7d6e3;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: #ffffff;
}

.manage-current strong {
  color: var(--primary-dark);
  font-size: 16px;
}

.manage-current span {
  font-weight: 800;
  color: var(--text);
}

.manage-current small {
  color: var(--muted);
  font-weight: 700;
}

.confirmation-card {
  margin-top: 14px;
  border: 1px solid #b8d8c7;
  border-radius: 8px;
  background: #effaf3;
  color: #1f6b45;
  padding: 16px;
  animation: panelEnter 0.25s ease both;
}

.confirmation-card span {
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.confirmation-card strong {
  display: block;
  font-size: 34px;
  line-height: 1;
  margin: 7px 0;
  letter-spacing: 1px;
}

.confirmation-card p {
  margin: 0 0 12px;
  color: #285d42;
  line-height: 1.45;
}

.confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 320px;
  border: 1px solid #b8d8c7;
  border-radius: 8px;
  background: #effaf3;
  color: #1f6b45;
  box-shadow: 0 18px 40px rgba(24, 38, 52, 0.16);
  padding: 13px 15px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.closed-notice {
  border: 1px solid #e3b7b7;
  border-radius: 8px;
  background: #fff1f1;
  color: #7d2525;
  padding: 14px;
  margin-bottom: 18px;
}

.closed-notice strong {
  display: block;
  margin-bottom: 6px;
}

.closed-notice p {
  margin: 0;
  line-height: 1.45;
}

.status-preview {
  margin: 12px 0 0;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 12px;
  color: #344054;
  font-weight: 800;
}

.status-preview.open {
  color: var(--success);
}

.status-preview.closed {
  color: var(--danger);
}

.stat-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.stat-list span {
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.stat-list strong {
  display: block;
  font-size: 26px;
  color: var(--primary);
}

.field-config-list {
  display: grid;
  gap: 10px;
}

.field-config-item {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #344054;
}

.check-label input {
  width: 18px;
  height: 18px;
}

.table-wrap {
  overflow-x: auto;
}

.appointment-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.appointment-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.appointment-stat strong {
  display: block;
  color: var(--primary);
  font-size: 24px;
}

.appointment-stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.appointment-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.share-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 136px;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  margin-bottom: 14px;
}

.share-card strong,
.share-card span {
  display: block;
}

.share-card span {
  color: var(--muted);
  margin: 5px 0 10px;
}

.qr-box {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}

.qr-box img {
  width: 116px;
  height: 116px;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.share-actions .ghost-action {
  width: auto;
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.status-pill.active {
  background: #e9f9ef;
  color: #17623c;
}

.status-pill.scheduled {
  background: #edf4ff;
  color: #215184;
}

.status-pill.pending {
  background: #fff7e8;
  color: #9a5b12;
}

.status-pill.trash {
  background: #f4e8e8;
  color: #8c2d2d;
}

.status-pill.cancelled {
  background: #f4e8e8;
  color: #8c2d2d;
}

.status-pill.denied {
  background: #f7e9dc;
  color: #8a3f11;
}

.status-pill.next,
.status-pill.today {
  background: #dff7e9;
  color: #17633c;
}

.status-pill.late {
  background: #fff0cf;
  color: #8a5600;
}

.status-pill.overdue {
  background: #ffe1e1;
  color: #9c2929;
}

.status-pill.arrived {
  background: #e5eef6;
  color: #31546d;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

.appointment-row-denied td {
  background: #fff4eb;
  color: #6f3412;
}

.appointment-row-denied td:first-child {
  border-left: 4px solid #c76a24;
}

.appointment-row-cancelled td {
  background: #f4f6f8;
  color: #667085;
}

th {
  color: #475467;
  font-size: 13px;
  background: var(--surface-soft);
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 16px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.summary-card:hover {
  border-color: #b8c6d5;
  transform: translateY(-1px);
}

.summary-card.inactive-professor {
  background: #f5f6f8;
  opacity: 0.78;
}

.summary-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.professor-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.professor-card-actions .primary-action,
.professor-card-actions .ghost-action {
  width: auto;
  margin-top: 0;
}

.professor-edit-card {
  display: grid;
  gap: 10px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.summary-card strong {
  display: block;
  margin-bottom: 8px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}

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

  .sidebar {
    position: static;
    padding: 18px;
  }

  .nav-tabs {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .side-note {
    display: none;
  }

  .workspace {
    padding: 22px;
  }

  .booking-grid,
  .admin-layout,
  .field-row.two,
  .field-row.three {
    grid-template-columns: 1fr;
  }

  .appointment-stats,
  .appointment-tools,
  .gate-date-tools {
    grid-template-columns: 1fr;
  }

  .share-card {
    grid-template-columns: 1fr;
  }

  .qr-box {
    justify-self: start;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 14px;
  }

  .institution-header {
    align-items: center;
    padding: 10px;
  }

  .institution-logo {
    width: 52px;
    height: 52px;
  }

  .institution-logo img {
    width: 43px;
    height: 43px;
  }

  .institution-header span {
    font-size: 11px;
  }

  .institution-header strong {
    font-size: 17px;
  }

  .view-header {
    display: grid;
    align-items: start;
  }

  .agenda-switcher {
    width: 100%;
    min-width: 0;
  }

  .agenda-home-actions,
  .agenda-actions {
    grid-template-columns: 1fr;
  }

  .builder-summary,
  .planner-quick-actions {
    grid-template-columns: 1fr;
  }

  .planner-calendar {
    max-width: 100%;
  }

  .planner-calendar-head {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .calendar-day {
    min-height: 38px;
  }

  .agenda-card {
    grid-template-columns: 1fr;
  }

  .agenda-card-qr {
    justify-items: start;
  }

  .agenda-access-actions,
  .agenda-card-actions {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 25px;
  }

  .banner {
    min-height: 170px;
    padding: 20px;
  }

  .banner h2 {
    font-size: 24px;
  }

  .nav-tabs {
    grid-template-columns: 1fr;
  }

  .booking-progress {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .booking-progress li {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .booking-progress li:not(:last-child)::after {
    left: 14px;
    right: auto;
    top: 31px;
    width: 2px;
    height: 10px;
  }

  .booking-progress li > span {
    width: 28px;
    height: 28px;
  }

  .booking-progress strong {
    white-space: normal;
  }

  .day-mode-group {
    grid-template-columns: 1fr;
  }

  .field-config-item {
    grid-template-columns: 1fr;
  }

  .save-actions {
    grid-template-columns: 1fr;
  }

  .gate-card,
  .consult-card {
    grid-template-columns: 1fr;
  }

  .gate-status,
  .consult-time,
  .consult-meta {
    justify-items: start;
  }

  .gate-actions {
    justify-content: start;
  }

  .consult-time strong {
    font-size: 26px;
  }

  .toast {
    right: 14px;
    left: 14px;
    bottom: 14px;
    max-width: none;
  }

  .summary-card-head,
  .professor-card-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .professor-card-actions .primary-action,
  .professor-card-actions .ghost-action {
    width: 100%;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  body.printing {
    background: #ffffff;
    color: #17202a;
  }

  body.printing .app-shell,
  body.printing .toast {
    display: none !important;
  }

  body.printing .print-report {
    display: block !important;
  }

  body.printing .print-table {
    min-width: 0;
  }
}
