:root {
  --bg: #fcfcfd;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent: #1e3a5f;
  --accent-hover: #152a45;
  --radius: 0.5rem;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  max-width: 36rem;
  margin: 1.5rem auto;
  padding: 0 1rem;
  -webkit-font-smoothing: antialiased;
}

.page-header {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.page-header__brand {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.page-logo {
  display: block;
  width: 75%;
  max-width: 11rem;
  height: auto;
  margin: 0 auto 0.5rem;
}

@media (max-width: 29.99rem) {
  .page-header {
    position: relative;
    flex-wrap: wrap;
  }

  .page-header__brand {
    width: 100%;
    padding-left: 2.75rem;
    padding-right: 2.75rem;
  }

  .page-logo {
    width: 75%;
    max-width: none;
  }

  #user-button {
    position: absolute;
    top: 0;
    right: 0;
  }
}

.page-header h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0;
}

body.is-signed-in #signedOutView {
  display: none !important;
}

.auth-shell:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - 3rem);
  text-align: center;
}

.auth-shell .page-logo {
  margin-bottom: 1rem;
}

.auth-shell .sub {
  max-width: 20rem;
  margin-left: auto;
  margin-right: auto;
}

.empty-state,
.boot-error {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface);
}

.empty-state h2,
.boot-error h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

.boot-error pre {
  font-size: 0.85rem;
  margin: 0;
  white-space: pre-wrap;
}

#sign-in {
  margin-top: 1rem;
  width: 100%;
  max-width: 24rem;
  display: flex;
  justify-content: center;
}

.sub {
  color: var(--text-muted);
}

label {
  margin-right: 0.5rem;
}

.control-panel {
  border: 1px solid var(--border);
  background: var(--surface);
  margin: 1rem 0;
}

.control-block {
  padding: 0.85rem 1rem;
}

.control-block + .control-block {
  border-top: 1px solid var(--border);
}

.control-label {
  display: block;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.control-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-actions select,
.control-actions input[type='tel'] {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.control-actions button {
  flex: 0 0 auto;
  font-size: 1rem;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.control-actions .btn-primary {
  padding: 0.35rem 0.85rem;
  font-size: 0.95rem;
  font-weight: 500;
  min-height: 2.25rem;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  -webkit-text-fill-color: #fff;
}

.control-actions .btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-sizing: border-box;
  font-weight: 500;
  -webkit-text-fill-color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary--block {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 2.85rem;
  font-size: 1rem;
}

.btn-outline {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  box-sizing: border-box;
  font-weight: 500;
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
  -webkit-text-fill-color: #fff;
}

@media (min-width: 30rem) {
  .control-block {
    display: grid;
    grid-template-columns: 11.5rem 1fr;
    gap: 0.5rem 0.75rem;
    align-items: center;
  }

  .control-label {
    margin: 0;
  }

  .control-actions {
    min-width: 0;
  }
}

select {
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

#status.status-card {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem;
  margin: 1rem 0;
}

.status-list {
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

.status-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  font-size: 1rem;
  line-height: 1.4;
}

.status-row dt {
  margin: 0;
  font-size: inherit;
  font-weight: 600;
  color: inherit;
}

.status-row dd {
  margin: 0;
  font-size: inherit;
  font-weight: normal;
  color: inherit;
}

.status-row dd.is-loading {
  color: var(--text-muted);
  font-style: italic;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.75rem;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0 0 1.75rem;
}

.profile-actions button,
.buttons button {
  font-size: 1rem;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.profile-actions button {
  box-sizing: border-box;
  width: 100%;
  height: 2.75rem;
  min-height: 2.75rem;
  max-height: 2.75rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.15;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.profile-actions .profile-override-btn {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 500;
  -webkit-text-fill-color: currentColor;
}

.profile-actions .profile-override-btn:hover {
  background: #f8fafc;
}

.profile-actions .profile-override-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  -webkit-text-fill-color: #fff;
}

.profile-actions .profile-override-btn.is-active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.profile-actions .profile-override-btn.is-pending {
  opacity: 0.72;
}

.profile-actions .btn-outline {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 500;
  -webkit-text-fill-color: currentColor;
}

.profile-actions .btn-outline:hover {
  background: var(--accent);
  color: #fff;
  -webkit-text-fill-color: #fff;
}

.profile-actions__refresh {
  grid-column: 1 / -1;
}

.location-card {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem;
  margin: 0;
}

.location-card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.location-card .location-updated {
  margin-top: 0.75rem;
}

.location-card #map {
  height: 16rem;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0;
}

.location-card .map-link {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.location-card .map-link a {
  color: var(--accent);
}

#map {
  height: 16rem;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.map-link {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.debug-panel {
  margin: 1rem 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.debug-panel summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  user-select: none;
}

.debug-panel pre {
  font-size: 0.8rem;
  background: #f8fafc;
  padding: 0.75rem;
  margin: 0;
  overflow: auto;
  max-height: 10rem;
  border-top: 1px solid var(--border);
  white-space: pre-wrap;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.parent-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.parent-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text);
}

.parent-tab.is-active {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.parent-panel h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.schedule-panel {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem;
  margin: 0;
  min-width: 0;
  overflow: hidden;
}

.parent-panel {
  min-width: 0;
}

.schedule-block {
  border-top: 1px solid var(--border);
  padding: 1rem 0 0;
  margin: 1rem 0 0;
}

.schedule-block:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0.75rem;
}

.schedule-block h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.schedule-block--collapsible > summary {
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  list-style: none;
  margin: 0;
}

.schedule-block--collapsible > summary::-webkit-details-marker {
  display: none;
}

.schedule-block--collapsible > summary::before {
  content: '▸ ';
  color: var(--text-muted);
}

.schedule-block--collapsible[open] > summary::before {
  content: '▾ ';
}

.schedule-block__body {
  padding-top: 0.75rem;
}

.schedule-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  width: 100%;
  box-sizing: border-box;
}

.schedule-grid--add {
  gap: 0.5rem;
}

.schedule-grid__cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0.5rem;
  box-sizing: border-box;
}

.schedule-grid__cell--full {
  grid-column: 1 / -1;
}

.schedule-grid__cell label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.schedule-grid__cell input,
.schedule-grid__cell select {
  width: 100%;
  max-width: 100%;
  height: 2.35rem;
  min-height: 2.35rem;
  max-height: 2.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 0.35rem;
  font-size: 0.875rem;
  line-height: 1.2;
  box-sizing: border-box;
  display: block;
}

.schedule-grid__cell input[type='date'],
.schedule-grid__cell input[type='time'] {
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}

.schedule-grid__cell select {
  appearance: auto;
  padding-right: 1.5rem;
}

.schedule-actions {
  margin: 0;
  min-width: 0;
}

.btn-primary--block {
  margin-bottom: 0;
}

.schedule-row--half .btn-primary {
  min-height: 2.75rem;
  font-size: 0.95rem;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  -webkit-text-fill-color: #fff;
}

.schedule-row--half .btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.schedule-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  min-width: 0;
}

.schedule-field label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.schedule-field select {
  width: 100%;
  height: 2.35rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 0.5rem;
  box-sizing: border-box;
}

.schedule-row--half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0;
}

