:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #173039;
  background: #f3f6f5;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #79cfb2; outline-offset: 2px; }
[hidden] { display: none !important; }

.shell { min-height: 100vh; }
.content-column { min-height: 100vh; }
.topbar {
  height: 84px;
  padding: 0 clamp(22px, 3.5vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #fff;
  border-bottom: 1px solid #e4ebeb;
}
.topbar-brand, .sidebar-brand { display: flex; align-items: center; gap: 13px; }
.brand-symbol {
  display: inline-grid;
  place-items: center;
  flex: 0 0 39px;
  width: 39px;
  height: 39px;
  border-radius: 11px;
  background: #087e78;
  color: #fff;
  font: 800 23px/1 Georgia, serif;
  box-shadow: 0 6px 16px #0b817838;
}
.topbar-brand strong, .sidebar-brand strong { display: block; font-size: 16px; letter-spacing: .01em; }
.topbar-brand small, .sidebar-brand small { display: block; margin-top: 3px; color: #849a9d; font-size: 10px; letter-spacing: .14em; }
.topbar-actions { display: flex; align-items: center; gap: 15px; }
.environment { color: #58767c; background: #eef4f2; border: 1px solid #e1eae8; border-radius: 99px; padding: 7px 11px; font-size: 10px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.user-chip { color: #174a4b; background: #e6f4f0; border-radius: 99px; padding: 7px 12px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.quiet-button { border: 0; background: none; color: #61787e; font-size: 12px; font-weight: 700; padding: 9px 0; white-space: nowrap; }
.quiet-button:hover { color: #087e78; }

main { max-width: 1390px; margin: 0 auto; padding: 40px clamp(22px, 3.5vw, 56px) 80px; }
#message { margin: 0 0 18px; padding: 13px 16px; border-radius: 11px; background: #e8f6f1; color: #176657; font-size: 13px; font-weight: 600; line-height: 1.5; }
#message.error { background: #fff0ed; color: #a54030; }
#message:empty { display: none; }
.eyebrow { color: #0c8a7f; font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow-line { display: inline-block; width: 19px; height: 2px; margin: 0 8px 3px 0; background: #0c8a7f; }
.section-copy { margin: 4px 0 0; color: #70858a; font-size: 13px; line-height: 1.6; }
.hint { color: #82979b; font-size: 12px; line-height: 1.5; }

/* The public and staff entry screens share one quiet visual frame. */
body:not(.is-authenticated) { background: #eef4f1; }
body:not(.is-authenticated) .content-column { background: radial-gradient(circle at 19% 82%, #daebe3 0, transparent 34%), radial-gradient(circle at 95% 8%, #e1f1ee 0, transparent 31%), #f4f7f5; }
body:not(.is-authenticated) main { min-height: calc(100vh - 84px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 465px); gap: clamp(40px, 8vw, 130px); align-items: center; padding-top: 50px; padding-bottom: 70px; }
body:not(.is-authenticated) #message { grid-column: 1 / -1; align-self: end; margin-bottom: -34px; }
.auth-intro { position: relative; isolation: isolate; padding: 25px 0 45px 4%; }
.auth-intro::before { content: ""; position: absolute; z-index: -1; width: 245px; height: 245px; right: 0; bottom: -62px; border: 1px solid #bcd7ce; border-radius: 50%; box-shadow: 0 0 0 38px #edf6f114, 0 0 0 76px #dfeee725; }
.auth-intro h1 { margin: 30px 0 23px; color: #14343b; font-size: clamp(42px, 5vw, 72px); line-height: 1.16; letter-spacing: -.06em; font-weight: 800; }
.auth-intro h1 em { color: #0b9185; font-style: normal; }
.auth-intro > p { max-width: 460px; color: #58737a; font-size: 16px; line-height: 1.8; }
.auth-steps { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 68px; color: #34565c; font-size: 13px; font-weight: 700; }
.auth-steps span { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.auth-steps b { color: #0a8c81; font-size: 11px; letter-spacing: .06em; }
.auth-card { position: relative; overflow: hidden; background: #fff; border: 1px solid #dfeae6; border-radius: 20px; padding: 42px; box-shadow: 0 24px 70px #254b3e14, 0 4px 12px #254b3e08; }
.card-topline { position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, #087f78, #65c9b1 65%, #d4eee5); }
.auth-card h2 { margin: 10px 0 0; color: #17343c; font-size: 30px; letter-spacing: -.04em; }
.auth-card .section-copy { margin: 10px 0 30px; }
.auth-card form { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: #3a565d; font-size: 12px; font-weight: 700; }
input, select { width: 100%; min-width: 0; height: 45px; border: 1px solid #d4e0e0; border-radius: 9px; padding: 0 13px; background: #fff; color: #173039; font-size: 13px; outline: none; transition: border-color .16s, box-shadow .16s; }
input::placeholder { color: #a2b1b3; }
input:hover, select:hover { border-color: #a6c5c0; }
input:focus, select:focus { border-color: #159386; box-shadow: 0 0 0 3px #bce8dc80; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: #0a8b7f; }
button:not(.quiet-button):not(.text-button):not(.secondary):not(#tabs button), .secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px;
  border: 1px solid #087c74; border-radius: 9px; background: #087f78; color: white;
  padding: 10px 17px; text-decoration: none; font-size: 13px; font-weight: 750;
  transition: background .16s, transform .16s, box-shadow .16s;
}
button:not(.quiet-button):not(.text-button):not(.secondary):not(#tabs button):hover { background: #056b66; box-shadow: 0 7px 18px #0a786b25; transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }
.auth-card form > button { width: 100%; margin-top: 4px; }
.auth-card form > button span { margin-left: auto; font-size: 18px; font-weight: 400; line-height: 0; }
.auth-divider { height: 1px; margin: 29px 0 21px; background: #e6eeee; }
.auth-card .hint { margin: 0 0 4px; }
.text-button { padding: 5px 0; border: 0; background: none; color: #087f78; font-size: 13px; font-weight: 800; }
.text-button:hover { color: #055f5b; text-decoration: underline; }
#apply-status { margin-top: 12px; }
.back-button { margin-top: 25px; }
.document-list { margin: 0 0 24px; border-top: 1px solid #e7eeee; }
.document-list details { border-bottom: 1px solid #e7eeee; }
.document-list summary { padding: 14px 2px; cursor: pointer; color: #36565a; font-size: 13px; font-weight: 750; }
.document-list p { white-space: pre-wrap; color: #63797d; font-size: 13px; line-height: 1.7; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 600; line-height: 1.4; }

/* Staff workspace */
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; width: 242px; display: flex; flex-direction: column; padding: 28px 14px 19px; background: #142f32; color: #f3fbf8; }
.sidebar-brand { padding: 3px 10px 39px; }
.sidebar-brand .brand-symbol { background: #d0eee1; color: #087e78; box-shadow: none; }
.sidebar-brand strong { font-size: 16px; }
.sidebar-brand small { color: #77999a; }
.nav-caption { padding: 0 19px 11px; color: #789697; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
#tabs { display: grid; gap: 4px; }
#tabs button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 43px; padding: 7px 12px; border: 0; border-radius: 9px; background: transparent; color: #a8c0bf; text-align: left; font-size: 13px; font-weight: 650; transition: background .16s, color .16s; }
#tabs button:hover { background: #ffffff10; color: #fff; }
#tabs button.active { background: #e7f6ef; color: #0e655e; box-shadow: 0 4px 12px #001a1618; }
.nav-icon { display: grid; place-items: center; flex: 0 0 25px; width: 25px; height: 25px; border: 1px solid #72969558; border-radius: 7px; color: #9bc2b8; font-size: 11px; font-weight: 800; }
#tabs button.active .nav-icon { color: #087f78; background: #d4eee3; border-color: #c3e5d7; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; margin: auto 10px 0; padding: 17px 8px 0; border-top: 1px solid #ffffff1d; color: #8caaa7; font-size: 11px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #64cda1; box-shadow: 0 0 0 4px #64cda118; }
.is-authenticated .content-column { margin-left: 242px; }
.is-authenticated .topbar { position: sticky; top: 0; z-index: 10; height: 70px; }
.is-authenticated main { padding-top: 34px; }
.page-intro { margin: 0 0 26px; }
.alert-reminder { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding: 18px 20px; border: 1px solid #efb3a7; border-left: 5px solid #cf493e; border-radius: 12px; background: #fff1ed; color: #8b3029; box-shadow: 0 5px 18px #a8492a14; }
.alert-reminder-icon { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: #cc493d; color: white; font-weight: 800; }
.alert-reminder strong { font-size: 15px; }
.alert-reminder p { margin: 4px 0 0; font-size: 12px; }
.alert-reminder button { flex: 0 0 auto; margin-left: auto; background: #a83e33 !important; border-color: #a83e33 !important; }
.page-intro h1 { margin: 12px 0 4px; color: #17383e; font-size: clamp(27px, 3vw, 36px); letter-spacing: -.04em; }
.page-intro p { margin: 0; color: #71888a; font-size: 13px; }
.card { background: #fff; border: 1px solid #e1eae9; border-radius: 16px; padding: 27px 29px 30px; box-shadow: 0 3px 18px #163c3410; }
.heading { display: flex; justify-content: space-between; align-items: start; gap: 18px; margin-bottom: 22px; }
.heading h2 { margin: 0; color: #213b42; font-size: 18px; letter-spacing: -.015em; }
.secondary { min-height: 36px; padding: 8px 12px; border-color: #d5e7e2; background: #eff7f4; color: #14796f; white-space: nowrap; }
.secondary:hover { background: #e1f1ea; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 13px; margin: 0 0 28px; padding: 20px; border: 1px solid #e5eeeb; border-radius: 12px; background: #f8fbf9; }
.form-grid > button { white-space: nowrap; }
.vehicle-form { grid-template-columns: minmax(0, 2fr) auto minmax(0, 2fr); }
.vehicle-form > button:last-child { grid-column: 3; justify-self: end; min-width: 130px; }
.vehicle-form #disable-replaced-vehicle { align-self: end; }
.vehicle-form #start-device-scan { grid-column: 1; }
.vehicle-form #device-scan-result { grid-column: 2 / -1; }
.form-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; color: #35645f; font-size: 12px; overflow-wrap: anywhere; }
.form-feedback .secondary { min-height: 30px; padding: 5px 8px; white-space: normal; text-align: left; }
.form-note { grid-column: 1 / 3; margin: 0; color: #657d7e; font-size: 12px; line-height: 1.6; }
.import-panel { display: grid; gap: 12px; margin-bottom: 18px; padding: 19px 20px; border: 1px solid #d9e8e2; border-radius: 12px; background: #f4faf7; }
.import-panel strong { color: #1a4948; font-size: 14px; }
.import-panel p { margin: 5px 0 0; color: #647f7d; font-size: 12px; }
.import-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.import-controls input { width: auto; max-width: 100%; height: auto; padding: 8px; background: white; }
.import-controls button { min-height: 35px !important; padding: 7px 11px !important; }
.import-controls button:disabled { cursor: not-allowed; opacity: .45; }
.import-result { white-space: pre-line; color: #4b6767; font-size: 12px; line-height: 1.65; }
.import-result:empty { display: none; }
.tag-history { margin-top: 25px; }
.tag-history h3 { font-size: 15px; }
.table-wrap { overflow-x: auto; border: 1px solid #e4ebea; border-radius: 11px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid #ebf0ef; white-space: nowrap; }
th { background: #f7faf8; color: #789096; font-size: 11px; font-weight: 800; letter-spacing: .025em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfc; }
td { color: #2e454c; }
td.mono { color: #537076; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; letter-spacing: .015em; }
td.actions { white-space: nowrap; }
td.actions button { min-height: 29px !important; padding: 5px 10px !important; border-radius: 7px !important; background: #edf7f3 !important; border-color: #d5e9e1 !important; color: #14776c !important; font-size: 11px !important; box-shadow: none !important; transform: none !important; }
td.actions button:hover { background: #ddf1e9 !important; }
.pill { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border-radius: 99px; background: #eff3f3; color: #5d777c; font-size: 11px; font-weight: 750; }
.pill[data-tone="good"] { background: #e7f5ed; color: #248259; }
.pill[data-tone="warn"] { background: #fff2d9; color: #9b6c15; }
.pill[data-tone="muted"] { background: #f0f2f2; color: #76898b; }
.pill[data-tone="bad"] { background: #fff0ed; color: #b65a47; }
.empty-state { display: grid; place-items: center; min-height: 195px; padding: 30px; color: #8ca0a2; text-align: center; }
.empty-state span { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 11px; border-radius: 13px; background: #edf5f1; color: #3fa18a; font-size: 22px; }
.empty-state strong { color: #557079; font-size: 13px; }
.empty-state small { margin-top: 4px; font-size: 11px; }
.info-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; padding: 12px 14px; border: 1px solid #d8e8e6; border-radius: 9px; background: #f3f9f7; color: #4d7778; font-size: 12px; line-height: 1.5; }
.info-mark { display: grid; place-items: center; flex: 0 0 19px; width: 19px; height: 19px; border-radius: 50%; background: #cce9e2; color: #0f8178; font: bold 12px Georgia, serif; }
.lookup-panel { max-width: 620px; margin: 28px auto 12px; padding: 32px; border: 1px solid #dcebe5; border-radius: 16px; background: linear-gradient(145deg, #f5fbf8, #fff); text-align: center; }
.lookup-icon { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 22px; border: 1px solid #d0e9df; border-radius: 19px; background: #e5f5ec; color: #0e8779; font-size: 36px; }
.lookup-form { display: flex; align-items: end; gap: 11px; text-align: left; }
.lookup-form label { flex: 1; }
.lookup-result { margin: 17px 0 0; color: #235f5e; font-size: 13px; font-weight: 700; }
.lookup-result:empty { display: none; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; align-items: stretch; }
.settings-panel { display: grid; align-content: start; gap: 13px; padding: 22px; border: 1px solid #e3ece9; border-radius: 12px; background: #f9fbfa; }
.panel-number { color: #0a887b; font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.settings-panel h3 { margin: 0; font-size: 16px; }
.settings-panel .section-copy { margin: -7px 0 4px; }
.settings-panel button { justify-self: start; }
.subheading { margin: 30px 0 16px; }
.subheading h3 { margin: 0; font-size: 15px; }

@media (max-width: 1120px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vehicle-form { grid-template-columns: minmax(0, 2fr) auto; }
  .vehicle-form > button:last-child { grid-column: 2; }
  .vehicle-form .form-feedback { grid-column: 1 / -1; }
  .vehicle-form #device-scan-result { grid-column: 2; }
  .form-grid > button { justify-self: stretch; }
}
@media (max-width: 800px) {
  .is-authenticated .shell { display: flex; flex-direction: column; }
  .is-authenticated .content-column { display: contents; }
  .is-authenticated .topbar { order: 0; width: 100%; }
  .is-authenticated .sidebar { order: 1; }
  .is-authenticated main { order: 2; width: 100%; }
  body:not(.is-authenticated) main { display: block; padding-top: 35px; }
  .auth-intro { padding: 7px 0 20px; }
  .auth-intro::before { width: 150px; height: 150px; right: 2%; bottom: -20px; }
  .auth-intro h1 { margin: 18px 0 10px; font-size: clamp(33px, 8vw, 49px); }
  .auth-intro > p { margin: 0; font-size: 13px; }
  .auth-steps { margin-top: 23px; gap: 13px; font-size: 11px; }
  .auth-card { max-width: 560px; margin: 24px auto 0; }
  .sidebar { position: static; width: auto; padding: 14px 17px 15px; }
  .sidebar-brand, .nav-caption, .sidebar-foot { display: none; }
  #tabs { display: flex; overflow-x: auto; gap: 7px; padding-bottom: 1px; scrollbar-width: thin; }
  #tabs button { flex: 0 0 auto; width: auto; padding: 7px 11px; min-height: 37px; white-space: nowrap; }
  .nav-icon { display: none; }
  .is-authenticated .content-column { margin-left: 0; }
  .is-authenticated .topbar { top: 0; }
  .is-authenticated main { padding-top: 24px; }
}
@media (max-width: 600px) {
  .alert-reminder { flex-wrap: wrap; gap: 10px; padding: 14px; }
  .alert-reminder > div { flex: 1 1 calc(100% - 50px); }
  .alert-reminder button { width: 100%; margin-left: 0; }
  .topbar { height: 67px; padding: 0 17px; }
  .topbar-brand strong { font-size: 14px; }
  .topbar-brand small, .environment { display: none; }
  .brand-symbol { flex-basis: 34px; width: 34px; height: 34px; border-radius: 9px; font-size: 20px; }
  .topbar-actions { gap: 8px; }
  .user-chip { font-size: 11px; padding: 6px 8px; }
  .quiet-button { font-size: 11px; }
  main { padding: 20px 15px 50px; }
  body:not(.is-authenticated) main { min-height: calc(100vh - 67px); padding: 25px 20px 45px; }
  .auth-intro { padding-bottom: 8px; }
  .auth-intro h1 { font-size: 36px; }
  .auth-intro::before { opacity: .5; }
  .auth-steps { margin-top: 20px; gap: 11px; }
  .auth-steps span { gap: 4px; }
  .auth-card { margin-top: 23px; padding: 31px 24px; border-radius: 17px; }
  .auth-card h2 { font-size: 25px; }
  .page-intro { margin-bottom: 19px; }
  .card { padding: 19px 16px 22px; border-radius: 13px; }
  .heading { align-items: start; margin-bottom: 18px; }
  .heading h2 { font-size: 17px; }
  .heading .secondary { font-size: 11px; padding: 7px 9px; }
  .form-grid, .vehicle-form { grid-template-columns: 1fr; gap: 13px; padding: 15px; }
  .vehicle-form > button:last-child { grid-column: auto; }
  .vehicle-form .form-feedback, .form-note { grid-column: auto; }
  .vehicle-form #start-device-scan, .vehicle-form #device-scan-result { grid-column: auto; }
  .form-grid > button { width: 100%; }
  .table-wrap { overflow: visible; border: 0; border-radius: 0; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tbody { display: grid; gap: 11px; }
  tbody tr { padding: 12px 14px; border: 1px solid #e4eeeb; border-radius: 10px; background: #fcfefd; }
  tbody tr:hover { background: #fcfefd; }
  td { display: flex; justify-content: space-between; align-items: start; gap: 15px; padding: 7px 0; border: 0; white-space: normal; text-align: right; overflow-wrap: anywhere; }
  td::before { content: attr(data-label); flex: 0 0 88px; color: #809397; font-size: 11px; font-family: inherit; text-align: left; }
  td.actions { justify-content: flex-end; padding-top: 12px; border-top: 1px solid #e8efed; margin-top: 5px; }
  td.actions::before { display: none; }
  .lookup-panel { margin: 15px 0 0; padding: 23px 16px; }
  .lookup-form { display: grid; }
  .lookup-form button { width: 100%; }
  .admin-grid { grid-template-columns: 1fr; }
  .settings-panel { padding: 18px; }
}
.gate-choice { display: flex; gap: 1rem; align-items: center; border: 1px solid var(--border, #d7dfe6); border-radius: 10px; padding: .55rem .8rem; }
.gate-choice legend { padding: 0 .3rem; }
.gate-choice label { display: inline-flex; align-items: center; gap: .35rem; }
.gate-choice input { width: auto; }
