:root {
  --navy-950: #03101f;
  --navy-900: #06172a;
  --navy-850: #0a1d33;
  --navy-800: #102640;
  --blue: #2878ff;
  --blue-700: #145bd7;
  --green: #2db765;
  --green-soft: #dcf7e6;
  --red: #ef2b2d;
  --red-soft: #fee8e8;
  --orange: #ff8a1f;
  --purple: #8256df;
  --cyan: #14a8a0;
  --ink: #101828;
  --muted: #667085;
  --line: #e6eaf0;
  --surface: #ffffff;
  --canvas: #f4f6f9;
  --shadow: 0 12px 34px rgba(13, 32, 56, 0.08);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.icon { width: 22px; height: 22px; display: inline-block; flex: 0 0 auto; }
.icon-sm { width: 17px; height: 17px; }
.icon-lg { width: 28px; height: 28px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.eyebrow { font-size: .73rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: .75rem 1.05rem;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--blue), var(--blue-700)); box-shadow: 0 10px 22px rgba(40, 120, 255, .25); }
.btn-success { color: #fff; background: var(--green); box-shadow: 0 10px 22px rgba(45, 183, 101, .22); }
.btn-danger { color: #fff; background: linear-gradient(135deg, #ff3336, #dc171a); box-shadow: 0 10px 22px rgba(239, 43, 45, .24); }
.btn-secondary { color: #173055; background: #eef4ff; border: 1px solid #d7e4fb; }
.btn-ghost { color: #314766; background: #fff; border: 1px solid var(--line); }
.btn-dark { color: #fff; background: var(--navy-800); }
.btn-sm { min-height: 36px; padding: .5rem .75rem; border-radius: 10px; font-size: .83rem; }
.btn-block { width: 100%; }
.icon-btn { width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; display: grid; place-items: center; cursor: pointer; color: #42526c; position: relative; }

.badge { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .3rem .65rem; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.badge-green, .status-completed, .status-approved, .status-operational, .status-valid { background: var(--green-soft); color: #087a37; }
.badge-blue, .status-in_progress, .status-ready, .status-assigned { background: #e4edff; color: #145bd7; }
.badge-red, .status-rejected, .status-critical, .status-out_of_service { background: var(--red-soft); color: #c81d20; }
.badge-orange, .status-pending, .status-open, .status-in_review, .status-maintenance { background: #fff2dc; color: #b45c00; }
.badge-gray, .status-draft, .status-cancelled, .status-inactive, .status-closed { background: #eef1f5; color: #536175; }

.card { background: var(--surface); border: 1px solid rgba(16, 40, 72, .08); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 1rem; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 0 0 .8rem; }
.section-title h2, .section-title h3 { margin: 0; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: .4rem; }
.field label { font-size: .78rem; font-weight: 800; color: #45546d; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #dce2ea;
  background: #fff;
  color: var(--ink);
  border-radius: 11px;
  padding: .7rem .8rem;
  outline: none;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40, 120, 255, .12); }
.field-hint { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.upload-file-meta { color: #315173; font-weight: 700; overflow-wrap: anywhere; }
.upload-file-meta.error { color: #c81d20; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }

.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th { text-align: left; padding: .8rem .9rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #667085; background: #f8fafc; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
.data-table td { padding: .86rem .9rem; border-bottom: 1px solid #edf0f4; font-size: .86rem; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #f9fbff; }

.empty-state { padding: 2.4rem 1rem; text-align: center; color: var(--muted); }
.empty-state .icon { width: 42px; height: 42px; color: #9aa6b5; margin-bottom: .5rem; }
.privacy-page { max-width: 860px; margin: 0 auto; padding: 1rem 1rem 3rem; line-height: 1.7; }
.privacy-page header { background: var(--navy-950); color: #fff; margin: -1rem -1rem 1rem; padding: 1.5rem max(1rem, calc((100vw - 860px) / 2)); }
.privacy-page header img { width: 170px; }
.privacy-page header h1 { font-size: clamp(1.5rem, 4vw, 2.4rem); }
.privacy-page h2 { margin-bottom: .35rem; }
.privacy-page hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

/* Login */
.login-page { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(460px, 1.1fr); min-height: 100vh; background: #fff; }
.login-brand {
  background:
    radial-gradient(circle at 15% 15%, rgba(40, 120, 255, .23), transparent 33%),
    radial-gradient(circle at 85% 85%, rgba(45, 183, 101, .17), transparent 32%),
    linear-gradient(155deg, var(--navy-950), #0b213a);
  color: #fff;
  padding: clamp(2rem, 5vw, 5rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-brand::after { content: ""; position: absolute; width: 28rem; height: 28rem; border: 1px solid rgba(255,255,255,.06); border-radius: 50%; right: -12rem; top: 15%; box-shadow: 0 0 0 5rem rgba(255,255,255,.018), 0 0 0 10rem rgba(255,255,255,.012); }
.login-logo { width: 210px; position: relative; z-index: 1; }
.login-brand-copy { position: relative; z-index: 1; max-width: 580px; }
.login-brand-copy h1 { font-size: clamp(2rem, 4.5vw, 4.6rem); line-height: 1.02; margin: 0 0 1rem; letter-spacing: -.045em; }
.login-brand-copy p { margin: 0; color: #b8c6d9; font-size: 1.06rem; max-width: 520px; line-height: 1.7; }
.login-feature-row { display: flex; gap: 1.3rem; flex-wrap: wrap; margin-top: 2rem; color: #d5dfec; font-size: .82rem; }
.login-feature-row span { display: inline-flex; align-items: center; gap: .45rem; }
.login-feature-row i { width: 8px; height: 8px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 5px rgba(45,183,101,.12); }
.login-panel { display: grid; place-items: center; padding: 2rem; background: linear-gradient(180deg, #fff, #f8fafc); }
.login-card { width: min(430px, 100%); }
.login-card h2 { font-size: 2rem; margin: 0 0 .45rem; letter-spacing: -.035em; }
.login-card > p { color: var(--muted); margin: 0 0 1.6rem; }
.login-card .field { margin-bottom: .9rem; }
.login-card .field input { min-height: 52px; }
.login-options { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: .5rem 0 1.15rem; font-size: .82rem; color: var(--muted); }
.language-pills { display: inline-flex; background: #edf1f6; border-radius: 11px; padding: 3px; }
.language-pills button { border: 0; background: transparent; padding: .43rem .7rem; border-radius: 8px; font-weight: 800; font-size: .75rem; cursor: pointer; color: #667085; }
.language-pills button.active { background: #fff; color: var(--blue); box-shadow: 0 3px 10px rgba(17,38,67,.08); }
.login-demo { margin-top: 1.15rem; padding: .9rem; background: #f1f6ff; border: 1px solid #dae7ff; border-radius: 12px; font-size: .78rem; color: #3c526f; line-height: 1.55; }

/* Driver PWA */
.driver-app { min-height: 100vh; background: var(--navy-950); }
.driver-frame { min-height: 100vh; max-width: 640px; margin: 0 auto; background: #f7f8fa; position: relative; padding-bottom: calc(84px + var(--safe-bottom)); box-shadow: 0 0 50px rgba(0,0,0,.28); }
.offline-page { display: grid; place-items: center; padding: 1.25rem; background: var(--navy-950); color: #fff; text-align: center; }
.offline-page section { max-width: 430px; }
.offline-page img { width: 190px; }
.offline-page p { color: #b8c6d9; line-height: 1.6; }
.driver-top {
  min-height: 225px;
  background:
    radial-gradient(circle at 90% 15%, rgba(45,183,101,.16), transparent 30%),
    linear-gradient(155deg, var(--navy-950), #0a2037);
  color: #fff;
  padding: calc(1rem + env(safe-area-inset-top, 0px)) 1.05rem 1.4rem;
}
.driver-top-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.driver-top .brand-logo { width: 132px; }
.driver-bell { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.13); }
.notification-dot { position: absolute; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; background: var(--red); color: #fff; font-size: .64rem; font-weight: 900; border-radius: 999px; border: 2px solid var(--navy-950); right: -5px; top: -5px; }
.driver-greeting { margin-top: 1.45rem; }
.driver-greeting h1 { font-size: 1.5rem; margin: 0 0 .3rem; letter-spacing: -.025em; }
.driver-greeting p { margin: 0; color: #b6c4d6; font-size: .84rem; }
.driver-content { margin-top: -72px; padding: 0 .85rem 1.5rem; position: relative; z-index: 2; }
.driver-frame.subview .driver-top { display: none; }
.driver-frame.subview .driver-content { margin-top: 0; padding-top: 0; }
.driver-frame.subview .driver-subheader .icon-btn:first-child .icon { transform: rotate(180deg); }
.driver-view { display: none; }
.driver-view.active { display: block; animation: viewIn .2s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.driver-card { background: #fff; border: 1px solid rgba(13,35,62,.08); border-radius: 16px; box-shadow: 0 10px 28px rgba(10,31,54,.09); margin-bottom: .85rem; overflow: hidden; }
.driver-card-pad { padding: 1rem; }
.next-run-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; }
.next-run-code { font-size: 1.45rem; font-weight: 900; letter-spacing: -.035em; }
.next-run-route { display: flex; align-items: center; gap: .45rem; color: #516077; font-size: .82rem; margin-top: .55rem; }
.next-run-actions { margin-top: .9rem; display: grid; grid-template-columns: 1fr auto; gap: .55rem; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .65rem; }
.summary-tile { border: 1px solid #edf0f4; border-radius: 12px; padding: .8rem; background: #fff; }
.summary-tile span { display: block; font-size: .68rem; color: var(--muted); margin-bottom: .25rem; }
.summary-tile strong { font-size: 1.13rem; letter-spacing: -.02em; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .55rem; }
.quick-action { border: 0; background: transparent; padding: .2rem 0; cursor: pointer; color: var(--ink); display: grid; gap: .4rem; place-items: center; font-size: .67rem; text-align: center; }
.quick-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; }
.quick-icon.blue { background: linear-gradient(145deg, #2e85ff, #155fdb); }
.quick-icon.green { background: linear-gradient(145deg, #3bc777, #19944e); }
.quick-icon.orange { background: linear-gradient(145deg, #ff9e38, #ee6d00); }
.quick-icon.red { background: linear-gradient(145deg, #ff5154, #d71f22); }
.quick-icon.purple { background: linear-gradient(145deg, #9a72ef, #6840c0); }

.driver-subheader { margin: 0 -.85rem .85rem; padding: calc(.8rem + env(safe-area-inset-top, 0px)) 1rem .9rem; background: var(--navy-950); color: #fff; display: flex; align-items: center; justify-content: space-between; min-height: 72px; }
.driver-subheader h2 { margin: 0; font-size: 1rem; }
.trip-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .7rem; }
.info-row { display: flex; justify-content: space-between; gap: 1rem; padding: .72rem 0; border-bottom: 1px solid #edf0f4; font-size: .82rem; }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }
.progress-track { height: 7px; background: #e8edf4; border-radius: 999px; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), #5d9cff); border-radius: inherit; transition: width .3s ease; }
.itinerary { padding: .35rem 0; }
.stop { display: grid; grid-template-columns: 28px 1fr auto; gap: .65rem; min-height: 90px; position: relative; }
.stop:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 27px; bottom: 0; width: 2px; background: #dce4ef; }
.stop-dot { width: 27px; height: 27px; border: 2px solid #cbd5e1; background: #fff; color: #64748b; border-radius: 50%; display: grid; place-items: center; font-size: .68rem; font-weight: 900; z-index: 1; }
.stop.completed .stop-dot { border-color: var(--green); background: var(--green); color: #fff; }
.stop.arrived .stop-dot { border-color: var(--blue); background: var(--blue); color: #fff; }
.stop-body strong { display: block; font-size: .86rem; margin: .1rem 0 .2rem; }
.stop-body p { margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.stop-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; font-size: .7rem; color: var(--muted); }
.stop-action-row { grid-column: 2 / -1; display: flex; gap: .4rem; margin: -.25rem 0 .65rem; }
.map-placeholder { height: 250px; background: #eaf0f4; border-radius: 14px; overflow: hidden; position: relative; }
#driverMap, #adminMap, #liveMap { width: 100%; height: 100%; position: relative; z-index: 1; isolation: isolate; }
.leaflet-container { position: relative; z-index: 1 !important; }
.tracking-chip { display: inline-flex; align-items: center; gap: .4rem; background: #eaf8ef; color: #087a37; border: 1px solid #c7efd6; border-radius: 999px; padding: .42rem .65rem; font-size: .7rem; font-weight: 800; }
.tracking-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(45,183,101,.12); }
.tracking-chip.off { background: #f1f3f6; color: #6d7788; border-color: #e0e4ea; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--navy-850); border-radius: 11px; padding: 3px; gap: 3px; }
.segmented button { border: 0; background: transparent; color: #aab7c7; border-radius: 8px; padding: .62rem .45rem; font-weight: 750; font-size: .75rem; cursor: pointer; }
.segmented button.active { background: #fff; color: var(--ink); }
.doc-item, .notification-item, .support-item, .more-item { padding: 1rem; border-bottom: 1px solid #edf0f4; }
.doc-item:last-child, .notification-item:last-child, .support-item:last-child, .more-item:last-child { border-bottom: 0; }
.doc-item h3, .notification-item h3 { font-size: .86rem; margin: 0 0 .35rem; }
.doc-item p, .notification-item p { font-size: .75rem; color: var(--muted); margin: 0; line-height: 1.5; }
.doc-item-head, .notification-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.notification-item.unread { background: #f4f8ff; }
.notification-meta { display: flex; gap: .5rem; align-items: center; color: #8994a5; font-size: .68rem; margin-top: .45rem; }
.availability-calendars { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.calendar-card { padding: .85rem; }
.calendar-card h3 { margin: 0 0 .65rem; text-align: center; text-transform: capitalize; font-size: .84rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .2rem; text-align: center; }
.calendar-grid strong { color: var(--muted); font-size: .62rem; padding: .15rem 0; }
.calendar-grid > span { min-height: 29px; border-radius: 8px; display: grid; place-items: center; font-size: .69rem; }
.calendar-day { background: #f5f7fa; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--blue); }
.calendar-day.calendar-pending { background: #fff0d6; color: #9b5100; }
.calendar-day.calendar-approved { background: var(--green-soft); color: #087a37; }
.calendar-day.calendar-rejected { background: var(--red-soft); color: #b7191c; }
.calendar-legend { display: flex; gap: .8rem; flex-wrap: wrap; margin: -.25rem 0 .9rem; color: var(--muted); font-size: .68rem; }
.calendar-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.calendar-legend i { width: 9px; height: 9px; border-radius: 50%; background: #ddd; }
.calendar-legend i.pending { background: #f2a52b; }
.calendar-legend i.approved { background: var(--green); }
.calendar-legend i.rejected { background: var(--red); }
.more-profile { padding: 1rem; display: flex; align-items: center; gap: .8rem; }
.avatar { width: 54px; height: 54px; border-radius: 50%; background: linear-gradient(145deg, #d7e3f4, #eef3f9); display: grid; place-items: center; color: #46617f; overflow: hidden; flex: 0 0 auto; }
.avatar.small-avatar { width: 38px; height: 38px; }
.online { display: inline-flex; align-items: center; gap: .35rem; color: var(--green); font-size: .75rem; }
.online::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.more-section-title { color: #8995a7; font-size: .67rem; letter-spacing: .08em; font-weight: 800; text-transform: uppercase; margin: 1rem .25rem .5rem; }
.more-item { display: flex; align-items: center; gap: .75rem; background: #fff; cursor: pointer; }
.more-item .quick-icon { width: 42px; height: 42px; border-radius: 12px; }
.more-item-copy { min-width: 0; flex: 1; }
.more-item-copy strong { display: block; font-size: .87rem; margin-bottom: .15rem; }
.more-item-copy span { display: block; color: var(--muted); font-size: .71rem; }

.bottom-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(640px,100%); height: calc(70px + var(--safe-bottom)); padding: .5rem .45rem var(--safe-bottom); background: rgba(255,255,255,.97); border-top: 1px solid #e2e7ee; display: grid; grid-template-columns: repeat(5, 1fr); z-index: 100; backdrop-filter: blur(15px); }
.bottom-nav button { border: 0; background: transparent; color: #8792a1; display: grid; place-items: center; align-content: center; gap: .22rem; font-size: .62rem; cursor: pointer; position: relative; }
.bottom-nav button.active { color: var(--blue); }
.bottom-nav .icon { width: 23px; height: 23px; }

/* Admin */
.admin-app { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; background: #f5f7fa; }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; width: 238px; background: linear-gradient(180deg, var(--navy-950), #07192c); color: #fff; padding: calc(1.1rem + var(--safe-top)) calc(.65rem + var(--safe-right)) calc(1.1rem + var(--safe-bottom)) calc(.65rem + var(--safe-left)); overflow-y: auto; overscroll-behavior: contain; z-index: 2100; }
.sidebar-backdrop { display: none; }
.admin-logo { width: 152px; margin: .4rem .7rem 1.5rem; }
.side-section { font-size: .62rem; color: #8291a4; text-transform: uppercase; letter-spacing: .09em; margin: 1.2rem .8rem .45rem; }
.side-nav { display: grid; gap: .18rem; }
.side-nav button { width: 100%; min-height: 42px; border: 0; border-radius: 8px; background: transparent; color: #c8d1dd; padding: .62rem .75rem; display: flex; align-items: center; gap: .7rem; text-align: left; cursor: pointer; font-size: .82rem; }
.side-nav button:hover { background: rgba(255,255,255,.055); color: #fff; }
.side-nav button.active { background: linear-gradient(90deg, rgba(40,120,255,.92), rgba(40,120,255,.64)); color: #fff; box-shadow: 0 8px 18px rgba(7,87,222,.25); }
.side-nav button .icon { width: 19px; height: 19px; }
.admin-main { grid-column: 2; min-width: 0; }
.admin-topbar { min-height: calc(68px + var(--safe-top)); background: rgba(255,255,255,.96); border-bottom: 1px solid #e5e9ef; padding: var(--safe-top) calc(1.35rem + var(--safe-right)) 0 calc(1.35rem + var(--safe-left)); display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 1200; box-shadow: 0 3px 12px rgba(16,35,60,.03); }
.sidebar-toggle { display: none; }
.admin-topbar h1 { font-size: 1.25rem; margin: 0; letter-spacing: -.025em; }
.admin-search { margin-left: auto; width: min(360px, 34vw); position: relative; }
.admin-search input { width: 100%; height: 40px; border: 1px solid #e0e5ec; border-radius: 10px; background: #f9fafb; padding: 0 2.5rem 0 .85rem; outline: none; }
.admin-search .icon { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); color: #8a96a6; width: 18px; height: 18px; }
.admin-user { display: flex; align-items: center; gap: .55rem; padding-left: .65rem; border-left: 1px solid #edf0f4; }
.admin-user strong { display: block; font-size: .77rem; }
.admin-user span { display: block; font-size: .66rem; color: var(--muted); margin-top: .08rem; }
.admin-content { padding: 1.2rem 1.35rem 2rem; max-width: 1680px; margin: 0 auto; }
.admin-view { display: none; }
.admin-view.active { display: block; animation: viewIn .18s ease; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-heading h2 { margin: 0 0 .25rem; font-size: 1.1rem; }
.page-heading p { margin: 0; color: var(--muted); font-size: .78rem; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(140px,1fr)); gap: .75rem; margin-bottom: .85rem; }
.stat-card { padding: .95rem; background: #fff; border: 1px solid #e5e9ef; border-radius: 12px; box-shadow: 0 5px 16px rgba(16,35,60,.04); display: grid; grid-template-columns: 1fr auto; gap: .6rem; }
.stat-card span { font-size: .72rem; color: #3e4c60; }
.stat-card strong { display: block; font-size: 1.7rem; margin-top: .35rem; line-height: 1; letter-spacing: -.04em; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--blue); background: #e8f0ff; }
.stat-icon.green { color: #14924a; background: #e0f6e8; }
.stat-icon.purple { color: #7d3eda; background: #f0e8ff; }
.stat-icon.orange { color: #d97600; background: #fff1db; }
.stat-icon.red { color: #d52629; background: #ffe8e8; }
.admin-grid-main { display: grid; grid-template-columns: 1.1fr 1fr .82fr; gap: .85rem; }
.admin-panel { background: #fff; border: 1px solid #e5e9ef; border-radius: 13px; overflow: hidden; box-shadow: 0 5px 18px rgba(16,35,60,.04); }
.panel-head { min-height: 48px; padding: .75rem .9rem; border-bottom: 1px solid #edf0f4; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.panel-head h3 { margin: 0; font-size: .86rem; }
.panel-body { padding: .85rem; }
.admin-map { height: 390px; }
.active-run { padding: .85rem; border-bottom: 1px solid #edf0f4; }
.active-run:last-child { border-bottom: 0; }
.active-run-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.active-run strong { font-size: .86rem; }
.active-run p { margin: .35rem 0 .55rem; color: var(--muted); font-size: .7rem; }
.run-metrics { display: flex; justify-content: space-between; color: #667085; font-size: .67rem; margin-bottom: .35rem; }
.alert-row, .activity-row { display: grid; grid-template-columns: 34px 1fr auto; gap: .6rem; align-items: start; padding: .75rem .85rem; border-bottom: 1px solid #edf0f4; }
.alert-row:last-child, .activity-row:last-child { border-bottom: 0; }
.mini-icon { width: 34px; height: 34px; border-radius: 10px; background: #edf3ff; color: var(--blue); display: grid; place-items: center; }
.alert-row strong, .activity-row strong { font-size: .74rem; display: block; }
.alert-row p, .activity-row p { font-size: .67rem; color: var(--muted); margin: .2rem 0 0; line-height: 1.4; }
.alert-row time, .activity-row time { font-size: .62rem; color: #9aa3af; white-space: nowrap; }
.secondary-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .85rem; margin-top: .85rem; }
.donut { width: 130px; height: 130px; border-radius: 50%; background: conic-gradient(var(--green) 0 75%, var(--blue) 75% 96%, var(--red) 96%); display: grid; place-items: center; margin: .5rem auto; position: relative; }
.donut::after { content: ""; width: 82px; height: 82px; border-radius: 50%; background: #fff; position: absolute; }
.donut span { z-index: 1; font-size: 1.4rem; font-weight: 900; text-align: center; }
.mini-bars { display: grid; gap: .65rem; padding: .35rem 0; }
.mini-bar { display: grid; grid-template-columns: 105px 1fr 50px; gap: .6rem; align-items: center; font-size: .7rem; }
.mini-bar-track { height: 7px; background: #edf1f5; border-radius: 999px; overflow: hidden; }
.mini-bar-track i { display: block; height: 100%; background: #b9dfc6; border-radius: inherit; }
.content-card { background: #fff; border: 1px solid #e5e9ef; border-radius: 13px; box-shadow: 0 5px 18px rgba(16,35,60,.04); overflow: hidden; }
.content-card + .content-card { margin-top: .85rem; }
.live-filter-card { padding: .85rem 1rem; display: flex; align-items: end; gap: 1rem; }
.live-filter-field { width: min(520px, 100%); }
.live-filter-hint { margin: 0 0 .72rem; color: var(--muted); font-size: .75rem; line-height: 1.45; }

/* Dialogs, toasts, loading */
dialog { border: 0; padding: 0; border-radius: 18px; width: min(720px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); color: var(--ink); box-shadow: 0 30px 90px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(3,16,31,.62); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 1rem; }
.dialog-body { padding: 1rem 1.15rem 1.2rem; max-height: calc(100vh - 100px); overflow-y: auto; }
.toast-stack { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .55rem; z-index: 1000; width: min(360px, calc(100% - 2rem)); }
.toast { padding: .85rem 1rem; background: var(--navy-900); color: #fff; border-radius: 12px; box-shadow: 0 15px 40px rgba(0,0,0,.22); font-size: .82rem; animation: toastIn .2s ease; display: flex; gap: .65rem; align-items: flex-start; }
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.loading-overlay { position: fixed; inset: 0; background: rgba(247,249,252,.72); display: grid; place-items: center; z-index: 999; backdrop-filter: blur(2px); }
.spinner { width: 44px; height: 44px; border: 4px solid #dfe7f2; border-top-color: var(--blue); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1250px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .admin-grid-main { grid-template-columns: 1.15fr 1fr; }
  .admin-grid-main > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: 290px; padding: 1.6rem; }
  .login-brand-copy h1 { font-size: 2.25rem; }
  .login-brand-copy p { font-size: .9rem; }
  .login-feature-row { margin-top: 1.1rem; }
  .login-panel { padding: 2.1rem 1rem; }
  .admin-app { grid-template-columns: 1fr; }
  .admin-main { grid-column: 1; }
  body.admin-menu-open { overflow: hidden; }
  .admin-sidebar { width: min(82vw, 300px); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 15px 0 40px rgba(0,0,0,.2); will-change: transform; }
  .admin-app.sidebar-open .admin-sidebar { transform: translateX(0); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(3,16,31,.55); opacity: 0; visibility: hidden; pointer-events: none; z-index: 2050; transition: opacity .2s ease, visibility .2s ease; }
  .admin-app.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; pointer-events: auto; }
  .sidebar-toggle { display: grid; }
  .admin-search { display: none; }
  .admin-user { margin-left: auto; }
  .admin-content { padding: 1rem; }
  .admin-grid-main, .secondary-grid { grid-template-columns: 1fr; }
  .admin-grid-main > :last-child { grid-column: auto; }
  .stats-grid { grid-template-columns: repeat(2, minmax(135px, 1fr)); }
}

@media (max-width: 560px) {
  .login-brand { min-height: 250px; }
  .login-logo { width: 160px; }
  .login-brand-copy h1 { font-size: 1.8rem; }
  .login-feature-row { display: none; }
  .login-panel { place-items: start center; }
  .login-card h2 { font-size: 1.65rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .quick-grid { gap: .35rem; }
  .availability-calendars { grid-template-columns: 1fr; }
  .quick-action { font-size: .61rem; }
  .quick-icon { width: 42px; height: 42px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .55rem; }
  .stat-card { padding: .75rem; }
  .stat-card strong { font-size: 1.35rem; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .btn { width: 100%; }
  .live-filter-card { align-items: stretch; flex-direction: column; gap: .35rem; }
  .live-filter-hint { margin: 0; }
  .admin-topbar { min-height: calc(64px + var(--safe-top)); padding: var(--safe-top) calc(.65rem + var(--safe-right)) 0 calc(.65rem + var(--safe-left)); gap: .45rem; }
  .admin-topbar h1 { min-width: 0; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
  .admin-topbar .icon-btn { width: 44px; height: 44px; flex: 0 0 44px; }
  .admin-topbar .language-pills button { min-width: 38px; min-height: 40px; padding: .35rem .45rem; }
  .admin-user { display: none; }
  .toast-stack { right: .6rem; bottom: calc(78px + var(--safe-bottom)); width: calc(100% - 1.2rem); }
}
