:root {
  color-scheme: light;
  --ink: #203b3b;
  --muted: #738582;
  --primary: #14776f;
  --primary-dark: #0d5d57;
  --tint: #eaf5f1;
  --line: #e3ebe7;
  --canvas: #f5f7f6;
  --white: #fff;
  --radius: 14px;
  --shadow: 0 3px 14px #1e423b04;
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 28px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  font-weight: 700;
}
h2 {
  font-size: 17px;
  line-height: 1.6;
}
h3 {
  font-size: 14px;
}
a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  color: var(--primary-dark);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
input[type="button"],
input[type="submit"],
a {
  touch-action: manipulation;
}
button,
input[type="button"],
input[type="submit"] {
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button {
  color: inherit;
}
input:not(
  [type="checkbox"],
  [type="radio"],
  [type="hidden"],
  [type="button"],
  [type="submit"]
),
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #d9e3dd;
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
  color: var(--ink);
  min-height: 44px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
input::placeholder,
textarea::placeholder {
  color: #a1aaa7;
  font-size: 12px;
}
input[readonly] {
  background: #f4f6f5 !important;
  color: var(--muted) !important;
}
textarea {
  resize: vertical;
  line-height: 1.8;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin: 0;
  vertical-align: middle;
}
input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px #14776f16;
}
a:focus-visible,
button:focus-visible,
input[type="button"]:focus-visible,
tr:focus-visible {
  outline: 3px solid #83bdb6;
  outline-offset: 3px;
}
label {
  font-size: 12px;
  font-weight: 600;
}
label:not(.nav-item, .checkbox-label, .temporary-label) {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
legend {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
.icon {
  display: block;
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}
.button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
  transition:
    background 0.15s,
    box-shadow 0.15s;
}
.button .icon {
  width: 17px;
  height: 17px;
}
.primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 3px 5px #14776f10;
}
.primary:hover {
  background: var(--primary-dark);
  color: #fff;
}
.secondary {
  color: #536761;
  background: #fff;
  border-color: #dce5e0;
}
.secondary:hover {
  background: #f5f8f6;
  color: var(--primary);
}
.danger {
  background: #fff5f3;
  color: #b65d50;
  border-color: #f1dcd6;
}
.danger:hover {
  background: #fbe9e5;
}
.compact {
  padding: 8px 12px;
  min-height: 38px;
}
.full-width {
  width: 100%;
}
.subtle,
.help-text {
  color: var(--muted);
  font-size: 12px;
}
.help-text {
  font-weight: 400;
  line-height: 1.9;
}
.muted {
  color: #9ca9a4;
}
.text-link {
  font-size: 12px;
  font-weight: 600;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 4px;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  padding: 3px 9px;
  color: var(--primary);
  background: var(--tint);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.optional {
  display: inline-block;
  align-self: flex-start;
  padding: 1px 6px;
  color: #84918b;
  background: #eff2f0;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 400;
  margin-left: 6px;
}
.sr-only,
.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.skip-link:focus {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  background: #fff;
  padding: 14px;
  border: 2px solid var(--primary);
}
/* Application shell */
.app-shell {
  display: flex;
  min-height: 100dvh;
}
.sidebar {
  width: 224px;
  background: #fff;
  border-right: 1px solid var(--line);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  padding: 30px 18px;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  line-height: 1.3;
}
.brand-mark {
  width: 56px;
  height: 48px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.clinic-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand strong {
  font-size: 19px;
  letter-spacing: 0.13em;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  margin-top: 6px;
}
.sidebar .brand {
  padding: 0 8px;
  margin-bottom: 44px;
}
.nav-label {
  color: #97a49e;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 0 16px;
  margin: 0 0 10px;
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 28px;
}
.nav-item {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 47px;
  padding: 11px 16px;
  border-radius: 8px;
  color: #6b7d76;
  font-size: 13px;
  font-weight: 500;
}
.nav-item .icon {
  width: 19px;
  height: 19px;
}
.nav-item:hover {
  background: #f4f7f5;
}
.nav-item.is-active {
  background: var(--tint);
  color: var(--primary);
  font-weight: 700;
}
.nav-item.is-active:after {
  content: "";
  margin-left: auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.sidebar-bottom > a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #74867e;
  font-size: 12px;
  padding: 6px 10px;
}
.sidebar-bottom > a > span {
  margin-left: auto;
}
.sidebar-bottom .icon {
  width: 17px;
  height: 17px;
}
.sidebar-clinic {
  display: block;
  font-size: 9px;
  color: #a0aba5;
  padding: 20px 10px 0;
}
.workspace {
  display: flex;
  flex-direction: column;
  margin-left: 224px;
  min-width: 0;
  width: calc(100% - 224px);
}
.topbar {
  height: 72px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #6f8278;
}
.staff-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
}
.staff-avatar {
  background: #eff3ef;
  border: 1px solid #e0e8e2;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 11px;
}
.main-content {
  width: 100%;
  max-width: 1560px;
  padding: 33px 36px 24px;
  margin: 0 auto;
  flex: 1;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  margin-bottom: 28px;
}
.page-description {
  font-size: 12px;
  color: var(--muted);
  margin-top: 7px;
}
.date-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #7f8c85;
  white-space: nowrap;
}
.date-label .icon {
  width: 15px;
  height: 15px;
}
.workspace-footer {
  padding: 0 36px 22px;
  font-size: 9px;
  letter-spacing: 0.09em;
  color: #9aa8a0;
  display: flex;
  justify-content: space-between;
}
.workspace-footer span {
  font-size: 10px;
  letter-spacing: 0;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  min-width: 0;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 23px 25px 20px;
}
.section-heading .subtle {
  font-size: 10px;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 25px;
}
.summary-card {
  display: flex;
  align-items: flex-start;
  gap: 17px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.summary-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #edf6f0;
  color: var(--primary);
  margin-top: 4px;
  flex-shrink: 0;
}
.summary-icon.blue {
  background: #ecf3f8;
  color: #6d94b0;
}
.summary-icon.amber {
  background: #fbf5e9;
  color: #c0a05d;
}
.summary-card p {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.summary-card strong {
  display: block;
  font-size: 27px;
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: 0.015em;
  font-variant-numeric: tabular-nums;
}
.summary-card small {
  display: block;
  font-size: 9px;
  color: #9ba69f;
  margin-top: 6px;
}
.reception-card {
  margin-bottom: 25px;
}
.reception-toggle {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.reception-toggle::-webkit-details-marker {
  display: none;
}
.reception-toggle .subtle {
  margin-left: auto;
}
.reception-chevron {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--primary);
  border-bottom: 1.5px solid var(--primary);
  transform: rotate(45deg);
  margin: 0 4px 4px 10px;
  flex-shrink: 0;
}
.reception-card[open] .reception-chevron {
  transform: rotate(225deg);
  margin-top: 6px;
}
.reception-toggle:hover {
  background: #f8fbf9;
  border-radius: var(--radius);
}
.reception-toggle:focus-visible {
  outline: 3px solid #83bdb6;
  outline-offset: 3px;
  border-radius: var(--radius);
}
.entry-fields {
  display: grid;
  grid-template-columns: 1.1fr 1.2fr 1.05fr 1.2fr auto;
  gap: 15px;
  padding: 0 25px 25px;
  align-items: end;
}
.entry-fields input {
  font-size: 13px;
}
.entry-fields .button {
  min-height: 44px;
  padding-left: 20px;
  padding-right: 20px;
}
#AjaxResult:empty {
  display: none;
}
#AjaxResult {
  font-size: 12px;
  color: #ad554a;
  background: #fff4ed;
  margin: 0 25px 22px;
  padding: 12px;
  border-radius: 8px;
}
.queue-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 25px;
}
.queue-toolbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 16px;
}
.live-indicator {
  color: #86968e;
  font-size: 10px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.live-indicator > span {
  width: 5px;
  height: 5px;
  background: #68a991;
  border-radius: 50%;
}
.queue-filters {
  display: flex;
  align-items: center;
  gap: 12px;
}
.room-filter {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}
.room-filter select {
  font-size: 12px;
  min-height: 36px;
  padding: 6px 29px 6px 10px;
  width: auto;
}
.segmented {
  display: flex;
  border-radius: 7px;
  background: #f3f5f3;
  border: 1px solid #e8ede9;
  padding: 3px;
  gap: 2px;
  white-space: nowrap;
}
.segmented label {
  position: relative;
  display: block !important;
  cursor: pointer;
}
.segmented input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.segmented span {
  display: block;
  color: #84918a;
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 5px;
  font-weight: 500;
}
.segmented input:checked + span {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 3px #1c393211;
}
.segmented input:focus-visible + span {
  outline: 2px solid var(--primary);
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.queue-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 850px;
  font-size: 12px;
  text-align: center;
  table-layout: auto;
}
.queue-table th {
  height: 45px;
  background: #f7f9f7;
  color: #819086;
  font-size: 10px;
  font-weight: 500;
  padding: 10px 13px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.queue-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #eef1ee;
  vertical-align: middle;
  white-space: nowrap;
}
.queue-table tbody tr:last-child td {
  border-bottom: 0;
}
.queue-table tr:not(.empty-row):hover td {
  background: #f8fbf9;
}
.queue-table tr.is-outside {
  background: #f7f8f7;
}
.queue-table tr.is-finished {
  color: #97a59b;
}
.queue-table tr.dragging {
  opacity: 0.4;
}
.queue-table .patient-column {
  text-align: left;
  min-width: 150px;
}
.ticket-cell {
  display: flex;
  align-items: center;
  gap: 7px;
}
.drag-symbol {
  color: #bbc8bf;
  font-size: 19px;
  cursor: grab;
  line-height: 1;
}
.bTicket {
  background: var(--tint);
  color: var(--primary);
  border: 0;
  border-radius: 7px;
  width: 38px;
  height: 36px;
  font-size: 15px;
  font-weight: 650;
  padding: 0;
}
.time-cell {
  font-variant-numeric: tabular-nums;
  color: #697e71;
}
.time-cell small {
  display: block;
  font-size: 9px;
  color: #a0aca3;
  margin-top: 3px;
}
.appointment-time {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.patient-link {
  font-weight: 600;
  font-size: 12px;
}
.patient-name {
  display: block;
  color: #677b6e;
  font-size: 11px;
  margin-top: 2px;
}
.temporary-label {
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 8px;
}
.temporary-label input {
  width: 14px;
  height: 14px;
}
.btnStatus {
  width: 31px;
  height: 31px;
  border-radius: 7px;
  border: 1px solid #e3eae4;
  background: #fff;
  color: #c3cec5;
  line-height: 1;
  font-size: 13px;
  padding: 0;
}
.btnStatus:hover {
  border-color: #90b7a5;
  background: #f0f7f2;
}
.btnStatus[aria-pressed="true"] {
  background: #e4f2eb;
  color: #2e8870;
  border-color: #d6eade;
  font-weight: 700;
}
.btnStatus.status-finish[aria-pressed="true"] {
  background: #edf0f3;
  color: #7390a0;
  border-color: #e1e6ea;
}
.table-note {
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 13px 24px;
  font-size: 9px;
  color: #97a69a;
  flex-wrap: wrap;
}
.table-note .drag-symbol {
  font-size: 15px;
}
.note-divider {
  margin: 0 4px;
  color: #c1c9c1;
}
.empty-state {
  padding: 46px 20px 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: normal;
}
.empty-icon {
  color: #9ab9a9;
  background: #f2f7f3;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 15px;
}
.empty-icon .icon {
  width: 25px;
  height: 25px;
}
.empty-state strong {
  font-size: 13px;
  color: #718577;
  font-weight: 500;
}
.empty-state p {
  font-size: 11px;
  color: #a1aea3;
  margin-top: 6px;
}
/* Forms and settings */
.patient-search-card {
  margin-bottom: 24px;
}
.patient-search-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1.5fr) auto;
  align-items: end;
  gap: 16px;
  padding: 0 25px 24px;
}
.patients-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  align-items: start;
  gap: 24px;
}
.patient-list-scroll {
  overflow: auto;
  max-height: max(280px, calc(100dvh - 380px));
  border-radius: 0 0 var(--radius) var(--radius);
}
.patient-list-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  text-align: left;
  font-size: 12px;
}
.patient-list-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 15px;
  background: #f7f9f7;
  border-block: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.patient-list-table td {
  border-bottom: 1px solid #eef1ee;
  padding: 13px 15px;
  overflow-wrap: anywhere;
}
.patient-list-table tr:last-child td {
  border-bottom: 0;
}
.patient-list-table tr:hover td,
.patient-list-table tr.is-selected td {
  background: #f0f7f3;
}
.patient-list-table tr.is-selected td:first-child {
  box-shadow: inset 3px 0 var(--primary);
}
.patient-list-link {
  font-weight: 600;
}
.patient-row {
  cursor: pointer;
}
.patient-list-table .empty-hint {
  padding: 30px 4px;
}
@media (max-width: 1100px) and (min-width: 701px) {
  .patients-layout {
    gap: 16px;
  }
  .patient-detail-pane .form-grid {
    grid-template-columns: 1fr;
  }
  .patient-list-table th,
  .patient-list-table td {
    padding-inline: 10px;
  }
}
@media (max-width: 700px) {
  .patient-search-card {
    margin-bottom: 18px;
  }
  .patient-search-form {
    grid-template-columns: 1fr 1fr;
    gap: 14px 12px;
    padding: 0 18px 20px;
  }
  .patient-search-form .button {
    grid-column: 1 / -1;
  }
  .patients-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .patient-list-scroll {
    max-height: 320px;
  }
}
.split-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.5fr);
  gap: 24px;
  align-items: start;
}
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0 25px 25px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.span-all {
  grid-column: 1/-1;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.form-actions.spread {
  justify-content: space-between;
}
.search-results {
  border-top: 1px solid var(--line);
  max-height: 510px;
  overflow-y: auto;
}
.patient-result,
.holiday-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 25px;
  border-bottom: 1px solid #f0f3f0;
  color: var(--ink);
}
.patient-result:hover,
.holiday-item:hover,
.patient-result.selected,
.holiday-item.selected {
  background: #f1f7f3;
}
.patient-result > span:last-child,
.holiday-item > span:last-child {
  margin-left: auto;
  color: #a4b8a9;
}
.patient-result strong,
.holiday-item strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}
.patient-result small,
.holiday-item small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}
.patient-avatar,
.calendar-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: #f2f6f2;
  border-radius: 9px;
  color: #8da798;
  flex-shrink: 0;
}
.patient-avatar .icon,
.calendar-icon .icon {
  width: 17px;
  height: 17px;
}
.empty-hint {
  padding: 30px 24px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.subheading {
  padding: 4px 0 0;
}
.time-range > div {
  display: flex;
  align-items: center;
  gap: 10px;
}
.time-range input {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.time-range span {
  color: var(--muted);
}
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.settings-form > .card > .form-grid {
  padding: 0 25px 25px;
}
.settings-form > .card > .stack-form {
  gap: 20px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  line-height: 1.8;
  cursor: pointer;
}
.checkbox-label small {
  font-weight: 400;
  color: var(--muted);
}
.schedule-table,
.category-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.schedule-table th,
.category-table th {
  font-size: 11px;
  font-weight: 500;
  color: #839589;
  background: #f8faf8;
  padding: 12px 20px;
  white-space: nowrap;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.schedule-table td,
.category-table td {
  padding: 10px 20px;
  border-bottom: 1px solid #edf1ec;
}
.schedule-table tr:last-child td,
.category-table tr:last-child td {
  border-bottom: 0;
}
.schedule-table th[scope="row"] {
  background: #fff;
  border-top: 0;
  width: 70px;
  color: var(--ink);
}
.schedule-table th.sunday {
  color: #c7847b;
}
.schedule-table th.saturday {
  color: #7f9caf;
}
.time-inputs {
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: 300px;
}
.time-inputs input {
  min-height: 38px;
  padding: 7px 9px;
  text-align: center;
  max-width: 102px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.time-inputs span {
  color: #a4b3a7;
  font-size: 11px;
}
.schedule-hint {
  padding: 15px 25px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--line);
}
.category-table td:first-child {
  color: #a0b1a3;
  width: 60px;
  font-variant-numeric: tabular-nums;
}
.category-table input:not([type="checkbox"]) {
  min-height: 38px;
  padding: 7px 11px;
}
.unit-input {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.unit-input input {
  max-width: 100px;
}
.sticky-save {
  position: sticky;
  bottom: 15px;
  background: #ffffffef;
  backdrop-filter: blur(8px);
  padding: 15px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 18px #25463009;
}
.sticky-save p {
  font-size: 11px;
  color: var(--muted);
}
/* Detail modal and login */
#patient-dialog {
  padding: 0;
  margin: auto;
  width: 600px;
  max-width: calc(100vw - 28px);
  height: 720px;
  max-height: 92dvh;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 20px 100px #17372d30;
  overflow: hidden;
  background: #fff;
}
#patient-dialog::backdrop {
  background: #183e365e;
  backdrop-filter: blur(3px);
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 19px 25px;
  border-bottom: 1px solid var(--line);
  height: 65px;
}
.dialog-header h2 {
  font-size: 16px;
}
#close-patient {
  background: #f3f6f3;
  border: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 21px;
  line-height: 1;
  color: #7b8e7f;
}
#patient-frame {
  width: 100%;
  height: calc(100% - 65px);
  border: 0;
}
body[data-screen="patient-detail"] {
  background: #fff;
}
.detail-content {
  padding: 22px 0 0;
}
.detail-ticket {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.room-choice {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}
.room-choice label {
  flex-direction: row !important;
  align-items: center;
  font-size: 13px;
  font-weight: 400;
}
#detail-error:empty {
  display: none;
}
#detail-error {
  color: #b45b51;
  font-size: 12px;
}
.login-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100dvh;
}
.login-intro {
  position: relative;
  overflow: hidden;
  background: #eaf2ee;
  padding: 70px 14%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-intro .brand {
  margin-bottom: 90px;
}
.login-intro .eyebrow {
  font-size: 10px;
  position: relative;
  z-index: 1;
}
.login-intro h1 {
  font-size: 36px;
  line-height: 1.8;
  margin: 12px 0 24px;
  position: relative;
  z-index: 1;
}
.login-intro > p:last-of-type {
  color: #799086;
  font-size: 13px;
  line-height: 2;
  position: relative;
  z-index: 1;
}
.login-decoration {
  position: absolute;
  width: 550px;
  height: 550px;
  right: -220px;
  bottom: -260px;
  border: 1px solid #d5e5db;
  border-radius: 50%;
  box-shadow:
    0 0 0 60px #deebe230,
    0 0 0 120px #deebe230;
}
.login-decoration span {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #c1d8ca;
  border-radius: 50%;
  top: 55px;
  left: 90px;
}
.login-decoration span:nth-child(2) {
  width: 8px;
  height: 8px;
  left: 0;
  top: 320px;
}
.login-decoration span:nth-child(3) {
  width: 10px;
  height: 10px;
  left: 300px;
  top: -45px;
}
.login-panel {
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #fff;
}
.login-panel form {
  max-width: 350px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.login-panel h2 {
  font-size: 25px;
}
.login-panel .eyebrow {
  margin-bottom: -15px;
}
.login-panel .subtle {
  margin-top: -13px;
  margin-bottom: 14px;
}
.login-panel .primary {
  margin-top: 9px;
}
.login-footer {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #a5b3a8;
  margin-top: 70px;
}
.form-message:empty {
  display: none;
}
.form-message {
  font-size: 12px;
  color: #b95c4e;
}
/* Patient-facing pages */
.public-header {
  max-width: 1120px;
  margin: auto;
  padding: 28px 28px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.public-header .brand strong {
  font-size: 16px;
  letter-spacing: 0.015em;
}
.public-header .brand small {
  font-size: 10px;
}
.clinic-contact {
  text-align: right;
  font-size: 11px;
  color: var(--muted);
}
.clinic-contact a {
  display: block;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.public-nav {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.public-nav > div {
  max-width: 1120px;
  margin: auto;
  display: flex;
  padding: 0 28px;
  gap: 30px;
  overflow-x: auto;
}
.public-nav a {
  display: block;
  white-space: nowrap;
  color: #7b8f80;
  font-size: 11px;
  padding: 15px 0;
}
.public-nav a[aria-current="page"] {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  font-weight: 600;
}
.public-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 43px 28px 50px;
}
.public-hero {
  display: flex;
  justify-content: space-between;
  gap: 25px;
  align-items: center;
  margin-bottom: 30px;
}
.public-hero h1 {
  font-size: 30px;
  margin-bottom: 12px;
}
.public-hero p:not(.eyebrow) {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.9;
}
.open-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #eaf4ed;
  color: var(--primary);
  border-radius: 20px;
  font-size: 11px;
  padding: 7px 14px;
  white-space: nowrap;
}
.open-badge:before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.open-badge.closed {
  background: #eef1ee;
  color: #8b9a8d;
}
.public-columns {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 24px;
  align-items: start;
}
.public-side {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.public-form {
  padding: 0 25px 25px;
  display: flex;
  flex-direction: column;
  gap: 21px;
}
.public-form input {
  font-size: 15px;
}
.birth-help {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.8;
}
.notice {
  padding: 14px 17px;
  border-radius: 9px;
  background: #f6f3ec;
  color: #9f8b61;
  font-size: 12px;
  margin: 0 25px 20px;
  line-height: 1.8;
}
.notice:empty {
  display: none;
}
.public-categories {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.public-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 22px 25px;
  background: #f0f7f2;
  border-bottom: 1px solid #e0ebe3;
  gap: 16px;
  border-radius: 14px 14px 0 0;
}
.public-stats p {
  font-size: 11px;
  color: #7e9787;
}
.public-stats strong {
  font-size: 29px;
  font-weight: 600;
  display: block;
  margin-top: 3px;
  line-height: 1.6;
}
.public-stats strong small {
  font-size: 13px;
  font-weight: 400;
  margin-left: 4px;
}
.public-queue-table {
  border-collapse: collapse;
  width: 100%;
  text-align: center;
  font-size: 12px;
}
.public-queue-table th {
  font-size: 10px;
  color: #899e8b;
  font-weight: 500;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}
.public-queue-table td {
  padding: 13px 8px;
  border-bottom: 1px solid #f0f3ef;
}
.public-queue-table tr:last-child td {
  border: 0;
}
.public-queue-table td:first-child {
  font-weight: 600;
  color: var(--primary);
}
.public-queue-table .public-empty {
  padding: 27px 15px;
  color: #9dad9b;
  font-size: 11px;
  font-weight: 400;
}
.hours-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 11px;
}
.hours-table th {
  font-weight: 500;
  color: #98a69a;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
}
.hours-table td {
  padding: 11px 6px;
  color: #72977f;
  border-bottom: 1px solid #f0f3ef;
}
.hours-table td:first-child {
  color: #819586;
  font-size: 10px;
}
.hours-table + .help-text {
  padding: 16px 23px 23px;
}
.public-footer {
  border-top: 1px solid var(--line);
  max-width: 1064px;
  margin: 0 auto;
  padding: 25px 0 30px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #93a391;
  gap: 20px;
}
.holiday-notice {
  background: #fff;
  border-left: 3px solid #bbccba;
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 24px;
  font-size: 12px;
  color: var(--muted);
}
.holiday-notice h2 {
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 5px;
}
.public-cancel {
  max-width: 640px;
  margin: 45px auto;
  padding: 35px;
  text-align: center;
}
.confirmation-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--primary);
  margin: 0 auto 20px;
}
.confirmation-icon .icon {
  width: 30px;
  height: 30px;
}
.public-cancel h1 {
  font-size: 23px;
  margin-bottom: 12px;
}
.confirmation-number {
  font-size: 64px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.5;
}
.confirmation-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  background: #f5f8f3;
  border-radius: 10px;
  padding: 20px;
  margin: 23px 0;
}
.confirmation-meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.confirmation-meta strong {
  font-weight: 500;
  font-size: 18px;
}
.confirmation-message {
  font-size: 12px;
  line-height: 1.9;
  text-align: left;
  margin: 20px 0;
  color: var(--muted);
}
.public-cancel #cancel-reception {
  margin: 22px 0;
}
.public-cancel > a {
  font-size: 12px;
}
.public-cancel > .subtle {
  margin-top: 20px;
}
.mobile-main {
  max-width: 640px;
}
.mobile-main .public-columns {
  grid-template-columns: 1fr;
}
.mobile-main .public-hero h1 {
  font-size: 25px;
}
.mobile-main .public-hero {
  align-items: flex-start;
}
.legacy-mobile-hours {
  font-size: 12px;
  color: var(--muted);
  padding: 0 25px 25px;
  line-height: 2;
}
.waiting-display {
  max-width: 1500px;
  margin: auto;
  padding: 45px;
}
.waiting-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}
.waiting-heading .brand strong {
  font-size: 21px;
}
.waiting-heading time {
  font-size: 15px;
  color: var(--muted);
}
.waiting-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 30px;
}
.waiting-stat {
  padding: 35px 45px;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
}
.waiting-stat:nth-child(2) {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.waiting-stat h1 {
  font-size: 22px;
  font-weight: 500;
  opacity: 0.8;
}
.waiting-number {
  /* Keep the display readable in Safari versions without clamp(). */
  font-size: 60px;
  font-size: 8vw;
  line-height: 1.5;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.waiting-number small {
  font-size: 28px;
  font-weight: 400;
  margin-left: 10px;
}
.waiting-display #cl_Line {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.waiting-display .public-queue-table {
  font-size: 21px;
}
.waiting-display .public-queue-table th {
  font-size: 16px;
  padding: 20px;
}
.waiting-display .public-queue-table td {
  padding: 20px;
}
.waiting-caption {
  color: var(--muted);
  font-size: 12px;
  margin-top: 20px;
  text-align: right;
}
@media (max-width: 750px) {
  .waiting-number {
    font-size: 60px;
  }
}
@media (min-width: 1625px) {
  .waiting-number {
    font-size: 130px;
  }
}
@media (min-width: 1600px) {
  .main-content {
    padding-top: 40px;
  }
  .summary-card {
    padding: 26px;
  }
  .queue-table td {
    padding-top: 18px;
    padding-bottom: 18px;
  }
}
@media (max-width: 1200px) {
  .sidebar {
    width: 200px;
    padding: 28px 14px;
  }
  .workspace {
    margin-left: 200px;
    width: calc(100% - 200px);
  }
  .main-content {
    padding: 28px 25px;
  }
  .topbar {
    padding: 0 25px;
  }
  .summary-card {
    padding: 19px 17px;
    gap: 12px;
  }
  .summary-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  .summary-icon .icon {
    width: 18px;
    height: 18px;
  }
  .summary-card strong {
    font-size: 24px;
  }
  .summary-card small {
    font-size: 8px;
  }
  .entry-fields {
    gap: 10px;
    grid-template-columns: 1fr 1.1fr 1.1fr 1.1fr auto;
  }
  .entry-fields .button {
    padding: 10px 14px;
  }
  .queue-toolbar > div:first-child {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .queue-filters {
    gap: 8px;
  }
  .section-heading .subtle {
    display: none;
  }
}
@media (max-width: 960px) {
  .sidebar {
    width: 175px;
    padding: 24px 12px;
  }
  .sidebar .brand {
    padding: 0 4px;
    gap: 8px;
  }
  .brand-mark {
    width: 40px;
    height: 36px;
  }
  .brand strong {
    font-size: 15px;
  }
  .brand small {
    font-size: 9px;
  }
  .nav-item {
    padding: 11px 12px;
    font-size: 12px;
    gap: 9px;
  }
  .workspace {
    margin-left: 175px;
    width: calc(100% - 175px);
  }
  .main-content {
    padding: 25px 20px;
  }
  .summary-grid {
    gap: 12px;
  }
  .summary-card {
    gap: 10px;
    padding: 18px 14px;
  }
  .summary-card small {
    display: none;
  }
  .summary-icon {
    width: 30px;
    height: 32px;
    border-radius: 8px;
  }
  .summary-card p {
    font-size: 10px;
  }
  .summary-card strong {
    font-size: 22px;
  }
  .entry-fields {
    grid-template-columns: 1fr 1fr;
  }
  .entry-fields .button {
    grid-column: 1/-1;
  }
  .queue-toolbar {
    gap: 15px;
  }
  .queue-toolbar > div:first-child {
    flex-direction: row;
    align-items: center;
  }
  .queue-filters {
    width: 100%;
    justify-content: space-between;
  }
  .split-layout {
    grid-template-columns: 1fr 1.4fr;
    gap: 16px;
  }
  .form-grid {
    gap: 15px;
  }
  .split-layout .form-grid {
    grid-template-columns: 1fr;
  }
  .section-heading {
    padding: 20px;
  }
  .stack-form {
    padding: 0 20px 20px;
  }
  .date-label {
    font-size: 10px;
  }
  .page-heading {
    align-items: flex-start;
  }
  .page-heading h1 {
    font-size: 25px;
  }
  .public-hero h1 {
    font-size: 28px;
  }
  .public-columns {
    grid-template-columns: 1fr 1fr;
  }
  .login-intro {
    padding: 50px 12%;
  }
  .login-intro h1 {
    font-size: 30px;
  }
  .login-panel {
    padding: 40px;
  }
  .schedule-table {
    min-width: 590px;
  }
}
@media (max-width: 700px) {
  .app-shell {
    display: block;
  }
  .workspace {
    width: 100%;
    margin: 0;
  }
  .topbar {
    height: 46px;
    padding: 0 20px;
    font-size: 10px;
    background: var(--canvas);
    border: 0;
  }
  .staff-label {
    font-size: 9px;
  }
  .staff-avatar {
    width: 23px;
    height: 23px;
    font-size: 9px;
  }
  .main-content {
    padding: 16px 18px 24px;
  }
  .page-heading {
    margin-bottom: 20px;
    align-items: flex-start;
  }
  .page-heading h1 {
    font-size: 24px;
  }
  .page-description {
    font-size: 11px;
    max-width: 240px;
    line-height: 1.9;
  }
  .date-label {
    font-size: 9px;
    gap: 4px;
    padding-top: 24px;
  }
  .date-label .icon {
    width: 13px;
    height: 13px;
  }
  .eyebrow {
    font-size: 9px;
  }
  .summary-grid {
    gap: 8px;
    margin-bottom: 18px;
  }
  .summary-card {
    display: block;
    padding: 14px 11px;
    border-radius: 11px;
  }
  .summary-icon {
    width: 28px;
    height: 28px;
    margin: 0 0 10px;
    border-radius: 8px;
  }
  .summary-icon .icon {
    width: 16px;
    height: 16px;
  }
  .summary-card p {
    font-size: 9px;
  }
  .summary-card strong {
    font-size: 19px;
    white-space: nowrap;
  }
  .card {
    border-radius: 12px;
  }
  .reception-card {
    margin-bottom: 18px;
  }
  .section-heading {
    padding: 19px 18px 16px;
  }
  .section-heading h2 {
    font-size: 15px;
  }
  .entry-fields {
    padding: 0 18px 19px;
    gap: 13px 12px;
  }
  .entry-fields label {
    font-size: 11px;
  }
  .entry-fields input {
    padding: 11px 10px;
    font-size: 13px;
  }
  .entry-fields .button {
    margin-top: 3px;
  }
  .queue-toolbar {
    padding: 19px 18px 16px;
  }
  .queue-toolbar h2 {
    font-size: 15px;
  }
  .live-indicator {
    font-size: 9px;
  }
  .queue-filters {
    flex-wrap: wrap;
    gap: 10px;
  }
  .room-filter {
    font-size: 10px;
  }
  .room-filter select {
    font-size: 11px;
    max-width: 110px;
    padding-right: 21px;
  }
  .segmented span {
    padding: 5px 8px;
    font-size: 10px;
  }
  .queue-filters .button {
    min-height: 34px;
    padding: 7px 8px;
  }
  .queue-filters .button span {
    display: none;
  }
  .queue-filters .button .icon {
    width: 16px;
    height: 16px;
  }
  .table-note {
    padding: 13px 18px;
    font-size: 9px;
    line-height: 1.9;
    display: block;
  }
  .table-note .note-divider {
    display: none;
  }
  .table-note .note-divider:after {
    content: "";
    display: block;
  }
  .queue-table {
    min-width: 820px;
  }
  .queue-table th {
    height: 42px;
  }
  .queue-table .empty-state {
    align-items: flex-start;
    padding-left: 80px;
    min-height: 200px;
  }
  .queue-table .empty-state p {
    max-width: 230px;
    text-align: left;
  }
  .queue-table .empty-icon {
    margin-left: 67px;
  }
  .queue-table .empty-state strong {
    margin-left: 25px;
  }
  .workspace-footer {
    padding: 0 18px 22px;
    font-size: 8px;
  }
  .workspace-footer span {
    font-size: 9px;
  }
  .split-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .split-layout .form-grid,
  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 17px 12px;
  }
  .stack-form {
    padding: 0 18px 20px;
    gap: 18px;
  }
  .settings-form > .card > .form-grid {
    padding: 0 18px 20px;
  }
  .settings-form .span-all {
    grid-column: 1/-1;
  }
  .settings-form > .card > .stack-form .form-grid {
    grid-template-columns: 1fr;
  }
  .schedule-table th,
  .schedule-table td {
    padding: 10px 14px;
  }
  .category-table {
    min-width: 530px;
  }
  .settings-form {
    gap: 18px;
  }
  .schedule-hint {
    padding: 13px 18px;
    font-size: 10px;
  }
  .sticky-save {
    padding: 12px 15px;
    bottom: 10px;
    gap: 10px;
  }
  .sticky-save p {
    font-size: 9px;
    max-width: 170px;
  }
  .sticky-save .button {
    padding: 10px 15px;
  }
  .login-layout {
    display: block;
  }
  .login-intro {
    padding: 32px 25px 38px;
  }
  .login-intro .brand {
    margin-bottom: 34px;
  }
  .login-intro h1 {
    font-size: 27px;
    margin: 10px 0 16px;
  }
  .login-intro > p:last-of-type {
    font-size: 11px;
  }
  .login-panel {
    padding: 38px 25px 30px;
  }
  .login-panel h2 {
    font-size: 23px;
  }
  .login-footer {
    margin-top: 35px;
  }
  .login-decoration {
    width: 360px;
    height: 360px;
    right: -200px;
    bottom: -240px;
  }
  .public-header {
    padding: 22px 20px;
    gap: 10px;
    align-items: center;
  }
  .public-header .brand {
    gap: 9px;
  }
  .public-header .brand strong {
    font-size: 12px;
  }
  .public-header .brand small {
    font-size: 8px;
  }
  .public-header .brand-mark {
    width: 44px;
    height: 40px;
  }
  .clinic-contact {
    font-size: 8px;
    max-width: 140px;
  }
  .clinic-contact a {
    font-size: 12px;
  }
  .public-nav > div {
    gap: 23px;
    padding: 0 20px;
  }
  .public-nav a {
    font-size: 10px;
    padding: 12px 0;
  }
  .public-main {
    padding: 28px 18px 35px;
  }
  .public-hero {
    display: block;
    margin-bottom: 25px;
  }
  .public-hero h1 {
    font-size: 25px;
    line-height: 1.7;
  }
  .public-hero p:not(.eyebrow) {
    font-size: 11px;
  }
  .public-hero .open-badge {
    margin-top: 16px;
    font-size: 10px;
  }
  .public-columns {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .public-form {
    padding: 0 18px 22px;
  }
  .notice {
    margin: 0 18px 18px;
    font-size: 11px;
  }
  .public-stats {
    padding: 20px;
  }
  .public-footer {
    margin: 0 18px;
    padding: 23px 0;
    display: block;
    font-size: 9px;
    line-height: 2;
  }
  .public-footer > span {
    display: block;
  }
  .public-cancel {
    margin: 25px 18px;
    padding: 25px 20px;
  }
  .public-cancel h1 {
    font-size: 21px;
  }
  .confirmation-meta {
    padding: 18px 10px;
    gap: 10px;
  }
  .confirmation-meta strong {
    font-size: 15px;
  }
  .waiting-display {
    padding: 25px 18px;
  }
  .waiting-heading {
    margin-bottom: 25px;
    gap: 15px;
  }
  .waiting-heading .brand strong {
    font-size: 15px;
  }
  .waiting-heading time {
    font-size: 10px;
  }
  .waiting-stats {
    gap: 15px;
  }
  .waiting-stat {
    padding: 22px 18px;
    border-radius: 14px;
  }
  .waiting-stat h1 {
    font-size: 13px;
  }
  .waiting-number {
    font-size: 52px;
  }
  .waiting-number small {
    font-size: 15px;
    margin-left: 3px;
  }
  .waiting-display .public-queue-table {
    font-size: 16px;
  }
  .waiting-display .public-queue-table th {
    font-size: 11px;
    padding: 15px 8px;
  }
  .waiting-display .public-queue-table td {
    padding: 15px 8px;
  }
  .waiting-caption {
    font-size: 10px;
  }
  .detail-content .form-grid {
    gap: 16px 12px;
  }
  #patient-dialog {
    max-height: 94dvh;
  }
  .dialog-header {
    padding: 17px 20px;
  }
  .detail-content input {
    font-size: 13px;
  }
  .detail-content .stack-form {
    gap: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Keep the reception list close to the entry form on staff displays. */
@media (min-width: 701px) {
  body[data-screen="entry"] .main-content {
    padding-top: 24px;
  }
  body[data-screen="entry"] .page-heading {
    margin-bottom: 22px;
  }
  body[data-screen="entry"] .summary-card {
    padding-top: 18px;
    padding-bottom: 18px;
  }
  body[data-screen="entry"] .summary-card small {
    margin-top: 3px;
  }
  body[data-screen="entry"] .summary-grid {
    margin-bottom: 20px;
  }
  .reception-card .section-heading {
    padding-top: 18px;
    padding-bottom: 15px;
  }
  .reception-card .entry-fields {
    padding-bottom: 20px;
  }
  .reception-card {
    margin-bottom: 20px;
  }
  .queue-toolbar {
    padding-top: 18px;
    padding-bottom: 18px;
  }
}
input:not([type="button"], [type="submit"]),
select,
textarea {
  font-weight: 400;
}
#t_Hour_unit:empty {
  display: none;
}
.confirmation-number small {
  font-size: 20px;
  margin-left: 6px;
}
@media (max-width: 700px) {
  .summary-card strong {
    font-size: clamp(15px, 4.4vw, 19px);
  }
  .queue-table .btnStatus {
    width: 40px;
    height: 40px;
  }
  .waiting-number {
    font-size: 42px;
    white-space: nowrap;
  }
  .waiting-stats {
    grid-template-columns: 1fr;
  }
}

/* Monitoring keeps the live legacy database unchanged. */
.monitor-fields { display: contents; }
.monitor-notice { position: sticky; top: 0; z-index: 20; background: #e8f4f1; border-bottom: 1px solid #b7d8d2; padding: 10px 24px; color: #145d56; font-size: 14px; font-weight: 700; }
.monitor-notice span { margin-left: 20px; font-weight: 400; font-size: 12px; }
body[data-monitor="1"] .app-shell { min-height: calc(100vh - 42px); }
body[data-monitor="1"] .sticky-save, body[data-monitor="1"] .form-actions { display: none; }
body[data-monitor="1"] .queue-table input:disabled { cursor: default; opacity: .85; }
body[data-monitor="1"] .queue-table .drag-symbol { display: none; }
@media (max-width: 640px) { .monitor-notice { padding: 8px 16px; } .monitor-notice span { display: block; margin-left: 0; } }

@media (min-width: 701px) { body[data-monitor="1"] .sidebar { top: 43px; } }

#ticket-dialog, #web-registration-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); box-shadow: 0 24px 80px #163b3630; }
#ticket-dialog::backdrop, #web-registration-dialog::backdrop { background: #173a3555; }
#ticket-dialog .dialog-header button { border: 0; background: none; font-size: 26px; color: var(--muted); cursor: pointer; }
.ticket-dialog-content { padding: 24px; }
.ticket-dialog-content > p { margin: 0 0 20px; }
#ticket-number { font-size: 24px; margin-right: 4px; }
#ticket-error { color: #b65d50; font-size: 13px; }
.ticket-dialog-actions { display: flex; gap: 12px; justify-content: flex-end; }
#web-registration-error { color: #b65d50; font-size: 14px; margin-bottom: 0; }

.staff-users-layout { display: grid; grid-template-columns: minmax(240px, .85fr) minmax(320px, 1.15fr); gap: 24px; align-items: start; }
.staff-users-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.staff-users-table th, .staff-users-table td { padding: 16px 22px; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.staff-users-table th { color: var(--muted); font-size: 12px; }
.staff-users-table a { color: var(--primary); font-weight: 600; }
.staff-users-table .badge { margin-left: 8px; }
.staff-users-table .is-selected { background: #edf6f3; }
.staff-user-form { padding: 24px; display: grid; gap: 18px; }
.staff-user-form label { display: grid; gap: 8px; font-size: 13px; font-weight: 600; }
.staff-user-form input { width: 100%; min-width: 0; }
.staff-user-form .subtle { margin: -10px 0 0; }
.staff-form-error { color: #a54236; margin: 0; }
.staff-form-actions { margin-top: 6px; display: flex; justify-content: flex-end; }
@media (max-width: 1100px) { .staff-users-layout { grid-template-columns: minmax(0, 1fr); } }

/* Use a drawer so narrow staff windows keep their full working area. */
.topbar-start { display: flex; align-items: center; gap: 14px; min-width: 0; }
.menu-toggle, .menu-close, .menu-backdrop { display: none; }
@media (max-width: 960px) {
  .workspace { width: 100%; margin-left: 0; }
  .menu-toggle, .menu-close {
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; min-width: 44px; min-height: 44px; padding: 8px 10px;
    color: var(--primary); background: #fff; border: 1px solid var(--line);
    border-radius: 8px; cursor: pointer;
  }
  .menu-toggle { gap: 8px; font-size: 12px; white-space: nowrap; }
  .menu-close { align-self: flex-end; margin-bottom: 18px; font-size: 24px; line-height: 1; }
  .sidebar {
    display: none; position: fixed; inset: 0 auto 0 0;
    width: min(280px, calc(100vw - 48px)); padding: 18px;
    overflow-y: auto; overscroll-behavior: contain; z-index: 40;
    box-shadow: 8px 0 40px #173a3526;
  }
  body[data-monitor="1"] .sidebar { top: 0; }
  .sidebar.is-open { display: flex; }
  .sidebar .brand { margin-bottom: 28px; }
  .menu-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 30; background: #173a3555; }
  body.menu-open { overflow: hidden; }
  .topbar { gap: 12px; min-height: 60px; height: auto; padding-top: 8px; padding-bottom: 8px; }
  .topbar-clinic { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .staff-label { flex-shrink: 0; }
}
@media (max-width: 700px) {
  .topbar { background: #fff; border-bottom: 1px solid var(--line); padding-left: 18px; padding-right: 18px; }
  .topbar-start { gap: 10px; }
  .staff-label time, .staff-avatar { display: none; }
}

/* Clinic Sato extensions */
.queue-table .memo-column{min-width:230px}.queue-table textarea[data-memo]{width:100%;min-width:205px;resize:vertical;border:1px solid var(--line);border-radius:7px;padding:8px;background:#fff;font-size:12px;line-height:1.6}.queue-table textarea[data-memo]:focus{outline:2px solid #14776f55;border-color:var(--primary)}.exam-link{margin-top:22px;padding-top:20px;border-top:1px solid var(--line)}.waiting-display #cl_Line{display:grid;grid-template-columns:3fr 1fr;gap:24px}.waiting-display #cl_Line .card{padding:20px}.waiting-display #cl_Line .public-queue-table{width:100%}@media(max-width:700px){.waiting-display #cl_Line{grid-template-columns:1fr}}

.reception-availability{border:0;padding:0;margin:0;min-width:0}.reception-availability:disabled{opacity:.65}.clinic-announcements{margin-top:24px}.clinic-announcements>summary{color:var(--primary);font-weight:600;cursor:pointer}.clinic-announcements[open]>summary{margin-bottom:20px}.clinic-announcements .holiday-notice:last-child{margin-bottom:0}
.exam-link{padding:20px 24px;margin-top:0}.public-side>.card:first-child .Cl_Detail{max-height:540px;overflow:auto}.public-side .public-queue-table thead{position:sticky;top:0;background:#fff;z-index:1}

/* Keep Clinic Sato cross logo; the supplied Nishiya logo is clinic-specific. */
.brand-mark{width:40px;height:42px;border-radius:12px;background:var(--primary);color:#fff}.brand-mark .icon{width:25px;height:25px;stroke-width:2.8}


body[data-screen="entry"] .summary-grid { margin-bottom: 16px; gap: 14px; }
body[data-screen="entry"] .summary-card { padding: 12px 20px; gap: 14px; align-items: center; }
body[data-screen="entry"] .summary-icon { margin-top: 0; }
body[data-screen="entry"] .summary-card strong { font-size: 24px; line-height: 1.25; }
#open-manual-reception { margin-right: 12px; margin-left: auto; white-space: nowrap; font-size: 12px; }
#manual-reception { width: 560px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); box-shadow: 0 24px 80px #163b3630; }
#manual-reception::backdrop { background: #173a3566; }
#manual-reception .dialog-header button { background: none; border: 0; font-size: 26px; cursor: pointer; color: #334a41; }
#manual-reception .entry-fields { display: grid; grid-template-columns: 1fr 1fr; padding: 20px 24px 24px; }
#manual-reception #PEnter { grid-column: 1 / -1; justify-self: end; }
#manual-reception-error { color: #a32e2e; margin: 0 24px; }
body[data-screen="entry"] .queue-toolbar h2 { font-size: 12px; color: #111; }
body[data-screen="entry"] .queue-table { color: #111; }
body[data-screen="entry"] .queue-table th { background: #cbdcd3; color: #111; font-size: 12px; font-weight: 650; border-color: #afc7b9; }
body[data-screen="entry"] .queue-table td,
body[data-screen="entry"] .queue-table td a,
body[data-screen="entry"] .queue-table td span,
body[data-screen="entry"] .queue-table td small,
body[data-screen="entry"] .queue-table td label,
body[data-screen="entry"] .queue-table td input,
body[data-screen="entry"] .queue-table td textarea,
body[data-screen="entry"] .queue-table td strong,
body[data-screen="entry"] .queue-table td p { font-size: 12px; color: #111; }
body[data-screen="entry"] .queue-table .patient-name { font-weight: 700; }
body[data-screen="entry"] .queue-table .bTicket,
body[data-screen="entry"] .queue-table .patient-link { font-weight: 400; }
body[data-screen="entry"] .queue-table .drag-symbol { color: #444; }
body[data-screen="entry"] .queue-table tr.is-finished { background: #f0f3f1; }
@media (max-width: 540px) {
  #manual-reception .entry-fields { grid-template-columns: 1fr; }
  body[data-screen="entry"] .topbar-clinic { display: none; }
  body[data-screen="entry"] .summary-card { padding: 12px; }
}
@media (max-width: 960px) {
  body[data-screen="entry"] .summary-icon { display: none; }
  body[data-screen="entry"] .summary-grid { margin-bottom: 12px; gap: 8px; }
  body[data-screen="entry"] .summary-card { padding: 8px 12px; }
  body[data-screen="entry"] .summary-card p { margin-bottom: 2px; }
}

/* Outside patients remain identifiable while clearly shown as absent. */
body[data-screen="entry"] .queue-table tr.is-outside td,
body[data-screen="entry"] .queue-table tr.is-outside:hover td { background: #e1e4e6; }
body[data-screen="entry"] .queue-table tr.is-outside td,
body[data-screen="entry"] .queue-table tr.is-outside td a,
body[data-screen="entry"] .queue-table tr.is-outside td span,
body[data-screen="entry"] .queue-table tr.is-outside td small,
body[data-screen="entry"] .queue-table tr.is-outside td label,
body[data-screen="entry"] .queue-table tr.is-outside td input,
body[data-screen="entry"] .queue-table tr.is-outside td textarea,
body[data-screen="entry"] .queue-table tr.is-outside td strong,
body[data-screen="entry"] .queue-table tr.is-outside td p { color: #333; }
body[data-screen="entry"] .queue-table tr.is-outside textarea[data-memo] { background: #eceeef; border-color: #bfc5c9; }
body[data-screen="entry"] .queue-table tr.is-outside .btnStatus[aria-pressed="true"] { background: #657078; border-color: #657078; color: #fff; }

/* Dialog fallback for Safari versions without HTMLDialogElement.showModal. */
dialog.compat-dialog:not([open]) { display: none; }
dialog.compat-dialog[open] {
  display: block;
  position: fixed;
  z-index: 100;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  margin: 0;
  background: #fff;
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 80px #163b3630;
}

.compat-dialog-backdrop:not([hidden]) {
  position: fixed;
  z-index: 99;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(23, 58, 53, 0.4);
}

.queue-toolbar { flex-wrap: wrap; gap: 10px; }
.queue-toolbar > div:first-child { flex: 0 0 auto; white-space: nowrap; }
.queue-filters { flex-wrap: nowrap; margin-left: auto; max-width: 100%; overflow-x: auto; gap: 8px; }
.queue-filters > * { flex-shrink: 0; }
.queue-filters .button { width: 36px; min-height: 36px; padding: 0; }
@media(max-width:700px) { .queue-filters { width: auto; justify-content: flex-start; } }
.pwa-update { position:fixed; bottom:20px; right:20px; z-index:150; padding:16px; background:#fff; border:1px solid #adc8bf; border-radius:12px; box-shadow:0 6px 30px #173a3526; }
.pwa-update button { margin-left:12px; }

.waiting-display { padding-top: 22px; padding-bottom: 22px; }
.waiting-heading { margin-bottom: 16px; }
.waiting-stats { margin-bottom: 16px; }
.waiting-stat { padding-top: 14px; padding-bottom: 14px; }
.waiting-number { line-height: 1.12; }

.waiting-notices { display: grid; position: relative; margin-bottom: 10px; }
.waiting-notice {
  grid-area: 1 / 1;
  margin: 0;
  min-width: 0;
  padding: 6px 54px 6px 36px;
  line-height: 1.35;
  overflow-wrap: break-word;
}
.waiting-notice[data-inactive] { visibility: hidden; }
.waiting-notice h2 { display: block; margin: 0 0 2px; font-size: 15px; font-weight: 700; }
.waiting-notice p { display: inline; margin: 0; white-space: pre-line; }
.waiting-notice-position { position: absolute; top: 6px; right: 10px; margin: 0; font-size: 11px; color: var(--muted); }
