* {
  box-sizing: border-box;
}

:root {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;

  color: #1f2937;
  background: #eef0f3;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #eef0f3;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}


/* =========================================================
   LOGIN
   ========================================================= */

.login-screen {
  width: 100%;
  max-width: 520px;
  min-height: 100dvh;

  margin: 0 auto;

  padding:
    calc(40px + env(safe-area-inset-top))
    20px
    calc(40px + env(safe-area-inset-bottom));

  display: flex;
  align-items: center;
  justify-content: center;

  background: #f7f8fa;
}

.login-card {
  width: 100%;

  padding: 24px 18px;

  background: white;

  border: 1px solid #e5e7eb;
  border-radius: 14px;
}

.login-brand {
  margin-bottom: 26px;
  text-align: center;
}

.login-brand h1 {
  margin: 0;

  font-size: 28px;
  line-height: 1.1;
}

.login-brand p {
  margin: 5px 0 0;

  color: #6b7280;
  font-size: 13px;
}

.login-help {
  margin: 13px 0 0;

  color: #6b7280;

  text-align: center;

  font-size: 12px;
  line-height: 1.4;
}

.login-error {
  margin-top: 15px;
  padding: 10px 12px;

  background: #fef2f2;

  border: 1px solid #fecaca;
  border-radius: 8px;

  color: #991b1b;

  font-size: 13px;
  line-height: 1.4;
}


/* =========================================================
   APP SHELL
   ========================================================= */

.app-shell {
  width: 100%;
  max-width: 520px;
  min-height: 100dvh;

  margin: 0 auto;

  background: #f7f8fa;

  position: relative;
}

@media (min-width: 521px) {

  .app-shell,
  .login-screen {
    box-shadow:
      0 0 30px rgba(0, 0, 0, 0.08);
  }

}


/* =========================================================
   HEADER
   ========================================================= */

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;

  min-height: 72px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding:
    calc(11px + env(safe-area-inset-top))
    14px
    11px;

  background: rgba(255, 255, 255, 0.96);

  border-bottom: 1px solid #e5e7eb;
}

.brand {
  min-width: 0;
}

.brand strong {
  display: block;

  font-size: 19px;
  line-height: 1.1;
}

.brand span {
  display: block;

  margin-top: 3px;

  color: #6b7280;

  font-size: 11px;
}

