/* ============================================================
   CABAL Admin Dashboard
   Clean, minimal, modern design
   ============================================================ */

/* Component Library */
@import url('variables.css');
@import url('base.css');
@import url('components.css');
@import url('toastr.css');
@import url('theme-light.css');

/* Legacy: font import kept for pages that don't load variables.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-0: #12131a;
    --bg-1: #171823;
    --bg-2: #1e1f2e;
    --bg-3: #262838;
    --bg-4: #2f3145;
    --bg-surface: rgba(255,255,255,0.03);
    --bg-surface-hover: rgba(255,255,255,0.07);

    --white: #fafafa;
    --text-1: #eeeef2;
    --text-2: #a8a8b8;
    --text-3: #7a7a8e;
    --text-4: #4a4a5a;

    --border: #2e2f40;
    --border-light: #3a3b50;

    --brand: #6366f1;
    --brand-light: #818cf8;
    --brand-dim: rgba(99,102,241,0.12);
    --blue: #3b82f6;
    --blue-dim: rgba(59,130,246,0.12);
    --emerald: #10b981;
    --emerald-dim: rgba(16,185,129,0.12);
    --amber: #f59e0b;
    --amber-dim: rgba(245,158,11,0.12);
    --rose: #f43f5e;
    --rose-dim: rgba(244,63,94,0.12);
    --cyan: #06b6d4;
    --cyan-dim: rgba(6,182,212,0.12);
    --violet: #8b5cf6;
    --violet-dim: rgba(139,92,246,0.12);

    --sidebar-w: 260px;
    --radius: 8px;
    --radius-lg: 12px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset --- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-size: 16px; }

body {
    font-family: 'Inter', 'Anuphan', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    background: var(--bg-0);
    color: var(--text-1);
    min-height: 100vh;
    display: flex;
}

a { text-decoration:none; color:inherit; }
button { font-family:inherit; cursor:pointer; }

::-webkit-scrollbar { width:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--bg-4); border-radius:10px; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s var(--ease);
}

/* Brand */
.brand {
    height: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.brand-icon {
    width: 30px;
    height: 30px;
    background: var(--brand);
    border-radius: 7px;
    display: grid;
    place-items: center;
}

.brand-icon svg { width:16px; height:16px; stroke:#fff; fill:none; stroke-width:2; }

.brand h1 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-1);
}

.brand span {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-3);
    background: var(--bg-3);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

/* Nav */
.nav { flex:1; overflow-y:auto; padding:8px 0; }

.nav-section {
    padding: 0 12px;
    margin-bottom: 4px;
}

.nav-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-4);
    padding: 16px 8px 6px;
}

/* Nav group (collapsible) */
.nav-group {}

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 8px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-2);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s var(--ease);
    text-align: left;
}

.nav-group-header:hover {
    background: var(--bg-surface-hover);
    color: var(--text-1);
    padding-left: 10px;
}

.nav-group-header .icon {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.nav-group-header .icon svg { width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

.nav-group-header .chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    transition: transform 0.4s var(--ease);
    color: var(--text-4);
}

.nav-group-header .chevron svg { width:14px; height:14px; stroke:currentColor; fill:none; stroke-width:2; }

.nav-group.open > .nav-group-header .chevron {
    transform: rotate(90deg);
}

.nav-group.open > .nav-group-header {
    color: var(--text-1);
}

/* Sub items */
.nav-sub {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.5s var(--ease);
    padding-left: 16px;
}

.nav-group.open > .nav-sub {
    max-height: 400px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 22px;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-3);
    border-radius: var(--radius);
    transition: all 0.15s var(--ease);
    position: relative;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-4);
    transition: all 0.15s var(--ease);
}

.nav-link:hover {
    background: var(--bg-surface-hover);
    color: var(--text-1);
    padding-left: 26px;
}

.nav-link:hover::before {
    background: var(--text-2);
}

.nav-link.active {
    background: var(--brand-dim);
    color: var(--brand-light);
}

.nav-link.active::before {
    background: var(--brand);
    width: 5px;
    height: 5px;
    box-shadow: 0 0 8px rgba(99,102,241,0.6);
}

/* Standalone nav link (no children) */
.nav-single {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 8px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-2);
    transition: all 0.15s var(--ease);
}

.nav-single:hover {
    background: var(--bg-surface-hover);
    color: var(--text-1);
    padding-left: 10px;
}

