/* Desktop / tablet layer.
   ------------------------------------------------------------------------
   app.css is the mobile baseline and is never touched below; everything here
   is additive from 640px up. The web build stops being a stretched phone at
   1024px: the bottom tab bar becomes a fixed left sidebar, content gets a
   centred measure, and the equipment feeds become a 3-4 column card grid.

   The layout hangs off one structural trick: `.ph:has(> .nav)` distinguishes
   an in-app screen (sidebar + dashboard chrome) from an onboarding screen
   (centred auth panel), so no screen has to declare which shell it wants. */

:root {
  --nav-w: 260px;
  --content-max: 1400px;
  --content-gutter: clamp(24px, 3.5vw, 56px);
}

/* ======================================================================
   TABLET - still a single column with the bottom tab bar, but the feed
   goes two-up and the measure stops running to the screen edges.
   ====================================================================== */
@media (min-width: 640px) {
  .ph > .pad { max-width: 760px; margin-inline: auto; width: 100%; padding-inline: 28px; }

  .feed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
  .feed-empty { grid-column: 1 / -1; }

  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .ph > .cta { max-width: 760px; margin-inline: auto; padding-inline: 28px; }
}

/* ======================================================================
   DESKTOP - sidebar dashboard.
   ====================================================================== */
@media (min-width: 1024px) {

  /* ---- Shell ---------------------------------------------------------- */
  /* Cards need to sit ON something, so the desktop canvas goes a step darker
     than --color-bg and surfaces come back up to --color-neutral-100. The
     phone never needed this: there, every surface is the page. */
  .ph { background: var(--color-bg); font-size: 14px; }

  .ph > .pad { max-width: var(--content-max); padding-inline: var(--content-gutter); }

  /* ---- Shell ---------------------------------------------------------- */
  /* The navigation and the mode switch are the sticky top bar; both live in
     css/navbar.css. Only the pieces the brand block shares with the phone
     bar are defined here. */
  .nav-brand-text { display: flex; flex-direction: column; min-width: 0; }
  .nav-mark {
    flex: none; display: grid; place-items: center;
    font-family: var(--font-heading); font-weight: 600; letter-spacing: .06em;
  }
  .nav-wordmark {
    font-family: var(--font-heading); font-weight: 600;
    text-transform: uppercase; color: #fff; line-height: 1.2;
  }
  .nav-sub {
    line-height: 1.4; color: color-mix(in srgb, #fff 55%, transparent);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .nav-icon { display: block; flex: none; }

  .status-picker { gap: 6px; margin-top: 12px; }
  .status-option { min-height: 40px; font-size: 12px; }
  .status-option:not(.on):hover { background: var(--color-bg); border-color: var(--color-accent-400); }

  /* ---- Screen header --------------------------------------------------- */
  .page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
    padding-top: 36px; padding-bottom: 20px; margin-bottom: 4px;
    border-bottom: 1px solid var(--color-divider);
  }
  /* A screen whose body is a single panel narrows its header to match, so the
     title sits over the form rather than floating off to the left of it. */
  .ph:has(> .panel) > .page-head { max-width: 720px; margin-inline: auto; padding-inline: 32px; }
  .page-title { font-size: 34px; }
  .page-sub { font-size: 13px; }
  .page-head-actions { margin-top: 0; }
  .page-head-actions .btn { font-size: 13px; padding: 9px 18px; }

  /* ---- Feeds ----------------------------------------------------------- */
  .feed { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

  .card {
    background: var(--color-neutral-100); border-color: var(--color-neutral-300);
    padding: 16px; box-shadow: var(--shadow-sm);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  }
  .card-title { font-size: 17px; }
  .card-foot { margin-top: auto; padding-top: 14px; }
  .card-price { font-size: 17px; }
  .card-link:hover {
    transform: translateY(-2px); box-shadow: var(--shadow-md);
    border-color: var(--color-accent-400);
  }
  .card-link:active { transform: none; }

  /* ---- Stats ----------------------------------------------------------- */
  .stat-grid { gap: 16px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .stat {
    background: var(--color-neutral-100); border-color: var(--color-neutral-300);
    padding: 22px; box-shadow: var(--shadow-sm);
  }
  .stat-value { font-size: 38px; }

  /* ---- Forms and detail panels ---------------------------------------- */
  /* Long forms and record detail read badly at 1400px, so they cap tighter. */
  .ph > .panel {
    max-width: 720px; margin-inline: auto; width: 100%;
    padding: 28px 32px; margin-top: 22px;
    background: var(--color-neutral-100); border: 1px solid var(--color-neutral-300);
    box-shadow: var(--shadow-sm);
  }
  .ph > .panel + .panel { margin-top: 16px; }
  /* Two-up fields only inside a full-width panel; the narrow onboarding
     column keeps its single stack. */
  .panel.form-grid, .panel .form-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px;
  }
  .panel.form-grid > .field-wide, .panel .form-grid > .field-wide,
  .panel.form-grid > .form-error, .panel .form-grid > .form-error { grid-column: 1 / -1; }
  .input { min-height: 40px; }

  /* ---- CTA ------------------------------------------------------------- */
  /* The full-bleed sticky action bar is a phone pattern; on desktop it
     collapses to a normal button sitting under the content it commits. */
  .ph > .cta {
    position: static; width: 100%; max-width: 720px; margin: 20px auto 48px;
    padding: 0 32px; background: transparent; justify-content: flex-start;
  }
  .ph > .cta .cta-label {
    background: var(--color-accent-900); color: #fff;
    padding: 13px 36px; transition: background .15s ease;
  }
  .ph > .cta:hover .cta-label { background: var(--color-accent-800); }

  .empty-note { padding-top: 72px; font-size: 14px; }

  #toast { left: auto; right: 32px; bottom: 32px; transform: none; max-width: 380px; }

  /* ---- Onboarding: no sidebar, centred panel --------------------------- */
  .ph:not(:has(> .nav)) {
    display: grid; grid-template-columns: minmax(0, 460px);
    justify-content: center; align-content: center;
    padding: 56px 24px; min-height: 100dvh;
  }
  .ph:not(:has(> .nav)) > .pad {
    max-width: none; margin: 0; padding: 36px 36px 30px;
    background: var(--color-neutral-100); border: 1px solid var(--color-neutral-300);
    box-shadow: var(--shadow-md);
  }
  .ph:not(:has(> .nav)) > .pad + .pad { border-top: 0; }
  .ph:not(:has(> .nav)) > .auth-head { padding-bottom: 18px; }
  .ph:not(:has(> .nav)) > .auth-form { padding-top: 24px; }
  .ph:not(:has(> .nav)) > .cta {
    position: static; width: 100%; max-width: none; margin: 0;
    padding: 15px 20px; justify-content: center; background: var(--color-accent-900);
  }
  .ph:not(:has(> .nav)) > .cta:hover { background: var(--color-accent-800); }
  .ph:not(:has(> .nav)) > .cta .cta-label { background: transparent; padding: 0; }
}

/* ======================================================================
   WIDE - a fourth column once three would leave the cards oversized.
   ====================================================================== */
@media (min-width: 1440px) {
  .feed { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* The WhatsApp/Call money bar follows the same rule as .cta: full-bleed
   sticky is a phone pattern, so on desktop it collapses to a pair of inline
   buttons sitting under the content. */
@media (min-width: 1024px) {
  .ph > .cta-bar {
    position: static; max-width: 720px; margin: 20px auto 48px;
    padding: 0 32px; gap: 10px;
  }
  .ph > .cta-bar .cta-action { flex: 0 0 auto; padding: 13px 36px; }
}

/* ======================================================================
   WEBSITE PASS — desktop stops being a stretched phone app.

   The complaints this answers, verbatim from review: "fonts are very small,
   text isn't aligned properly, looks dull and basic, doesn't look like a
   website". Bigger type scale, a real hero for the visitor, accent colour
   doing actual work, and an aligned toolbar.
   ====================================================================== */
@media (min-width: 1024px) {

  /* Readable web typography, not phone sizes on a monitor. */
  .ph { font-size: 15px; }
  .page-sub { font-size: 15px; max-width: 720px; line-height: 1.6; }
  .card-meta { font-size: 13px; }
  .card-note { font-size: 12px; }
  .card-title { font-size: 18px; }
  .card-price { font-size: 19px; }
  .kv { font-size: 14px; }
  .input { font-size: 14px; }
  .empty-note, .feed-empty { font-size: 14px; }

  /* Search box worthy of being the primary control. */
  #searchInput { font-size: 16px; padding: 12px 16px; }

  /* The results toolbar aligns as one row: count left, controls right. */
  .results-bar { flex-wrap: nowrap; align-items: center; }
  .results-count { font-size: 13px; }
  .input-compact { font-size: 13px; padding: 8px 10px; }
  .results-bar .chip { font-size: 12px; padding: 8px 14px; }

  /* Accent earns its keep: active chip and hover states stop being grey. */
  .chip:hover { border-color: var(--color-accent-500); color: var(--color-accent-800); }
  .chips-scroll { flex-wrap: wrap; }         /* desktop has the room */
  .card-link:hover { border-color: var(--color-accent-400); box-shadow: 0 2px 10px rgb(0 0 0 / 6%); }
  .card-link { transition: border-color .12s ease, box-shadow .12s ease; }

  /* Footer as a proper site footer band. */
  .site-links {
    background: var(--color-surface); border-top: 1px solid var(--color-divider);
    max-width: none; margin-top: 48px; padding: 30px var(--content-gutter);
  }
  .site-links nav { gap: 26px; }
  .site-links a { font-size: 12px; }

  /* Blog reads like an article page. */
  .blog-body { font-size: 16px; max-width: 720px; }
}
