:root {
  --font-heading: "Montserrat", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Montserrat", -apple-system, BlinkMacSystemFont, sans-serif;
  --navy: #01426d;
  --navy-900: #012c49;
  --sand: #f4f1ed;
  --secondary-blue: #0c71c3;
  --accent-grey: #dbdbdb;
  --accent-green: #2da701;
  --link: #14821c;
  --white: #ffffff;
  --grey-text: #5b6470;
  --muted-text: #8a929c;
  --card: #ffffff;
  --border: #e6e3de;
  --err: #b91c1c;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(16, 38, 56, 0.06), 0 6px 18px rgba(16, 38, 56, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 38, 56, 0.06);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  background-color: var(--sand);
  background-image:
    radial-gradient(ellipse 115% 75% at 90% 2%, rgba(12, 113, 195, 0.14) 0%, transparent 62%),
    radial-gradient(ellipse 90% 65% at 6% 98%, rgba(1, 66, 109, 0.11) 0%, transparent 58%);
  background-size: auto, auto;
  background-position: top right, bottom left;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
  color: var(--grey-text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
@media (max-width: 900px) {
  body { background-attachment: scroll, scroll; }
}
@media (prefers-reduced-motion: reduce) {
  body { background-attachment: scroll, scroll; }
}

h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; color: var(--navy); letter-spacing: -0.01em; }
a { color: var(--link); }

/* ---------------- App shell: sidebar + main ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-900) 100%);
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
}
.sidebar-brand { display: flex; align-items: center; gap: 0.7rem; padding: 1.25rem 1.25rem 1rem; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  object-fit: contain; display: block;
}
.brand-name { color: #fff; font-family: var(--font-heading); font-weight: 600; font-size: 1.02rem; }
.brand-sub { font-size: 0.72rem; color: rgba(255,255,255,0.55); letter-spacing: 0.08em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 0.5rem 0.75rem; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: none; border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 500;
  padding: 0.62rem 0.8rem;
  transition: background 0.15s, color 0.15s;
}
.nav-item .icon { width: 19px; height: 19px; opacity: 0.85; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active { background: var(--secondary-blue); color: #fff; box-shadow: 0 4px 12px rgba(12, 113, 195, 0.35); }
.nav-item.active .icon { opacity: 1; }

.sidebar-footer { padding: 0.85rem 0.9rem 1rem; border-top: 1px solid rgba(255,255,255,0.1); }
.user-chip { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; min-width: 0; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,0.15); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.82rem; text-transform: uppercase;
}
.user-meta { min-width: 0; }
.user-name { color: #fff; font-size: 0.82rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-account { font-size: 0.72rem; color: rgba(255,255,255,0.55); }
.btn-logout {
  width: 100%; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.16);
  color: #fff; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font-body); font-weight: 500; font-size: 0.84rem; transition: background 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.18); }
.sidebar-version { text-align: center; font-size: 0.66rem; color: rgba(255,255,255,0.35); margin-top: 0.6rem; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(1, 28, 46, 0.5);
  z-index: 150; backdrop-filter: blur(1px);
}

.main-area {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
}
/* Centered ferry mark watermark (same asset as sidebar logo). */
.main-area::before {
  content: "";
  position: fixed;
  top: 54%;
  left: calc(50vw + (var(--sidebar-w) / 2));
  transform: translate(-50%, -50%);
  width: min(380px, 42vw);
  height: min(440px, 52vh);
  background: url("/static/img/sandbanks-ferry-mark.png") center / contain no-repeat;
  opacity: 0.11;
  pointer-events: none;
  z-index: 0;
}
.main-area > * { position: relative; z-index: 1; }
.app-shell.auth-mode .main-area::before {
  left: 50%;
  top: 58%;
  width: min(320px, 72vw);
  height: min(380px, 48vh);
  opacity: 0.1;
}
@media (max-width: 900px) {
  .main-area::before {
    left: 50%;
    width: min(300px, 68vw);
    height: min(360px, 45vh);
  }
}

.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 0.85rem;
  background: rgba(244, 241, 237, 0.92); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.6rem;
}
.topbar-title { margin: 0; font-size: 1.3rem; font-weight: 600; }
.menu-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 6px; }
.menu-toggle span { width: 22px; height: 2px; background: var(--navy); border-radius: 2px; }

main { max-width: 1040px; width: 100%; margin: 0 auto; padding: 1.6rem 1.6rem 3rem; }

