/* Creative Hub UI patch — SGC QA2
   Branding institucional Creative Hub + portal externo.
   Objetivo: unificar colores, eliminar azul genérico y dar estética premium/operativa. */
:root {
    --ch-yellow: #f6b316;
    --ch-yellow-2: #ffca3a;
    --ch-yellow-dark: #d99600;
    --ch-black: #050505;
    --ch-ink: #0b0f19;
    --ch-sidebar: #07090d;
    --ch-sidebar-2: #10141d;
    --ch-white: #ffffff;
    --ch-gray: #aeb6c3;
    --ch-muted: #667085;
    --ch-bg: #f4f6f8;
    --ch-card: #ffffff;
    --ch-border: #e3e7ee;
    --ch-shadow: 0 18px 50px rgba(5,5,5,.08);
    --sgc-primary: var(--ch-yellow);
    --sgc-primary-dark: var(--ch-yellow-dark);
    --sgc-bg: var(--ch-bg);
    --sgc-text: var(--ch-ink);
    --sgc-muted: var(--ch-muted);
    --sgc-border: var(--ch-border);
    --sgc-panel: var(--ch-card);
}

* { scrollbar-width: thin; scrollbar-color: rgba(174,182,195,.30) transparent; }
body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at 90% 5%, rgba(246,179,22,.10), transparent 28rem),
        radial-gradient(circle at 96% 92%, rgba(11,15,25,.08), transparent 30rem),
        var(--ch-bg) !important;
    color: var(--ch-ink);
}

a { transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease; }
.app-shell { grid-template-columns: 264px minmax(0, 1fr); }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background:
        radial-gradient(circle at 20% 0%, rgba(246,179,22,.16), transparent 18rem),
        linear-gradient(180deg, #11151f 0%, #07090d 48%, #020203 100%) !important;
    border-right: 1px solid rgba(255,255,255,.08);
    padding: 20px 14px;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(174,182,195,.30); border-radius: 999px; }

.creativehub-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px 18px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,.10);
}
.creativehub-brand strong {
    display: block;
    color: var(--ch-white);
    font-size: 18px;
    letter-spacing: -.04em;
    line-height: 1;
}
.creativehub-brand span {
    display: block;
    color: #aeb6c3;
    font-size: 12px;
    font-weight: 650;
    margin-top: 5px;
}
.creativehub-brand-mark-img,
.creativehub-brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 14px;
    background: rgba(255,255,255,.06);
    padding: 4px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.creativehub-brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--ch-yellow), #e59d00);
    color: #080b12 !important;
    font-size: 16px !important;
    font-weight: 950 !important;
    margin: 0 !important;
}

.nav-group { margin-bottom: 18px; }
.nav-title {
    color: #aeb6c3;
    font-size: 10.5px;
    letter-spacing: .13em;
    margin: 0 0 7px 8px;
}
.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 9px 10px 9px 12px;
    color: #eef2f7;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 13.5px;
    transition: all .16s ease;
}
.nav-link::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: rgba(174,182,195,.55);
    margin-right: 9px;
    flex: 0 0 auto;
}
.nav-link:hover,
.nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.10);
    transform: translateX(2px);
}
.nav-link.active::before {
    background: var(--ch-yellow);
    box-shadow: 0 0 0 4px rgba(246,179,22,.14);
}

