:root {
  color-scheme: light;
  --ink: #16202a;
  --muted: #65717c;
  --line: #dce2e6;
  --paper: #ffffff;
  --canvas: #f4f6f7;
  --orange: #f36f21;
  --orange-dark: #cc5410;
  --navy: #172b3a;
  --navy-soft: #eef3f6;
  --success: #28754d;
  --danger: #a63b31;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 4%, rgba(243, 111, 33, .08), transparent 24rem),
    linear-gradient(180deg, #f8fafb 0, var(--canvas) 34rem);
}
a { color: var(--orange-dark); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.site-header, footer, main { width: min(1240px, calc(100% - 48px)); margin-inline: auto; }
.site-header { min-height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(220, 226, 230, .8); }
.brand { color: var(--navy); font-size: 1.45rem; font-weight: 800; letter-spacing: -.04em; text-decoration: none; }
.brand span { color: var(--orange); }
.portal-mark { display: grid; justify-items: end; gap: 2px; color: var(--navy); }
.portal-mark span { font-size: .9rem; font-weight: 850; letter-spacing: -.01em; }
.portal-mark small { color: var(--muted); font-size: .68rem; font-weight: 650; }

.login-view { min-height: calc(100vh - 190px); display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: clamp(30px, 7vw, 90px); padding: 56px 0 80px; }
.intro-panel h1, .portal-heading h1 { max-width: 720px; margin: 8px 0 18px; color: var(--navy); font-size: clamp(2.35rem, 5vw, 4.8rem); line-height: .98; letter-spacing: -.055em; }
.intro-panel > p:not(.eyebrow) { max-width: 650px; color: #4d5a64; font-size: 1.16rem; line-height: 1.65; }
.intro-panel ul { display: grid; gap: 12px; padding: 0; list-style: none; color: var(--navy); font-weight: 700; }
.intro-panel li::before { content: "✓"; margin-right: 11px; color: var(--orange); }

.card { border: 1px solid rgba(207, 216, 222, .9); border-radius: 20px; background: rgba(255, 255, 255, .96); box-shadow: 0 18px 50px rgba(23, 43, 58, .065); }
.login-card { padding: clamp(26px, 5vw, 46px); }
h2 { margin: 5px 0 10px; color: var(--navy); font-size: 1.65rem; letter-spacing: -.025em; }
.eyebrow { margin: 0; color: var(--orange-dark); font-size: .76rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.55; }
form { display: grid; gap: 9px; margin-top: 24px; }
label { margin-top: 7px; color: var(--navy); font-size: .86rem; font-weight: 750; }
input, select { width: 100%; min-height: 48px; border: 1px solid #bac3ca; border-radius: 10px; padding: 0 13px; color: var(--ink); background: #fff; }
input:focus, select:focus { outline: 3px solid rgba(243, 111, 33, .18); border-color: var(--orange); }
.primary, .secondary { min-height: 46px; border-radius: 10px; padding: 0 18px; font-weight: 800; }
.primary { margin-top: 12px; border: 1px solid var(--orange); color: white; background: var(--orange); }
.primary:hover { background: var(--orange-dark); }
.secondary { border: 1px solid #aeb9c1; color: var(--navy); background: white; }
.compact { min-height: 40px; margin: 0; }
.text-button { margin-top: 18px; border: 0; padding: 0; color: var(--orange-dark); background: transparent; font-weight: 750; }
.reset-form { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 15px; }
.message { margin-top: 10px; border-radius: 9px; padding: 11px 12px; color: var(--success); background: #edf8f2; font-size: .9rem; }
.message.error { color: var(--danger); background: #fff0ee; }

.portal-view { padding: 54px 0 88px; }
.portal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.portal-heading h1 { margin: 9px 0 10px; font-size: clamp(2.5rem, 5vw, 4.35rem); line-height: 1; }
.portal-heading .muted { max-width: 650px; margin: 0; font-size: 1.05rem; }
.portal-heading .secondary { margin-top: 7px; border-color: #c6d0d6; box-shadow: 0 7px 20px rgba(23, 43, 58, .05); }
.portal-tabs { display: flex; gap: 8px; margin: 0 0 34px; overflow-x: auto; border-bottom: 1px solid var(--line); padding: 0 0 14px; }
.portal-tabs button { flex: 0 0 auto; border: 1px solid transparent; border-radius: 11px; padding: 10px 15px; color: #53616c; background: transparent; font-size: .84rem; font-weight: 800; transition: background .16s ease, color .16s ease, transform .16s ease; }
.portal-tabs button:hover { color: var(--navy); background: rgba(255, 255, 255, .8); }
.portal-tabs button.active { border-color: var(--navy); color: white; background: var(--navy); box-shadow: 0 8px 22px rgba(23, 43, 58, .16); }
.portal-panel { display: block; }
.overview-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 18px; }
.overview-heading h2 { margin: 6px 0 0; font-size: 1.8rem; }
.overview-heading > p { max-width: 480px; margin: 0; color: var(--muted); line-height: 1.55; text-align: right; }
.summary-grid { display: grid; grid-template-columns: minmax(190px, .7fr) minmax(190px, .7fr) minmax(440px, 2fr); gap: 17px; }
.summary-card { position: relative; display: grid; gap: 9px; min-height: 190px; overflow: hidden; padding: 25px; }
.summary-card::after { position: absolute; right: -31px; bottom: -38px; width: 115px; height: 115px; border-radius: 999px; background: rgba(40, 117, 77, .08); content: ""; }
.pending-summary::after { background: rgba(243, 111, 33, .1); }
.summary-card strong { align-self: end; color: var(--navy); font-size: 3.35rem; line-height: 1; letter-spacing: -.055em; }
.summary-label { color: var(--navy); font-size: .9rem; font-weight: 820; }
.summary-detail { color: var(--muted); font-size: .78rem; }
.report-card { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 28px; min-height: 190px; overflow: hidden; padding: 28px 30px; background: linear-gradient(135deg, #fff 0%, #fff 68%, #fff8f3 100%); }
.report-card::before { position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--orange); content: ""; }
.report-copy { max-width: 610px; }
.report-copy > strong { display: block; margin-top: 7px; color: var(--navy); font-size: 1.4rem; letter-spacing: -.025em; }
.report-card p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
.report-empty { flex: 0 0 auto; display: grid; gap: 4px; min-width: 150px; border: 1px solid #f3d4c1; border-radius: 14px; padding: 17px 18px; color: var(--orange-dark); background: #fff8f3; }
.report-empty span { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.report-empty strong { color: var(--navy); font-size: .94rem; }
.report-history { flex: 0 0 min(315px, 40%); display: grid; gap: 9px; }
.report-row { border: 1px solid #eadfd8; border-radius: 13px; padding: 13px 14px; background: rgba(255, 255, 255, .86); }
.report-row > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.report-row strong { color: var(--navy); font-size: .88rem; }
.report-row span { border-radius: 999px; padding: 4px 7px; color: var(--success); background: #e8f5ee; font-size: .65rem; font-weight: 850; text-transform: uppercase; }
.report-row p { margin: 6px 0 0 !important; font-size: .73rem; line-height: 1.4 !important; }
.portal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 370px; align-items: start; gap: 18px; }
.portal-grid > .card { padding: 25px; }
.portal-grid:not(:has(.add-driver-card:not([hidden]))) { grid-template-columns: 1fr; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.driver-access-note { display: grid; grid-template-columns:auto 1fr; gap: 14px; align-items:start; margin-top:18px; border:1px solid #d9e5eb; border-radius:14px; padding:15px 17px; color:var(--muted); background:var(--navy-soft); font-size:.86rem; line-height:1.55; }
.driver-access-note strong { color:var(--navy); white-space:nowrap; }
.driver-list { display: grid; gap: 0; margin-top: 19px; }
.driver-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(190px, 1fr) 125px auto; align-items: center; gap: 15px; border-top: 1px solid var(--line); padding: 16px 2px; }
.driver-row:first-child { border-top: 0; }
.driver-name { display: grid; gap: 3px; }
.driver-name strong { color: var(--navy); }
.driver-name span, .driver-email { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.status { width: max-content; border-radius: 999px; padding: 5px 9px; color: var(--success); background: #e8f5ee; font-size: .75rem; font-weight: 800; text-transform: capitalize; }
.status.pending, .status.expired { color: #895118; background: #fff3df; }
.status.inactive { color: #646b70; background: #eceff1; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.row-actions button { border: 1px solid #c1c9ce; border-radius: 8px; padding: 7px 10px; color: var(--navy); background: white; font-size: .79rem; font-weight: 750; }
.row-actions .pin-action { border-color: var(--navy); color: white; background: var(--navy); }
.pin-dialog { width: min(470px, calc(100% - 28px)); border: 1px solid rgba(207, 216, 222, .95); border-radius: 20px; padding: 0; color: var(--ink); background: white; box-shadow: 0 24px 70px rgba(23, 43, 58, .24); }
.pin-dialog::backdrop { background: rgba(16, 31, 42, .55); backdrop-filter: blur(3px); }
.pin-dialog form { margin: 0; padding: 28px; }
.empty-state { border: 1px dashed #bdc7cd; border-radius: 12px; padding: 28px; color: var(--muted); text-align: center; }
.close-button { border: 0; color: var(--muted); background: transparent; font-size: 1.7rem; }
.optional { color: var(--muted); font-size: .75rem; font-weight: 500; }
.portal-section-card { padding: 26px; }
.manager-grid:not(:has(.add-driver-card:not([hidden]))) { grid-template-columns: 1fr; }
.manager-row { grid-template-columns: minmax(180px, 1.2fr) minmax(190px, 1fr) 125px auto; }
.billing-card { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.billing-card > div:first-child { max-width: 760px; }
.billing-card .message { width: 100%; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr); align-items: start; gap: 18px; }
.manager-schedule-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.manager-schedule-section h3 { margin: 0 0 8px; color: var(--navy); }
#manager-phone-fields, #weekly-manager-schedule { display: grid; gap: 9px; }
.support-action { display: inline-flex; margin-top: 15px; font-weight: 800; }
.authorization-status { border-radius: 10px; padding: 11px 13px; color: var(--navy); background: #eef3f6; font-size: .9rem; font-weight: 750; }
.authorization-choice { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; margin: 18px 0 4px; color: var(--muted); line-height: 1.5; }
.authorization-choice input { width: 18px; min-height: 18px; margin-top: 2px; padding: 0; }

footer { display: flex; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); padding: 26px 0 35px; color: var(--muted); font-size: .8rem; }
footer nav { display: flex; gap: 16px; flex: 0 0 auto; }

[hidden] { display: none !important; }
button:disabled { cursor: wait; opacity: .62; }

@media (max-width: 880px) {
  .login-view, .portal-grid, .settings-grid { grid-template-columns: 1fr; }
  .login-view { padding-top: 30px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .report-card { grid-column: 1 / -1; }
  .report-history { flex-basis: min(315px, 44%); }
  .overview-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .overview-heading > p { text-align: left; }
  .driver-row { grid-template-columns: 1fr 1fr; }
  .row-actions { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .site-header, footer, main { width: min(100% - 24px, 1240px); }
  .portal-mark small { display: none; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 160px; }
  .report-card { grid-column: auto; align-items: flex-start; flex-direction: column; }
  .report-empty { width: 100%; }
  .report-history { width: 100%; }
  .portal-heading, footer { align-items: flex-start; flex-direction: column; }
  .driver-row, .manager-row { grid-template-columns: 1fr; }
  .driver-access-note { grid-template-columns:1fr; gap:5px; }
  .billing-card { align-items: flex-start; flex-direction: column; }
}
