:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --panel: #ffffff;
  --line: #d9e2e7;
  --text: #17202a;
  --muted: #687888;
  --brand: #0b7f78;
  --brand-dark: #075f5a;
  --blue: #2563a8;
  --danger: #b42318;
  --soft: #eef7f6;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

.agenda-auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.agenda-auth {
  width: min(100%, 420px);
}

.agenda-auth-panel {
  display: grid;
  gap: 18px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(23, 32, 42, 0.08);
}

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

.agenda-auth-brand img {
  width: 92px;
  max-height: 44px;
  object-fit: contain;
}

.agenda-auth-brand span,
.agenda-eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.agenda-auth-panel h1,
.agenda-toolbar h1 {
  margin: 0;
  letter-spacing: 0;
}

.agenda-auth-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.agenda-auth-panel input,
.agenda-date-picker input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.agenda-button,
.agenda-icon-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 13px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

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

.agenda-button.primary:hover,
.agenda-button.primary:focus {
  background: var(--brand-dark);
}

.agenda-button.secondary,
.agenda-icon-button {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.agenda-button.secondary:hover,
.agenda-icon-button:hover {
  border-color: #afc1cb;
}

.agenda-alert {
  margin: 0;
  padding: 11px 13px;
  border-radius: 6px;
  font-weight: 700;
}

.agenda-alert.error {
  background: #fff1f0;
  color: var(--danger);
  border: 1px solid #ffd2cc;
}

.agenda-topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.agenda-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.agenda-brand img {
  width: 108px;
  max-height: 42px;
  object-fit: contain;
}

.agenda-brand small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.agenda-topbar nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.agenda-topbar nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  text-decoration: none;
  font-weight: 800;
  color: var(--muted);
}

.agenda-layout {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 40px;
  display: grid;
  gap: 18px;
}

.agenda-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.agenda-date-picker {
  display: grid;
  grid-template-columns: 40px minmax(150px, 1fr) 40px auto;
  gap: 8px;
  align-items: center;
}

.agenda-table-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.agenda-table-head {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.agenda-table-head span,
.agenda-empty-state p,
.agenda-opened {
  color: var(--muted);
}

.agenda-table {
  display: grid;
}

.agenda-row {
  display: grid;
  grid-template-columns: 84px minmax(210px, 1.4fr) minmax(170px, 1fr) minmax(150px, 0.9fr) 128px;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #edf1f3;
}

.agenda-row:last-child {
  border-bottom: 0;
}

.agenda-row.header {
  background: #f9fbfc;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.agenda-time {
  color: var(--blue);
  font-weight: 900;
}

.agenda-patient {
  display: grid;
  gap: 4px;
}

.agenda-patient small,
.agenda-opened {
  display: block;
  font-size: 0.82rem;
}

.agenda-status {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.agenda-inline-form {
  margin: 0;
}

.agenda-empty-state {
  padding: 28px 16px;
}

.agenda-empty-state strong {
  display: block;
  margin-bottom: 6px;
}

@media (max-width: 860px) {
  .agenda-topbar,
  .agenda-toolbar,
  .agenda-table-head {
    align-items: stretch;
    flex-direction: column;
    height: auto;
  }

  .agenda-topbar {
    padding: 14px 16px;
  }

  .agenda-date-picker {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
  }

  .agenda-date-picker .agenda-button {
    grid-column: 1 / -1;
  }

  .agenda-row,
  .agenda-row.header {
    grid-template-columns: 1fr;
  }

  .agenda-row.header {
    display: none;
  }
}
