/* Customer 360 — follows the "Customer 360 Sales App" phone mockups. */
:root {
  --navy: #121a33; --navy-2: #1d2647; --navy-line: #2c3658;
  --bg: #f1f2f6; --card: #ffffff; --ink: #121a2e; --muted: #7b8296; --line: #ebedf2;
  --blue: #3d5af1; --blue-soft: #e9edfe; --blue-light: #a8b8f8;
  --orange: #f2a33a; --orange-soft: #fdf0dc; --orange-ink: #b86a00;
  --red: #c8302b; --red-soft: #fde9e8; --red-ink: #c8302b;
  --green: #1f8a4c; --green-soft: #e2f4e9; --green-ink: #1c7a44;
  --grey-soft: #eef0f4;
  --radius: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.4 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
h1 { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
h1.h-sm { font-size: 1.15rem; }
p { margin: 0; }
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 24px; }
.app.has-tabbar { padding-bottom: 84px; }
.grow { flex: 1; min-width: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub { color: var(--muted); font-size: .8rem; }
.tiny { color: var(--muted); font-size: .72rem; }
.empty { color: var(--muted); text-align: center; padding: 28px 0; }
.ico { width: 18px; height: 18px; flex: none; }

/* ---- navy header ---- */
.hero { background: var(--navy); color: #fff; padding: 18px 16px 20px;
  border-radius: 0 0 22px 22px; }
.hero-open { border-radius: 0; padding-bottom: 12px; }
/* Header (title + search) stays put while the list scrolls under it. */
.hero-sticky { position: sticky; top: 0; z-index: 5; box-shadow: 0 6px 16px rgb(18 26 51 / .18); }
.hero-card { padding-bottom: 64px; }
.hero-tall { padding-bottom: 64px; }
.hello { color: #b8bfd6; font-size: .78rem; margin-bottom: 4px; }
.hero-sub { color: #aab2cc; font-size: .75rem; margin-top: 2px; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hero-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.circle { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy-2); color: #fff; flex: none; }
.ident { display: flex; align-items: center; gap: 12px; }
.hero-lbl { color: #aab2cc; font-size: .75rem; margin-top: 4px; }
.hero-total { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 2px; }
.hero-total strong { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; }

/* avatar + account menu */
.avatar, .av { display: inline-grid; place-items: center; font-weight: 700; flex: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--orange); color: var(--navy);
  font-size: .82rem; cursor: pointer; list-style: none; }
.avatar::-webkit-details-marker { display: none; }
.me { position: relative; }
.menu { position: absolute; right: 0; top: 46px; z-index: 5; background: var(--card); color: var(--ink);
  border-radius: 12px; padding: 12px; min-width: 170px; box-shadow: 0 10px 30px rgba(18,26,51,.25); }
.menu-name { font-weight: 600; margin-bottom: 8px; }
.menu button { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--red); cursor: pointer; }
.av { width: 40px; height: 40px; border-radius: 10px; font-size: .8rem; }
.av-lg { width: 48px; height: 48px; border-radius: 12px; font-size: 1rem; }
.av-blue { background: var(--blue-soft); color: var(--blue); }
.av-green { background: var(--green-soft); color: var(--green); }
.av-orange { background: var(--orange-soft); color: var(--orange-ink); }
.av-solid-orange { background: var(--orange); color: var(--navy); }

/* search */
.searchbar { display: flex; gap: 8px; margin-top: 16px; }
.searchbox { flex: 1; display: flex; align-items: center; gap: 8px; background: #fff; color: var(--muted);
  border-radius: 12px; padding: 0 12px; height: 44px; }
.searchbox input { flex: 1; border: 0; outline: 0; font: inherit; color: var(--ink); background: transparent; min-width: 0; }
.hero-tail { background: var(--navy); padding: 4px 16px 18px; border-radius: 0 0 22px 22px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips a { padding: 6px 14px; border-radius: 999px; font-size: .76rem; font-weight: 500;
  color: #fff; border: 1px solid var(--navy-line); }
.chips a[aria-current] { background: #fff; color: var(--navy); border-color: #fff; }

/* body */
.wrap { padding: 14px 16px 0; }
.wrap.overlap { margin-top: -50px; }
.panel { background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: 0 1px 2px rgba(18,26,51,.05); }
.list-head { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 2px 10px; }
.list-head strong { font-size: .85rem; }
.list-head span { color: var(--muted); font-size: .72rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.panel-head strong { font-size: .9rem; }
.panel-head span { color: var(--muted); font-size: .72rem; }
.kv { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; }
.kv span { color: var(--muted); }
.kv strong { font-variant-numeric: tabular-nums; }

/* badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .68rem; font-weight: 600; white-space: nowrap; }
.soft-red { background: var(--red-soft); color: var(--red-ink); }
.soft-green { background: var(--green-soft); color: var(--green-ink); }
.soft-orange { background: var(--orange-soft); color: var(--orange-ink); }
.soft-grey { background: var(--grey-soft); color: var(--muted); }
.solid-red { background: var(--red); color: #fff; }
.solid-orange { background: var(--orange); color: var(--navy); }

/* 1 · search list cards */
.ccard { display: block; background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(18,26,51,.05); }
.ccard-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ccard .name { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccard .sub { display: block; }
.meter { display: block; width: 100%; height: 6px; margin: 8px 0 6px; }
.meter .track { fill: var(--line); }
.m-green { fill: var(--green); stroke: var(--green); }
.m-orange { fill: var(--orange); stroke: var(--orange); }
.m-red { fill: var(--red); stroke: var(--red); }
.skeleton { height: 34px; border-radius: 8px; background: linear-gradient(90deg, var(--line), #f6f7fa, var(--line)); }

/* 2 · customer card */
.summary { display: flex; align-items: center; gap: 14px; }
.donut { width: 72px; height: 72px; flex: none; }
.donut-track { stroke: var(--orange-soft); }
.donut-fill { fill: none; }
.donut-pct { font-size: 9px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.donut-lbl { font-size: 5px; text-anchor: middle; fill: var(--muted); }
.eyebrow { font-size: .66rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.big { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.summary .sub { margin: 2px 0 6px; }
.chev { color: var(--muted); }
.alert { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--red-soft); color: var(--red-ink); }
.alert strong { font-size: .82rem; }
.alert p { font-size: .72rem; color: var(--red-ink); opacity: .85; }
.alert-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--red); color: #fff; flex: none; }
.alert-inline { background: var(--red-soft); color: var(--red-ink); padding: 8px 10px; border-radius: 8px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.tile .lbl { color: var(--muted); font-size: .72rem; margin-top: 10px; }
.tile .val { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tico, .pico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; }
.t-blue { background: var(--blue-soft); color: var(--blue); }
.t-orange { background: var(--orange-soft); color: var(--orange-ink); }
.t-green { background: var(--green-soft); color: var(--green); }
.aging { margin-top: 12px; }
/* Overview: compact widgets so more fits on a phone screen (other screens unchanged). */
.page-overview .hero-card { padding-top: 12px; padding-bottom: 58px; }
.page-overview .hero-nav { margin-bottom: 8px; }
.page-overview .hero-nav .circle { width: 30px; height: 30px; }
.page-overview .ident { gap: 10px; }
.page-overview .ident h1 { font-size: 1.12rem; line-height: 1.25; }
.page-overview .ident .av-lg { width: 40px; height: 40px; border-radius: 10px; font-size: .88rem; }
.page-overview .ident .hero-sub { font-size: .7rem; }
.page-overview .panel { padding: 11px 12px; }
.page-overview .summary { gap: 12px; }
.page-overview .donut { width: 60px; height: 60px; }
.page-overview .big { font-size: 1.3rem; }
.page-overview .summary .sub { margin: 1px 0 4px; font-size: .75rem; }
.page-overview .alert { margin-top: 9px; padding: 9px 12px; gap: 10px; }
.page-overview .alert-ico { width: 26px; height: 26px; }
.page-overview .alert-ico .ico { width: 15px; height: 15px; }
.page-overview .tiles { gap: 8px; margin-top: 9px; }
.page-overview .tico { width: 28px; height: 28px; border-radius: 8px; }
.page-overview .tico .ico { width: 15px; height: 15px; }
.page-overview .tile .lbl { margin-top: 6px; font-size: .7rem; }
.page-overview .tile .val { font-size: .95rem; margin-top: 1px; }
.page-overview .aging { margin-top: 9px; }
.page-overview .panel-head { margin-bottom: 8px; }
.page-overview .segbar { height: 8px; }
.page-overview .legend { margin-top: 8px; }
.page-overview .legend li { padding: 2px 0; font-size: .75rem; }
.page-overview .kv.foot { margin-top: 7px; padding-top: 7px; }
.segbar { display: block; width: 100%; height: 10px; }
.b1 { fill: var(--blue-light); background: var(--blue-light); }
.b2 { fill: var(--blue); background: var(--blue); }
.b3 { fill: var(--orange); background: var(--orange); }
.b4 { fill: var(--red); background: var(--red); }
.legend { list-style: none; margin: 12px 0 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: .78rem; padding: 4px 0; }
.legend .dot { width: 10px; height: 10px; flex: none; }
.legend .pct { color: var(--muted); width: 40px; text-align: right; }
.legend .num { width: 96px; text-align: right; font-weight: 600; }
.kv.foot { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; font-size: .75rem; }
.kv.foot span:last-child { color: var(--ink); font-weight: 500; }

/* 3 · bills */
.stat-row { display: flex; gap: 10px; }
.stat { flex: 1; border-radius: 12px; padding: 10px 12px; }
.stat p { font-size: .68rem; opacity: .85; }
.stat strong { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; margin-top: 2px; }
.s-blue { background: var(--navy-2); }
.s-red { background: var(--red); }
.s-green { background: var(--green); }
.segmented { display: flex; background: var(--card); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.segmented a { flex: 1; text-align: center; padding: 8px 0; border-radius: 9px; font-size: .78rem; font-weight: 500; color: var(--ink); }
.segmented a[aria-current] { background: var(--navy); color: #fff; }
.bill { display: flex; gap: 12px; margin-bottom: 10px; align-items: flex-start; }
.days { display: grid; place-items: center; align-content: center; width: 50px; height: 50px; border-radius: 12px; color: #fff; flex: none; }
.days b { font-size: 1.05rem; line-height: 1; }
.days small { font-size: .55rem; font-weight: 600; letter-spacing: .05em; margin-top: 2px; }
.days.b1 { color: var(--blue); background: var(--blue-soft); }
.bill .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bill strong { font-size: .86rem; }
.bill .sub { margin: 2px 0 6px; font-size: .72rem; }
.note { display: block; background: var(--green-soft); color: var(--green-ink); font-size: .75rem;
  border-radius: 12px; padding: 12px 14px; margin-top: 4px; }

/* 4 · history */
.chart-card .bars { display: flex; justify-content: space-around; gap: 4px; overflow-x: auto; }
.bar-col { flex: 1 0 40px; max-width: 64px; text-align: center; font-size: .7rem; color: var(--muted); }
.bar-col svg { display: block; width: 100%; height: 110px; }
.bar { fill: var(--blue-light); }
.bar-now { fill: var(--blue); }
.bar-val { font-size: 9px; text-anchor: middle; fill: var(--ink); font-weight: 600; }
.line { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding: 12px 14px; }
.line strong { font-size: .84rem; display: block; }
.line .sub { font-size: .72rem; }
.line.is-return .amt strong { color: var(--orange-ink); }
.amt { text-align: right; }
.amt strong { font-size: .9rem; font-variant-numeric: tabular-nums; }
.amt small { display: block; color: var(--muted); font-size: .62rem; }
.pico { width: 40px; height: 40px; border-radius: 12px; }
.k-battery { background: var(--blue-soft); color: var(--blue); }
.k-oil { background: var(--orange-soft); color: var(--orange-ink); }
.k-tyre { background: var(--grey-soft); color: var(--ink); }
.k-brake { background: var(--red-soft); color: var(--red); }
.k-box { background: var(--grey-soft); color: var(--muted); }
.more { display: block; text-align: center; padding: 12px; color: var(--blue); font-weight: 600; }

/* 5 · last rates */
.rate { margin-bottom: 10px; }
.rate-top { display: flex; align-items: center; gap: 12px; }
.rate-top strong { font-size: .86rem; }
.rate-val { text-align: right; }
.rate-val strong { display: block; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: .66rem; }
.facts dd { margin: 2px 0 0; font-size: .75rem; font-weight: 600; }

/* bottom tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; justify-content: space-around;
  max-width: 480px; margin: 0 auto; background: var(--card); border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); }
.tabbar a { display: grid; justify-items: center; gap: 3px; font-size: .66rem; color: var(--muted); min-width: 64px; }
.tabbar a[aria-current] { color: var(--blue); font-weight: 600; }

/* forms, misc */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); }
.form input { font: inherit; color: var(--ink); padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; }
.btn-primary { font: inherit; font-weight: 600; padding: 13px; border: 0; border-radius: 12px; background: var(--blue); color: #fff; cursor: pointer; }
.asof { margin: 14px 2px 0; font-size: .72rem; color: var(--muted); text-align: right; }
.asof a { color: var(--blue); display: inline-flex; align-items: center; gap: 3px; }
.asof .ico { width: 12px; height: 12px; }
.demo { text-align: center; font-size: .72rem; color: var(--orange-ink); padding: 6px 0 90px; }

/* profile */
.avatar img, img.avatar-xl { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar { overflow: hidden; }
.avatar-xl { width: 96px; height: 96px; font-size: 1.6rem; flex: none; }
img.avatar-xl { width: 96px; height: 96px; }
.profile-photo { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.profile-photo strong { font-size: 1rem; }
.photo-form { display: flex; gap: 8px; align-items: center; margin: 10px 0 6px; flex-wrap: wrap; }
.btn-ghost { display: inline-block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: .8rem; font-weight: 600; color: var(--blue); cursor: pointer; }
/* Photo picker (profile): the photo itself is the button. */
.photo-picker { flex: none; margin: 0; }
.photo-drop { display: block; border-radius: 50%; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.photo-ring { position: relative; display: block; width: 104px; height: 104px; padding: 4px; border-radius: 50%;
  background: conic-gradient(from 200deg, var(--blue), var(--blue-light), var(--orange), var(--blue));
  transition: transform .2s ease, box-shadow .2s ease; }
.photo-ring > .avatar-xl { width: 96px; height: 96px; border: 3px solid var(--card); box-sizing: border-box; border-radius: 50%; }
.photo-ring > img[hidden], .photo-ring > [data-initials][hidden] { display: none; }
.photo-ring::after { content: "Change"; position: absolute; inset: 4px; z-index: 1; display: grid; place-items: center;
  border-radius: 50%; background: rgb(18 26 51 / .5); color: #fff; font-size: .75rem; font-weight: 600;
  opacity: 0; transition: opacity .2s ease; }
.photo-badge { position: absolute; right: -2px; bottom: 2px; z-index: 3; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff;
  border: 3px solid var(--card); box-shadow: 0 2px 6px rgb(18 26 51 / .25); transition: transform .2s ease; }
.photo-badge .ico { width: 16px; height: 16px; }
.photo-drop:hover .photo-ring { transform: scale(1.03); }
.photo-drop:hover .photo-ring::after { opacity: 1; }
.photo-drop:hover .photo-badge { transform: rotate(-8deg) scale(1.08); }
#avatar-file:focus-visible + .photo-drop .photo-ring { outline: 3px solid var(--blue-light); outline-offset: 3px; }
.photo-drop.is-drag .photo-ring { transform: scale(1.06); box-shadow: 0 0 0 8px var(--blue-soft); }
.photo-drop.is-drag .photo-ring::after { content: "Drop"; opacity: 1; }
.photo-drop.is-dirty .photo-ring { animation: photo-pulse 1.6s ease-out infinite; }
.photo-drop.is-busy { pointer-events: none; }
.photo-drop.is-busy .photo-ring::after { content: ""; opacity: 1; }
.photo-drop.is-busy .photo-ring::before { content: ""; position: absolute; z-index: 2; inset: 38px;
  border: 3px solid #fff; border-top-color: transparent; border-radius: 50%; animation: photo-spin .8s linear infinite; }
@keyframes photo-pulse { 0% { box-shadow: 0 0 0 0 rgb(61 90 241 / .45); } 100% { box-shadow: 0 0 0 14px rgb(61 90 241 / 0); } }
@keyframes photo-spin { to { transform: rotate(360deg); } }
.photo-hint { margin: 6px 0 10px; font-size: .75rem; color: var(--muted); line-height: 1.35; }
.photo-hint.is-ready { color: var(--blue); font-weight: 600; }
.photo-hint.is-error { color: var(--red); font-weight: 600; }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.photo-actions[hidden] { display: none; }
.photo-actions .btn-small, .profile-photo .btn-link-red { display: inline-flex; align-items: center; gap: 6px; }
.photo-actions .btn-small .ico { width: 15px; height: 15px; }
.profile-photo .btn-link-red .ico { width: 13px; height: 13px; }
.photo-actions .btn-small:disabled { opacity: .7; cursor: progress; }
button.btn-ghost { font: inherit; font-size: .8rem; font-weight: 600; background: none; }
@media (prefers-reduced-motion: reduce) {
  .photo-ring, .photo-badge, .photo-ring::after { transition: none; }
  .photo-drop.is-dirty .photo-ring { animation: none; box-shadow: 0 0 0 4px var(--blue-soft); }
}
.btn-small { font: inherit; font-size: .8rem; font-weight: 600; padding: 8px 14px; border: 0; border-radius: 10px;
  background: var(--blue); color: #fff; cursor: pointer; }
.btn-link-red { font: inherit; font-size: .75rem; background: none; border: 0; padding: 0; color: var(--red); cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.form .hint { font-size: .7rem; color: var(--muted); }
.field-error { font-size: .72rem; color: var(--red); }
.menu-link { display: block; padding: 8px; margin-bottom: 8px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); font-weight: 600; text-align: center; }
.centered { text-align: center; margin-top: 10px; }
.note + .panel, .wrap.overlap > .note { margin-bottom: 12px; }