/* Auth screen has no shell chrome */
.app-shell.auth-mode .sidebar,
.app-shell.auth-mode .topbar,
.app-shell.auth-mode .sidebar-overlay { display: none; }
.app-shell.auth-mode .main-area { margin-left: 0; }
.app-shell.auth-mode main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 100vh;
  max-width: none;
  padding: 0;
}
.auth-page {
  --auth-col: 440px;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}
.auth-page.auth-page--register { --auth-col: 720px; }
.auth-page-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-900) 100%);
  color: var(--white);
  padding: 1.8rem 1rem 1.9rem;
  width: 100%;
  box-shadow: 0 10px 28px rgba(1, 44, 73, 0.16);
}
.auth-header-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.95rem;
  max-width: var(--auth-col);
  margin: 0 auto;
  /* Align the logo's left edge with the card's inner content (wrap 1rem + card 1.6rem)
     so the brand, headings and inputs share one clean vertical line. */
  padding: 0 2.6rem;
}
.auth-header-icon { height: 56px; width: auto; flex-shrink: 0; display: block; }
.auth-header-text { text-align: left; min-width: 0; }
.auth-page-header h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.01em;
  font-family: var(--font-heading);
}
.auth-header-tagline {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--white);
  opacity: 0.85;
  line-height: 1.35;
}
.auth-wrap { max-width: var(--auth-col); width: 100%; margin: 0 auto; padding: 1.65rem 1rem 2.5rem; flex: 1; }
/* The first screen a user sees: give its card a more premium lift. */
.auth-wrap .card {
  border-radius: 16px;
  border-color: rgba(1, 66, 109, 0.08);
  box-shadow: 0 18px 48px rgba(1, 44, 73, 0.12), 0 2px 6px rgba(1, 44, 73, 0.05);
  padding: 1.6rem 1.6rem 1.5rem;
}
.auth-wrap .card h2 { font-size: 1.3rem; font-weight: 600; margin-bottom: 1.15rem; }
label .required-mark { color: var(--err); font-weight: 600; margin-left: 0.1rem; }
.register-password-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
  align-items: start;
  margin-bottom: 0.75rem;
}
.register-password-row .password-rules-title {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--grey-text);
  margin: 0 0 0.35rem;
}
.password-rules-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
}
.password-rules-grid li { color: var(--grey-text); line-height: 1.35; }
.password-rules-grid li.ok { color: var(--link); }
.register-section-title { margin: 0.5rem 0 0.2rem; font-size: 1rem; font-weight: 600; color: var(--navy); }
@media (max-width: 640px) {
  .register-password-row { grid-template-columns: 1fr; }
}
.auth-tabs { margin-bottom: 1.1rem; gap: 0.4rem; }
.auth-tabs .btn-inline { flex: 1 1 0; min-width: 0; padding: 0.55rem 0.5rem; font-size: 0.85rem; }
.auth-alt-actions { margin-top: 0.25rem; }
.auth-alt-actions button.secondary { width: 100%; }
.auth-card-links { margin-top: 0.65rem; padding-top: 0.65rem; border-top: 1px solid var(--border); }
button.auth-forgot-link {
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.auth-forgot-link:hover { color: var(--secondary-blue); }
@media (max-width: 380px) {
  .auth-header-brand { flex-direction: column; gap: 0.5rem; justify-content: center; text-align: center; }
  .auth-header-text { text-align: center; }
  .auth-header-icon { height: 52px; }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.35rem 1.45rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}
.card h2 { margin-top: 0; font-size: 1.2rem; }
.card h3 { margin-top: 0; font-size: 1.02rem; font-weight: 600; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.card--success { background: linear-gradient(160deg, #2da701, #1f8a00); border-color: transparent; box-shadow: 0 10px 30px rgba(45, 167, 1, 0.25); }
.card--success h2, .card--success p, .card--success .msg, .card--success .msg.ok { color: var(--white); }

/* Blue variant used for the token purchase success card */
.card--success-blue { background: linear-gradient(160deg, var(--secondary-blue), var(--navy)); border-color: transparent; box-shadow: 0 10px 30px rgba(1, 66, 109, 0.25); }
.card--success-blue h2, .card--success-blue p, .card--success-blue .msg, .card--success-blue .msg.ok { color: var(--white); }

/* Read-only purchase summary inside the token success card */
.token-success-summary {
  display: inline-flex; flex-direction: column; gap: 0.4rem;
  margin: 0.4rem auto 1rem; padding: 0.8rem 1.1rem; text-align: left;
  background: rgba(255, 255, 255, 0.14); border-radius: 10px; min-width: min(20rem, 100%);
}
.token-success-row { display: flex; justify-content: space-between; gap: 1.5rem; }
.token-success-label { color: rgba(255, 255, 255, 0.85); font-size: 0.85rem; }
.token-success-value { color: var(--white); font-weight: 600; }

/* Action buttons stacked at the bottom of the token success card */
.token-success-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.4rem; }
.token-success-actions button { flex: 1 1 12rem; }
/* Invert button colours so they read clearly on the blue card */
.card--success-blue .token-success-actions button.primary { background: var(--white); color: var(--navy); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18); }
.card--success-blue .token-success-actions button.primary:hover:not(:disabled) { background: #eaf3fb; }
.card--success-blue .token-success-actions button.secondary { background: transparent; color: var(--white); border-color: rgba(255, 255, 255, 0.7); }
.card--success-blue .token-success-actions button.secondary:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--white); color: var(--white); }

.grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Profile page: two independent stacking columns so cards pack tightly without row-alignment gaps */
/* Profile page: tabbed layout */
.profile-page { max-width: 640px; }
.profile-account-label {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.02em;
}
.profile-tabs { margin-bottom: 1rem; gap: 0.4rem; }
.profile-tabs .btn-inline { flex: 1 1 0; min-width: 0; padding: 0.55rem 0.5rem; font-size: 0.85rem; }
.profile-panel { margin-bottom: 0; }
.profile-panel-body { min-height: 12rem; }
.profile-tab-panel:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* Stat cards (dashboard) */
.stat-card { display: flex; flex-direction: column; gap: 0.15rem; position: relative; overflow: hidden; }
.stat-icon {
  width: 40px; height: 40px; border-radius: 11px; margin-bottom: 0.6rem;
  display: flex; align-items: center; justify-content: center; color: var(--secondary-blue);
  background: rgba(12, 113, 195, 0.1);
}
.stat-icon .icon { width: 21px; height: 21px; }
.stat-label { font-size: 0.78rem; color: var(--muted-text); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-family: var(--font-heading); font-weight: 600; color: var(--navy); font-size: 1.7rem; }

/* Responsive: sidebar becomes a slide-in drawer */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: 0 0 40px rgba(0,0,0,0.3); }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.nav-open .sidebar-overlay { display: block; }
  .main-area { margin-left: 0; }
  .menu-toggle { display: flex; }
  main { padding: 1.1rem 1rem 2.5rem; }
  .topbar { padding: 0.8rem 1rem; }
}

