:root {
  color: #172033;
  background: #f4f7fb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 20rem; background: #f4f7fb; }
a { color: #164e63; }
a:focus-visible, summary:focus-visible, main:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}
.skip-link {
  position: fixed; left: 1rem; top: -5rem; z-index: 10;
  padding: .75rem 1rem; background: #172033; color: #fff; border-radius: .5rem;
}
.skip-link:focus { top: 1rem; }
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 4rem; padding: .75rem 1rem; background: #fff;
  border-bottom: 1px solid #d8e0eb;
}
.brand { color: #0f3d4c; font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.user-summary { display: grid; text-align: right; font-size: .875rem; }
.user-summary span { color: #526075; font-size: .75rem; }
.user-actions { display: flex; align-items: center; gap: .75rem; }
.logout-form { margin: 0; }
.logout-form button {
  min-height: 2.75rem; padding: .55rem .8rem; border: 1px solid #94a3b8;
  border-radius: .5rem; background: #fff; color: #172033; font: inherit; cursor: pointer;
}
.logout-form button:hover { background: #eef5f7; }
.app-shell { width: min(100%, 80rem); margin: 0 auto; padding: 1rem; }
.guest-shell { min-height: calc(100vh - 8rem); display: grid; align-items: center; }
.mobile-navigation { margin-bottom: 1rem; border: 1px solid #cbd5e1; border-radius: .75rem; background: #fff; }
.mobile-navigation summary { min-height: 3rem; padding: .75rem 1rem; cursor: pointer; font-weight: 700; }
nav ul { list-style: none; margin: 0; padding: .5rem; }
nav a { display: flex; align-items: center; min-height: 2.75rem; padding: .65rem .75rem; border-radius: .5rem; text-decoration: none; }
nav a:hover { background: #eef5f7; }
nav a[aria-current="page"] { background: #0f566d; color: #fff; font-weight: 700; }
.desktop-navigation { display: none; }
.panel { padding: 1.25rem; background: #fff; border: 1px solid #d8e0eb; border-radius: 1rem; box-shadow: 0 8px 24px rgba(23, 32, 51, .06); }
.auth-panel { width: min(100%, 28rem); margin: 0 auto; }
.panel h1 { margin: .25rem 0 .75rem; font-size: clamp(1.5rem, 6vw, 2rem); line-height: 1.2; }
.eyebrow { margin: 0; color: #0f566d; font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.status-message { margin-top: 1.25rem; padding: .875rem 1rem; border-left: .3rem solid #0f766e; background: #ecfdf5; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; padding: 1rem; color: #526075; font-size: .75rem; }
.site-footer code { overflow-wrap: anywhere; }
.job-form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.form-field { display: grid; gap: .35rem; font-weight: 700; }
.form-field input, .form-field select, .inline-actions input { width: 100%; min-height: 2.75rem; padding: .65rem .75rem; border: 1px solid #94a3b8; border-radius: .5rem; font: inherit; }
.check-field { display: flex; align-items: center; gap: .65rem; min-height: 2.75rem; }
.check-field input { width: 1.25rem; height: 1.25rem; }
.primary-button, .danger-button { min-height: 2.75rem; padding: .7rem 1rem; border: 0; border-radius: .55rem; color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.primary-button { background: #0f566d; }
.primary-link { display: inline-flex; align-items: center; min-height: 2.75rem; padding: .7rem 1rem; border-radius: .55rem; background: #0f566d; color: #fff; font-weight: 800; text-decoration: none; }
.danger-button { background: #b42318; }
.secondary-link { display: inline-flex; align-items: center; min-height: 2.75rem; font-weight: 700; }
.job-list { margin-top: 1rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-heading h2 { margin: .25rem 0; }
.job-cards { display: grid; gap: .75rem; margin-top: 1rem; }
.job-card { display: grid; gap: .75rem; padding: 1rem; border: 1px solid #d8e0eb; border-radius: .75rem; }
.job-card h3 { margin: .5rem 0 .25rem; font-size: 1rem; }
.job-card p { margin: 0; color: #526075; }
.status-badge { display: inline-flex; padding: .2rem .55rem; border-radius: 999px; background: #e2e8f0; font-size: .8rem; font-weight: 800; }
.status-running { background: #dbeafe; color: #1e40af; }
.status-succeeded { background: #dcfce7; color: #166534; }
.status-failed, .status-cancelled { background: #fee2e2; color: #991b1b; }
.job-detail .job-id { display: grid; gap: .25rem; }
.job-id code { overflow-wrap: anywhere; }
.detail-grid { display: grid; gap: .75rem; margin: 1.5rem 0; }
.detail-grid div { padding: .75rem; border: 1px solid #d8e0eb; border-radius: .6rem; }
.detail-grid dt { color: #526075; font-size: .8rem; }
.detail-grid dd { margin: .2rem 0 0; font-weight: 800; }
.error-message { display: grid; gap: .25rem; margin: 1rem 0; padding: 1rem; border-left: .3rem solid #b42318; background: #fff1f2; }
.polling-note, .empty-state { color: #526075; }
.batch-form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.schedule-summary, .schedule-panel, .statistics-panel { margin-bottom: 1rem; }
.summary-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: 1rem; }
.summary-cards > div { display: grid; padding: .75rem; border: 1px solid #d8e0eb; border-radius: .65rem; background: #f8fafc; }
.summary-cards span { color: #526075; font-size: .78rem; }
.summary-cards strong { overflow-wrap: anywhere; }
.warning-message { margin-top: 1rem; padding: 1rem; border-left: .3rem solid #d97706; background: #fffbeb; }
.warning-message ul { margin-bottom: 0; }
.scroll-hint { color: #526075; font-size: .85rem; }
.schedule-scroll, .statistics-scroll { max-width: 100%; overflow: auto; border: 1px solid #cbd5e1; border-radius: .75rem; }
.schedule-scroll:focus-visible, .statistics-scroll:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
.schedule-table { border-collapse: separate; border-spacing: 0; min-width: max-content; font-size: .85rem; }
.schedule-table th, .schedule-table td { min-width: 2.75rem; height: 2.75rem; padding: .35rem; text-align: center; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; background: #fff; }
.schedule-table thead th { position: sticky; top: 0; z-index: 2; background: #eef5f7; }
.schedule-table thead th span, .schedule-table thead th small { display: block; }
.schedule-table .nurse-column { position: sticky; left: 0; z-index: 3; min-width: 7rem; text-align: left; background: #f8fafc; }
.schedule-table thead .nurse-column { z-index: 4; background: #dcecef; }
.schedule-table .weekend { background: #fff1f2; color: #9f1239; }
.shift-cell span { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; min-height: 2rem; border-radius: .45rem; font-weight: 900; }
.shift-d span { background: #fef3c7; color: #854d0e; }
.shift-e span { background: #dbeafe; color: #1e40af; }
.shift-n span, .shift-ne span { background: #312e81; color: #fff; }
.shift-m span { background: #ccfbf1; color: #115e59; }
.shift-o span { background: #e2e8f0; color: #334155; }
.shift-missing span { background: #fee2e2; color: #991b1b; }
.statistics-panel details summary { min-height: 3rem; cursor: pointer; }
.statistics-panel details summary > span { display: inline-grid; margin-left: .5rem; }
.statistics-table { width: 100%; border-collapse: collapse; margin-top: 1rem; text-align: center; }
.statistics-table th, .statistics-table td { min-width: 3rem; padding: .55rem; border: 1px solid #d8e0eb; }
.operation-panel { margin-top: 1rem; }
.operation-form, .operation-cards { display: grid; gap: .75rem; }
.operation-card { display: grid; gap: .75rem; padding: 1rem; border: 1px solid #d8e0eb; border-radius: .75rem; background: #f8fafc; }
.operation-card > div { display: grid; }
.operation-card span { color: #526075; }
.inline-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

@media (min-width: 48rem) {
  .site-header { padding-inline: 2rem; }
  .app-shell { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1.5rem; padding: 1.5rem 2rem; }
  .guest-shell { display: grid; grid-template-columns: minmax(0, 1fr); }
  .mobile-navigation { display: none; }
  .desktop-navigation { display: block; align-self: start; position: sticky; top: 1.5rem; background: #fff; border: 1px solid #d8e0eb; border-radius: 1rem; }
  .panel { padding: 2rem; }
  .job-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job-form .check-field, .job-form .primary-button { grid-column: 1 / -1; }
  .job-card { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .batch-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .summary-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .operation-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operation-form button, .operation-form .check-field { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
