:root {
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --emerald: #059669;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #cbd5e1;
  --danger: #d93025;
  --danger-bg: #fce8e6;
}

*, *::before, *::after { box-sizing: border-box; }

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

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

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

.container {
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 1rem;
}

.site-header {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
  color: #ffffff;
  padding-block: 1.75rem;
  margin-block-end: 1.5rem;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.badge-top {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-block-end: 0.5rem;
}

.site-header h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
}

.subtitle {
  margin: 0;
  opacity: 0.92;
  max-width: 700px;
  font-size: 0.95rem;
}

.btn-light {
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  padding: 0.7rem 1.15rem;
  border-radius: 12px;
  border: 0;
  background: #10b981;
  color: #022c22;
  cursor: pointer;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 960px) {
  .main-grid {
    grid-template-columns: 1fr 1.15fr;
    align-items: start;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.35rem;
  box-shadow: 0 8px 24px -10px rgba(15, 23, 42, 0.08);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-block-end: 1rem;
}

.field label, fieldset legend {
  font-weight: 600;
  font-size: 0.9rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.field input, .field textarea {
  font: inherit;
  font-size: max(1rem, 1em);
  min-height: 48px;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid #767676;
  border-radius: 10px;
}

.radio-box {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}

.radio-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-block-start: 0.35rem;
}

.radio-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
}

.radio-opt input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--brand);
}

.error-msg {
  display: none;
  color: var(--danger);
  font-size: 0.84rem;
  font-weight: 600;
}

.field :is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.field :is(:user-invalid, .user-invalid-fallback) + .error-msg {
  display: block;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.btn-primary {
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: 0;
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
}

.btn-secondary {
  font: inherit;
  font-weight: 600;
  min-height: 48px;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  border: 1.5px solid #64748b;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

.status-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-block-end: 1rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-block-end: 1.25rem;
}

.kpi-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  background: var(--bg);
}

.kpi-box span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.kpi-box strong {
  font-size: 1.15rem;
  color: var(--text);
}

.kpi-highlight {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.kpi-highlight strong {
  color: var(--emerald);
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap h3 {
  margin: 0 0 0.65rem;
  font-size: 1.02rem;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.schedule-table th, .schedule-table td {
  padding: 0.6rem 0.65rem;
  border-block-end: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.schedule-table th:first-child, .schedule-table td:first-child {
  text-align: center;
}

.schedule-table thead th {
  background: #f1f5f9;
  font-weight: 700;
}

.site-footer {
  padding-block: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

dialog {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0;
  width: min(92vw, 480px);
  background: var(--surface);
  color: var(--text);
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(15, 23, 42, 0.6);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.2rem;
  border-block-end: 1px solid var(--border);
}

.dialog-header h2 { margin: 0; font-size: 1.1rem; }

.close-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
}

.dialog-body { padding: 1.2rem; }