/* Forms */
label { display: block; font-size: 0.78rem; font-weight: 500; color: var(--grey-text); margin-bottom: 0.3rem; }
label { font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--navy);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--muted-text); font-weight: 400; }
input[readonly] { background: #f6f4f1; color: var(--grey-text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--secondary-blue); box-shadow: 0 0 0 3px rgba(12,113,195,0.15); }
.row { margin-bottom: 0.75rem; }

/* Password reveal toggle (eye icon) */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { width: 100%; padding-right: 2.6rem; }
.pw-toggle {
  position: absolute; top: 0; right: 0; height: 100%;
  width: 2.4rem; padding: 0; margin: 0; border: none; background: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted-text); cursor: pointer;
}
.pw-toggle:hover { color: var(--navy); }
.pw-toggle .icon { width: 18px; height: 18px; }
.row-2 { display: grid; gap: 0.75rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .row-2 { grid-template-columns: 1fr; } }

/* Buttons */
button.primary, button.secondary, button.danger {
  width: 100%;
  padding: 0.72rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
}
button.primary { background: var(--secondary-blue); color: var(--white); box-shadow: 0 4px 12px rgba(12,113,195,0.25); }
button.primary:hover:not(:disabled) { background: #0a63ab; }
button.primary:active:not(:disabled) { transform: translateY(1px); }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
button.secondary { background: var(--white); color: var(--navy); border: 1px solid var(--border); }
button.secondary:hover { border-color: var(--secondary-blue); color: var(--secondary-blue); }
button.danger { background: #fff; color: var(--err); border: 1px solid #f0c9c9; }
button.danger:hover { background: #fdf2f2; }
button.link { background: none; border: none; color: var(--link); cursor: pointer; font-family: var(--font-body); font-size: 0.85rem; padding: 0; }
button.btn-inline { width: auto; padding: 0.45rem 0.8rem; font-size: 0.82rem; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.helpdesk-recent { display: flex; flex-direction: column; gap: 0.45rem; }
.helpdesk-recent-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem;
  width: 100%; text-align: left; padding: 0.65rem 0.75rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); cursor: pointer;
}
.helpdesk-recent-item:hover { border-color: var(--secondary-blue); }
.helpdesk-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.helpdesk-thread { display: flex; flex-direction: column; gap: 0.65rem; }
.helpdesk-conversation { padding: 0.75rem 0.85rem; }
.helpdesk-conversation.flat { box-shadow: none; border: 1px solid var(--border); }
.helpdesk-conversation-meta {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.75rem; margin-bottom: 0.35rem;
}
.helpdesk-conversation-author { font-weight: 600; font-size: 0.85rem; color: var(--navy); }
.helpdesk-html p { margin: 0 0 0.5rem; }
.helpdesk-html p:last-child { margin-bottom: 0; }

.helpdesk-ticket { display: flex; flex-direction: column; gap: 1rem; }
.helpdesk-ticket-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.15rem;
}
.helpdesk-ticket-header-left { display: flex; align-items: flex-start; gap: 0.75rem; min-width: 0; flex: 1; }
.helpdesk-ticket-header-left > div { flex: 1; min-width: 0; }
button.secondary.helpdesk-back {
  flex-shrink: 0;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.helpdesk-ticket-id-line { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.helpdesk-ticket-id-line strong { font-size: 0.95rem; color: var(--navy); }
.helpdesk-ticket-title {
  margin: 0.35rem 0 0; font-size: 1.35rem; font-weight: 500; color: var(--navy); line-height: 1.25;
  overflow-wrap: anywhere;
}
.helpdesk-ticket-header-actions { display: flex; gap: 0.55rem; flex-shrink: 0; flex-wrap: wrap; align-items: flex-start; }
@media (max-width: 640px) {
  .helpdesk-ticket-header { flex-direction: column; align-items: stretch; }
  .helpdesk-ticket-header-actions { justify-content: flex-start; }
}
.helpdesk-ticket-header-actions button { width: auto; padding: 0.5rem 1rem; font-size: 0.85rem; }

.helpdesk-ticket-grid {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: 1rem; align-items: start;
}
@media (max-width: 820px) {
  .helpdesk-ticket-grid { grid-template-columns: 1fr; }
}
.helpdesk-ticket-main { padding: 1rem 1.15rem; }
.helpdesk-ticket-main-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
}
.helpdesk-ticket-main-head h3 { margin: 0; font-size: 1rem; font-weight: 600; color: var(--navy); }
.helpdesk-ticket-badges { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.helpdesk-divider { border: none; border-top: 1px solid var(--border); margin: 0.85rem 0; }
.helpdesk-ticket-description { font-size: 0.9rem; line-height: 1.55; color: var(--text); }
.helpdesk-conversations-section { margin-top: 1.25rem; }
.helpdesk-conversations-section h4 {
  margin: 0 0 0.65rem; font-size: 0.85rem; font-weight: 600; color: var(--navy); text-transform: uppercase;
  letter-spacing: 0.03em;
}

.helpdesk-ticket-sidebar { padding: 1rem 1.15rem; }
.helpdesk-sidebar-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.85rem;
}
.helpdesk-sidebar-head h3 { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--navy); }
.helpdesk-sidebar-head button.link { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.82rem; }
.helpdesk-prop-list { margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.helpdesk-prop-row { display: flex; flex-direction: column; gap: 0.15rem; }
.helpdesk-prop-label { margin: 0; font-size: 0.82rem; color: var(--grey-text); font-weight: 400; }
.helpdesk-prop-value { margin: 0; font-size: 0.88rem; font-weight: 600; color: var(--navy); }

.pill.status-new { background: #e3f0fb; color: #0c71c3; }
.pill.status-open { background: #e7f6e7; color: var(--link); }
.pill.status-closed { background: #eee; color: #777; }
.pill.status-escalated { background: #fde8e8; color: var(--err); }
.pill.priority-critical { background: #fde8ec; color: #c0392b; }
.pill.priority-high { background: #fff0e0; color: #c06000; }
.pill.priority-medium { background: #fff8e0; color: #9a7b00; }
.pill.priority-low { background: #e7f6e7; color: var(--link); }
.card textarea { width: 100%; min-height: 6rem; resize: vertical; }
.card strong, .card .break { overflow-wrap: anywhere; word-break: break-word; }

/* Messages */
.msg { font-size: 0.85rem; margin-top: 0.6rem; font-weight: 500; min-height: 1em; }
.msg.ok { color: var(--link); }
.msg.err { color: var(--err); }
.msg.hint { color: var(--grey-text); font-weight: 400; }
.banner { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.85rem; }
.banner.err { background: #fde8e8; color: var(--err); }
.banner.ok { background: #e7f6e7; color: var(--link); }

/* Tables / lists */
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th, .table td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--navy); font-weight: 500; }
.table tr:last-child td { border-bottom: none; }
.muted { color: var(--grey-text); font-size: 0.82rem; }
.pill { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.72rem; background: var(--sand); color: var(--navy); }
.pill.green { background: #e7f6e7; color: var(--link); }
.pill.grey { background: #eee; color: #777; }
.amount { font-family: var(--font-heading); font-weight: 300; color: var(--navy); }
.big-amount { font-size: 1.8rem; }

.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.8rem 0; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .meta { font-size: 0.78rem; color: var(--grey-text); }
.list-item .info { min-width: 0; flex: 1; }
.list-item .actions { flex-shrink: 0; }

/* Vehicle cards */
.vehicle-card {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 0.6rem;
}
.vehicle-card:last-child { margin-bottom: 0; }
.vehicle-vrm { font-family: var(--font-heading); font-weight: 300; color: var(--navy); font-size: 1.1rem; letter-spacing: 0.04em; }
.vehicle-icon { width: 38px; height: 38px; border-radius: 8px; background: var(--sand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--navy); }
.vehicle-icon .icon { width: 22px; height: 22px; }
.vehicle-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.vehicle-card .actions { flex-shrink: 0; display: flex; align-items: center; }

/* Searchable combobox */
.combobox { position: relative; }
.combo-display {
  width: 100%; text-align: left; padding: 0.6rem 0.7rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--white); color: var(--navy); font-family: var(--font-body);
  font-size: 1rem; font-weight: 500; cursor: pointer;
}
.combo-display:focus { outline: none; border-color: var(--secondary-blue); box-shadow: 0 0 0 2px rgba(12,113,195,0.2); }
.combo-placeholder { color: #999; }
.combo-panel {
  position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--white); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(1,66,109,0.15); overflow: hidden;
}
.combo-search { width: 100%; border: none; border-bottom: 1px solid var(--border); border-radius: 0; padding: 0.6rem 0.7rem; }
.combo-search:focus { box-shadow: none; border-color: var(--secondary-blue); }
.combo-list { max-height: 240px; overflow-y: auto; }
.combo-option { padding: 0.55rem 0.7rem; cursor: pointer; font-size: 0.92rem; color: var(--navy); }
.combo-option:hover { background: var(--sand); }
.combo-option.selected { background: rgba(12,113,195,0.1); font-weight: 500; }
.combo-empty { padding: 0.6rem 0.7rem; color: var(--grey-text); font-size: 0.85rem; }

.hidden { display: none !important; }
.center { text-align: center; }
.spinner {
  width: 28px; height: 28px; border: 3px solid var(--accent-grey); border-top-color: var(--secondary-blue);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 1.5rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.app-version { position: fixed; bottom: 0.4rem; right: 0.6rem; font-size: 0.66rem; color: rgba(1,66,109,0.4); pointer-events: none; }
.footnote { font-size: 0.75rem; text-align: center; margin-top: 1rem; color: var(--grey-text); }
#payment-element { margin: 1rem 0; min-height: 8px; }
.section-head { display:flex; align-items:center; justify-content:space-between; margin: 0 0 0.75rem; }
.section-head h2 { margin: 0; }

/* Donut / pie charts */
.donut-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.donut-svg { display: block; transform: rotate(0deg); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center-label { font-family: var(--font-heading); font-weight: 600; color: var(--navy); font-size: 1.05rem; line-height: 1.1; }
.donut-center-sub { font-size: 0.66rem; color: var(--grey-text); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.1rem; }

.token-charts { display: flex; flex-wrap: wrap; gap: 1.4rem; margin-top: 0.4rem; }
.token-chart { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; width: 120px; }
.token-chart-name { font-size: 0.76rem; color: var(--navy); text-align: center; font-weight: 500; line-height: 1.2; }
.token-chart-meta { font-size: 0.72rem; color: var(--grey-text); text-align: center; }
.token-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.9rem; font-size: 0.76rem; color: var(--grey-text); }
.token-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; }

/* Per-vehicle activity stats */
.vehicle-stats { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.3rem; }
.vehicle-stat { display: inline-flex; align-items: baseline; gap: 0.3rem; background: var(--sand); border-radius: 999px; padding: 0.12rem 0.6rem; font-size: 0.74rem; color: var(--grey-text); }
.vehicle-stat b { font-family: var(--font-heading); font-weight: 600; color: var(--navy); font-size: 0.82rem; }
.vehicle-stat-loading { font-style: italic; }
.vehicle-stat-link { cursor: pointer; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s; }
.vehicle-stat-link:hover, .vehicle-stat-link:focus { background: rgba(12,113,195,0.12); border-color: rgba(12,113,195,0.25); outline: none; }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 8px; }
.usage-table { min-width: 640px; margin: 0; }
.usage-table th, .usage-table td { white-space: nowrap; vertical-align: top; }
.usage-table .usage-datetime { white-space: pre-line; line-height: 1.25; min-width: 6.5rem; }
.usage-table .usage-photo-col { width: 5rem; text-align: center; }
.usage-photo-cell { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.usage-photo-link { font-size: 0.78rem; padding: 0; }
.usage-image-status { font-size: 0.68rem; text-align: center; max-width: 5rem; }
.usage-loading { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.75rem; }
.usage-loading .spinner { margin: 0; width: 22px; height: 22px; border-width: 2px; }
.usage-host { margin-top: 0.75rem; min-height: 2.5rem; }
.usage-hint { font-size: 0.78rem; margin-top: 0.6rem; }

.image-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem; }
.image-actions .link { font-size: 0.78rem; }

.stripe-mount { min-height: 22rem; margin: 0.75rem 0; }
.stripe-mount--modal { min-height: 12rem; }

/* Modal */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(1, 28, 46, 0.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: modal-fade 0.2s ease;
}
.modal-panel {
  background: var(--card);
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(1, 28, 46, 0.22);
  width: 100%;
  max-height: min(92vh, 860px);
  display: flex; flex-direction: column;
  animation: modal-slide 0.25s ease;
}
.modal-md { max-width: 480px; }
.modal-lg { max-width: 560px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.15rem 1.35rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { margin: 0; font-size: 1.15rem; font-weight: 600; color: var(--navy); }
.modal-close {
  width: 2rem; height: 2rem; border: none; border-radius: 8px;
  background: var(--sand); color: var(--grey-text); font-size: 1.35rem; line-height: 1;
  cursor: pointer; flex-shrink: 0;
}
.modal-close:hover { background: var(--accent-grey); color: var(--navy); }
.modal-body { padding: 1.15rem 1.35rem 1.35rem; overflow-y: auto; flex: 1; min-height: 0; }
.modal-actions { margin-top: 0.85rem; }
.modal-actions .primary { width: 100%; }
.modal-footer {
  display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap;
  margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border);
}
.modal-footer .primary { margin-left: auto; }
.modal-footer-nav { border-top: none; padding-top: 0; margin-top: 0.35rem; }
.modal-footer-nav .secondary { flex: 1; }
.pay-stripe-hint { font-size: 0.84rem; line-height: 1.45; margin: 0.65rem 0 0.5rem; }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-slide { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

/* Pay wizard */
.pay-modal-balance { margin: 0 0 0.85rem; font-size: 0.92rem; }
.pay-modal-balance strong { font-family: var(--font-heading); color: var(--navy); font-size: 1.05rem; }
.pay-wizard-label { font-size: 0.78rem; font-weight: 600; color: var(--grey-text); text-transform: uppercase; letter-spacing: 0.04em; margin: 0.5rem 0 0.55rem; }
.pay-modal-hint { font-size: 0.85rem; margin-top: 0.65rem; }

.pay-method-tiles { display: flex; flex-direction: column; gap: 0.55rem; }
.pay-method-tile {
  display: flex; align-items: center; gap: 0.85rem;
  width: 100%; text-align: left;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  font-family: var(--font-body);
}
.pay-method-tile:hover:not(.disabled) { border-color: rgba(12, 113, 195, 0.45); box-shadow: var(--shadow-sm); }
.pay-method-tile.selected { border-color: var(--secondary-blue); background: rgba(12, 113, 195, 0.04); box-shadow: 0 0 0 1px rgba(12, 113, 195, 0.15); }
.pay-method-tile.disabled { opacity: 0.55; cursor: not-allowed; }
.pay-method-tile-icon {
  width: 2.6rem; height: 2.6rem; flex-shrink: 0;
  border-radius: 9px;
  background: rgba(12, 113, 195, 0.1);
  color: var(--secondary-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.02em;
}
.pay-method-tile-icon.sm { width: 2rem; height: 2rem; font-size: 0.55rem; }
.pay-method-tile-body { flex: 1; min-width: 0; }
.pay-method-tile-title { font-weight: 600; color: var(--navy); font-size: 0.92rem; }
.pay-method-tile-sub { font-size: 0.78rem; color: var(--muted-text); margin-top: 0.12rem; line-height: 1.35; }
.pay-method-tile-check {
  width: 1.4rem; height: 1.4rem; flex-shrink: 0;
  border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; color: #fff; font-weight: 700;
}
.pay-method-tile.selected .pay-method-tile-check { background: var(--secondary-blue); border-color: var(--secondary-blue); }

.pay-summary-box {
  background: var(--sand); border-radius: var(--radius-sm);
  padding: 0.85rem 1rem; margin-bottom: 0.85rem;
}
.pay-summary-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; }
.pay-summary-row strong { font-family: var(--font-heading); color: var(--navy); font-size: 1.2rem; }
.pay-card-preview {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.65rem 0.85rem; background: var(--sand); border-radius: var(--radius-sm);
  font-weight: 500; color: var(--navy); margin-bottom: 0.5rem;
}

.pay-success { text-align: center; padding: 1.5rem 0.5rem; }
.pay-success-icon {
  width: 3.2rem; height: 3.2rem; margin: 0 auto 0.85rem;
  border-radius: 50%; background: var(--accent-green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700;
}
.pay-success p { margin: 0; color: var(--navy); font-size: 0.95rem; }

.pay-summary-card .pay-balance-display {
  display: flex; flex-direction: column; gap: 0.15rem; margin: 0.35rem 0 0.75rem;
}
.pay-balance-label { font-size: 0.78rem; color: var(--muted-text); text-transform: uppercase; letter-spacing: 0.04em; }
.pay-balance-amount { font-family: var(--font-heading); font-weight: 600; color: var(--navy); font-size: 1.85rem; }

.pay-amount-input { font-size: 1.05rem !important; font-weight: 600; }

/* Guest direct payment (#/pay) */
.dp-wrap { max-width: 440px; }
.dp-step.hidden { display: none; }
.dp-disclaimer { font-size: 0.82rem; margin: 0.75rem 0 0; line-height: 1.45; }
.dp-notice {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: #fff8eb;
  border: 1px solid #f0d090;
  font-size: 0.85rem;
  color: var(--navy);
}
.dp-notice.hidden { display: none; }
.dp-balance-row { font-size: 1.05rem; margin: 0.5rem 0; }
.dp-advance { margin-top: 1rem; }
.dp-advance.hidden { display: none; }
.dp-advance-prompt { margin: 0 0 0.75rem; font-size: 0.9rem; }
.dp-advance-buttons { display: flex; flex-direction: column; gap: 0.5rem; }
.dp-advance-btn { width: 100%; text-align: left; }
.dp-pay-line { margin: 0 0 1rem; font-size: 0.95rem; }
.dp-sign-in-link { margin-top: 1rem; }
.input-mismatch { border-color: var(--err, #b91c1c) !important; box-shadow: 0 0 0 1px var(--err, #b91c1c); }
.card-success {
  background: var(--accent-green, #2da701);
  border-color: var(--accent-green, #2da701);
  color: #fff;
}
.card-success h2,
.card-success p { color: #fff; }
.card-success .primary { background: #fff; color: var(--navy); }
.card-success .primary:hover:not(:disabled) { background: var(--sand); }

.proxy-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 1.25rem 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: #fff8e6;
  border: 1px solid #f0d48a;
  color: var(--navy);
  font-size: 0.92rem;
}

.csr-account-preview {
  margin-top: 0.75rem;
  font-size: 0.92rem;
}
