/**
 * Skip Manager app shell: app bar, bottom tab bar, desktop top nav, page container, card grid.
 * Reads tokens.css only. Applies to pages whose <body class="app"> (set by header.php).
 */

body.app {
    padding-top: calc(var(--appbar-h) + var(--safe-top));
    padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}

/* ---------- App bar ---------- */
.appbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    padding-top: var(--safe-top);
    background: var(--bg);
}
.appbar__inner {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    height: var(--appbar-h);
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--sp-4);
}
.appbar__brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text-1); text-decoration: none; }
.appbar__logo { display: flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: var(--fs-3); }
.appbar__name { font-size: var(--fs-4); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar__status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-2); font-weight: 600; color: var(--text-3); }
.appbar__status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.appbar__status.offline::before { background: var(--danger); }
.appbar__status-text { display: none; }

/* ---------- Top nav (desktop) ---------- */
.topnav { display: none; gap: var(--sp-1); }
.topnav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    min-height: var(--tap);
    padding: 0 14px;
    border-radius: var(--r-md);
    color: var(--text-2);
    font-size: var(--fs-4);
    font-weight: 600;
    text-decoration: none;
}
.topnav__link:hover { background: var(--surface-2); color: var(--text-1); }
.topnav__link.is-active { background: var(--accent-tint); color: var(--accent-ink); }

/* ---------- Bottom tab bar (mobile) ---------- */
.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-fixed);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: var(--sp-2) var(--sp-2) calc(var(--sp-2) + var(--safe-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
}
.tabbar__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 44px;
    color: var(--text-3);
    font-size: var(--fs-1);
    font-weight: 600;
    text-decoration: none;
}
.tabbar__item i { font-size: 19px; }
.tabbar__item.is-active { color: var(--accent); font-weight: 700; }
.badge {
    position: absolute;
    top: -4px;
    left: calc(50% + 4px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--r-pill);
    background: var(--accent);
    color: var(--on-accent);
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
}
.topnav__link .badge { position: static; box-shadow: none; }

/* ---------- Page container, toolbar, card grid ---------- */
.page { max-width: var(--content-max); margin: 0 auto; padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-4); }
.page__head { display: flex; flex-direction: column; gap: 2px; }
.page__eyebrow { font-size: var(--fs-3); font-weight: 500; color: var(--text-2); }
.page__title { margin: 0; font-size: var(--fs-7); font-weight: 700; letter-spacing: -.02em; line-height: var(--lh-tight); }

.toolbar { display: flex; flex-direction: column; gap: var(--sp-3); }
.toolbar__filters { display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; }
.toolbar__filters::-webkit-scrollbar { display: none; }

.card-grid { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; }

.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.row { display: flex; align-items: center; gap: var(--sp-3); }

/* ---------- 768px and up: top nav, grid, one-row toolbar ---------- */
@media (min-width: 768px) {
    body.app { padding-bottom: 0; }
    .tabbar { display: none; }
    .topnav { display: flex; }
    .appbar__brand { flex: none; margin-right: var(--sp-4); }
    .appbar__inner { gap: var(--sp-2); }
    .appbar__spacer { flex: 1; }
    .appbar__status-text { display: inline; }
    .page { padding: var(--sp-6); gap: var(--sp-6); }
    .toolbar { flex-direction: row; align-items: center; }
    .toolbar .search { flex: 1; max-width: 360px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr)); gap: var(--sp-4); }
}
@media (max-width: 767px) {
    .appbar__spacer { display: none; }
}
