/* =====================================================================
   Fit-to-screen layer (loaded last). Makes the admin portal fit the browser at 100% zoom on everything from a
   1280x720 laptop to a 1920x1080+ desktop: the root size, the shell and the spacing scale with the window,
   and wide tables drop their least important columns instead of scrolling sideways.
   ===================================================================== */

/* Root size follows the window: ~14 px on a 1366 px laptop, 16 px on a 1920 px screen. Everything in rem follows. */
html { font-size: clamp(13.5px, calc(.34vw + 9.7px), 16px); }
:root {
    --font-scale: 1.04;
    --topbar-h: clamp(52px, calc(1.6vw + 34px), 64px);
    --sidebar-w: clamp(212px, calc(6vw + 130px), 248px);
}

/* ---------- Top bar ---------- */
.portal-topbar .brand { padding: 0 .85rem; }
.portal-topbar .brand-mark, .portal-topbar .brand-logo { width: 2.5rem; height: 2.5rem; font-size: 1rem; }
.portal-topbar .brand-text strong { font-size: 1.15rem; }
.portal-topbar .brand-text span { font-size: .78rem; }
.topbar-tagline { font-size: .9rem; }
.topbar-btn { width: 2.4rem; height: 2.4rem; font-size: 1rem; }
.avatar { width: 2.3rem; height: 2.3rem; font-size: .8rem; }
.topbar-search input { height: 2.35rem; width: clamp(200px, 18vw, 300px); }
@media (max-width: 1399.98px) { .topbar-tagline { display: none; } }

/* ---------- Sidebar ---------- */
.side-heading { padding: .7rem .8rem .25rem; }
.side-link { padding: .5rem .7rem; font-size: .88rem; }
.sub-link { padding: .4rem .7rem; font-size: .84rem; }
.sidebar-foot { padding: .5rem .6rem .6rem; gap: .3rem; }
.side-user { padding: .35rem .45rem; }
.side-user .avatar { width: 2.1rem; height: 2.1rem; }
.side-quota { padding: .45rem .6rem; margin-bottom: .3rem; }
@media (min-width: 992px) { body.sidebar-mini .portal-topbar .brand { min-width: clamp(212px, calc(6vw + 130px), 248px); } }

/* ---------- Main area ---------- */
.portal-main { padding: calc(var(--topbar-h) + .75rem) clamp(.75rem, 1.2vw, 1.4rem) 1.25rem; }
.portal-footer { padding: 0 clamp(.75rem, 1.2vw, 1.4rem) 1rem; }
.page-head { padding: .6rem 1rem; gap: .75rem; margin-bottom: .75rem; }
.page-head-icon { width: 2.3rem; height: 2.3rem; font-size: 1rem; }
.page-head h1 { font-size: 1.15rem; }
.page-head p { font-size: .82rem; }
.page-head .head-actions { gap: .45rem; }
.page-head .head-actions .btn { padding: .38rem .8rem; font-size: .86rem; }
.head-clock { font-size: .78rem; }
.head-clock i { font-size: 1rem; }

/* ---------- KPI cards ---------- */
.kpi-grid { gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 12vw, 190px), 1fr)); margin-bottom: .75rem; }
.kpi { padding: .75rem .85rem; gap: .7rem; align-items: center; }
.kpi .kpi-label { margin-top: 0; font-size: .8rem; }
.kpi .kpi-value { font-size: 1.35rem; margin: .1rem 0; }
.kpi .kpi-trend { font-size: .74rem; line-height: 1.3; }
.icon-circle { width: 2.6rem; height: 2.6rem; font-size: 1.05rem; }

/* ---------- Panels, forms, tables ---------- */
.panel-header { padding: .7rem 1rem .5rem; }
.panel-title { font-size: .98rem; }
.panel-body { padding: .35rem 1rem 1rem; }
.panel-footer { padding: .6rem 1rem; }
.filter-bar { padding: .7rem 1rem; gap: .5rem; }
.filter-bar .form-control, .filter-bar .form-select { min-height: 2.3rem; }
.filter-bar > div { min-width: 130px; }
.status-chips { padding: .7rem 1rem 0; }
.table-modern { font-size: .84rem; }
.table-modern thead th { padding: .55rem .65rem; font-size: .7rem; }
.table-modern td { padding: .5rem .65rem; }
.media-thumb { width: 64px; height: 40px; flex-basis: 64px; }
.media-cell { min-width: 190px; gap: .65rem; }
.media-cell .cell-sub { max-width: 220px; }
.mini-stat { padding: .5rem .65rem; }
.activity li { padding: .45rem 0; }
.empty-state { padding: 1.75rem 1rem; }
.player.doc { height: 65vh; min-height: 380px; }
.dropzone { padding: 1.6rem 1rem; }
.dropzone .dz-icon { width: 3.4rem; height: 3.4rem; font-size: 1.4rem; margin-bottom: .6rem; }
.idbox { padding: .9rem 1rem; }

/* ---------- Tables drop optional columns instead of scrolling sideways ----------
   Cells marked .col-opt-N are hidden when the table's own space is narrower than the threshold,
   so the rule works whether the sidebar is expanded, collapsed or hidden. */
.table-responsive { container-type: inline-size; }
@container (max-width: 1250px) { .col-opt-1 { display: none; } }
@container (max-width: 1100px) { .col-opt-2 { display: none; } }
@container (max-width: 950px)  { .col-opt-3 { display: none; } }
@container (max-width: 800px)  { .col-opt-4 { display: none; } }
@container (max-width: 650px)  { .col-opt-5 { display: none; } }
@container (max-width: 520px)  { .col-opt-6 { display: none; } }

/* Short viewports (768 px high laptops): keep more rows in view. */
@media (max-height: 800px) and (min-width: 992px) {
    .page-head p { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
}
