:root {
  --desk: #e3e9e6;
  --paper: #ffffff;
  --ink: #14201c;
  --muted: #55645e;
  --rule: #9aa6a1;
  --accent: #0e5a4b;
  --danger: #a4281f;
  --field-tint: #e8f1ed;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 17px;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Buttons */

.button {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--field-tint);
}

.button:disabled {
  border-color: var(--rule);
  color: var(--rule);
  cursor: default;
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button-primary:hover {
  background: #0a4539;
}

.button-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.button-danger:hover {
  background: #f8e9e7;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--danger);
  font: inherit;
  font-size: 0.85em;
  text-decoration: underline;
  cursor: pointer;
}

/* Top bar */

.top-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}

.site-name {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.status {
  color: var(--muted);
}

.status-error {
  color: var(--danger);
  font-weight: 700;
}

.notice {
  margin: 0;
  padding: 10px 24px;
  background: #fff6d6;
  border-bottom: 1px solid var(--rule);
}

/* Text inputs outside the sheet */

.text-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--paper);
  font: inherit;
}

.form-label {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
}

.form-field {
  margin-bottom: 14px;
}

.form-error {
  min-height: 1.45em;
  margin: 0 0 10px;
  color: var(--danger);
  font-weight: 700;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

/* Login */

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 28px;
  border: 1px solid var(--ink);
  border-top: 8px solid var(--accent);
  background: var(--paper);
}

.login-card h1 {
  margin-bottom: 20px;
}

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

.login-actions .button {
  flex: 1;
}

/* Patient list */

.page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.page-header h1 {
  margin-right: auto;
}

.list-section {
  margin-bottom: 32px;
}

.list-section h2 {
  margin-bottom: 8px;
}

.patient-table {
  width: 100%;
  border: 1px solid var(--ink);
  border-collapse: collapse;
  background: var(--paper);
}

.patient-table th,
.patient-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.patient-table th {
  border-bottom: 1px solid var(--ink);
  font-size: 13px;
}

.patient-table tr:last-child td {
  border-bottom: 0;
}

.patient-table .select-column {
  width: 36px;
}

.patient-table .bed-column {
  width: 110px;
  font-weight: 700;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--ink);
  background: var(--paper);
  text-align: center;
}

/* Patient sheet screen */

.sheet-container {
  padding: 24px;
  overflow-x: auto;
}

.sheet-container .sheet-page {
  width: 1340px;
  margin: 0 auto 24px;
  padding: 22px;
  border: 1px solid var(--rule);
  font-size: 13px;
}

.sheet-container .sheet-page:not(.sheet-editable) .box-grid {
  grid-template-rows: minmax(16em, auto) minmax(22em, auto);
}

.sheet-container .sheet-page:not(.sheet-editable) .days-grid {
  grid-auto-columns: 19em;
  grid-template-rows: minmax(12em, auto) minmax(9em, auto) auto minmax(5em, auto);
  overflow-x: auto;
}

.days-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 1340px;
  margin: 0 auto 8px;
}

/* Dialogs */

.dialog {
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 22px;
  border: 1px solid var(--ink);
  border-top: 8px solid var(--accent);
  color: var(--ink);
}

.dialog::backdrop {
  background: rgb(20 32 28 / 45%);
}

.dialog h2 {
  margin-bottom: 12px;
}

.dialog p {
  margin: 0 0 16px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.share-list {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.share-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
}

.share-form {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

/* Print screen */

.print-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.print-options fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.print-options legend {
  padding: 0;
  font-weight: 700;
}

.print-options label {
  display: block;
}

.day-choices {
  margin-top: 6px;
  padding-left: 22px;
}

.day-choices label {
  display: inline-block;
  margin-right: 12px;
}

.print-preview {
  padding: 20mm 24px;
  overflow-x: auto;
}

/* The white spread stands in for the printer margin, so the preview looks like the
   sheet of paper without changing the size of the content being measured. */
.print-page {
  width: 281mm;
  margin: 0 auto 26mm;
  box-shadow:
    0 0 0 8mm #fff,
    0 0 0 calc(8mm + 1px) var(--rule);
}

.overflow-shrink .print-page {
  height: 192mm;
  overflow: hidden;
}

.overflow-grow .print-page {
  min-height: 192mm;
}

@page {
  size: A4 landscape;
  margin: 8mm;
}

@media print {
  body {
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .print-preview {
    padding: 0;
    overflow: visible;
  }

  .print-page {
    margin: 0;
    box-shadow: none;
  }

  .print-page + .print-page {
    break-before: page;
  }
}
