:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-strong: #eef2f6;
  --text: #17202a;
  --muted: #5e6b78;
  --line: #d8dee6;
  --accent: #1f7a6d;
  --accent-strong: #155e54;
  --danger: #a33d3d;
  --warning: #9a6a16;
  --ok: #1f7a4d;
  --shadow: 0 14px 32px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: var(--accent-strong);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand strong {
  font-size: 18px;
}

.brand span,
.muted {
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav a,
.button.secondary,
button.secondary {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 24px;
  align-items: start;
}

.panel,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
}

.card {
  padding: 18px;
}

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

h1 {
  font-size: 34px;
  line-height: 1.12;
  margin-bottom: 12px;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 16px;
}

.stack {
  display: grid;
  gap: 16px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.full {
  grid-column: 1 / -1;
}

.button,
button,
.nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

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

.status {
  min-height: 24px;
  color: var(--muted);
}

.status[data-tone="ok"] {
  color: var(--ok);
}

.status[data-tone="error"] {
  color: var(--danger);
}

.status[data-tone="warn"] {
  color: var(--warning);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

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

th {
  background: var(--surface-strong);
  font-size: 13px;
  color: var(--muted);
}

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

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric strong {
  display: block;
  font-size: 28px;
}

.signature-pad {
  width: 100%;
  height: 220px;
  border: 1px dashed var(--muted);
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}

.notice {
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  background: #ecf7f5;
  color: #24433f;
  border-radius: 6px;
}

.section-head,
.calendar-toolbar,
.slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.compact-field {
  max-width: 360px;
}

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

.prof-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.prof-card:hover,
.prof-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: #ecf7f5;
}

.prof-card strong {
  font-size: 17px;
}

.prof-card span,
.slot-meta {
  color: var(--muted);
  font-size: 14px;
}

.calendar-toolbar {
  padding: 10px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.calendar-cell,
.calendar-weekday {
  min-height: 92px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  justify-content: flex-start;
  align-items: flex-start;
  padding: 10px;
  font-weight: 600;
}

.calendar-weekday {
  min-height: auto;
  background: var(--surface-strong);
  color: var(--muted);
  cursor: default;
}

.calendar-cell:hover {
  background: #ecf7f5;
}

.calendar-cell.is-muted {
  color: #9aa5b1;
  background: #f9fafb;
}

.calendar-cell.has-slots::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 28px;
  border-radius: 999px;
  background: var(--accent);
}

.slot-popover {
  position: fixed;
  inset: auto 24px 24px auto;
  z-index: 10;
  width: min(520px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.slot-row {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

@media (max-width: 820px) {
  .topbar,
  .grid,
  .form-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  h1 {
    font-size: 28px;
  }
}
