:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #0c7493;
  --primary-dark: #0a607a;
  --primary-soft: #ecf6f9;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.topbar {
  grid-column: 1 / -1;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.topbar-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 600;
  text-decoration: none;
}

.topbar-logo img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.topbar-logo span {
  color: var(--primary-dark);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.host-pill,
.mode-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #d0e8ee;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.loading-panel {
  min-height: 420px;
  grid-column: 1 / -1;
  display: grid;
  place-content: center;
  gap: 16px;
  color: var(--muted);
  text-align: center;
}

.loader {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.meeting-panel {
  padding: 32px 28px;
  background: #f8fafc;
  border-right: 1px solid var(--line);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 34px;
}

.brand-symbol {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.company-name {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 600;
}

.meeting-title {
  margin: 0;
  font-size: 2rem;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: 0;
}

.meta-list {
  display: grid;
  gap: 14px;
  margin: 30px 0;
}

.meta-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 12px;
  align-items: start;
  color: var(--muted);
}

.meta-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--primary);
}

.meta-icon svg {
  width: 21px;
  height: 21px;
}

.meta-item strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
}

.partners {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.partner {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--primary);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.partner:nth-child(2) .avatar {
  background: #64748b;
}

.partner:nth-child(3) .avatar {
  background: var(--primary-dark);
}

.partner-name {
  display: block;
  font-weight: 600;
}

.partner-email {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.booking-panel {
  min-width: 0;
  padding: 32px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 28px;
}

.step {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

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

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 300px;
  gap: 28px;
  align-items: start;
}

.section-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0;
}

.calendar-toolbar,
.slots-header {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1.25rem;
  font-weight: 700;
}

.icon-button:hover {
  color: var(--primary-dark);
  border-color: var(--primary);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

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

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

.weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.day-cell {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 6px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid transparent;
  border-radius: 8px;
}

.day-cell.is-empty {
  background: transparent;
}

.day-cell.is-available {
  color: var(--text);
  background: #ffffff;
  border-color: var(--line);
}

.day-cell.is-selected {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.day-cell.is-available:hover {
  border-color: var(--primary);
}

.day-number {
  font-size: 1rem;
  font-weight: 700;
}

.day-count {
  position: absolute;
  right: 6px;
  bottom: 5px;
  color: var(--primary-dark);
  font-size: 0.68rem;
  font-weight: 700;
}

.day-cell.is-selected .day-count {
  color: #ffffff;
}

.slots-panel {
  min-width: 0;
}

.selected-date {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
}

.slot-list {
  display: grid;
  gap: 10px;
  max-height: 440px;
  overflow: auto;
  padding-right: 4px;
}

.slot-button {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--primary-dark);
  background: #ffffff;
  border: 1px solid #a1d2dd;
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
}

.slot-button:hover,
.slot-button.is-selected {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.empty-state {
  min-height: 170px;
  display: grid;
  place-items: center;
  padding: 22px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  text-align: center;
}

.form-panel {
  margin-top: 30px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.booking-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field.is-wide {
  grid-column: 1 / -1;
}

.field label {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
}

.field input,
.login-field input {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
}

.field input:focus,
.login-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(12, 116, 147, 0.14);
}

.primary-button {
  min-height: 48px;
  padding: 12px 18px;
  color: #ffffff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 8px;
  font-weight: 600;
}

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

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.form-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.error-message {
  color: var(--danger);
  font-weight: 600;
}

.success-panel {
  max-width: 660px;
  display: grid;
  gap: 18px;
}

.success-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--primary);
  border-radius: 8px;
  font-size: 1.5rem;
  font-weight: 700;
}

.success-panel h2 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0;
}

.success-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.secondary-link,
.secondary-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}

.login-page {
  min-height: 100vh;
  background: var(--bg);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 384px;
  display: grid;
  gap: 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

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

.login-brand img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.login-brand h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.875rem;
}

.login-field {
  display: grid;
  gap: 4px;
}

.login-field label {
  color: #334155;
  font-size: 0.875rem;
  font-weight: 500;
}

.login-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  color: #ffffff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.login-button:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.login-link,
.login-footnote {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.login-link {
  font-size: 0.75rem;
  text-decoration: none;
}

.login-link:hover,
.login-footnote a:hover {
  color: #334155;
  text-decoration: underline;
}

.login-footnote a {
  color: var(--primary-dark);
  text-decoration: none;
}

.secondary-link:hover,
.secondary-button:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.app-error {
  grid-column: 1 / -1;
  max-width: 680px;
  margin: auto;
  padding: 32px;
}

.app-error h1 {
  margin: 0 0 12px;
}

.app-error p {
  color: var(--muted);
}

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

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

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

  .slot-list {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .topbar-logo img {
    height: 36px;
  }

  .meeting-panel,
  .booking-panel {
    padding: 24px 18px;
  }

  .meeting-title {
    font-size: 1.55rem;
  }

  .stepper,
  .booking-form {
    grid-template-columns: 1fr;
  }

  .weekdays,
  .calendar-grid {
    gap: 5px;
  }

  .day-cell {
    min-height: 44px;
    aspect-ratio: auto;
  }

  .day-count {
    display: none;
  }

  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }
}