.nav-single.active {
    background: var(--brand-dim);
    color: var(--brand-light);
}

.nav-single .icon { width:20px; height:20px; display:grid; place-items:center; flex-shrink:0; }
.nav-single .icon svg { width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

/* Collapse toggle button */
.collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    height: 36px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.04);
    color: var(--text-3);
    font-size: 0.7rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    backdrop-filter: blur(4px);
}
.collapse-btn:hover {
    background: var(--brand-dim); color: var(--brand-light);
    border-color: rgba(99,102,241,0.3);
    box-shadow: 0 0 12px rgba(99,102,241,0.1);
    transform: translateY(-1px);
}
.collapse-btn:active { transform: translateY(0); }
.collapse-btn svg { width:14px; height:14px; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; transition: transform 0.3s var(--ease); flex-shrink:0; }
.collapse-btn .cb-text { white-space: nowrap; }
.sb-collapsed .collapse-btn svg { transform: rotate(180deg); }
.sb-collapsed .collapse-btn .cb-text { display: none; }
.sb-collapsed .collapse-btn { width: 36px; height: 36px; margin: 0 auto 8px; padding: 0; }

/* Sidebar footer */
.sidebar-foot {
    padding: 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius);
    transition: background 0.15s var(--ease);
}

.user-card:hover { background: var(--bg-surface-hover); }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--violet));
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-info { flex:1; min-width:0; }
.user-info .name { font-size:0.75rem; font-weight:600; color:var(--text-1); }
.user-info .role { font-size:0.6rem; color:var(--text-3); }

/* ============================================================
   MAIN
   ============================================================ */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s var(--ease);
}

/* Header */
.header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(18,19,26,0.88);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
    box-shadow: 0 1px 8px rgba(0,0,0,0.15);
}

.header-left { display:flex; align-items:center; gap:14px; }

.menu-btn {
    display: none;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-2);
}

.menu-btn svg { width:18px; height:18px; stroke:currentColor; fill:none; stroke-width:2; }

.header-title { font-size:0.9rem; font-weight:600; color:var(--text-1); }

.header-right { display:flex; align-items:center; gap:10px; }

.status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 100px;
    border: 1px solid rgba(16,185,129,0.2);
    background: rgba(16,185,129,0.06);
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--emerald);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--emerald);
    animation: blink 2s infinite;
}

@keyframes blink {
    0%,100% { opacity:1; }
    50% { opacity:0.3; }
}

/* Content area */
.content {
    flex: 1;
    padding: 28px;
}

/* ---- Welcome banner ---- */
.banner {
    position: relative;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    margin-bottom: 28px;
    overflow: hidden;
}

.banner::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -5%;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.banner h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--white);
    margin-bottom: 6px;
}

.banner p {
    font-size: 0.82rem;
    color: var(--text-3);
    line-height: 1.6;
    max-width: 520px;
}

/* ---- Stats ---- */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.stat:hover {
    border-color: var(--border-light);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.stat-body { min-width: 0; }

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.stat-icon svg { width:18px; height:18px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

.stat-icon.indigo { background:var(--brand-dim); color:var(--brand-light); }
.stat-icon.blue   { background:var(--blue-dim);  color:var(--blue); }
.stat-icon.emerald{ background:var(--emerald-dim); color:var(--emerald); }
.stat-icon.amber  { background:var(--amber-dim); color:var(--amber); }

.stat-val {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-1);
    margin-bottom: 2px;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-3);
    font-weight: 500;
}

/* ---- Quick nav ---- */
.section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.section-head h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: -0.01em;
}

.section-head .line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

.shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
}

.shortcut {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s var(--ease);
}

.shortcut:hover {
    border-color: var(--border-light);
    background: var(--bg-3);
    transform: translateY(-1px);
}

.sc-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.sc-icon svg { width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

.sc-icon.indigo { background:var(--brand-dim); color:var(--brand-light); }
.sc-icon.blue   { background:var(--blue-dim);  color:var(--blue); }
.sc-icon.emerald{ background:var(--emerald-dim); color:var(--emerald); }
.sc-icon.amber  { background:var(--amber-dim); color:var(--amber); }
.sc-icon.rose   { background:var(--rose-dim);  color:var(--rose); }
.sc-icon.cyan   { background:var(--cyan-dim);  color:var(--cyan); }
.sc-icon.violet { background:var(--violet-dim); color:var(--violet); }

.sc-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-2);
}

