/**
 * Atelier Nusa — Fit width 100%
 * Goal: NO left-right page scroll, and tables fit the viewport
 * (no horizontal table swipe). Compact type + wrap + table-layout:fixed.
 */

/* ---------- Root ---------- */
html {
    max-width: 100%;
    overflow-x: clip;
}

body.studio-bg {
    max-width: 100%;
    width: 100%;
    overflow-x: clip;
}

body.studio-bg > .flex,
body.studio-bg .atn-page,
body.studio-bg main,
body.studio-bg main > .atn-page,
body.studio-bg main > .atn-page > * {
    max-width: 100%;
    min-width: 0;
}

body.studio-bg img,
body.studio-bg svg,
body.studio-bg canvas,
body.studio-bg video {
    max-width: 100%;
    height: auto;
}

body.studio-bg pre,
body.studio-bg code {
    max-width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
}

body.studio-bg .flex,
body.studio-bg .grid {
    min-width: 0;
    max-width: 100%;
}

body.studio-bg .flex > *,
body.studio-bg .grid > * {
    min-width: 0;
}

body.studio-bg .kpi-value,
body.studio-bg .atn-hero-title,
body.studio-bg .atn-section-title {
    overflow-wrap: anywhere;
    word-break: break-word;
}

body.studio-bg .form-input,
body.studio-bg input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body.studio-bg select,
body.studio-bg textarea {
    max-width: 100%;
    box-sizing: border-box;
}

body.studio-bg .glass,
body.studio-bg .glass-strong,
body.studio-bg .kpi,
body.studio-bg .atn-hero,
body.studio-bg .person-card {
    max-width: 100%;
    box-sizing: border-box;
}

body.studio-bg .btn-primary,
body.studio-bg .btn-secondary,
body.studio-bg .btn-ghost,
body.studio-bg .btn-danger,
body.studio-bg a.btn-primary,
body.studio-bg a.btn-secondary {
    max-width: 100%;
}

body.studio-bg .w-screen {
    width: 100% !important;
    max-width: 100% !important;
}

/* ---------- TABLES: always fit container, never force swipe ---------- */
body.studio-bg .overflow-x-auto,
body.studio-bg .atn-table-scroll {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    /* no horizontal swipe — content must wrap/fit */
    overflow-x: visible !important;
    overflow-y: visible !important;
}

body.studio-bg .table-dark,
body.studio-bg table.table-dark,
body.studio-bg table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse;
}

body.studio-bg .table-dark th,
body.studio-bg .table-dark td {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    hyphens: auto;
    vertical-align: top;
    line-height: 1.3 !important;
    padding: 0.4rem 0.35rem !important;
    font-size: 0.75rem !important;
}

body.studio-bg .table-dark th {
    font-size: 0.65rem !important;
    letter-spacing: 0.02em !important;
    line-height: 1.25 !important;
}

/* Money columns stay tabular but can shrink */
body.studio-bg .table-dark td.text-right,
body.studio-bg .table-dark th.text-right {
    font-variant-numeric: tabular-nums;
    font-size: 0.7rem !important;
    white-space: normal !important;
}

/* Kill sticky first-col (was expanding layout feel) */
body.studio-bg .table-dark th:first-child,
body.studio-bg .table-dark td:first-child {
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
}

/* Tailwind min-width helpers on th/td — neutralize on all sizes */
body.studio-bg .table-dark [class*="min-w-"],
body.studio-bg .table-dark .min-w-\[4\.5rem\],
body.studio-bg .table-dark .min-w-\[6\.5rem\],
body.studio-bg .table-dark .min-w-\[7\.25rem\],
body.studio-bg .table-dark .min-w-\[12rem\],
body.studio-bg .table-dark .min-w-\[14rem\],
body.studio-bg .table-dark .max-w-\[14rem\],
body.studio-bg .table-dark .max-w-xs {
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
}

body.studio-bg .table-dark .whitespace-nowrap {
    white-space: normal !important;
}

/* Compact buttons inside tables */
body.studio-bg .table-dark .btn-primary,
body.studio-bg .table-dark .btn-secondary,
body.studio-bg .table-dark .btn-danger,
body.studio-bg .table-dark .btn-ghost {
    min-height: 1.75rem !important;
    min-width: 0 !important;
    padding: 0.2rem 0.4rem !important;
    font-size: 0.65rem !important;
    white-space: normal !important;
}

/* ---------- Data cards (list rows that replace wide tables) ---------- */
body.studio-bg .atn-data-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.85rem 0.95rem;
}

body.studio-bg .atn-data-card + .atn-data-card {
    margin-top: 0.65rem;
}

body.studio-bg .atn-data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    min-width: 0;
}

@media (min-width: 640px) {
    body.studio-bg .atn-data-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

body.studio-bg .atn-data-cell {
    min-width: 0;
    border-radius: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.45);
    padding: 0.45rem 0.55rem;
}

body.studio-bg .atn-data-cell .lbl {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
}

body.studio-bg .atn-data-cell .val {
    margin-top: 0.15rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

body.studio-bg .atn-data-cell .val.money {
    font-size: 0.78rem;
    font-weight: 700;
}

/* Smaller type on narrow phones */
@media (max-width: 480px) {
    body.studio-bg .table-dark th,
    body.studio-bg .table-dark td {
        padding: 0.3rem 0.25rem !important;
        font-size: 0.68rem !important;
    }

    body.studio-bg .table-dark th {
        font-size: 0.58rem !important;
    }

    body.studio-bg .atn-data-cell .val {
        font-size: 0.74rem;
    }

    body.studio-bg .kpi-value {
        font-size: 1.2rem !important;
    }

    body.studio-bg main {
        padding-left: 0.65rem !important;
        padding-right: 0.65rem !important;
    }
}

/* Pagination wrap */
body.studio-bg nav[role="navigation"],
body.studio-bg .pagination {
    max-width: 100%;
    flex-wrap: wrap;
}

body.studio-bg nav[role="navigation"] .flex {
    flex-wrap: wrap;
    max-width: 100%;
    gap: 0.35rem;
}

/* Tabs / chips: wrap instead of horizontal strip when possible */
body.studio-bg .atn-tabs,
body.studio-bg .atn-step-strip {
    max-width: 100%;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
}

/* Matrix project: still fixed layout so it fits; text tiny */
body.studio-bg .table-dark input,
body.studio-bg .table-dark button {
    max-width: 100%;
}

body.studio-bg .guest-card {
    max-width: min(28rem, 100%);
    width: 100%;
    box-sizing: border-box;
}
