:root {
  --bg: #f3f3f3;
  --paper: #ffffff;
  --ink: #111111;
  --muted: #666666;
  --line: #111111;
  --soft: #e8e8e8;
  --danger: #8b0000;
}

* { box-sizing: border-box; }

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

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

.app {
  min-height: 100vh;
  padding: 22px;
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 22px;
}

.panel,
.sheet {
  background: var(--paper);
  border: 2px solid var(--line);
  box-shadow: 8px 8px 0 #000;
}

.panel {
  position: sticky;
  top: 22px;
  align-self: start;
  padding: 20px;
}

.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.eyebrow,
.clinic {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 800;
}

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

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.status {
  border: 1px solid var(--line);
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
}

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

input,
select,
button {
  font: inherit;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 0;
}

input,
select {
  min-height: 44px;
  padding: 9px 10px;
  width: 100%;
}

.assistants-box,
.server-box {
  margin-top: 16px;
  padding: 14px;
  border: 2px solid #111;
  background: #fbfbfb;
}

.assistants-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.assistants-head span,
.mini-hint,
.hint {
  color: #666;
  font-size: 12px;
}

.add-assistant,
.save-server {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.save-server { margin-top: 8px; }

.server-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.assistant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  border: 2px solid #111;
  background: #fff;
  padding: 4px 8px 4px 10px;
  font-weight: 900;
  cursor: pointer;
}

.chip.active { background: #111; color: #fff; }

.chip .remove {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 14px;
  line-height: 1;
}

.quick-insert {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quick-insert label {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
}

.mini-hint { margin: 9px 0 0; line-height: 1.35; }

.button-row {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button {
  min-height: 44px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 900;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

button.primary {
  grid-column: 1 / -1;
  background: #111;
  color: #fff;
}

button.ghost { background: var(--soft); }
button.danger { color: var(--danger); }

.sheet-wrap {
  overflow: auto;
  padding: 0 0 18px;
}

.sheet {
  width: min(100%, 980px);
  min-height: 720px;
  margin: 0 auto;
  padding: 30px;
}

.sheet.iphone-preview {
  width: min(100%, 460px);
  min-height: 880px;
}

.sheet.dark {
  background: #262626;
  color: #fff;
  border-color: #fff;
  box-shadow: 8px 8px 0 #111;
}

.sheet.light {
  background: #fff;
  color: #111;
  border-color: #111;
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
  border-bottom: 2px solid currentColor;
  padding-bottom: 14px;
}

.sheet h2 {
  margin: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 0.96;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}

.sheet-head p:last-child,
.date {
  margin: 10px 0 0;
  font-size: 14px;
  opacity: 0.82;
}

.table-shell {
  overflow: auto;
}

#scheduleTable {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#scheduleTable td {
  border: 3px solid currentColor;
  min-height: 112px;
  height: 112px;
  padding: 12px;
  text-align: center;
  vertical-align: middle;
  font-size: 32px;
  font-weight: 900;
  white-space: pre-line;
  outline: none;
}

#scheduleTable td:first-child {
  width: 18%;
  font-weight: 900;
}

#scheduleTable tr:first-child td {
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 6px;
}

#scheduleTable td:focus {
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.15);
}

.sheet.dark #scheduleTable td:focus {
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.hint {
  margin: 14px 0 0;
  line-height: 1.4;
}

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .panel { position: static; }
}

@media (max-width: 760px) {
  .app { padding: 12px; gap: 12px; }

  .panel,
  .sheet { box-shadow: 4px 4px 0 #000; }

  .panel { padding: 14px; }

  .controls,
  .button-row,
  .quick-insert,
  .server-actions,
  .save-server {
    grid-template-columns: 1fr;
  }

  .add-assistant { grid-template-columns: 1fr; }

  .brand {
    flex-direction: column;
    align-items: flex-start;
  }

  h1 { font-size: 24px; }

  .sheet {
    width: 100%;
    padding: 16px;
    min-height: 0;
  }

  .sheet.iphone-preview {
    width: 100%;
    min-height: 0;
  }

  .sheet-head {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
  }

  .sheet h2 { font-size: 28px; }

  #scheduleTable td {
    min-height: 88px;
    height: 88px;
    font-size: 18px;
    padding: 8px;
  }

  #scheduleTable td:first-child { width: 22%; }

  .status { font-size: 11px; }
}
