/* client-shell.css: moved out of templates/consumer/base.html (efficiency batch E6, 2026-10-12) so browsers cache it
   instead of downloading it inside every page. Theme colours still come from the
   inline --bg/--card/... variables on <html>. Bump ?v= in the template after editing. */
  :root {
    --bg: #050e1a;
    --card: #0c1724;
    --text: #ecf3f8;
    --muted: #94a0aa;
    --accent: #00d5ef;
    --border: #243040;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    min-height: 100vh;
    padding-bottom: 5rem;
  }
  /* iOS notch/Dynamic Island clearance — viewport-fit=cover lets the
     page draw edge-to-edge, but without this the header sits under
     the status bar clock (confirmed on a real iPhone 15, 2026-08-03).
     Applied once here so header + main don't double up on it.
     env() falls back to 0 on browsers/devices without a safe area. */
  .page {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .app-header {
    max-width: 480px;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .app-header .logo { font-weight: 700; letter-spacing: 0.02em; font-size: 0.95rem; color: var(--text); text-decoration: none; }
  /* Account menu (2026-08-10) — replaces a separate greeting text +
     Appearance icon + Sign out pill, which crowded this row enough to
     wrap on longer usernames (reported against a raw fallback
     username with no first_name set). One tap target, collapsible
     menu underneath — can't wrap regardless of name length, and
     leaves room for more account-level options later without
     re-crowding the header again. */
  .app-header .header-right { display: flex; align-items: center; position: relative; }
  .account-btn {
    display: flex; align-items: center; gap: 0.5rem; max-width: 170px;
    background: transparent; border: 1px solid var(--border); border-radius: 999px;
    padding: 0.3rem 0.8rem 0.3rem 0.3rem; color: var(--text); font-size: 0.8rem; cursor: pointer;
  }
  .account-avatar {
    width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #0a0a0a;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex: none;
  }
  .account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .account-menu {
    position: absolute; top: calc(100% + 0.5rem); right: 0; z-index: 20; min-width: 170px;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 0.4rem; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  }
  .account-menu[hidden] { display: none; }
  .account-menu-item {
    display: flex; align-items: center; gap: 0.6rem; min-height: 44px; padding: 0 0.6rem;
    border-radius: 8px; color: var(--text); text-decoration: none; font-size: 0.9rem;
  }
  .account-menu-item:hover, .account-menu-item:active { background: var(--bg); }
  button.account-menu-item { width: 100%; background: none; border: 0; font-family: inherit; cursor: pointer; text-align: left; }
  .account-menu-item svg { width: 18px; height: 18px; color: var(--muted); flex: none; }

  /* Dashboard (2026-08-04) — shared by staff and customer, same template,
     different stat/tile content (see apps/core/views.py::dashboard_page).
     Sizing follows the same 44px/1rem conventions as the auth screens. */
  .stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1.25rem; }
  .stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; text-align: center; }
  .stat-card.stat-full { grid-column: 1 / -1; }
  .stat-value { font-size: 1.6rem; font-weight: 700; }
  .stat-label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; margin-top: 0.25rem; }
  .stat-card.stat-warn .stat-value { color: #ff9c9c; }
  .stat-card.stat-active .stat-value { color: var(--accent); }
  /* 2026-08-05: stat cards doubling as shortcuts (Open Rentals -> Rentals,
     Overdue -> Rentals filtered, Devices Online -> group picker) — same
     card look, just made tappable. */
  a.stat-card { text-decoration: none; color: inherit; display: block; }

  /* Nav tiles (2026-08-10 redesign) — square icon grid instead of a
     vertical list of full-width rows. Per common mobile UX guidance
     (recognizable icons, minimalist/consistent layout, familiar
     grid-of-destinations pattern): each tile is icon-on-top,
     short-label-below, same tap-target-friendly sizing (aspect-ratio
     keeps them comfortably above the 44px minimum at any reasonable
     screen width). Icons are small inline SVGs (feather-style: 24x24,
     stroke-based, currentColor) rather than an icon font/CDN — keeps
     the picker's zero-extra-network-request posture (see
     quote_builder.html's picker comment) and stays consistent with
     this app never having pulled in a build step or external UI kit. */
  .tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
  /* 2026-09-29: count badge on a dashboard tile (Website). */
  .tile-badged { position: relative; }
  /* 2026-10-10 Messages icon in the header */
  .msg-ico { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); color: var(--text); margin-right: 0.4rem; }
  .msg-ico svg { width: 18px; height: 18px; }
  .msg-ico-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #e5484d; color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center; }
  .msg-ico-badge[hidden], [data-msg-badge][hidden] { display: none; }
  .tile-badge { position: absolute; top: 0.45rem; right: 0.45rem; min-width: 1.3rem; padding: 0 0.35rem; border-radius: 999px; background: #ef6c00; color: #fff; font-size: 0.72rem; font-weight: 700; line-height: 1.3rem; }
  .tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
    aspect-ratio: 1; min-height: 44px;
    background: var(--card); border: 1px solid var(--border); border-radius: 16px;
    padding: 0.75rem 0.5rem; color: var(--text); text-decoration: none;
    font-weight: 600; font-size: 0.78rem; text-align: center; line-height: 1.25;
  }
  .tile svg { width: 26px; height: 26px; color: var(--accent); flex: none; }
  .tile.tile-disabled { color: var(--muted); }
  .tile.tile-disabled svg { color: var(--muted); }
  .tile-badge {
    font-size: 0.65rem; font-weight: 600; color: var(--muted); background: var(--bg);
    border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem 0.5rem;
  }
  .back-link { display:inline-block; margin-bottom:0.9rem; color:var(--muted); text-decoration:none; font-size:0.9rem; font-weight:600; }
  .back-link:hover { color:var(--text); }
  main {
    max-width: 480px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
  }
  /* 2026-08-16, real-device report: on an iPad this content column
     (phone-width by design, per the Capacitor app's actual target
     device) was only using a fraction of the screen, big empty
     margins either side. Widen the cap on larger viewports rather
     than removing it — an unbounded main would stretch cards/forms
     uncomfortably wide on a full iPad landscape screen. Tile grid
     stays 3-across (see .tile-grid above); tiles just get bigger,
     which is fine at this width. */
  @media (min-width: 700px) {
    .app-header, main {
      max-width: 720px;
    }
  }
  h1 { font-size: 1.1rem; font-weight: 600; margin: 0 0 1.25rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
  .card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
  }

  /* Auth screens (2026-08-04 UI pass) — shared classes so login.html
     isn't repeating the same inline style block on every input/button.
     Sizing follows Apple HIG's 44pt minimum tap target and iOS's
     16px/1rem minimum input font-size (smaller triggers unwanted
     auto-zoom on focus in Safari/WKWebView). */
  .brand { text-align: center; margin-bottom: 1.75rem; }
  .brand .logo-mark { font-weight: 700; font-size: 1.15rem; letter-spacing: 0.02em; color: var(--muted); margin-bottom: 0.6rem; }
  .brand .welcome { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.3rem; color: var(--text); text-transform: none; letter-spacing: normal; }
  .brand .subtext { color: var(--muted); font-size: 0.9rem; margin: 0; }

  .field-label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
  .text-input {
    width: 100%; box-sizing: border-box; padding: 0.85rem; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text);
    font-size: 1rem; margin-bottom: 0.9rem; min-height: 44px;
  }
  .text-input:focus { outline: none; border-color: var(--accent); }
  .password-field { position: relative; }
  .password-field .text-input { padding-right: 3.75rem; }
  .password-toggle {
    position: absolute; right: 0.4rem; top: 0.4rem; height: 36px;
    background: transparent; border: none; color: var(--accent);
    font-size: 0.8rem; font-weight: 600; padding: 0 0.6rem; cursor: pointer;
  }
  .btn-primary {
    width: 100%; padding: 0.85rem; border-radius: 8px; border: none; min-height: 44px;
    background: var(--accent); color: #0a0a0a; font-weight: 600; font-size: 1rem; cursor: pointer;
  }
  .btn-primary:disabled { opacity: 0.6; cursor: default; }
  .card-notice { text-align: center; }
  .card-notice p { margin: 0 0 0.5rem; }
  .card-notice p:last-child { margin-bottom: 0; }
  .card-error { border-color: #7a3232; background: #2a1616; }
  .card-error p:first-child { color: #ff9c9c; }
  .link-back {
    display: block; text-align: center; margin: 1rem 0 0; color: var(--muted);
    font-size: 0.85rem; text-decoration: none; padding: 0.5rem; min-height: 44px; line-height: 1.6;
  }


/* ── Client Gen2 (2026-10-27) ───────────────────────────────────────────
   The same app shell as the staff side and Signage: sidebar on computers
   (>=1024px), sticky top bar, tab bar + More sheet on phones. Only on
   pages for a signed-in client (body.cs, apps/core/context_processors.py
   client_nav). Theme colours still come from the inline variables. */
  :root { --raised: color-mix(in srgb, var(--card), var(--text) 6%); --subtle: color-mix(in srgb, var(--muted), var(--bg) 25%); --ok: #22c55e; --warn: #eab308; }
  body.cs { padding-bottom: 0; -webkit-font-smoothing: antialiased; text-align: left; } /* html.brand (NuVision theme) centres everything via .brand */
  .cs .sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; display: none; flex-direction: column; background: var(--card); border-right: 1px solid var(--border); z-index: 40; }
  .cs .brandmark { display: flex; align-items: center; gap: 0.75rem; padding: 1.4rem 1.5rem; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
  .cs .mark { width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover; }
  .cs .side-nav { flex: 1; overflow-y: auto; padding: 0 1rem; }
  .cs .nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 0.9rem; margin-bottom: 2px; min-height: 40px; }
  .cs .nav-item svg { width: 18px; height: 18px; flex: none; }
  .cs .nav-item:hover { background: var(--raised); color: var(--text); }
  .cs .nav-item.is-active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; }
  .cs .nav-ext { margin-left: auto; display: inline-flex; opacity: 0.6; }
  .cs .nav-ext svg { width: 13px; height: 13px; }
  .cs .nav-count { margin-left: auto; min-width: 1.25rem; padding: 0 0.35rem; border-radius: 999px; background: #e5484d; color: #fff; font-size: 0.7rem; font-weight: 700; line-height: 1.25rem; text-align: center; }
  .cs .nav-count[hidden] { display: none; }
  .cs .nav-btn { width: 100%; background: none; border: 0; font-family: inherit; text-align: left; cursor: pointer; }
  .cs .eyebrow { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--subtle); }
  .cs .side-section { padding: 1rem 0.75rem 0.5rem; }
  .cs .side-user { border-top: 1px solid var(--border); padding: 1rem; display: flex; align-items: center; gap: 0.75rem; }
  .cs .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--raised); display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; flex: none; }
  .cs .side-user .who { min-width: 0; flex: 1; }
  .cs .side-user .who p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cs .side-user a { color: var(--subtle); font-size: 0.75rem; text-decoration: none; }
  .cs .side-user a:hover { color: var(--accent); }
  .cs .app-main { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .cs .topbar { position: sticky; top: 0; z-index: 30; min-height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 1rem 0; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
  .cs .mobile-brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 650; font-size: 1.02rem; color: var(--text); text-decoration: none; }
  .cs .header-right { display: flex; align-items: center; position: relative; }
  .cs .msg-ico { display: none; } /* Messages is in the sidebar / tab bar */
  .cs main { max-width: 1080px; width: 100%; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
  .cs a.back-link[href="/app/"], .cs a.link-back[href="/app/"] { display: none; } /* Home is always one tap away */
  .cs .tabbar { position: fixed; inset: auto 0 0 0; z-index: 40; height: calc(72px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: flex; align-items: stretch; background: var(--card); border-top: 1px solid var(--border); }
  .cs .tabbar a, .cs .tabbar button { flex: 1 1 0; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 500; background: none; border: 0; padding: 0.25rem 0; font-family: inherit; cursor: pointer; }
  .cs .tabbar svg { width: 24px; height: 24px; }
  .cs .tabbar .is-active { color: var(--accent); }
  .cs .tab-count { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #e5484d; color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center; }
  .cs .tab-count[hidden] { display: none; }
  .cs .more-sheet { position: fixed; inset: 0; z-index: 50; display: none; }
  .cs .more-sheet.open { display: block; }
  .cs .more-sheet .scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
  .cs .more-sheet .panel { position: absolute; inset: auto 0 0 0; max-height: 80vh; overflow-y: auto; background: var(--card); border-top: 1px solid var(--border); border-radius: 18px 18px 0 0; padding: 1rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); animation: cs-up 0.22s ease-out; }
  .cs .more-sheet .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  .cs .more-sheet .nav-item { font-size: 1rem; padding: 0.8rem 0.85rem; gap: 0.8rem; }
  .cs .more-sheet .nav-item svg { width: 21px; height: 21px; }
  .cs .sheet-close { background: none; border: 0; color: var(--muted); font: inherit; padding: 0.4rem 0.6rem; cursor: pointer; }
  @keyframes cs-up { from { transform: translateY(40px); opacity: 0; } }
  @media (min-width: 768px) { .cs main { padding: 1.75rem 1.5rem 2.5rem; } }
  @media (min-width: 1024px) {
    .cs .sidebar { display: flex; }
    .cs .app-main { padding-left: 248px; padding-bottom: 0; }
    .cs .topbar { padding-left: 2rem; padding-right: 2rem; }
    .cs .mobile-brand { visibility: hidden; }
    .cs .tabbar, .cs .more-sheet { display: none !important; }
    .cs main { padding: 2rem 2rem 3rem; }
  }

  /* Gen2 page pieces for client pages */
  .cs h1 { font-size: 1.55rem; font-weight: 700; color: var(--text); text-transform: none; letter-spacing: -0.02em; margin: 0 0 1.25rem; }
  .cs .card { border-radius: 14px; }
  .cs .stat-card { text-align: left; border-radius: 14px; }
  .cs .stat-value { font-size: 1.55rem; letter-spacing: -0.02em; }
  .cs .stat-label { text-transform: none; letter-spacing: 0; font-size: 0.8rem; }
  .cs .tile { border-radius: 14px; aspect-ratio: auto; min-height: 96px; }
  .cs .tile:hover { border-color: var(--accent); }
  @media (min-width: 700px) { .cs .stat-grid { grid-template-columns: repeat(3, 1fr); } .cs .stat-card.stat-full { grid-column: auto; } .cs .tile-grid { grid-template-columns: repeat(4, 1fr); } }
  @media (min-width: 1200px) { .cs .tile-grid { grid-template-columns: repeat(5, 1fr); } }

  /* Dashboard: greeting + What's new (2026-10-27) */
  .cs .hello { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 1.25rem; }
  .cs .hello h1 { margin: 0; }
  .cs .hello p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.92rem; }
  .cs .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.75rem 0 0.75rem; }
  .cs .section-head h2 { margin: 0; font-size: 1.05rem; font-weight: 650; }
  .cs .section-head a { color: var(--accent); font-size: 0.85rem; text-decoration: none; white-space: nowrap; }
  .cs .news { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 0.75rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 0.25rem; list-style: none; margin: 0; padding-left: 0; }
  .cs .news li { scroll-snap-align: start; min-width: 0; }
  .cs .news a { display: flex; flex-direction: column; height: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; color: var(--text); text-decoration: none; }
  .cs .news a:hover { border-color: var(--accent); }
  .cs .news .pic { aspect-ratio: 16 / 9; background: var(--raised); display: grid; place-items: center; color: var(--accent); }
  .cs .news .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .cs .news .pic svg { width: 30px; height: 30px; opacity: 0.8; }
  .cs .news .body { padding: 0.75rem 0.85rem 0.9rem; display: flex; flex-direction: column; gap: 0.3rem; }
  .cs .news .kind { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
  .cs .news .title { font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
  .cs .news .text { color: var(--muted); font-size: 0.82rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  @media (min-width: 1024px) { .cs .news { grid-auto-flow: row; grid-template-columns: repeat(4, 1fr); overflow: visible; } }
  .cs .site-card { display: flex; align-items: center; gap: 0.9rem; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 1rem; color: var(--text); text-decoration: none; }
  .cs .site-card:hover { border-color: var(--accent); }
  .cs .site-card svg { width: 26px; height: 26px; color: var(--accent); flex: none; }
  .cs .site-card span { color: var(--muted); font-size: 0.85rem; display: block; }
