:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --text: #17201b;
  --muted: #68746e;
  --line: #dfe4e1;
  --soft: #edf1ee;
  --green: #1f7a55;
  --green-soft: #edf7f2;
  --danger: #ad2f2f;
  --shadow: 0 16px 42px rgba(23, 32, 27, 0.07);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  min-width: 320px;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.auth-page,
.loading-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-box {
  width: min(430px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  display: grid;
  gap: 16px;
  box-shadow: 0 18px 50px rgba(24, 34, 29, 0.08);
}

.auth-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.auth-brand img,
.brand img {
  flex: 0 0 auto;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(24, 34, 29, 0.08);
}

.auth-brand img {
  width: 88px;
  height: 88px;
  border-radius: 18px;
  padding: 6px;
}

.brand img {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  padding: 5px;
}

.auth-brand div,
.brand div {
  min-width: 0;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 100vh;
  overflow: auto;
  position: sticky;
  top: 0;
}

.main {
  padding: 28px 34px 40px;
  display: grid;
  gap: 22px;
  align-content: start;
  min-width: 0;
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
}

.topbar,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.panel-subheader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding-top: 4px;
}

.panel-subheader h4 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.panel-subheader span {
  color: var(--muted);
  font-size: 13px;
}

.brand h1,
.topbar h2,
.panel-header h3,
.auth-box h1 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.15;
}

.brand span,
.panel-header span,
.muted {
  color: var(--muted);
}

.eyebrow,
.section-title {
  margin: 0 0 4px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
}

.section-title {
  margin: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px 18px;
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 92px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.rider-pay-panel {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.rider-pay-panel h3 {
  margin: 0 0 6px;
  font-size: clamp(22px, 2.4vw, 34px);
  line-height: 1.1;
}

.rider-rate-box {
  display: grid;
  gap: 10px;
  justify-items: end;
  min-width: 280px;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
  min-width: 0;
}

.admin-settings-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: dense;
}

.admin-settings-grid > .panel:nth-child(1) {
  grid-column: 1 / span 7;
  grid-row: 1 / span 2;
}

.admin-settings-grid > .panel:nth-child(2) {
  grid-column: 8 / -1;
  grid-row: 1;
}

.admin-settings-grid > .panel:nth-child(3) {
  grid-column: 8 / -1;
  grid-row: 2;
}

.day-payment-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.day-payment-grid > .panel:nth-child(1) {
  grid-column: span 8;
}

.day-payment-grid > .panel:nth-child(2) {
  grid-column: span 4;
}

.availability-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.availability-grid > .panel:first-child {
  grid-column: span 8;
}

.availability-grid > .panel:last-child {
  grid-column: span 4;
}

.availability-grid > .panel:only-child {
  grid-column: 1 / -1;
}

.panel {
  padding: 20px;
  display: grid;
  gap: 16px;
  min-width: 0;
  overflow: hidden;
  align-content: start;
}

.settings-panel {
  padding: 0;
}

.settings-details {
  min-width: 0;
}

.settings-details summary {
  min-height: 68px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-details summary::-webkit-details-marker {
  display: none;
}

.settings-details summary::after {
  content: "+";
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--text);
  font-weight: 900;
}

.settings-details[open] summary {
  border-bottom: 1px solid var(--line);
}

.settings-details[open] summary::after {
  content: "-";
}

.summary-title {
  display: grid;
  gap: 3px;
  min-width: 0;
  font-weight: 800;
  line-height: 1.2;
}

.summary-title small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.settings-body {
  padding: 18px 20px 20px;
  display: grid;
  gap: 16px;
}

.stack,
.stack-form {
  display: grid;
  gap: 10px;
}

.rider-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.rider-button {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  background: #f9faf9;
  color: var(--text);
  border-radius: 10px;
  padding: 11px;
}

.rider-button strong,
.payment-row strong {
  font-weight: 800;
}

.rider-button small,
.payment-row span {
  color: var(--muted);
}

.rider-button.active {
  border-color: var(--green);
  background: var(--green-soft);
}

.sidebar-dropdown {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9faf9;
  overflow: hidden;
}

.sidebar-dropdown summary {
  min-height: 42px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
  color: #39443e;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-dropdown summary::-webkit-details-marker {
  display: none;
}

.sidebar-dropdown summary::after {
  content: "+";
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--text);
  font-weight: 900;
}

.sidebar-dropdown[open] summary {
  border-bottom: 1px solid var(--line);
}

.sidebar-dropdown[open] summary::after {
  content: "-";
}

.danger-dropdown summary {
  color: var(--danger);
}

.danger-dropdown summary::after {
  background: #fff1f1;
  color: var(--danger);
}

.sidebar-dropdown .stack-form {
  padding: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: #39443e;
  font-size: 13px;
  font-weight: 800;
  min-width: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.field-title {
  margin-bottom: 8px;
  color: #39443e;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  border: 1px solid #cfd7d3;
  border-radius: 10px;
  padding: 9px 12px;
  background: #ffffff;
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 85, 0.12);
  outline: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: 150px 110px minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.admin-day-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.admin-day-form .button {
  align-self: end;
}

.special-list {
  display: grid;
  gap: 8px;
}

.special-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 92px auto;
  gap: 10px;
  align-items: end;
  border: 1px solid #edf0ee;
  border-radius: 12px;
  padding: 12px;
  background: #fbfcfb;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  white-space: nowrap;
}

