/* ==========================================================================
   TSCE Digital Platform — Responsive layer
   Breakpoints: 1200 (laptop) · 1024 (tablet landscape) · 820 (tablet) · 600 (phone)
   Mobile is redesigned, not shrunk: bottom nav in portals, drawers,
   table → card lists, stacked wizards and sticky pay bars.
   ========================================================================== */

@media (max-width: 1320px) {
    .nav-links { display: none; }
    .nav-toggle { display: inline-grid; place-items: center; }
}

@media (max-width: 1200px) {
    .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
    .footer-grid > :last-child { grid-column: span 4; }
    .kpis { grid-template-columns: repeat(3, 1fr); }
    .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; }
    .span-6 { grid-column: span 12; }
}

@media (max-width: 1024px) {
    .section { padding: 72px 0; }
    .hero .container { grid-template-columns: 1fr; gap: 40px; }
    .hero-visual { margin: 0 auto; max-width: 480px; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3, .prog-grid { grid-template-columns: repeat(2, 1fr); }
    .steps { grid-template-columns: repeat(2, 1fr); }
    .innov { grid-template-columns: 1fr; padding: 44px; }
    .cohort { grid-template-columns: 1fr; padding: 30px; }
    .wizard-wrap { grid-template-columns: 1fr; }
    .wizard-steps { position: static; padding: 14px; }
    .wizard-steps ol { grid-template-columns: repeat(5, 1fr); gap: 4px; }
    .wstep { flex-direction: column; text-align: center; gap: 6px; padding: 8px 2px; }
    .wstep small { display: none; }
    .wstep strong { font-size: .72rem; }
    .pay-wrap { grid-template-columns: 1fr; }
    .order-summary { position: static; order: -1; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-side { display: none; }

    /* Portal: sidebar becomes an off-canvas drawer */
    .app-shell, .app-shell.collapsed { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
    .app-shell.sb-open .sidebar { transform: none; }
    .app-shell.sb-open::after { content: ""; position: fixed; inset: 0; background: rgba(9, 18, 48, .45); z-index: 55; }
    .collapsed .brand-text, .collapsed .sb-label, .collapsed .sb-link span, .collapsed .sb-portal .txt, .collapsed .sb-user .meta { display: revert; }
    .sb-collapse { display: none; }
    .tb-menu { display: inline-grid; }
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .dash-grid.cols-2, .dash-grid.cols-3 { grid-template-columns: 1fr; }
    .settings-layout { grid-template-columns: 1fr; }
    .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; }
    .settings-nav a { white-space: nowrap; }
    .quick { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
    .tb-search { display: none; }
    .tb-search.m-open { display: block; position: fixed; left: 12px; right: 12px; top: 12px; width: auto; z-index: 120; }
    .tb-user .meta-txt { display: none; }
    .tb-user { padding: 3px; }
    .topbar { padding: 0 16px; gap: 10px; }
    .view { padding: 18px 16px 110px; }
    .demo-pill { display: none; }

    /* Bottom navigation (portals) */
    .bottom-nav {
        display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 70;
        background: rgba(255,255,255,.96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
        border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 6px;
    }
    .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border-radius: 14px; color: var(--muted); font-size: .66rem; font-weight: 700; background: none; border: 0; }
    .bottom-nav i { font-size: 1.05rem; }
    .bottom-nav .active { color: var(--primary); background: var(--primary-50); }

    /* Tables become card lists */
    .table-wrap.responsive .table { display: none; }
    .table-wrap.responsive .m-list { display: block; }
    .table-tools { padding: 12px 16px; }
    .table-tools .input-icon { max-width: none; flex-basis: 100%; }
    .table-tools .select { flex: 1; min-width: 0; }

    .drawer .dr-panel { width: 100vw; top: auto; height: 92vh; border-radius: 22px 22px 0 0; transform: translateY(100%); }
    .kv { grid-template-columns: 1fr; } .kv .full { grid-column: auto; }
    .welcome { flex-direction: column; align-items: flex-start; padding: 22px; }
    .explore-fab { bottom: 16px; right: 16px; }
    .portal .explore-fab { display: none; }
    .demo-chip { display: none; }
    .dropdown-menu { position: fixed; left: 10px; right: 10px; top: 76px; width: auto; }
    .ann { grid-template-columns: auto 1fr; }
    .ann > :last-child { grid-column: span 2; }
}

@media (max-width: 600px) {
    body { font-size: 15px; }
    .container { padding: 0 16px; }
    .section { padding: 56px 0; }
    .section-head { margin-bottom: 32px; }
    .announce-bar { font-size: .76rem; }
    .announce-bar .hide-sm { display: none; }
    .nav-actions .btn-apply-desktop { display: none; }
    .brand-text small { display: none; }
    .site-header .brand-mark, .mn-head .brand-mark { width: 52px; height: 52px; }
    .hero { padding: 40px 0 80px; }
    .hero-ctas .btn { flex: 1; }
    .hero-meta { gap: 16px; }
    .hero-visual { max-width: 360px; }
    .hv-node { font-size: .72rem; padding: 7px 10px 7px 7px; }
    .hv-node .icon-tile { width: 26px; height: 26px; font-size: .7rem; }
    .hv-node small { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat { padding: 22px 18px; }
    .stat:nth-child(3)::before { display: none; }
    .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
    .stat .stat-icon { display: none; }
    .grid-2, .grid-3, .grid-4, .prog-grid, .steps { grid-template-columns: 1fr; }
    .pathway { grid-template-columns: 1fr; gap: 12px; }
    .pathway::before, .pathway .path-fill { display: none; }
    .path-step { display: grid; grid-template-columns: 64px 1fr; gap: 14px; text-align: left; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 18px; background: #fff; }
    .path-node { width: 64px; height: 64px; margin: 0; border-radius: 20px; font-size: 1.2rem; }
    .innov { padding: 30px 22px; border-radius: 24px; }
    .innov-list { grid-template-columns: 1fr; }
    .cta-band { flex-direction: column; align-items: flex-start; padding: 34px 24px; border-radius: 24px; }
    .countdown-grid strong { font-size: 1.5rem; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
    .footer-grid > :first-child, .footer-grid > :last-child { grid-column: span 2; }
    .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .option-grid, .prog-select { grid-template-columns: 1fr; }
    .wizard-head, .wizard-body, .wizard-foot { padding-left: 18px; padding-right: 18px; }
    .wizard-foot { position: sticky; bottom: 0; z-index: 5; }
    .wizard-foot .btn { flex: 1; }
    .wstep .dot { width: 30px; height: 30px; font-size: .75rem; }
    .review-grid { grid-template-columns: 1fr; }
    .review-grid div:nth-child(odd) { border-right: 0; }
    .pd-facts { grid-template-columns: 1fr 1fr; }
    .checklist.cols-2 { grid-template-columns: 1fr; }
    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal, .modal.lg, .modal.xl { max-width: none; border-radius: 22px 22px 0 0; max-height: 94vh; }
    .success-details { grid-template-columns: 1fr 1fr; }
    .success-details div { border-right: 0 !important; }
    .success-details div:nth-child(odd) { border-right: 1px solid var(--border) !important; }
    .next-steps { grid-template-columns: 1fr; }
    .demo-creds { grid-template-columns: 1fr; }
    .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
    .kpi { padding: 16px; }
    .kpi .value { font-size: 1.4rem; }
    .kpi .icon-tile { width: 36px; height: 36px; font-size: .85rem; }
    .quick { grid-template-columns: repeat(2, 1fr); }
    .module { grid-template-columns: 38px 1fr; }
    .module .m-status { grid-column: 2; text-align: left; }
    .panel-head, .panel-body { padding-left: 16px; padding-right: 16px; }
    .list-item, .sched { padding-left: 16px; padding-right: 16px; }
    .view-head h2 { font-size: 1.35rem; }
    .view-head .actions { width: 100%; }
    .view-head .actions .btn { flex: 1; }
    .certificate { padding: 6%; }
    .certificate::before { inset: 7px; } .certificate::after { inset: 11px; }
    .cert-inner .cert-logo { height: 44px; }
    .tb-title p { display: none; }
    .toast-wrap { left: 12px; right: 12px; bottom: 90px; }
    .toast { min-width: 0; max-width: none; }
}

/* Keep the announcement bar on one line on laptops; trim KPI notes on phones */
@media (max-width: 1500px) { .announce-bar .countdown { display: none; } }
@media (max-width: 600px) { .kpi .trend-note { display: none; } }