.shortcut:hover .sc-text { color:var(--text-1); }

/* ============================================================
   OVERLAY (mobile)
   ============================================================ */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
}
.overlay.show { display:block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* ============================================================
   SIDEBAR COLLAPSED (desktop)
   ============================================================ */
.sb-collapsed .sidebar {
    width: 64px;
}
.sb-collapsed .main {
    margin-left: 64px;
}
.sb-collapsed .brand h1,
.sb-collapsed .brand span {
    display: none;
}
.sb-collapsed .brand {
    justify-content: center;
    padding: 0;
}
.sb-collapsed .nav-label {
    font-size: 0;
    padding: 8px 0 2px;
    text-align: center;
}
.sb-collapsed .nav-label::after {
    content: '';
    display: block;
    width: 16px;
    height: 1px;
    background: var(--border);
    margin: 0 auto;
}
.sb-collapsed .nav-section {
    padding: 0 8px;
}
.sb-collapsed .nav-group-header {
    justify-content: center;
    padding: 7px 0;
    gap: 0;
}
.sb-collapsed .nav-group-header .nav-text,
.sb-collapsed .nav-group-header .chevron {
    display: none;
}
.sb-collapsed .nav-sub {
    max-height: 0 !important;
}
.sb-collapsed .nav-single {
    justify-content: center;
    padding: 7px 0;
    gap: 0;
}
.sb-collapsed .nav-single .nav-text {
    display: none;
}
.sb-collapsed .user-info {
    display: none;
}
.sb-collapsed .user-card {
    justify-content: center;
}
.sb-collapsed .sidebar-foot {
    padding: 8px;
}
.sb-collapsed .collapse-btn {
    height: 32px;
}
.sb-collapsed .sidebar-foot > div:first-child {
    flex-direction: column; padding: 0 4px;
}
.sb-collapsed .sidebar-foot > div:first-child .collapse-btn {
    width: 100%; flex: none;
}
.sb-collapsed #themeToggle { width: 100% !important; }

/* Tooltip on hover when collapsed */
.sb-collapsed .nav-group-header,
.sb-collapsed .nav-single {
    position: relative;
}
.sb-collapsed .nav-group-header:hover::after,
.sb-collapsed .nav-single:hover::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-3);
    color: var(--text-1);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 200;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    border: 1px solid var(--border);
}

@media (max-width: 1024px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    html, body { overflow-x: hidden; max-width: 100vw; }
    .main { min-width: 0; width: 100%; overflow-x: hidden; }
    .content { min-width: 0; overflow-x: hidden; word-break: break-word; }
    /* Sidebar: hide on tablet & mobile */
    .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0 !important; }
    .menu-btn { display: grid; place-items:center; }
    .collapse-btn { display: none; }
    .sb-collapsed .nav-group-header .nav-text,
    .sb-collapsed .nav-group-header .chevron,
    .sb-collapsed .nav-single .nav-text,
    .sb-collapsed .brand h1,
    .sb-collapsed .brand span,
    .sb-collapsed .user-info { display: revert !important; }
    .sb-collapsed .nav-label { font-size: 0.6rem; }
    .sb-collapsed .nav-label::after { display: none; }
    .sb-collapsed .nav-sub { max-height: revert !important; }
    .sb-collapsed .brand { justify-content: flex-start; padding: 0 20px; }
    .sb-collapsed .nav-section { padding: 0 12px; }
    .sb-collapsed .nav-group-header,
    .sb-collapsed .nav-single { justify-content: flex-start; padding: 7px 8px; gap: 10px; }
    .sb-collapsed .user-card { justify-content: flex-start; }
    .sb-collapsed .sidebar-foot { padding: 12px; }
}

