/* ================================================================
   responsive.css — breakpoints
   ================================================================ */

/* ── 1024px: tablet landscape + hamburger nav ──────────────────── */
@media (max-width: 1024px) {
  /* Layout */
  .app-main { padding: var(--sp-lg) var(--sp-md); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-side { flex-direction: row; flex-wrap: wrap; }
  .detail-side > * { flex: 1 1 320px; }

  /* Hamburger menu */
  .nav-toggle { display: inline-flex; }
  .app-nav {
    position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0;
    background: var(--dark); flex-direction: column; align-items: stretch;
    padding: var(--sp-md); gap: .2rem; margin-left: 0;
    overflow-y: auto; overflow-x: hidden;
    transform: translateX(-100%); transition: transform .22s ease; z-index: 99;
  }
  .app-nav.open { transform: none; }
  .nav-link {
    padding: .75rem 1rem; font-size: .95rem; border-radius: var(--r-md);
    color: rgba(255,255,255,.85); width: 100%; white-space: normal;
  }
  .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
  .nav-link.active { background: rgba(224,123,42,.25); color: #fff; }
  .nav-link.active::after { display: none; }
  .nav-dropdown { width: 100%; }
  .nav-dd-menu {
    position: static; box-shadow: none; background: rgba(255,255,255,.05);
    border: none; margin: .2rem 0 .2rem 1rem; display: none; border-radius: var(--r-sm);
  }
  .nav-dropdown.open .nav-dd-menu { display: block; }
  .nav-dd-menu a { color: rgba(255,255,255,.82); padding: .5rem .75rem; }
  .nav-dd-menu a:hover { background: rgba(255,255,255,.08); color: #fff; }
  .nav-dd-menu a i { color: var(--accent-lt); }
}

/* ── 768px: tablet portrait / large phone ──────────────────────── */
@media (max-width: 768px) {
  .app-main { padding: var(--sp-md); }

  h1 { font-size: 1.25rem; }
  h2 { font-size: 1.15rem; }

  /* Page heading: stack title then actions */
  .page-head { flex-direction: column; align-items: flex-start; gap: var(--sp-sm); }
  .page-head > .btn-group {
    display: flex; flex-direction: row; flex-wrap: wrap;
    gap: var(--sp-xs); width: 100%;
  }
  .page-head > .btn-group .btn { flex: 1 1 auto; justify-content: center; min-width: 120px; }
  .page-head > a.btn,
  .page-head > button.btn { width: 100%; justify-content: center; }

  /* Toolbar: stack each filter full-width */
  .toolbar { flex-direction: column; align-items: stretch; gap: var(--sp-xs); }
  .toolbar .search-input { max-width: 100%; min-width: 0; width: 100%; flex: none; }
  .toolbar select { width: 100%; min-width: 0; }
  .toolbar .btn,
  .toolbar button { width: 100%; justify-content: center; }

  .panel { padding: var(--sp-md); }

  /* Forms: single column */
  .form-grid { grid-template-columns: 1fr; gap: var(--sp-sm); }
  .form-grid .col-2 { grid-column: span 1; }

  /* Info list: stacked label/value */
  .info-list { grid-template-columns: 1fr; gap: .1rem; }
  .info-list dt {
    margin-top: .6rem; font-size: .74rem;
    text-transform: uppercase; letter-spacing: .04em;
  }
  .info-list dt:first-child { margin-top: 0; }
  .info-list dd { font-weight: 500; }

  /* KPI: tighter */
  .kpi-grid { gap: var(--sp-sm); }
  .kpi .kpi-value { font-size: 1.5rem; }

  /* Timeline */
  .tl-item { gap: var(--sp-sm); }
  .tl-icon { width: 28px; height: 28px; font-size: .88rem; }

  /* Invoice */
  .invoice-doc { padding: 1rem; }

  .card-foot { flex-wrap: wrap; gap: var(--sp-xs); }
  .flex-between { flex-wrap: wrap; }
  .app-footer { padding: var(--sp-md); font-size: .78rem; }
}

/* ── 640px: phone landscape ────────────────────────────────────── */
@media (max-width: 640px) {
  /* Calendar: event dots instead of labels */
  .cal-cell { min-height: 60px; padding: .25rem; }
  .cal-event { display: none; }
  .cal-cell .ev-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

  /* Agenda: stack time above title */
  .agenda-item { flex-direction: column; gap: .2rem; padding: .6rem .75rem; }
  .agenda-time { min-width: auto; font-size: .82rem; }

  .lead-card { padding: .55rem .65rem; }
  .lead-card .lc-name { font-size: .875rem; }
}

/* ── Toast: notch/safe-area aware ──────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .toast-wrap { bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* ── 480px: small phone ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .app-main { padding: var(--sp-sm) var(--sp-xs); }

  /* KPI: 2-up, very compact */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-xs); }
  .kpi { padding: .55rem .6rem .55rem calc(.6rem + 4px); }
  .kpi .kpi-value { font-size: 1.2rem; }
  .kpi .kpi-label { font-size: .7rem; }
  .kpi i.kpi-icon { display: none; }

  .card-grid { grid-template-columns: 1fr; }

  /* Form actions: stacked, primary first */
  .form-actions { flex-direction: column-reverse; gap: var(--sp-xs); }
  .form-actions .btn { width: 100%; justify-content: center; }

  .panel { padding: var(--sp-sm); }

  /* Page-head: each action button full width */
  .page-head > .btn-group .btn { flex: 1 1 100%; }

  /* Detail side: single column */
  .detail-side { flex-direction: column; }
  .detail-side > * { flex: none; width: 100%; }

  /* Table action cells: allow wrap */
  table.data td.actions { white-space: normal; display: flex; flex-wrap: wrap; gap: .25rem; justify-content: flex-end; }

  /* Modal: more height available */
  .modal-box { max-height: 95vh; padding: var(--sp-md); }

  /* Calendar toolbar */
  .cal-toolbar { gap: var(--sp-sm); }
  .cal-title { font-size: 1.05rem; }

  /* Settings tabs: icon-only */
  .settings-tab .tab-label { display: none; }
  .settings-tab { min-width: 44px; padding: .45rem .5rem; }

  /* Auth + public page cards */
  .auth-card { padding: var(--sp-lg) var(--sp-md); }
  .public-shell { padding: var(--sp-md); }
}