.account-area {
  min-width: 0;

  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.account-details {
  min-width: 0;
  text-align: right;
}

.account-details strong {
  display: block;

  overflow: hidden;

  font-size: 12px;
  line-height: 1.25;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-details span {
  display: block;

  margin-top: 2px;

  overflow: hidden;

  color: #6b7280;

  font-size: 10px;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button {
  flex: 0 0 auto;

  min-height: 34px;

  padding: 6px 9px;

  border: 1px solid #d1d5db;
  border-radius: 7px;

  background: white;

  color: #4b5563;

  font-size: 11px;
  font-weight: 650;
}


/* =========================================================
   MAIN
   ========================================================= */

.app-content {
  padding:
    18px
    14px
    calc(90px + env(safe-area-inset-bottom));
}

.view {
  display: none;
}

.view.active {
  display: block;
}


/* =========================================================
   TITLES
   ========================================================= */

.view-title {
  margin-bottom: 18px;
}

.eyebrow {
  display: block;

  margin-bottom: 5px;

  color: #6b7280;

  font-size: 12px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.view-title h1 {
  margin: 0;

  font-size: 25px;
  line-height: 1.15;
}

.view-title p {
  margin: 7px 0 0;

  color: #6b7280;

  font-size: 14px;
  line-height: 1.45;
}

.form-title {
  margin-top: 18px;
}


/* =========================================================
   FILTERS
   ========================================================= */

.filters {
  margin-bottom: 22px;
  padding: 13px;

  background: white;

  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.filters-title {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 10px;

  font-size: 13px;
}

.text-button {
  padding: 4px 0;

  border: 0;

  background: transparent;

  color: #4b5563;

  font-size: 12px;
  font-weight: 600;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.field-wide {
  grid-column: 1 / -1;
}


/* =========================================================
   FORM FIELDS
   ========================================================= */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;

  margin-bottom: 15px;
}

.filter-grid .field {
  margin-bottom: 0;
}

.field label {
  color: #374151;

  font-size: 12px;
  font-weight: 700;
}

.field small {
  color: #6b7280;

  font-size: 11px;
  line-height: 1.35;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;

  padding: 10px 11px;

  border: 1px solid #cfd4dc;
  border-radius: 9px;

  background: white;

  color: #111827;
}

textarea {
  min-height: 85px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #dbeafe;
  border-color: #3b82f6;
}

.two-column-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}


/* =========================================================
   MULTI-CHILD SELECTOR
   ========================================================= */

.child-selector-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.child-select-card {
  padding: 11px 12px;

  background: white;

  border: 1px solid #d1d5db;
  border-radius: 10px;

  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.child-select-card.selected {
  background: #eff6ff;
  border-color: #60a5fa;
}

.child-select-main {
  width: 100%;
  min-height: 42px;

  display: flex;
  align-items: center;
  gap: 10px;

  padding: 0;

  border: 0;

  background: transparent;

  text-align: left;
}

.child-check {
  width: 24px;
  height: 24px;

  flex: 0 0 24px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1.5px solid #9ca3af;
  border-radius: 50%;

  color: transparent;

  font-size: 15px;
  font-weight: 800;
}

.child-select-card.selected .child-check {
  background: #111827;
  border-color: #111827;

  color: white;
}

.child-name {
  flex: 1;

  font-size: 14px;
  font-weight: 700;
}

.child-default {
  display: block;

  margin-top: 2px;

  color: #6b7280;

  font-size: 11px;
  font-weight: 500;
}

.child-booster-field {
  margin-top: 9px;
  padding-top: 9px;

  border-top: 1px solid #dbeafe;
}

.child-booster-field label {
  display: block;

  margin-bottom: 5px;

  color: #4b5563;

  font-size: 11px;
  font-weight: 700;
}

.child-booster-field select {
  min-height: 40px;

  padding-top: 7px;
  padding-bottom: 7px;
}

.selection-summary {
  margin-top: 9px;

  color: #4b5563;

  font-size: 12px;
  font-weight: 650;
}


/* =========================================================
   LIST HEADING
   ========================================================= */

.list-heading {
  margin-bottom: 10px;
}

.list-heading h2 {
  margin: 0;

  font-size: 18px;
}

.list-heading p {
  margin: 3px 0 0;

  color: #6b7280;

  font-size: 12px;
}


/* =========================================================
   RIDE CARDS
   ========================================================= */

.ride-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ride-card {
  padding: 15px;

  background: white;

  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.ride-date {
  margin-bottom: 6px;

  color: #6b7280;

  font-size: 12px;
  font-weight: 700;
}

.ride-route {
  font-size: 18px;
  font-weight: 750;
  line-height: 1.25;
}

.ride-time {
  margin-top: 4px;

  color: #374151;

  font-size: 14px;
}

.ride-person {
  margin-top: 12px;

  font-size: 14px;
}

.ride-person strong {
  font-weight: 700;
}

.ride-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;

  margin-top: 10px;
}

.ride-tag {
  padding: 5px 8px;

  background: #f3f4f6;

  border-radius: 999px;

  color: #4b5563;

  font-size: 11px;
  font-weight: 600;
}

.ride-comment {
  margin-top: 12px;
  padding-top: 11px;

  border-top: 1px solid #f0f1f3;

  color: #4b5563;

  font-size: 13px;
  line-height: 1.45;
}

.ride-action {
  width: 100%;
  min-height: 46px;

  margin-top: 14px;

  border: 0;
  border-radius: 9px;

  background: #111827;

  color: white;

  font-weight: 700;
}


/* =========================================================
   INLINE BOOKING
   ========================================================= */

.inline-booking {
  margin-top: 13px;
  padding: 13px;

  background: #f8f9fb;

  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.inline-booking-title {
  margin-bottom: 10px;

  font-size: 13px;
  font-weight: 750;
}

.inline-booking .child-selector-list {
  margin-bottom: 10px;
}

.inline-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}


/* =========================================================
   FALLBACK ACTION
   ========================================================= */

.fallback-card {
  margin-top: 20px;
  padding: 18px;

  background: #eef1f5;

  border-radius: 12px;

  text-align: center;
}

.fallback-card strong {
  display: block;

  font-size: 15px;
}

.fallback-card p {
  margin: 5px 0 14px;

  color: #6b7280;

  font-size: 13px;
  line-height: 1.4;
}


/* =========================================================
   FORMS / BUTTONS
   ========================================================= */

.ride-form {
  padding: 15px;

  background: white;

  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.primary-big-button,
.secondary-big-button {
  width: 100%;
  min-height: 48px;

  padding: 11px 14px;

  border-radius: 9px;

  font-weight: 700;
}

.primary-big-button {
  border: 1px solid #111827;

  background: #111827;

  color: white;
}

.primary-big-button:disabled {
  border-color: #9ca3af;

  background: #9ca3af;

  cursor: not-allowed;
}

.secondary-big-button {
  border: 1px solid #cfd4dc;

  background: white;

  color: #111827;
}

.back-button {
  min-height: 40px;

  padding: 7px 0;

  border: 0;

  background: transparent;

  color: #374151;

  font-weight: 650;
}


/* =========================================================
   EMPTY / LOADING
   ========================================================= */

.empty-state,
.loading {
  padding: 24px 18px;

  background: white;

  border: 1px dashed #d1d5db;
  border-radius: 12px;

  color: #6b7280;

  text-align: center;

  font-size: 13px;
  line-height: 1.45;
}

.empty-state strong {
  display: block;

  margin-bottom: 4px;

  color: #374151;

  font-size: 14px;
}


/* =========================================================
   BOTTOM NAV
   ========================================================= */

.bottom-nav {
  position: fixed;

  left: 50%;
  bottom: 0;

  transform: translateX(-50%);

  z-index: 30;

  width: 100%;
  max-width: 520px;

  min-height:
    calc(
      64px +
      env(safe-area-inset-bottom)
    );

  padding-bottom:
    env(safe-area-inset-bottom);

  display: grid;
  grid-template-columns: repeat(3, 1fr);

  background: rgba(255, 255, 255, 0.97);

  border-top: 1px solid #e5e7eb;
}

.nav-button {
  min-height: 64px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;

  border: 0;

  background: transparent;

  color: #6b7280;

  font-size: 11px;
  font-weight: 650;
}

.nav-icon {
  font-size: 20px;
  line-height: 1;
}

.nav-button.active {
  color: #111827;

  background: #f7f8fa;
}


/* =========================================================
   MESSAGE
   ========================================================= */

.message {
  position: fixed;

  left: 50%;

  bottom:
    calc(
      78px +
      env(safe-area-inset-bottom)
    );

  transform: translateX(-50%);

  z-index: 50;

  display: none;

  width: calc(100% - 28px);
  max-width: 492px;

  padding: 12px 14px;

  background: #111827;

  color: white;

  border-radius: 9px;

  text-align: center;

  font-size: 13px;

  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.2);
}

.message.error {
  background: #991b1b;
}


/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 380px) {

  .top-bar {
    padding-left: 11px;
    padding-right: 11px;
  }

  .brand strong {
    font-size: 17px;
  }

  .account-details span {
    display: none;
  }

  .app-content {
    padding-left: 11px;
    padding-right: 11px;
  }

  .two-column-fields {
    grid-template-columns: 1fr;
    gap: 0;
  }

}


/* =========================================================
   GREEN SCHOOL NEW ZEALAND VISUAL THEME
   Inspired by the school's green / earth palette and
   spacious, nature-led website presentation.
   ========================================================= */

:root {
  --gs-green: #085A2F;
  --gs-green-deep: #064725;
  --gs-green-soft: #E8F0EA;
  --gs-brown: #57370B;
  --gs-brown-soft: #EFE8DC;
  --gs-cream: #F4F1E9;
  --gs-paper: #FBFAF6;
  --gs-line: #D8D1C3;
  --gs-text: #243027;
  --gs-muted: #687168;

  color: var(--gs-text);
  background: var(--gs-cream);
}

html {
  background: var(--gs-cream);
}

body {
  background:
    linear-gradient(
      180deg,
      #EEEAE0 0,
      var(--gs-cream) 220px,
      var(--gs-cream) 100%
    );
  color: var(--gs-text);
}

.login-screen,
.app-shell {
  background: var(--gs-paper);
}

@media (min-width: 521px) {
  .app-shell,
  .login-screen {
    box-shadow:
      0 0 0 1px rgba(87, 55, 11, 0.05),
      0 18px 50px rgba(55, 61, 49, 0.12);
  }
}


/* --- Green School branding --- */

.login-card {
  padding: 28px 20px 24px;

  border-color: var(--gs-line);
  border-radius: 18px;

  background:
    linear-gradient(
      180deg,
      #FFFFFF 0%,
      #FBFAF6 100%
    );

  box-shadow:
    0 12px 35px rgba(44, 52, 42, 0.08);
}

.login-brand {
  margin-bottom: 30px;
}

.login-school-logo {
  display: block;

  width: min(255px, 78%);
  height: auto;

  margin: 0 auto;
}

.brand-rule {
  width: 62px;
  height: 2px;

  margin: 20px auto 18px;

  background: var(--gs-brown);
}

.login-app-label {
  display: block;

  margin-bottom: 6px;

  color: var(--gs-brown);

  font-size: 11px;
  font-weight: 750;

  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-brand h1,
.view-title h1,
.list-heading h2 {
  font-family:
    Georgia,
    "Times New Roman",
    serif;

  color: var(--gs-green);
}

.login-brand h1 {
  font-size: 35px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.login-brand p {
  max-width: 330px;

  margin: 8px auto 0;

  color: var(--gs-muted);

  font-size: 13px;
  line-height: 1.5;
}

.login-help {
  color: var(--gs-muted);
}


/* --- Header --- */

.top-bar {
  min-height: 78px;

  padding-top:
    calc(9px + env(safe-area-inset-top));
  padding-bottom: 9px;

  background: rgba(251, 250, 246, 0.97);

  border-bottom-color: var(--gs-line);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand-lockup {
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 9px;
}

.header-school-logo {
  width: 64px;
  height: 42px;

  flex: 0 0 auto;

  object-fit: contain;
}

.brand strong {
  color: var(--gs-green);

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size: 19px;
  font-weight: 600;
}

.brand span {
  color: var(--gs-muted);
}

.account-details strong {
  color: var(--gs-text);
}

.account-details span {
  color: var(--gs-muted);
}

.logout-button {
  border-color: #C9BFAE;
  background: transparent;
  color: var(--gs-brown);
}

.logout-button:hover {
  background: var(--gs-brown-soft);
}


/* --- Main page headings --- */

.app-content {
  padding-top: 22px;
}

.eyebrow {
  color: var(--gs-brown);

  letter-spacing: 0.11em;
}

.view-title h1 {
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.018em;
}

.view-title p,
.list-heading p,
.field small {
  color: var(--gs-muted);
}


/* --- Filters and form cards --- */

.filters,
.ride-form,
.ride-card {
  border-color: var(--gs-line);

  background: #FFFFFF;

  box-shadow:
    0 3px 12px rgba(56, 62, 51, 0.035);
}

.filters,
.ride-form {
  border-radius: 14px;
}

.filters-title strong,
.field label {
  color: var(--gs-green-deep);
}

.text-button,
.back-button {
  color: var(--gs-brown);
}

input,
select,
textarea {
  border-color: #CBC5B9;
  border-radius: 10px;

  background: #FFFFFF;

  color: var(--gs-text);
}

input:focus,
select:focus,
textarea:focus {
  outline:
    3px solid rgba(8, 90, 47, 0.11);

  border-color: var(--gs-green);
}


/* --- Buttons --- */

.primary-big-button,
.ride-action {
  border-color: var(--gs-green);

  background: var(--gs-green);

  color: #FFFFFF;

  box-shadow:
    0 4px 10px rgba(8, 90, 47, 0.13);
}

.primary-big-button:hover,
.ride-action:hover {
  border-color: var(--gs-green-deep);
  background: var(--gs-green-deep);
}

.primary-big-button:disabled {
  border-color: #A5AEA6;
  background: #A5AEA6;

  box-shadow: none;
}

.secondary-big-button {
  border-color: var(--gs-green);

  background: transparent;

  color: var(--gs-green);
}

.secondary-big-button:hover {
  background: var(--gs-green-soft);
}


/* --- Ride cards --- */

.ride-card {
  border-radius: 14px;
}

.ride-date {
  color: var(--gs-brown);

  letter-spacing: 0.025em;
}

.ride-route {
  color: var(--gs-green-deep);
}

.ride-time {
  color: #4E5B51;
}

.ride-comment {
  border-top-color: #ECE7DD;
  color: #59635A;
}

.ride-tag {
  background: var(--gs-green-soft);
  color: var(--gs-green-deep);
}

.ride-tag + .ride-tag {
  background: #F2EEE5;
  color: var(--gs-brown);
}


/* --- Multi-child cards --- */

.child-select-card {
  border-color: #D4CEC2;

  background: #FFFFFF;
}

.child-select-card.selected {
  border-color: var(--gs-green);

  background: var(--gs-green-soft);
}

.child-check {
  border-color: #9AA59C;
}

.child-select-card.selected .child-check {
  border-color: var(--gs-green);
  background: var(--gs-green);
}

.child-name {
  color: var(--gs-text);
}

.child-default {
  color: var(--gs-muted);
}

.child-booster-field {
  border-top-color: rgba(8, 90, 47, 0.17);
}

.child-booster-field label,
.selection-summary {
  color: var(--gs-green-deep);
}


/* --- Inline booking --- */

.inline-booking {
  border-color: #D5CEC0;

  background: #F8F5EE;
}

.inline-booking-title {
  color: var(--gs-green-deep);
}


/* --- Fallback / empty states --- */

.fallback-card {
  background:
    linear-gradient(
      135deg,
      #EEF3EC,
      #F4F0E7
    );

  border:
    1px solid #DDD4C6;
}

.fallback-card strong {
  color: var(--gs-green-deep);
}

.fallback-card p {
  color: var(--gs-muted);
}

.empty-state,
.loading {
  border-color: #D4CEC2;

  background: #FBFAF6;

  color: var(--gs-muted);
}

.empty-state strong {
  color: var(--gs-green-deep);
}


/* --- Bottom navigation --- */

.bottom-nav {
  background: rgba(251, 250, 246, 0.98);

  border-top-color: var(--gs-line);
}

.nav-button {
  color: #737B73;
}

.nav-button.active {
  background: var(--gs-green-soft);

  color: var(--gs-green);
}

.nav-icon {
  color: inherit;
}


/* --- Toast / messages --- */

.message {
  background: var(--gs-green-deep);
}

.message.error {
  background: #8B2F28;
}


/* --- Small phones --- */

@media (max-width: 380px) {

  .header-school-logo {
    width: 53px;
    height: 35px;
  }

  .brand-lockup {
    gap: 7px;
  }

  .brand strong {
    font-size: 17px;
  }

}


/* =========================================================
   CONFIRMED RIDE CONTACT + CANCELLATION
   ========================================================= */

.ride-contact {
  margin-top: 14px;
  padding: 13px;

  display: flex;
  flex-direction: column;
  gap: 3px;

  background: var(--gs-paper);

  border: 1px solid var(--gs-line);
  border-radius: 11px;
}

.contact-label {
  margin-bottom: 2px;

  color: var(--gs-brown);

  font-size: 10px;
  font-weight: 750;

  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-name {
  color: var(--gs-green-deep);

  font-size: 14px;
}

.contact-phone {
  color: var(--gs-text);

  font-size: 14px;
}

.call-button {
  width: 100%;
  min-height: 44px;

  margin-top: 9px;
  padding: 10px 12px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--gs-green);
  border-radius: 9px;

  background: var(--gs-green);
  color: white;

  font-size: 13px;
  font-weight: 750;

  text-decoration: none;
}

.call-button:hover {
  background: var(--gs-green-deep);
  border-color: var(--gs-green-deep);
}

.contact-unavailable {
  margin-top: 6px;

  color: var(--gs-muted);

  font-size: 12px;
  line-height: 1.4;
}

.cancel-ride-button {
  width: 100%;
  min-height: 42px;

  margin-top: 10px;
  padding: 9px 12px;

  border: 1px solid #B86C63;
  border-radius: 9px;

  background: transparent;
  color: #8B2F28;

  font-size: 13px;
  font-weight: 700;
}

.cancel-ride-button:hover {
  background: #FBF0EE;
}

.cancel-panel {
  margin-top: 10px;
  padding: 14px;

  border: 1px solid #D8B5AF;
  border-radius: 11px;

  background: #FBF4F2;
}

.cancel-panel > strong {
  display: block;

  color: #7A2924;

  font-size: 14px;
}

.cancel-panel > p {
  margin: 6px 0 12px;

  color: #654B48;

  font-size: 12px;
  line-height: 1.5;
}

.cancel-panel .call-button {
  margin-bottom: 10px;
}

.cancel-panel-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.danger-button {
  width: 100%;
  min-height: 46px;

  padding: 10px 12px;

  border: 1px solid #8B2F28;
  border-radius: 9px;

  background: #8B2F28;
  color: white;

  font-weight: 750;
}

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

.danger-button:disabled {
  border-color: #B9A09D;
  background: #B9A09D;

  cursor: not-allowed;
}



/* =========================================================
   PASSWORD SETUP
   ========================================================= */

.login-help-secondary {
  margin-top: 7px;
}

.password-logout-button {
  margin-top: 10px;
}

#passwordChangeScreen .login-brand p {
  max-width: 360px;
}

#passwordChangeScreen .login-card {
  align-self: center;
}