@media (max-width: 768px) {
    .content { padding: 16px; }
    .banner { padding: 20px; }
    .banner h2 { font-size: 1.1rem; }
    .header { padding: 0 16px; height: 50px; }
    .header-title { font-size: 0.85rem; }

    /* Stats & shortcuts */
    .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat { padding: 10px 14px; }
    .stat-val { font-size: 1.2rem; }
    .shortcuts { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .stats { grid-template-columns: 1fr; }
    .shortcuts { grid-template-columns: 1fr; }
    .content { padding: 12px; }
    .banner { padding: 16px; }
    .banner h2 { font-size: 1rem; }
    .header { padding: 0 12px; }
    .header-title { font-size: 0.8rem; }
    .status-pill { font-size: 0.6rem; padding: 3px 8px; }
    .stat { padding: 10px 12px; gap: 10px; }
    .stat-icon { width: 34px; height: 34px; }
    .stat-val { font-size: 1.1rem; }
    .stat-label { font-size: 0.68rem; }
}

/* ============================================================
   RESPONSIVE: Table horizontal scroll
   ============================================================ */
.table-responsive,
.tbl-wrap,
.az-tbl-wrap,
.rl-table-wrap,
.si-queue-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table,
.tbl-wrap table,
.az-tbl-wrap table,
.rl-table-wrap table {
    min-width: 600px;
}

/* ============================================================
   RESPONSIVE: Touch-friendly buttons & inputs on mobile
   ============================================================ */
@media (max-width: 768px) {
    /* Buttons: min 44px touch target */
    .content button,
    .content .btn,
    .content input[type="submit"],
    .content input[type="button"] {
        min-height: 44px;
        min-width: 44px;
        font-size: 14px;
    }

    /* Inputs: larger on mobile */
    .content input[type="text"],
    .content input[type="number"],
    .content input[type="search"],
    .content input[type="password"],
    .content select,
    .content textarea {
        min-height: 44px;
        font-size: 16px; /* prevents iOS zoom */
    }
}

/* ── Shared Tool Tabs (underline style) ────────────────────── */
.tool-nav { margin-bottom: 20px; }
.tool-nav-tabs {
    display: flex; gap: 0; border-bottom: 2px solid var(--border, #2a2a3e);
    overflow-x: auto; scrollbar-width: none;
}
.tool-nav-tabs::-webkit-scrollbar { display: none; }
.tn-tab {
    position: relative; padding: 10px 20px; cursor: pointer; font-size: 13px; font-weight: 500;
    color: var(--text-3, #7a7a8e); border: none; background: none; font-family: inherit;
    transition: color .15s; white-space: nowrap;
}
.tn-tab:hover { color: var(--text-1, #e0e0e0); }
.tn-tab.active { color: #48dbfb; font-weight: 600; }
.tn-tab.active::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
    background: #48dbfb; border-radius: 1px 1px 0 0;
}

/* Color variants */
.tool-nav.purple .tn-tab.active { color: #9f7aea; }
.tool-nav.purple .tn-tab.active::after { background: #9f7aea; }
.tool-nav.green .tn-tab.active { color: #26de81; }
.tool-nav.green .tn-tab.active::after { background: #26de81; }
.tool-nav.orange .tn-tab.active { color: #f0932b; }
.tool-nav.orange .tn-tab.active::after { background: #f0932b; }
.tool-nav.rose .tn-tab.active { color: #ff6b6b; }
.tool-nav.rose .tn-tab.active::after { background: #ff6b6b; }

@media (max-width: 768px) {
    .tn-tab { padding: 8px 14px; font-size: 12px; }
}

/* ============================================================
   RESPONSIVE: Admin components on mobile
   ============================================================ */
@media (max-width: 1024px) {
    /* Tool tabs: scroll horizontal, no wrap */
    .tool-nav-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }

    /* Forms: full width inputs */
    .content input[type="text"],
    .content input[type="number"],
    .content input[type="search"],
    .content input[type="password"],
    .content select { max-width: 100%; box-sizing: border-box; }

    /* Flex row layouts: wrap on mobile */
    .content > div[style*="display:flex"],
    .content > div[style*="display: flex"] { flex-wrap: wrap !important; }

    /* Cards / zones: prevent overflow */
    .card, .am-zone, [class*="-card"], [class*="-zone"] { max-width: 100%; overflow-x: hidden; }

    /* Table wrappers: max width = viewport */
    .table-responsive, .tbl-wrap, .az-tbl-wrap, .rl-table-wrap { max-width: calc(100vw - 24px); }

    /* Modal: fit mobile screen */
    .modal-content, [class*="modal"] > div { max-width: 95vw !important; max-height: 90vh; overflow-y: auto; }
}

@media (max-width: 480px) {
    .tool-nav-tabs { gap: 0; }
    .tn-tab { padding: 6px 10px; font-size: 11px; }
    .table-responsive, .tbl-wrap, .az-tbl-wrap, .rl-table-wrap { max-width: calc(100vw - 24px); }
}