.topbar {
    min-height: 70px;
    height: auto;
    background: rgba(255,255,255,.92) !important;
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(227,231,238,.80);
}
.topbar-kicker {
    font-size: 11px;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #9a6b00;
    font-weight: 900;
    margin-bottom: 2px;
}
.content { padding: 30px 28px 44px; }
.page-title { font-size: clamp(24px, 3vw, 34px); color: #07111f; }

.table-card,
.form-card,
.card,
.kpi-card,
.metric-card,
.dashboard-card {
    background: rgba(255,255,255,.96) !important;
    border: 1px solid rgba(227,231,238,.96) !important;
    box-shadow: var(--ch-shadow) !important;
    border-radius: 18px !important;
}
.table-header { background: linear-gradient(180deg, rgba(248,250,252,.96), rgba(255,255,255,.96)); }

button, .btn {
    border-radius: 12px !important;
    box-shadow: 0 8px 20px rgba(246,179,22,.14);
}
button[type="submit"], .btn-primary, a.btn-primary, .btn:not(.btn-light):not(.btn-secondary):not(.btn-danger) {
    background: linear-gradient(135deg, var(--ch-yellow), #eaa400) !important;
    border-color: #e2a000 !important;
    color: #090909 !important;
    font-weight: 850;
}
.btn-secondary {
    background: rgba(11,15,25,.88) !important;
    color: #fff !important;
    border: 1px solid rgba(11,15,25,.20) !important;
}
.btn-light {
    background: #eef1f5 !important;
    color: #111827 !important;
    box-shadow: none;
}
.btn-danger { box-shadow: none; }
input, select, textarea { border-radius: 12px !important; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(246,179,22,.66) !important;
    box-shadow: 0 0 0 4px rgba(246,179,22,.14) !important;
}

/* Corrección de colores Fase 15 / BI: elimina azul genérico y aplica Creative Hub. */
.phase15-hero {
    position: relative;
    overflow: hidden;
    border-radius: 26px !important;
    padding: 30px !important;
    background:
        radial-gradient(circle at 88% 12%, rgba(246,179,22,.22), transparent 20rem),
        linear-gradient(135deg, #0b0f19 0%, #151923 56%, #050505 100%) !important;
    color: #fff;
    box-shadow: 0 28px 70px rgba(5,5,5,.24) !important;
    border: 1px solid rgba(255,255,255,.08);
}
.phase15-hero::after {
    content: "";
    position: absolute;
    right: -90px;
    top: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    border: 38px solid rgba(246,179,22,.16);
    pointer-events: none;
}
.phase15-hero h1 { color:#fff; text-shadow: 0 10px 30px rgba(0,0,0,.22); }
.phase15-hero p { color: rgba(255,255,255,.78) !important; }
.phase15-badge {
    background: rgba(246,179,22,.14) !important;
    color: var(--ch-yellow) !important;
    border: 1px solid rgba(246,179,22,.22);
}
.phase15-actions .btn { color:#090909 !important; background: linear-gradient(135deg, var(--ch-yellow), #eaa400) !important; }
.phase15-actions .btn-secondary { color:#fff !important; background: rgba(255,255,255,.10) !important; border-color: rgba(255,255,255,.22) !important; }
.progress-fill { background: linear-gradient(90deg, var(--ch-yellow), #111827) !important; }
.chart-placeholder { border-color: rgba(246,179,22,.28) !important; }

/* Login / auth */
.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 10%, rgba(246,179,22,.22), transparent 25rem),
        linear-gradient(135deg, #020202 0%, #0d111a 52%, #1a1e29 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}
.auth-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, transparent, rgba(246,179,22,.06), transparent),
        radial-gradient(circle at 88% 82%, rgba(246,179,22,.12), transparent 18rem);
}
.creativehub-auth-card.auth-card {
    position: relative;
    width: min(440px, calc(100vw - 32px));
    background: rgba(255,255,255,.96) !important;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 28px 90px rgba(0,0,0,.36);
}
.creativehub-auth-logo-wrap { display: flex; justify-content: center; margin-bottom: 18px; }
.creativehub-auth-logo { max-width: 230px; width: 72%; height: auto; display: block; filter: drop-shadow(0 8px 22px rgba(0,0,0,.12)); }
.creativehub-auth-mark {
    width: 68px; height: 68px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 22px; background: linear-gradient(135deg, var(--ch-yellow), #eaa400); color: #0b0b0b; font-weight: 950; font-size: 22px;
}
.creativehub-auth-eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; color: #b88705; font-weight: 900; margin-bottom: 8px; }
.creativehub-auth-card h1 { margin-bottom: 4px; }
.creativehub-auth-card p { color: #667085; margin-bottom: 22px; }

/* Portal externo Creative Hub */
.portal-body,
.portal-login-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 85% 10%, rgba(246,179,22,.12), transparent 26rem),
        radial-gradient(circle at 15% 95%, rgba(11,15,25,.10), transparent 30rem),
        #f4f6f8 !important;
}
.portal-shell { min-height: 100vh; background: transparent !important; }
.portal-header {
    background:
        radial-gradient(circle at 90% 0%, rgba(246,179,22,.22), transparent 20rem),
        linear-gradient(135deg, #090b10 0%, #131823 70%, #050505 100%) !important;
    color:#fff;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 18px 48px rgba(5,5,5,.20);
}
.portal-header-inner { max-width:1180px; margin:0 auto; display:flex; justify-content:space-between; gap:18px; align-items:center; }
.portal-brand-wrap { display:flex; align-items:center; gap:12px; }
.portal-brand-logo {
    width:46px; height:46px; object-fit:contain; border-radius:14px; padding:5px;
    background:rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.portal-brand { font-size:20px; font-weight:900; letter-spacing:-.04em; line-height:1; }
.portal-subtitle { color:#aeb6c3; font-size:13px; margin-top:5px; }
.portal-nav { display:flex; gap:8px; flex-wrap:wrap; align-items:center; justify-content:flex-end; }
.portal-nav a {
    color:#e7ebf2; text-decoration:none; padding:9px 11px; border-radius:12px;
    border:1px solid transparent; font-size:13.5px; font-weight:700;
}
.portal-nav a:hover,
.portal-nav a.active { background:rgba(255,255,255,.08); border-color:rgba(255,255,255,.12); color:#fff; }
.portal-nav a.portal-nav-logout { background: rgba(246,179,22,.14); color: var(--ch-yellow); border-color: rgba(246,179,22,.25); }
.portal-main { max-width:1180px; margin:0 auto; padding:32px 20px 54px; }
.portal-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; }
.portal-hero {
    margin-bottom: 22px;
    padding: 26px;
    border-radius: 24px;
    background: linear-gradient(135deg,#0b0f19,#151923);
    color:#fff;
    border:1px solid rgba(255,255,255,.08);
    box-shadow:0 24px 70px rgba(5,5,5,.18);
    position:relative;
    overflow:hidden;
}
.portal-hero::after { content:""; position:absolute; right:-70px; top:-90px; width:260px; height:260px; border:30px solid rgba(246,179,22,.14); border-radius:50%; }
.portal-hero h1 { margin:0 0 8px; font-size:clamp(26px,3vw,38px); letter-spacing:-.05em; color:#fff; position:relative; }
.portal-hero p { margin:0; color:rgba(255,255,255,.74); max-width:760px; line-height:1.65; position:relative; }
.portal-kicker { color:var(--ch-yellow); font-size:11px; text-transform:uppercase; letter-spacing:.14em; font-weight:950; margin-bottom:8px; position:relative; }
.portal-empty { color:#667085; padding:18px; border:1px dashed #d9dee7; border-radius:16px; background:#f8fafc; }
.portal-table-scroll { width:100%; overflow-x:auto; }

.portal-login-body { display:flex; align-items:center; justify-content:center; padding:28px; }
.portal-login-shell { width:min(980px, calc(100vw - 32px)); display:grid; grid-template-columns:1.05fr .95fr; border-radius:30px; overflow:hidden; box-shadow:0 30px 90px rgba(5,5,5,.24); background:#fff; border:1px solid rgba(255,255,255,.65); }
.portal-login-brand {
    background: radial-gradient(circle at 80% 10%, rgba(246,179,22,.22), transparent 18rem), linear-gradient(135deg,#080b12,#151923 70%,#050505);
    color:#fff; padding:38px; position:relative; overflow:hidden;
}
.portal-login-brand::after { content:""; position:absolute; right:-90px; bottom:-110px; width:330px; height:330px; border:42px solid rgba(246,179,22,.15); border-radius:50%; }
.portal-login-logo { max-width:260px; width:78%; height:auto; display:block; margin-bottom:34px; position:relative; z-index:1; }
.portal-login-brand h1 { font-size:clamp(30px,4vw,48px); line-height:1; margin:0 0 12px; letter-spacing:-.06em; position:relative; z-index:1; }
.portal-login-brand p { color:rgba(255,255,255,.74); line-height:1.7; margin:0; position:relative; z-index:1; }
.portal-login-form { padding:38px; display:flex; flex-direction:column; justify-content:center; }
.portal-login-form h2 { font-size:28px; margin:0 0 8px; letter-spacing:-.04em; }
.portal-login-form p { color:#667085; line-height:1.6; margin:0 0 22px; }
.portal-login-note { margin-top:16px; color:#667085; font-size:13px; line-height:1.5; }

@media (max-width: 1100px) {
    .portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .sidebar { position: relative; height: auto; }
    .app-shell { grid-template-columns: 1fr; }
    .portal-header-inner { flex-direction: column; align-items:flex-start; }
    .portal-nav { justify-content:flex-start; }
    .portal-login-shell { grid-template-columns: 1fr; }
    .portal-login-brand { padding:30px; }
}
@media (max-width: 640px) {
    .content { padding: 22px 16px 34px; }
    .portal-grid { grid-template-columns: 1fr; }
    .portal-main { padding:22px 14px 40px; }
    .portal-login-body { padding:16px; }
    .portal-login-form { padding:28px 22px; }
    .portal-login-logo { max-width:210px; }
}

/* QA3 — Menú lateral desplegable tipo CH OS */
.sgc-nav { padding: 2px 0 24px; }
.nav-collapsible {
    margin: 0 0 8px;
}
.nav-section-toggle {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 10px 10px 12px;
    border-radius: 14px !important;
    border: 1px solid rgba(255,255,255,.06) !important;
    background: rgba(255,255,255,.025) !important;
    color: #aeb6c3 !important;
    box-shadow: none !important;
    cursor: pointer;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .105em;
    font-size: 10.5px;
    font-weight: 900;
}
.nav-section-toggle:hover,
.nav-collapsible.has-active .nav-section-toggle,
.nav-collapsible.is-open .nav-section-toggle {
    background: rgba(255,255,255,.07) !important;
    border-color: rgba(246,179,22,.16) !important;
    color: #ffffff !important;
}
.nav-collapsible.has-active .nav-section-toggle {
    box-shadow: inset 3px 0 0 var(--ch-yellow) !important;
}
.nav-chevron {
    color: var(--ch-yellow);
    font-size: 12px;
    line-height: 1;
    transition: transform .18s ease;
}
.nav-collapsible.is-open .nav-chevron {
    transform: rotate(180deg);
}
.nav-section-panel {
    display: none;
    padding: 7px 0 2px 8px;
    margin-left: 7px;
    border-left: 1px solid rgba(255,255,255,.08);
}
.nav-collapsible.is-open .nav-section-panel {
    display: block;
}
.nav-collapsible .nav-link {
    min-height: 33px;
    padding: 8px 9px 8px 11px;
    margin: 2px 0;
    font-size: 13px;
    color: rgba(238,242,247,.88);
    border-radius: 11px;
}
.nav-collapsible .nav-link::before {
    width: 4px;
    height: 4px;
    margin-right: 8px;
}
.nav-collapsible .nav-link:hover,
.nav-collapsible .nav-link.active {
    background: rgba(255,255,255,.085);
    border-color: rgba(255,255,255,.10);
    color: #fff;
}
.nav-collapsible .nav-link.active {
    background: linear-gradient(90deg, rgba(246,179,22,.18), rgba(255,255,255,.05));
    border-color: rgba(246,179,22,.22);
}
.nav-link-disabled {
    opacity: .48;
    cursor: default;
    pointer-events: none;
}
.nav-link-disabled::before {
    background: rgba(174,182,195,.28) !important;
}

/* Compatibilidad: ocultar títulos antiguos cuando un layout previo quede en cache parcial. */
.nav-collapsible .nav-title { display: none; }

@media (max-width: 900px) {
    .sgc-nav { padding-bottom: 12px; }
    .nav-section-toggle { min-height: 42px; }
}

/* QA5 — Visual finance layer: facturación, pagos, impresión y formularios. */
.ch-page-hero--compact {
    padding: 30px;
    margin: 6px 0 24px;
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(5,5,5,.96), rgba(20,24,32,.92) 42%, rgba(246,179,22,.90));
    color: #fff;
    display: flex;
    justify-content: space-between;
    gap: 22px;
    align-items: flex-end;
    box-shadow: 0 22px 70px rgba(5,5,5,.18);
}
.ch-page-hero--compact h1 { margin: 8px 0 8px; color: #fff; font-size: clamp(28px, 3.4vw, 44px); letter-spacing: -1.4px; line-height: 1.02; }
.ch-page-hero--compact p { margin: 0; color: rgba(255,255,255,.83); max-width: 840px; line-height: 1.6; }
.ch-eyebrow { display:inline-flex; align-items:center; gap:8px; font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--ch-yellow-2); }
.ch-hero-actions { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.ch-page-hero--compact .btn { white-space: nowrap; }

.ch-kpi-grid { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.ch-kpi-grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.ch-kpi-grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.ch-kpi { background: rgba(255,255,255,.92); border:1px solid var(--ch-border); border-radius: 18px; padding: 20px; box-shadow: 0 16px 50px rgba(5,5,5,.06); min-height: 112px; }
.ch-kpi span { display:block; color:#53627a; font-size: 12px; text-transform:uppercase; letter-spacing:.10em; font-weight:900; margin-bottom: 10px; }
.ch-kpi strong { display:block; color:var(--ch-ink); font-size: 30px; letter-spacing:-.7px; line-height:1.05; }
.ch-kpi small { color:#667085; display:block; margin-top: 10px; }

.ch-table-card, .ch-form-card { border-radius: 18px; overflow:hidden; box-shadow: 0 16px 48px rgba(5,5,5,.07); border: 1px solid var(--ch-border); background: rgba(255,255,255,.96); margin-bottom: 24px; }
.ch-table-header { align-items:flex-start; gap: 18px; padding: 20px 20px 18px; border-bottom: 1px solid var(--ch-border); }
.ch-table-header h2 { margin:0; color:var(--ch-ink); font-size: 20px; letter-spacing:-.3px; }
.ch-table-header p { margin: 6px 0 0; color:#667085; line-height:1.5; }
.ch-search { display:flex; gap:8px; align-items:center; }
.ch-search input { width: min(320px, 42vw); }
.ch-table-scroll { width:100%; overflow:auto; }
.ch-table-card table { min-width: 980px; }
.ch-table-card th { background:#fafbfc; color:#56627a; font-size: 11px; letter-spacing:.09em; text-transform:uppercase; font-weight:900; }
.ch-table-card td { vertical-align: middle; }
.ch-empty { padding: 28px !important; text-align:center; color:#667085; }
.ch-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.ch-actions form { display:inline-flex; margin:0; }

.ch-form-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; padding: 22px; }
.ch-form-grid--detail { grid-template-columns: 1.2fr 2fr .7fr .9fr .7fr auto; align-items:end; }
.ch-field { display:flex; flex-direction:column; gap: 7px; min-width:0; }
.ch-field label { color: #101828; font-size: 13px; font-weight: 900; }
.ch-field input, .ch-field select, .ch-field textarea, .ch-search input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #d8dde7;
    border-radius: 12px;
    padding: 10px 12px;
    background:#fff;
    color:var(--ch-ink);
    outline:none;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.ch-field textarea { resize: vertical; min-height: 108px; }
.ch-field input:focus, .ch-field select:focus, .ch-field textarea:focus, .ch-search input:focus { border-color: var(--ch-yellow); box-shadow: 0 0 0 4px rgba(246,179,22,.14); }
.ch-field--full { grid-column: 1 / -1; }
.ch-field--wide { grid-column: span 2; }
.ch-form-actions { display:flex; gap: 10px; align-items:center; flex-wrap:wrap; }

.ch-alert { border-radius: 16px; padding: 16px 18px; margin: 0 0 20px; border:1px solid; }
.ch-alert ul { margin: 8px 0 0 18px; padding:0; }
.ch-alert-warning { background:#fff8e5; border-color:#f4d06f; color:#5d4300; }
.ch-alert-success { background:#ecfdf3; border-color:#abefc6; color:#067647; }

.ch-invoice-shell { background:#fff; border:1px solid var(--ch-border); border-radius: 22px; box-shadow: 0 18px 58px rgba(5,5,5,.08); padding: 26px; margin-bottom: 24px; }
.ch-invoice-head { display:flex; justify-content:space-between; gap:20px; align-items:flex-start; padding-bottom: 18px; border-bottom: 1px solid var(--ch-border); }
.ch-invoice-head strong { display:block; font-size: 22px; color: var(--ch-ink); }
.ch-invoice-head small { color:#667085; }
.ch-invoice-number { text-align:right; }
.ch-invoice-number span { display:block; font-size: 11px; font-weight:900; letter-spacing:.12em; text-transform:uppercase; color:#667085; }
.ch-invoice-number strong { color: var(--ch-yellow-dark); font-size: 24px; }
.ch-detail-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin: 20px 0; }
.ch-detail-grid--payment { background:#fff; border:1px solid var(--ch-border); border-radius: 18px; padding: 18px; box-shadow: 0 14px 42px rgba(5,5,5,.06); margin-bottom: 24px; }
.ch-detail-grid > div { border:1px solid #edf0f5; background:#fbfcfd; border-radius: 14px; padding: 14px; }
.ch-detail-grid span { display:block; font-size: 11px; font-weight:900; letter-spacing:.09em; text-transform:uppercase; color:#667085; margin-bottom:6px; }
.ch-detail-grid strong { color:var(--ch-ink); }
.ch-invoice-footer { display:grid; grid-template-columns: minmax(0,1fr) 340px; gap:22px; margin-top: 22px; align-items:start; }
.ch-note-box { border:1px solid #edf0f5; background:#fbfcfd; border-radius: 16px; padding: 16px; min-height: 150px; }
.ch-note-box p { margin: 8px 0 0; color:#667085; line-height:1.5; }
.ch-totals { border:1px solid var(--ch-border); border-radius: 16px; overflow:hidden; background:#fff; }
.ch-totals div { display:flex; justify-content:space-between; gap:14px; padding: 12px 14px; border-bottom:1px solid #edf0f5; }
.ch-totals div:last-child { border-bottom:0; }
.ch-totals span { color:#667085; }
.ch-totals strong { color:var(--ch-ink); }
.ch-total-open { background:linear-gradient(135deg, rgba(246,179,22,.14), rgba(246,179,22,.06)); }
.ch-total-open strong { color:var(--ch-yellow-dark); font-size:18px; }

@media (max-width: 1100px) {
    .ch-kpi-grid, .ch-kpi-grid--3, .ch-kpi-grid--4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .ch-form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .ch-form-grid--detail { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .ch-detail-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .ch-invoice-footer { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .ch-page-hero--compact { flex-direction:column; align-items:stretch; padding:22px; border-radius:18px; }
    .ch-hero-actions { width:100%; }
    .ch-hero-actions .btn { flex:1 1 auto; justify-content:center; }
    .ch-kpi-grid, .ch-kpi-grid--3, .ch-kpi-grid--4, .ch-form-grid, .ch-form-grid--detail, .ch-detail-grid { grid-template-columns: 1fr; }
    .ch-field--wide { grid-column:auto; }
    .ch-search { width:100%; }
    .ch-search input { width:100%; }
}

@media print {
    body { background:#fff !important; }
    .sidebar, .topbar, .ch-print-hide, .flash, .alert, .ch-page-hero { display:none !important; }
    .app-shell { display:block !important; }
    .main-content, main { padding:0 !important; margin:0 !important; }
    .ch-invoice-shell { box-shadow:none; border:0; border-radius:0; padding:0; }
    .ch-table-scroll { overflow:visible; }
    table { min-width: 0 !important; width:100% !important; }
}
