:root {
  --navy: #0F2942;
  --navy-dark: #091B2D;
  --navy-light: #1E3A5F;
  --orange: #EA580C;
  --orange-pressed: #C2410C;
  --orange-soft: #FFF7ED;
  --orange-border: #FDBA74;
  --blue: #1D4ED8;
  --blue-pressed: #1E40AF;
  --blue-soft: #EFF6FF;
  --green: #15803D;
  --green-soft: #F0FDF4;
  --green-border: #86EFAC;
  --red: #DC2626;
  --red-soft: #FEF2F2;
  --red-border: #FCA5A5;
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --muted: #E2E8F0;
  --border: #CBD5E1;
  --text: #0F172A;
  --text-sec: #475569;
  --text-muted: #64748B;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

button,
input {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* Top Navigation Bar (iOS safe area aware) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--navy);
  color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.topbar-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back-btn {
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.back-btn:active {
  background: rgba(255, 255, 255, 0.28);
}

/* Main Container */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 16px calc(36px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Login View */
.login-shell {
  min-height: 100dvh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
}

.login-wrap {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-hero {
  text-align: center;
  color: #fff;
}

.login-circle {
  width: 86px;
  height: 86px;
  border-radius: 43px;
  background: var(--orange);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 10px;
}

.login-hero h1 {
  margin: 0 0 6px;
  font-size: 25px;
  font-weight: 900;
}

.login-hero p {
  margin: 0;
  font-size: 15px;
  color: #CBD5E1;
  line-height: 1.45;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: 18px;
  border: 1.5px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.card-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.helper-text {
  margin: 0;
  font-size: 14px;
  color: var(--text-sec);
  line-height: 1.45;
}

/* Company Header with Centered Logo */
.company-header {
  background: var(--surface);
  border-radius: 18px;
  border: 1.5px solid var(--border);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.logo-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
}

.logo-img {
  max-width: 88%;
  max-height: 76px;
  object-fit: contain;
  display: block;
}

.logo-fallback {
  font-size: 24px;
  font-weight: 900;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--muted);
  padding-top: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.role-badge {
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.role-admin {
  background: var(--orange);
}

.role-operator {
  background: var(--navy);
}

.user-name {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-btn {
  border: none;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.logout-btn {
  border: 1.5px solid var(--red-border);
  background: #fff;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
}

/* iPhone Add to Home Screen Hint */
.ios-hint {
  background: var(--blue-soft);
  border: 1.5px solid #93C5FD;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--navy);
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ios-hint-close {
  border: none;
  background: transparent;
  color: var(--navy);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  padding: 0 4px;
}

/* Inputs */
.label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-input {
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  background: #F8FAFC;
  border: 2px solid var(--navy-light);
  border-radius: 14px;
  outline: none;
}

.text-input:focus {
  border-color: var(--blue);
  background: #fff;
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 21px;
}

/* Big In-Cab Action Buttons */
.big-btn {
  width: 100%;
  min-height: 74px;
  border-radius: 18px;
  border: 2px solid transparent;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.big-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.big-btn-primary {
  background: var(--orange);
  border-color: var(--orange-pressed);
  color: #fff;
}

.big-btn-primary:active {
  background: var(--orange-pressed);
}

.big-btn-secondary {
  background: var(--blue);
  border-color: var(--blue-pressed);
  color: #fff;
}

.big-btn-secondary:active {
  background: var(--blue-pressed);
}

.big-btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--navy);
}

.big-btn-admin {
  background: var(--orange-soft);
  border-color: var(--orange);
  color: var(--navy);
}

.big-btn-phone {
  background: var(--green-soft);
  border-color: var(--green-border);
  color: var(--navy);
}

.call-pill {
  background: var(--green);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  min-width: 78px;
  flex-shrink: 0;
}

.phone-number {
  font-size: 18px;
  font-weight: 800;
  color: var(--green);
  margin-top: 3px;
}

.update-modal-sheet {
  border: 2px solid var(--orange);
  border-radius: 22px;
}

.update-item {
  background: #F8FAFC;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.update-badge {
  align-self: flex-start;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 4px 9px;
  border-radius: 6px;
}

.update-badge-pos {
  background: var(--orange);
}

.update-badge-tel {
  background: var(--green);
}

.big-btn-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.big-btn-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.big-btn-title {
  display: block;
  font-size: 19px;
  font-weight: 800;
}

.big-btn-sub {
  display: block;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
  margin-top: 2px;
}

.big-btn-badge {
  background: rgba(255, 255, 255, 0.22);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
}

.big-btn-outline .big-btn-badge {
  background: var(--blue-soft);
  color: var(--blue);
}

/* Navigator Banner */
.nav-banner {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}

.nav-banner-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.nav-banner-val {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
}

.nav-banner-cta {
  font-size: 15px;
  font-weight: 800;
  color: var(--blue);
}

/* Success Banner */
.success-card {
  background: var(--green-soft);
  border: 2px solid var(--green-border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.success-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--green);
}

.success-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.small-btn {
  flex: 1;
  min-height: 46px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.small-btn-blue {
  background: var(--blue);
  color: #fff;
}

.small-btn-white {
  background: #fff;
  color: var(--navy);
  border: 1.5px solid var(--border);
}

/* Client Cards */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 2px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
}

.section-badge {
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}

.client-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.client-main {
  width: 100%;
  background: transparent;
  border: none;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}

.client-main:active {
  background: var(--blue-soft);
}

.client-info {
  flex: 1;
  min-width: 0;
}

.client-name {
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
}

.client-city {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 3px;
}

.client-op {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sec);
  margin-top: 3px;
}

.client-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.guide-pill {
  background: var(--blue);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  min-width: 72px;
  flex-shrink: 0;
}

.card-actions {
  display: flex;
  border-top: 1px solid var(--muted);
  background: #F8FAFC;
}

.card-action-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px;
  font-size: 14px;
  font-weight: 800;
  color: var(--navy);
  cursor: pointer;
}

.card-action-danger {
  color: var(--red);
}

.card-action-blue {
  color: var(--blue);
}

/* City Chips */
.chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.chip {
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  background: var(--muted);
  color: var(--navy);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.chip-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* Vehicle Cards (Italian License Plate Style) */
.vehicle-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plate-box {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  background: #fff;
  border: 2.5px solid var(--navy);
  border-radius: 10px;
  overflow: hidden;
}

.plate-eu {
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  padding: 10px 10px;
}

.plate-text {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 6px 16px;
  color: var(--text);
}

.fuel-box {
  background: var(--orange-soft);
  border: 2px solid var(--orange-border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fuel-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
}

.fuel-code {
  font-size: 26px;
  font-weight: 900;
  color: var(--orange-pressed);
  letter-spacing: 1.5px;
}

/* Admin Tabs */
.tabs-row {
  display: flex;
  gap: 8px;
}

.tab-btn {
  flex: 1;
  min-height: 50px;
  border: none;
  border-radius: 12px;
  background: var(--muted);
  color: var(--navy);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.tab-btn-active {
  background: var(--navy);
  color: #fff;
}

.gen-btn {
  min-height: 56px;
  padding: 0 16px;
  border: none;
  border-radius: 14px;
  background: var(--navy);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.logo-preview-box {
  height: 112px;
  border: 2px dashed var(--border);
  border-radius: 14px;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.58);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

.modal-sheet {
  width: 100%;
  max-width: 540px;
  background: #fff;
  border-radius: 22px;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 85dvh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  color: var(--navy);
}

.nav-opt {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 13px 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-opt-active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.nav-opt-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.nav-opt-desc {
  font-size: 13px;
  color: var(--text-sec);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 200;
  background: var(--navy-dark);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  max-width: 92vw;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.empty-box {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-sec);
  font-size: 15px;
  line-height: 1.5;
}
