/* Breakpoints: ≤1180 tablet, ≤900 small tablet, ≤640 phone (spec 002 FR-010). */

@media (max-width: 1180px) {
  .content { padding: var(--sp-5); }
  .topbar { padding: 0 var(--sp-5); }
  .ctx-tabs { padding: 0 var(--sp-4); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .topbar-search { width: auto; flex: 0 1 260px; }
  .topbar-search .keys { display: none; }
}

@media (max-width: 640px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .shell-main { padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 var(--sp-4); gap: var(--sp-2); height: 56px; }
  .topbar-search { display: none; }
  .crumbs > :not(:last-child) { display: none; }
  .content { padding: var(--sp-4); }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .page-head h1 { font-size: var(--fs-xl); }
  .ctx-title { display: none; }
  .kpis { gap: var(--sp-3); }
  .kpi { padding: var(--sp-3) var(--sp-4); }
  .kpi .value { font-size: var(--fs-xl); }
  .hide-phone { display: none !important; }
  .show-phone { display: initial !important; }

  .bottom-nav {
    display: flex;
    position: fixed;
    inset: auto 0 0 0;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    padding: 8px 4px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    align-items: flex-start;
    z-index: 40;
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    width: 64px; min-height: 44px;
    font-size: 10.5px; font-weight: 600; color: var(--muted);
    text-decoration: none; background: none; border: 0; font-family: inherit; cursor: pointer;
  }
  .bottom-nav i { font-size: 21px; }
  .hive .bottom-nav [aria-current="page"] { color: var(--accent-text); }
  .bottom-nav .fab {
    width: 50px; height: 50px; margin-top: -22px; border-radius: 16px;
    display: grid; place-items: center; font-size: 22px; color: #fff;
    background: var(--ember-700);
    box-shadow: 0 10px 24px rgba(199, 78, 35, 0.4);
  }
}

.show-phone { display: none; }

/* Sheet (bottom sheet on phones, side panel otherwise) */
.sheet-scrim { position: fixed; inset: 0; background: rgba(7, 11, 20, 0.5); z-index: 70; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 71;
  max-height: 80vh; overflow: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--elev-3);
  padding: 10px var(--sp-4) calc(var(--sp-6) + env(safe-area-inset-bottom));
}
.sheet-grab { width: 40px; height: 5px; border-radius: var(--r-pill); background: var(--border-strong); margin: 0 auto var(--sp-3); }
.sheet[hidden], .sheet-scrim[hidden] { display: none; }
