/* ============================================================
   TowPilot customer portal — shared styles (auth + dashboard)
   Emerald brand, Barlow/Inter, mobile-first, matches the landing.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --accent: #10B981;
  --accent-600: #0E9E6E;
  --accent-700: #0B7A50;
  --accent-soft: #E7F8F1;
  --accent-glow: rgba(16,185,129,0.28);
  --ink-900: #0A0A0B; --ink-800: #1A1A1A; --ink-700: #2D2D2D;
  --ink-500: #5A5F66; --ink-400: #8A9099; --ink-300: #C7CCD2;
  --ink-200: #E4E6E9; --ink-100: #F3F4F5; --ink-50: #F8F9FA;
  --surface: #ffffff; --page: #F3F4F5;
  --font-display: 'Barlow','Arial Narrow',system-ui,sans-serif;
  --font-body: 'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  --radius: 16px; --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15,30,50,0.06);
  --shadow-md: 0 6px 20px rgba(15,30,50,0.08);
  --shadow-lg: 0 24px 60px rgba(15,30,50,0.16);
  --ease: cubic-bezier(0.22,0.61,0.36,1);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--page); color: var(--ink-800); -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4 { font-family: var(--font-display); margin: 0; color: var(--ink-900); letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: var(--font-body); }

/* ---- brand mark ---- */
.tp-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px var(--accent-glow); flex: none; }
.tp-word { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -0.02em; color: var(--ink-900); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 15px; border-radius: var(--radius-sm); border: none; cursor: pointer; padding: 12px 18px; line-height: 1; transition: background .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease), opacity .18s; white-space: nowrap; }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 8px 20px var(--accent-glow); }
.btn-accent:hover { background: var(--accent-600); transform: translateY(-1px); }
.btn-dark { background: var(--ink-900); color: #fff; }
.btn-dark:hover { transform: translateY(-1px); opacity: .92; }
.btn-outline { background: #fff; color: var(--ink-800); border: 1.5px solid var(--ink-200); }
.btn-outline:hover { border-color: var(--ink-300); }
.btn-ghost { background: var(--ink-100); color: var(--ink-800); }
.btn-ghost:hover { background: var(--ink-200); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-sm { padding: 8px 12px; font-size: 13.5px; }

/* ---- forms ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-700); margin-bottom: 6px; }
.input { width: 100%; padding: 13px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--ink-200); background: #fff; font-size: 15px; color: var(--ink-900); outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--ink-400); }
.err { color: #E2575B; font-size: 13px; margin-top: 6px; }
.hint { color: var(--ink-500); font-size: 13px; }

/* ---- alerts ---- */
.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 16px; line-height: 1.4; }
.alert-ok { background: var(--accent-soft); border: 1px solid rgba(16,185,129,0.4); color: var(--accent-700); }
.alert-err { background: rgba(226,87,91,0.1); border: 1px solid rgba(226,87,91,0.4); color: #B23a3e; }
.alert-info { background: #EEF3FF; border: 1px solid #C9D8FF; color: #2F5FCC; }

/* ---- status chips ---- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; padding: 4px 10px; border-radius: 999px; text-transform: capitalize; }
.chip-green { background: var(--accent-soft); color: var(--accent-700); }
.chip-amber { background: #FEF3E2; color: #B7791F; }
.chip-red { background: rgba(226,87,91,0.12); color: #C0464a; }
.chip-gray { background: var(--ink-100); color: var(--ink-500); }
.chip-blue { background: #EAF1FF; color: #2F5FCC; }

/* =========================================================
   AUTH shell (login / otp / password)
   ========================================================= */
.pa-page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 18px; background:
   radial-gradient(1200px 500px at 50% -10%, #ECFBF4 0%, transparent 60%), var(--page); }
.pa-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--ink-200); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 28px 26px 26px; }
.pa-brand { display: flex; align-items: center; gap: 9px; justify-content: center; margin-bottom: 20px; }
.pa-title { font-size: 23px; font-weight: 800; text-align: center; }
.pa-sub { text-align: center; color: var(--ink-500); font-size: 14px; margin: 6px 0 22px; line-height: 1.45; }
.pa-alt { text-align: center; margin-top: 16px; font-size: 14px; color: var(--ink-500); }
.pa-alt a { color: var(--accent-700); font-weight: 600; }
.pa-foot { text-align: center; margin-top: 22px; font-size: 12px; color: var(--ink-400); }
/* OTP segmented input */
.otp-row { display: flex; gap: 8px; justify-content: space-between; margin: 6px 0 4px; }
.otp-row input { width: 100%; aspect-ratio: 1/1; text-align: center; font-size: 22px; font-weight: 700; border-radius: 12px; border: 1.5px solid var(--ink-200); outline: none; color: var(--ink-900); }
.otp-row input:focus { border-color: var(--accent); }

/* =========================================================
   PORTAL shell (sidebar + main)
   ========================================================= */
.pp-app { min-height: 100vh; min-height: 100dvh; }
.pp-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 250px; background: var(--surface);
  border-right: 1px solid var(--ink-200); display: flex; flex-direction: column; z-index: 60;
  transition: transform .25s var(--ease);
}
.pp-side-brand { display: flex; align-items: center; gap: 9px; padding: 20px 20px 14px; }
.pp-nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.pp-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; color: var(--ink-500); font-weight: 600; font-size: 14.5px; transition: background .15s, color .15s; }
.pp-nav a svg { flex: none; color: currentColor; }
.pp-nav a:hover { background: var(--ink-100); color: var(--ink-800); }
.pp-nav a.active { background: var(--accent-soft); color: var(--accent-700); }
.pp-side-foot { padding: 12px; border-top: 1px solid var(--ink-200); }
.pp-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px; }
.pp-avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-700); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.pp-user-name { font-weight: 700; font-size: 14px; color: var(--ink-900); line-height: 1.1; }
.pp-user-sub { font-size: 12px; color: var(--ink-400); }