.check-label input {
  width: auto;
  min-height: 0;
}

.weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.weekday-chip {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #cfd7d3;
  border-radius: 10px;
  background: #fbfcfb;
  cursor: pointer;
}

.weekday-chip input {
  width: auto;
  min-height: 0;
}

.weekday-chip:has(input:checked) {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.availability-calendar,
.availability-pick-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.availability-day,
.availability-pick {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfb;
}

.availability-day {
  min-height: 112px;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.availability-day.covered {
  border-color: #b9dbc8;
  background: var(--green-soft);
}

.availability-day.uncovered {
  border-color: #efc9c9;
  background: #fff7f7;
}

.availability-day.today,
.availability-pick.today {
  box-shadow: inset 0 0 0 2px rgba(31, 122, 85, 0.18);
}

.availability-date {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.availability-date strong {
  font-size: 18px;
}

.availability-date span,
.availability-day small,
.availability-pick small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.availability-riders {
  display: grid;
  gap: 5px;
}

.availability-riders span {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 4px 7px;
  background: #ffffff;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.availability-form {
  display: grid;
  gap: 14px;
}

.availability-pick {
  min-height: 58px;
  padding: 8px;
  display: grid;
  gap: 3px;
  place-items: center;
  cursor: pointer;
}

.availability-pick input {
  width: auto;
  min-height: 0;
}

.availability-pick span {
  font-size: 17px;
  font-weight: 900;
}

.availability-pick:has(input:checked) {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.cell-stack {
  display: grid;
  gap: 5px;
}

.cell-stack small {
  color: var(--muted);
  line-height: 1.35;
}

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

.button,
.button-soft,
.button-dark,
.button-danger,
.text-button,
.text-danger {
  border: 0;
  border-radius: 10px;
  min-height: 44px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}

.button {
  background: var(--green);
  color: #ffffff;
}

.button:hover,
.button-soft:hover,
.button-dark:hover,
.text-button:hover,
.text-danger:hover {
  filter: brightness(0.98);
}

.button-soft {
  background: var(--soft);
  color: var(--text);
}

.button-dark {
  background: var(--text);
  color: #ffffff;
}

.button-danger {
  background: var(--danger);
  color: #ffffff;
}

.logout {
  margin-top: auto;
}

.text-button,
.text-danger {
  background: transparent;
  min-height: 32px;
  padding: 4px 6px;
}

.text-button {
  color: var(--green);
}

.text-danger {
  color: var(--danger);
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-actions .button-soft {
  min-width: 88px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--soft);
  color: #39443e;
  font-size: 12px;
  font-weight: 800;
}

.status.paid {
  background: #e6f4ec;
  color: var(--green);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #edf0ee;
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  table-layout: fixed;
  background: #ffffff;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #edf0ee;
  font-size: 14px;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #fbfcfb;
  padding: 11px 10px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tr.selected {
  background: var(--green-soft);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.payment-list {
  display: grid;
  gap: 8px;
}

.payment-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #edf0ee;
  border-radius: 12px;
  padding: 12px;
  background: #fbfcfb;
}

.payment-row div {
  display: grid;
  gap: 3px;
}

.payment-row div:last-child {
  text-align: right;
}

.alert,
.notice,
.empty {
  border-radius: 8px;
  padding: 10px 12px;
}

.alert {
  border: 1px solid #efc9c9;
  background: #fff1f1;
  color: #9d2020;
}

.notice {
  border: 1px solid #c8e6d6;
  background: #effaf4;
  color: var(--green);
}

.empty {
  background: #f2f4f3;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: none;
    position: static;
  }

  .metrics,
  .content-grid,
  .admin-settings-grid,
  .day-payment-grid,
  .availability-grid {
    grid-template-columns: 1fr;
  }

  .admin-settings-grid > .panel:nth-child(1),
  .admin-settings-grid > .panel:nth-child(2),
  .admin-settings-grid > .panel:nth-child(3) {
    grid-column: auto;
    grid-row: auto;
  }

  .day-payment-grid > .panel:nth-child(1),
  .day-payment-grid > .panel:nth-child(2),
  .availability-grid > .panel:first-child,
  .availability-grid > .panel:last-child {
    grid-column: auto;
    grid-row: auto;
  }

  .inline-form,
  .admin-day-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .special-row {
    grid-template-columns: minmax(0, 1fr) minmax(120px, 0.6fr);
  }

  .special-row .check-label,
  .special-row .button-soft {
    align-self: end;
  }
}

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .metrics,
  .form-grid,
  .inline-form,
  .admin-day-form,
  .special-row,
  .weekday-grid {
    grid-template-columns: 1fr;
  }

  .availability-calendar,
  .availability-pick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .panel-header,
  .panel-subheader,
  .payment-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .rider-pay-panel {
    grid-template-columns: 1fr;
  }

  .rider-rate-box {
    justify-items: start;
    min-width: 0;
  }

  .payment-row div:last-child {
    text-align: left;
  }

  .auth-brand,
  .brand {
    align-items: flex-start;
  }

  .brand img {
    width: 60px;
    height: 60px;
  }

  table {
    min-width: 860px;
  }
}

@media (max-width: 520px) {
  .auth-brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .metrics {
    gap: 10px;
  }

  .metric,
  .panel {
    border-radius: 12px;
  }
}