.schedule-row--half button {
  width: 100%;
  min-height: 2.75rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  box-sizing: border-box;
}

.schedule-row--half .schedule-btn-danger {
  border-color: #dc2626;
  color: #dc2626;
  background: var(--surface);
  font-weight: 500;
}

.schedule-delete-actions__primary {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 2.85rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.schedule-delete-actions__secondary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}

.schedule-delete-actions__secondary button {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.15;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  box-sizing: border-box;
}

.schedule-delete-actions__secondary .schedule-btn-danger {
  border-color: #dc2626;
  color: #dc2626;
  background: var(--surface);
  font-weight: 500;
}

.schedule-delete-actions__secondary .schedule-btn-danger:hover {
  background: #fef2f2;
}

.schedule-next {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
}

.schedule-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.75rem;
}

.schedule-row:last-child {
  margin-bottom: 0;
}

.schedule-row label {
  font-size: 1rem;
}

.schedule-row--past {
  margin-bottom: 0;
}

.schedule-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 1rem;
  margin: 0;
}

.schedule-row--calendar {
  justify-content: space-between;
}

.schedule-note {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.schedule-debug {
  margin-top: 1rem;
}

.schedule-block button:not(.btn-primary):not(.schedule-btn-danger) {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 1rem;
}

.schedule-block .btn-primary {
  padding: 0.6rem 1rem;
}

.window-list {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.window-list .window-past {
  color: var(--text-muted);
}

.bulk-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  margin: 0.5rem 0 0.75rem;
}

.bulk-weekday {
  font-size: 0.75rem;
  text-align: center;
  color: var(--text-muted);
}

.bulk-day {
  min-height: 2rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
}

.bulk-day.outside {
  border: none;
  background: transparent;
  cursor: default;
}

.bulk-day.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.bulk-day.today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

#btnForceSchool[aria-pressed='true'] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#btnForceSchool[aria-pressed='true']:hover,
.profile-actions button:hover,
.buttons button:hover,
.control-actions button:hover,
.schedule-block button:hover {
  border-color: var(--accent);
}

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

input[type='date'],
input[type='time'] {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
  font-size: 1rem;
}