.pp-main { margin-left: 250px; min-height: 100vh; display: flex; flex-direction: column; }
.pp-topbar { display: none; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--ink-200); position: sticky; top: 0; z-index: 40; }
.pp-hamb { background: none; border: none; padding: 6px; color: var(--ink-800); cursor: pointer; display: inline-flex; }
.pp-content { padding: 26px 28px 40px; max-width: 1100px; width: 100%; }
.pp-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pp-page-title { font-size: 26px; font-weight: 800; }
.pp-page-sub { color: var(--ink-500); font-size: 14px; margin-top: 3px; }

.pp-overlay { position: fixed; inset: 0; background: rgba(10,12,14,0.4); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
.pp-overlay.show { opacity: 1; pointer-events: auto; }

/* cards, grids */
.card { background: var(--surface); border: 1px solid var(--ink-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-p { padding: 18px; }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--ink-200); border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow-sm); }
.stat-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-700); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.stat-num { font-family: var(--font-display); font-weight: 800; font-size: 26px; color: var(--ink-900); line-height: 1; }
.stat-lbl { font-size: 12.5px; color: var(--ink-500); margin-top: 5px; }

.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; }
.sec-title { font-size: 17px; font-weight: 800; }

/* list rows */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--ink-100); }
.row:last-child { border-bottom: none; }
.row-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.row-ico img { width: 42px; height: 42px; border-radius: 12px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 700; font-size: 15px; color: var(--ink-900); }
.row-sub { font-size: 13px; color: var(--ink-500); margin-top: 2px; }
.row-amt { font-family: var(--font-display); font-weight: 800; font-size: 16px; color: var(--ink-900); white-space: nowrap; }
.row-arrow { color: var(--ink-300); flex: none; }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-400); }
.empty-ico { width: 52px; height: 52px; border-radius: 15px; background: var(--ink-100); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; color: var(--ink-400); }

/* definition list (receipt / job detail) */
.dl { display: grid; grid-template-columns: 1fr; }
.dl-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--ink-100); font-size: 14.5px; }
.dl-row:last-child { border-bottom: none; }
.dl-k { color: var(--ink-500); }
.dl-v { color: var(--ink-900); font-weight: 600; text-align: right; }

.total-band { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; background: var(--ink-900); color: #fff; border-radius: var(--radius); margin-top: 2px; }
.total-band .t-lbl { font-size: 13px; opacity: .8; }
.total-band .t-amt { font-family: var(--font-display); font-weight: 800; font-size: 26px; }

/* modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(10,12,14,0.5); z-index: 80; display: none; align-items: center; justify-content: center; padding: 18px; }
.modal-overlay.show { display: flex; }
.modal { width: 100%; max-width: 460px; background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); padding: 22px; }
.modal h3 { font-size: 19px; margin-bottom: 4px; }
.modal textarea { min-height: 96px; resize: vertical; }

/* pagination */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.pager a, .pager span { padding: 7px 12px; border-radius: 9px; font-size: 13.5px; border: 1px solid var(--ink-200); background: #fff; color: var(--ink-700); }
.pager .active span { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .pp-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .pp-sidebar.open { transform: translateX(0); }
  .pp-main { margin-left: 0; }
  .pp-topbar { display: flex; }
  .pp-content { padding: 18px 16px 40px; }
  .pp-page-title { font-size: 22px; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .row { padding: 12px 12px; gap: 11px; }
  .row-ico, .row-ico img { width: 38px; height: 38px; }
}
