/*
 * AlmaXplore UI
 * Linguagem visual global inspirada no Commercial Campaign Hub.
 * Esta camada adapta progressivamente as views MVC/Angular existentes sem
 * alterar os respetivos contratos, modelos ou controladores.
 */

:root {
    --ax-sidebar-width: 272px;
    --ax-topbar-height: 68px;
    --ax-ink: #101828;
    --ax-muted: #667085;
    --ax-subtle: #98a2b3;
    --ax-line: #e4e7ec;
    --ax-line-strong: #d0d5dd;
    --ax-canvas: #f5f7fa;
    --ax-surface: #ffffff;
    --ax-soft: #f8fafb;
    --ax-navy: #071723;
    --ax-navy-2: #0b2535;
    --ax-navy-3: #123c4e;
    --ax-teal: #25c6c2;
    --ax-teal-dark: #0f8b8d;
    --ax-violet: #6d5dfc;
    --ax-coral: #ff4d55;
    --ax-green: #12b76a;
    --ax-amber: #f79009;
    --ax-red: #f04438;
    --ax-blue: #2e90fa;
    --ax-shadow-xs: 0 2px 8px rgba(16, 24, 40, .045);
    --ax-shadow-sm: 0 8px 26px rgba(16, 24, 40, .055);
    --ax-shadow-md: 0 18px 48px rgba(16, 24, 40, .09);
    --ax-shadow-dark: 0 18px 50px rgba(7, 23, 35, .2);
    --ax-radius-sm: 10px;
    --ax-radius: 16px;
    --ax-radius-lg: 22px;
    --sidebar-width: var(--ax-sidebar-width);
}

html { background: var(--ax-canvas); }

body.ax-shell {
    min-height: 100vh;
    margin: 0;
    color: var(--ax-ink);
    background:
        radial-gradient(circle at 92% 2%, rgba(109, 93, 252, .07), transparent 29rem),
        radial-gradient(circle at 6% 14%, rgba(37, 198, 194, .06), transparent 25rem),
        var(--ax-canvas);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

body.ax-shell *, body.ax-login-shell * { box-sizing: border-box; }

body.ax-shell .wrapper { min-height: 100vh; }

.ax-sidebar-backdrop { display: none; }

body.ax-shell #main-content {
    min-height: 100vh;
    background: transparent;
}

body.ax-shell #content {
    min-height: calc(100vh - var(--ax-topbar-height));
    padding: 0;
    background: transparent;
}

body.ax-shell #content > main {
    min-height: calc(100vh - var(--ax-topbar-height));
}

body.ax-shell #content > main:not(.ax-page-stage) {
    padding: 0 0 48px !important;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

body.ax-shell #sidebar.ax-sidebar {
    top: 0;
    left: 0;
    width: var(--ax-sidebar-width);
    height: 100vh;
    overflow: hidden;
    color: #fff;
    border: 0 !important;
    background:
        radial-gradient(circle at 12% 4%, rgba(37, 198, 194, .13), transparent 14rem),
        radial-gradient(circle at 95% 62%, rgba(109, 93, 252, .12), transparent 18rem),
        linear-gradient(165deg, #06131d 0%, #081c28 48%, #0b2534 100%);
    box-shadow: 12px 0 40px rgba(7, 23, 35, .12);
}

body.ax-shell #sidebar::after {
    position: absolute;
    right: -80px;
    bottom: 8%;
    width: 180px;
    height: 180px;
    content: "";
    pointer-events: none;
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 50%;
    box-shadow: 0 0 0 30px rgba(255,255,255,.018), 0 0 0 60px rgba(255,255,255,.012);
}

.ax-sidebar-brand {
    position: relative;
    z-index: 2;
    min-height: 82px;
    padding: 15px 16px;
    border-bottom: 1px solid rgba(255,255,255,.075);
}

.ax-brand-link {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #fff;
    text-decoration: none !important;
}

.ax-brand-link:hover { color: #fff; }

.ax-brand-mark {
    display: grid;
    width: 45px;
    height: 45px;
    flex: 0 0 45px;
    place-items: center;
    color: #0b2935;
    border-radius: 14px;
    background: linear-gradient(145deg, #dffffb, #75e5da);
    box-shadow: 0 8px 22px rgba(37,198,194,.2);
    font-size: 20px;
}

.ax-brand-copy { display: flex; min-width: 0; flex-direction: column; }
.ax-brand-copy strong { font-size: 16px; font-weight: 800; letter-spacing: -.025em; }
.ax-brand-copy small { margin-top: 1px; color: rgba(255,255,255,.49); font-size: 9px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }

.ax-brand-status {
    position: absolute;
    top: 33px;
    right: 16px;
    display: grid;
    width: 19px;
    height: 19px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 50%;
    background: rgba(255,255,255,.06);
}
.ax-brand-status i { width: 6px; height: 6px; border-radius: 50%; background: #33d17a; box-shadow: 0 0 0 4px rgba(51,209,122,.11); }

body.ax-shell #sidebar .sidebar-scroll {
    position: relative;
    z-index: 2;
    scrollbar-color: rgba(255,255,255,.14) transparent;
    scrollbar-width: thin;
}

body.ax-shell #sidebar .sidebar-scroll::-webkit-scrollbar { width: 5px; }
body.ax-shell #sidebar .sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 99px; }
body.ax-shell #sidebar .sidebar-scroll::-webkit-scrollbar-track { background: transparent; }

.ax-sidebar-label {
    margin: 3px 10px 10px;
    color: rgba(255,255,255,.34);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .17em;
}

.ax-sidebar-profile {
    position: relative;
    overflow: hidden;
    color: rgba(255,255,255,.88);
    border: 1px solid rgba(255,255,255,.085);
    border-radius: 13px;
    background: rgba(255,255,255,.045);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}
.ax-sidebar-profile::before { position: absolute; top: 9px; bottom: 9px; left: 0; width: 2px; content: ""; border-radius: 0 4px 4px 0; background: linear-gradient(var(--ax-teal), var(--ax-violet)); }

body.ax-shell #sidebar .nav-link {
    position: relative;
    min-height: 40px;
    margin: 2px 0 !important;
    padding: 10px 11px;
    color: rgba(241,248,251,.72) !important;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: -.005em;
    transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease;
}

body.ax-shell #sidebar .nav-link > i:first-child {
    width: 18px;
    color: rgba(111,221,219,.7);
    text-align: center;
    transition: color .16s ease, transform .16s ease;
}

body.ax-shell #sidebar .nav-link:hover {
    color: #fff !important;
    border-color: rgba(255,255,255,.055);
    background: rgba(255,255,255,.065);
    transform: translateX(2px);
}

body.ax-shell #sidebar .nav-link:hover > i:first-child { color: #93eee8; transform: scale(1.05); }

body.ax-shell #sidebar .nav-link[aria-expanded="true"],
body.ax-shell #sidebar .nav-link.ax-route-parent {
    color: #fff !important;
    border-color: rgba(37,198,194,.1);
    background: rgba(37,198,194,.09);
}

body.ax-shell #sidebar .nav-link.ax-route-active {
    color: #fff !important;
    border-color: rgba(37,198,194,.14);
    background: linear-gradient(100deg, rgba(37,198,194,.18), rgba(109,93,252,.1));
    box-shadow: inset 3px 0 0 var(--ax-teal), 0 7px 16px rgba(0,0,0,.1);
}

body.ax-shell #sidebar .collapse ul {
    position: relative;
    margin-left: 9px !important;
    padding-left: 13px;
    border-left: 1px solid rgba(255,255,255,.075);
}

body.ax-shell #sidebar .collapse .nav-link {
    min-height: 33px;
    padding: 7px 9px;
    color: rgba(241,248,251,.55) !important;
    font-size: 10px;
}

body.ax-shell #sidebar .collapse .nav-link.ax-route-active { color: #fff !important; }

.ax-sidebar-footer {
    display: grid;
    grid-template-columns: 34px minmax(0,1fr);
    gap: 9px;
    align-items: center;
    margin-top: 17px;
    padding: 13px 8px 4px;
    color: rgba(255,255,255,.55);
    border-top: 1px solid rgba(255,255,255,.075);
}
.ax-sidebar-footer > span { display: grid; width: 32px; height: 32px; place-items: center; color: #8cece5; border-radius: 10px; background: rgba(37,198,194,.09); }
.ax-sidebar-footer strong, .ax-sidebar-footer small { display: block; }
.ax-sidebar-footer strong { color: rgba(255,255,255,.78); font-size: 10px; }
.ax-sidebar-footer small { margin-top: 1px; color: rgba(255,255,255,.32); font-size: 8px; }

/* --------------------------------------------------------------------------
   Topbar global
   -------------------------------------------------------------------------- */

body.ax-shell #topbar.ax-topbar {
    z-index: 1040;
    min-height: var(--ax-topbar-height);
    margin: 0 !important;
    padding: 0;
    color: var(--ax-ink);
    border-bottom: 1px solid rgba(208,213,221,.7) !important;
    background: rgba(255,255,255,.88);
    box-shadow: 0 7px 24px rgba(16,24,40,.045);
    backdrop-filter: blur(18px) saturate(150%);
}

.ax-topbar-inner { display: grid; grid-template-columns: 45px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 9px 20px; }
.ax-topbar-inner--database { grid-template-columns: 45px minmax(0,1fr) auto auto; }

.ax-sidebar-toggle {
    width: 40px;
    height: 40px;
    padding: 0 !important;
    color: #344054;
    border: 1px solid var(--ax-line) !important;
    border-radius: 12px !important;
    background: var(--ax-surface) !important;
    box-shadow: var(--ax-shadow-xs) !important;
}
.ax-sidebar-toggle:hover { color: var(--ax-violet); border-color: #cfc9ff !important; background: #f8f7ff !important; }
.ax-sidebar-toggle:focus-visible { outline: 3px solid rgba(109,93,252,.18); outline-offset: 2px; }

.ax-topbar-context { display: flex; min-width: 0; flex-direction: column; }
.ax-topbar-kicker { color: var(--ax-teal-dark); font-size: 8px; font-weight: 850; letter-spacing: .16em; }
.ax-topbar-context strong { overflow: hidden; margin-top: 1px; color: #263544; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }

.ax-user-link {
    display: flex;
    max-width: min(330px,32vw);
    align-items: center;
    gap: 9px;
    padding: 5px 7px 5px 6px;
    color: #344054;
    border: 1px solid transparent;
    border-radius: 13px;
    text-decoration: none !important;
    transition: background .16s ease, border-color .16s ease;
}
.ax-user-link:hover { color: #101828; border-color: var(--ax-line); background: #fff; }
.ax-user-icon { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; color: #0f7779; border-radius: 11px; background: #e9fbf9; }
.ax-user-copy { min-width: 0; flex-direction: column; }
.ax-user-copy small { color: var(--ax-subtle); font-size: 8px; font-weight: 700; text-transform: uppercase; }
.ax-user-copy strong { overflow: hidden; max-width: 210px; margin-top: 1px; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.ax-user-link > .bi-chevron-right { color: #98a2b3; font-size: 10px; }

/* --------------------------------------------------------------------------
   Hero e navegação por secções
   -------------------------------------------------------------------------- */

.ax-page-stage {
    width: min(100%, 1600px);
    margin: 0 auto;
    padding: 24px 28px 54px !important;
}

.ax-page-hero {
    position: relative;
    isolation: isolate;
    display: flex;
    min-height: 142px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    overflow: hidden;
    margin-bottom: 17px;
    padding: 27px 30px;
    color: #fff;
    border: 1px solid rgba(255,255,255,.075);
    border-radius: var(--ax-radius-lg);
    background: linear-gradient(125deg, var(--ax-navy) 0%, var(--ax-navy-2) 58%, var(--ax-navy-3) 100%);
    box-shadow: var(--ax-shadow-dark);
    animation: ax-hero-in .38s ease both;
}

.ax-page-hero::before {
    position: absolute;
    z-index: -1;
    top: -92px;
    right: 14%;
    width: 240px;
    height: 240px;
    content: "";
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 50%;
    box-shadow: 0 0 0 38px rgba(255,255,255,.024), 0 0 0 76px rgba(255,255,255,.016);
}

.ax-page-hero::after {
    position: absolute;
    z-index: -1;
    right: 75px;
    bottom: -48px;
    width: 255px;
    height: 135px;
    content: "";
    opacity: .27;
    background-image: linear-gradient(rgba(255,255,255,.13) 1px,transparent 1px), linear-gradient(90deg,rgba(255,255,255,.13) 1px,transparent 1px);
    background-size: 18px 18px;
    transform: rotate(-8deg);
    mask-image: linear-gradient(90deg,transparent,#000);
}

.ax-hero-copy { display: grid; grid-template-columns: 54px minmax(0,1fr); column-gap: 17px; align-items: center; min-width: 0; }
.ax-hero-icon { display: grid; width: 54px; height: 54px; grid-row: 1 / 4; place-items: center; color: #a8f3eb; border: 1px solid rgba(168,243,235,.22); border-radius: 16px; background: rgba(255,255,255,.07); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); font-size: 23px; backdrop-filter: blur(10px); }
.ax-hero-eyebrow { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; color: #6fdddb; font-size: 9px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.ax-hero-eyebrow::before { width: 6px; height: 6px; content: ""; border-radius: 50%; background: var(--ax-teal); box-shadow: 0 0 0 5px rgba(37,198,194,.1), 0 0 15px rgba(37,198,194,.58); }
.ax-page-hero h1 { overflow-wrap: anywhere; margin: 0; color: #fff; font-size: clamp(1.75rem,3vw,2.2rem); font-weight: 800; line-height: 1.08; letter-spacing: -.04em; }
.ax-page-hero p { max-width: 760px; margin: 7px 0 0; color: rgba(255,255,255,.66); font-size: 12px; line-height: 1.55; }
.ax-hero-context { position: relative; z-index: 1; display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.ax-context-pill { display: inline-flex; min-height: 39px; align-items: center; gap: 8px; padding: 8px 12px; color: rgba(255,255,255,.76); border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(255,255,255,.055); font-size: 10px; font-weight: 700; backdrop-filter: blur(8px); }
.ax-context-pill i { color: #8cece5; }

.ax-section-nav {
    position: relative;
    z-index: 30;
    top: auto;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    margin: 0 0 18px;
    padding: 7px;
    border: 1px solid var(--ax-line);
    border-radius: 15px;
    background: rgba(255,255,255,.9);
    box-shadow: 0 8px 28px rgba(16,24,40,.045);
    scrollbar-width: none;
    backdrop-filter: blur(16px);
}
.ax-section-nav::-webkit-scrollbar { display: none; }
.ax-section-nav button { display: inline-flex; min-height: 38px; flex: 0 0 auto; align-items: center; gap: 7px; padding: 8px 12px; color: var(--ax-muted); border: 0; border-radius: 10px; background: transparent; font-size: 10px; font-weight: 750; white-space: nowrap; cursor: pointer; transition: color .16s ease, background .16s ease, transform .16s ease; }
.ax-section-nav button:hover { color: #1d2939; background: #f2f4f7; transform: translateY(-1px); }
.ax-section-nav button.is-active { color: #fff; background: var(--ax-navy); box-shadow: 0 6px 14px rgba(7,23,35,.18); }
.ax-section-nav button.is-active i { color: #78e4de; }
.ax-section-anchor { scroll-margin-top: calc(var(--ax-topbar-height) + 76px); }

/* --------------------------------------------------------------------------
   Adaptador das páginas existentes
   -------------------------------------------------------------------------- */

.ax-page-content { min-width: 0; }

.ax-legacy-page {
    width: 100%;
    margin: 0;
    padding: 0;
    color: var(--ax-ink);
}

body.ax-shell .ax-legacy-page > .container,
body.ax-shell .ax-legacy-page > .container-fluid,
body.ax-shell .ax-modern-page > .container,
body.ax-shell .ax-modern-page > .container-fluid { max-width: none; }

body.ax-shell .ax-modern-page { min-height: 0 !important; padding: 0 !important; background: transparent !important; }

/* As topbars internas passam a funcionar como toolbars, porque o hero global já identifica a página. */
body.ax-shell .ax-inline-toolbar {
    position: relative !important;
    z-index: 20 !important;
    top: auto !important;
    margin: 0 0 17px !important;
    padding: 6px 8px !important;
    color: var(--ax-ink) !important;
    border: 1px solid var(--ax-line) !important;
    border-radius: 15px !important;
    background: rgba(255,255,255,.92) !important;
    box-shadow: var(--ax-shadow-sm) !important;
    backdrop-filter: blur(14px);
}

body.ax-shell .ax-inline-toolbar > .container,
body.ax-shell .ax-inline-toolbar > .container-fluid { max-width: none !important; padding: 4px 7px !important; }

body.ax-shell .ax-inline-toolbar .ax-toolbar-copy { display: none !important; }
body.ax-shell .ax-inline-toolbar .ax-toolbar-primary-row { justify-content: flex-end !important; }

/* Mantém as páginas Comercial, que já possuem o seu próprio hero, com o padding original. */
body.ax-shell .ch-page,
body.ax-shell .st-page.cx-enhanced,
body.ax-shell .obj-page.cx-enhanced { margin: -24px -28px -54px; }

/* Cartões */
body.ax-shell .ax-page-content .card,
body.ax-shell .ax-page-content .ax-surface-card {
    border: 1px solid var(--ax-line);
    border-radius: var(--ax-radius);
    background: rgba(255,255,255,.97);
    box-shadow: var(--ax-shadow-sm);
}

body.ax-shell .ax-page-content .card.shadow-sm { box-shadow: var(--ax-shadow-sm) !important; }
body.ax-shell .ax-page-content .card-header { padding: 15px 17px; border-bottom: 1px solid var(--ax-line); border-radius: var(--ax-radius) var(--ax-radius) 0 0; background: #fff; }
body.ax-shell .ax-page-content .card-header h1,
body.ax-shell .ax-page-content .card-header h2,
body.ax-shell .ax-page-content .card-header h3,
body.ax-shell .ax-page-content .card-header h4,
body.ax-shell .ax-page-content .card-header h5,
body.ax-shell .ax-page-content .card-header h6 { margin-bottom: 0; color: var(--ax-ink); font-weight: 780; letter-spacing: -.02em; }
body.ax-shell .ax-page-content .card-body { min-width: 0; padding: 17px; }

.ax-heading-icon { display: inline-grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; margin-right: 9px; color: #6941c6; border-radius: 10px; background: #f4f3ff; font-size: 15px; vertical-align: middle; }

/* Formulários */
body.ax-shell .ax-page-content label,
body.ax-shell .ax-page-content .small-label { color: #475467; font-size: 10px; font-weight: 750; letter-spacing: .015em; }

body.ax-shell .ax-page-content .form-control,
body.ax-shell .ax-page-content .custom-select,
body.ax-shell .ax-page-content select,
body.ax-shell .ax-page-content input[type="text"],
body.ax-shell .ax-page-content input[type="number"],
body.ax-shell .ax-page-content input[type="email"],
body.ax-shell .ax-page-content input[type="password"],
body.ax-shell .ax-page-content input[type="date"],
body.ax-shell .ax-page-content input[type="month"],
body.ax-shell .ax-page-content input[type="datetime-local"],
body.ax-shell .ax-page-content textarea {
    min-height: 42px;
    color: #344054;
    border: 1px solid var(--ax-line-strong);
    border-radius: var(--ax-radius-sm);
    background-color: #fff;
    box-shadow: none;
    font-size: 12px;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

body.ax-shell .ax-page-content textarea { min-height: 92px; }

body.ax-shell .ax-page-content .form-control:focus,
body.ax-shell .ax-page-content .custom-select:focus,
body.ax-shell .ax-page-content select:focus,
body.ax-shell .ax-page-content input:focus,
body.ax-shell .ax-page-content textarea:focus {
    border-color: #8c7cf8;
    outline: 0;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(109,93,252,.11);
}

body.ax-shell .ax-page-content .input-group-text { min-height: 42px; color: #667085; border-color: var(--ax-line-strong); background: #f9fafb; font-size: 11px; }
body.ax-shell .ax-page-content .custom-file-label { height: 42px; padding: 10px 12px; color: #667085; border-color: var(--ax-line-strong); border-radius: var(--ax-radius-sm); font-size: 11px; }
body.ax-shell .ax-page-content .custom-file-label::after { height: 40px; padding: 10px 12px; content: "Procurar"; border-color: var(--ax-line); background: #f2f4f7; }

/* Botões Bootstrap harmonizados */
body.ax-shell .ax-page-content .btn {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 13px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.15;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
body.ax-shell .ax-page-content .btn:hover:not(:disabled) { transform: translateY(-1px); }
body.ax-shell .ax-page-content .btn-sm { min-height: 34px; padding: 6px 10px; font-size: 10px; }
body.ax-shell .ax-page-content .btn-lg { min-height: 48px; padding: 10px 17px; font-size: 13px; }
body.ax-shell .ax-page-content .btn-primary { color: #fff; border-color: var(--ax-coral); background: var(--ax-coral); box-shadow: 0 8px 18px rgba(255,77,85,.18); }
body.ax-shell .ax-page-content .btn-primary:hover:not(:disabled) { border-color: #ee3e47; background: #ee3e47; box-shadow: 0 11px 22px rgba(255,77,85,.24); }
body.ax-shell .ax-page-content .btn-secondary,
body.ax-shell .ax-page-content .btn-dark { color: #fff; border-color: var(--ax-navy); background: var(--ax-navy); box-shadow: 0 7px 16px rgba(7,23,35,.14); }
body.ax-shell .ax-page-content .btn-secondary:hover:not(:disabled),
body.ax-shell .ax-page-content .btn-dark:hover:not(:disabled) { border-color: #123c4e; background: #123c4e; }
body.ax-shell .ax-page-content .btn-success { color: #fff; border-color: #0e9f72; background: #0e9f72; }
body.ax-shell .ax-page-content .btn-danger { color: #fff; border-color: var(--ax-red); background: var(--ax-red); }
body.ax-shell .ax-page-content .btn-warning { color: #6f3700; border-color: #fedf89; background: #fef0c7; }
body.ax-shell .ax-page-content .btn-info { color: #075985; border-color: #bae6fd; background: #e0f2fe; }
body.ax-shell .ax-page-content .btn-light { color: #344054; border-color: var(--ax-line); background: #f9fafb; }
body.ax-shell .ax-page-content .btn-outline-primary { color: #6941c6; border-color: #b9afff; background: #fff; }
body.ax-shell .ax-page-content .btn-outline-primary:hover { color: #fff; border-color: var(--ax-violet); background: var(--ax-violet); }
body.ax-shell .ax-page-content .btn-outline-secondary,
body.ax-shell .ax-page-content .btn-outline-dark { color: #344054; border-color: var(--ax-line-strong); background: #fff; }
body.ax-shell .ax-page-content .btn-outline-success { color: #067647; border-color: #abefc6; background: #f6fef9; }
body.ax-shell .ax-page-content .btn-outline-danger { color: #b42318; border-color: #fecdca; background: #fff8f7; }
body.ax-shell .ax-page-content .btn:focus { box-shadow: 0 0 0 3px rgba(109,93,252,.13); }

/* Tabelas */
body.ax-shell .ax-page-content .table-responsive,
body.ax-shell .ax-page-content .ax-table-scroll {
    overflow: auto;
    border: 1px solid var(--ax-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--ax-shadow-xs);
}
body.ax-shell .ax-page-content .table { width: 100%; margin-bottom: 0; color: #475467; background: #fff; font-size: 11px; }
body.ax-shell .ax-page-content .table thead th,
body.ax-shell .ax-page-content .table .thead-dark th {
    padding: 11px 13px;
    color: #667085;
    border: 0;
    border-bottom: 1px solid var(--ax-line);
    background: #f9fafb;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .055em;
    text-transform: uppercase;
    white-space: nowrap;
}
body.ax-shell .ax-page-content .table td,
body.ax-shell .ax-page-content .table tbody th { padding: 12px 13px; border-top: 0; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
body.ax-shell .ax-page-content .table-striped tbody tr:nth-of-type(odd) { background: #fcfcfd; }
body.ax-shell .ax-page-content .table-hover tbody tr:hover,
body.ax-shell .ax-page-content .table tbody tr:hover { background: #fafaff; }
body.ax-shell .ax-page-content .table-responsive thead th,
body.ax-shell .ax-page-content .ax-table-scroll thead th { position: sticky; z-index: 3; top: 0; }

/* Tabelas antigas sem wrapper ganham o mesmo aspeto sem mexer no DOM Angular. */
body.ax-shell .ax-page-content > table.table,
body.ax-shell .ax-legacy-page > table.table { border: 1px solid var(--ax-line); border-radius: 14px; box-shadow: var(--ax-shadow-xs); }

/* Feedback, badges e paginação */
body.ax-shell .ax-page-content .alert { padding: 11px 13px; border-radius: 11px; font-size: 11px; }
body.ax-shell .ax-page-content .alert-info { color: #175cd3; border-color: #b2ddff; background: #eff8ff; }
body.ax-shell .ax-page-content .alert-success { color: #067647; border-color: #abefc6; background: #ecfdf3; }
body.ax-shell .ax-page-content .alert-warning { color: #93370d; border-color: #fedf89; background: #fffaeb; }
body.ax-shell .ax-page-content .alert-danger { color: #b42318; border-color: #fecdca; background: #fef3f2; }
body.ax-shell .ax-page-content .badge { padding: .45em .68em; border-radius: 999px; font-size: 9px; font-weight: 800; }
body.ax-shell .ax-page-content .badge-primary { background: var(--ax-violet); }
body.ax-shell .ax-page-content .badge-success { background: var(--ax-green); }
body.ax-shell .ax-page-content .badge-danger { background: var(--ax-red); }
body.ax-shell .ax-page-content .badge-warning { color: #7a2e0e; background: #fedf89; }
body.ax-shell .ax-page-content .badge-light { color: #344054; border: 1px solid var(--ax-line); background: #f2f4f7; }
body.ax-shell .ax-page-content .badge-secondary { color: #344054; background: #eaecf0; }
body.ax-shell .ax-page-content .badge-info { color: #075985; background: #e0f2fe; }
body.ax-shell .ax-page-content .pagination { gap: 5px; }
body.ax-shell .ax-page-content .pagination .page-link { min-width: 34px; min-height: 34px; padding: 8px 10px; color: #475467; border: 1px solid var(--ax-line); border-radius: 9px; background: #fff; box-shadow: none; font-size: 10px; text-align: center; }
body.ax-shell .ax-page-content .pagination .active .page-link { color: #fff; border-color: var(--ax-navy); background: var(--ax-navy); }

/* Modais */
body.ax-shell .modal-backdrop.show { opacity: .48; backdrop-filter: blur(3px); }
body.ax-shell .modal-dialog { margin-top: 6vh; }
body.ax-shell .modal-content { overflow: hidden; border: 1px solid rgba(255,255,255,.45); border-radius: 18px; background: #fff; box-shadow: 0 28px 80px rgba(7,23,35,.25); }
body.ax-shell .modal-header { align-items: center; padding: 17px 19px; color: #fff; border: 0; background: linear-gradient(120deg,var(--ax-navy),var(--ax-navy-3)); }
body.ax-shell .modal-header .modal-title { color: #fff; font-size: 16px; font-weight: 780; letter-spacing: -.02em; }
body.ax-shell .modal-header .sp-modal-title { color: #fff; }
body.ax-shell .modal-header .bd-modal-subtitle,
body.ax-shell .modal-header .sp-modal-subtitle { color: rgba(255,255,255,.8); }
body.ax-shell .modal-body .modal-title { color: var(--ax-ink); }
body.ax-shell .modal-header .close { min-height: 34px; color: #fff; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: rgba(255,255,255,.08); opacity: 1; text-shadow: none; }
body.ax-shell .modal-header .btn-close { filter: invert(1) grayscale(100%) brightness(200%); opacity: 1; }
body.ax-shell .modal-body { padding: 19px; }
body.ax-shell .modal-footer { padding: 12px 19px; border-top: 1px solid var(--ax-line); background: #fafafa; }

/* Listas e elementos auxiliares */
body.ax-shell .ax-page-content .list-group { gap: 6px; }
body.ax-shell .ax-page-content .list-group-item { color: #475467; border: 1px solid var(--ax-line); border-radius: 11px !important; background: #fff; font-size: 11px; }
body.ax-shell .ax-page-content hr { border-color: var(--ax-line); }
body.ax-shell .ax-page-content a:not([class]) { color: #5b4acb; }
body.ax-shell .ax-page-content a:not([class]):hover { color: #392d9e; }
body.ax-shell .ax-page-content .ax-text-link { color: #5b4acb; }
body.ax-shell .ax-page-content .ax-text-link:hover { color: #392d9e; }

/* Erro global apresentado dentro do shell autenticado. */
body.ax-shell .ax-status-card { position: relative; overflow: hidden; width: min(100%,700px); margin-top: 18px; }
body.ax-shell .ax-status-card::before { position: absolute; top: 0; right: 0; left: 0; height: 4px; content: ""; background: linear-gradient(90deg,var(--ax-red),var(--ax-coral),var(--ax-violet)); }
body.ax-shell .ax-status-icon { display: inline-grid; width: 58px; height: 58px; margin-bottom: 18px; place-items: center; color: #b42318; border: 1px solid #fecdca; border-radius: 17px; background: #fef3f2; font-size: 24px; }
body.ax-shell .ax-request-id { display: inline-flex; max-width: 100%; flex-direction: column; gap: 4px; padding: 10px 14px; color: var(--ax-muted); border: 1px solid var(--ax-line); border-radius: 11px; background: var(--ax-soft); font-size: 10px; }
body.ax-shell .ax-request-id code { overflow-wrap: anywhere; color: var(--ax-ink); }

/* Estados de carregamento */
.ax-loading-copy { position: relative; overflow: hidden; }
.ax-loading-copy::after { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; content: ""; background: linear-gradient(90deg,transparent,var(--ax-teal),var(--ax-violet),transparent); transform: translateX(-100%); animation: ax-loading-line 1.3s ease-in-out infinite; }
.ax-loading-orbit { display: inline-flex; align-items: center; gap: 4px; margin-left: 7px; vertical-align: middle; }
.ax-loading-orbit i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .35; animation: ax-dot 1s ease-in-out infinite; }
.ax-loading-orbit i:nth-child(2) { animation-delay: .12s; }
.ax-loading-orbit i:nth-child(3) { animation-delay: .24s; }

/* Revelação progressiva */
.ax-reveal { opacity: 0; transform: translateY(10px) scale(.995); transition: opacity .38s ease var(--ax-delay,0ms), transform .38s cubic-bezier(.2,.75,.2,1) var(--ax-delay,0ms); }
.ax-reveal.is-visible { opacity: 1; transform: none; }

/* Harmonização de páginas modernas já existentes */
body.ax-shell .ax-modern-page [class*="-container"] { max-width: 1500px !important; }
body.ax-shell .ax-modern-page [class*="-primary-btn"] { border-color: var(--ax-coral) !important; background: var(--ax-coral) !important; box-shadow: 0 8px 18px rgba(255,77,85,.18) !important; }
body.ax-shell .ax-modern-page [class*="-card-header-dot"] { background: linear-gradient(var(--ax-teal),var(--ax-violet)) !important; box-shadow: 0 0 0 5px rgba(109,93,252,.08); }

/* Compatibilidade visual para utilitários Bootstrap 4 ainda usados pelas views. */
body.ax-shell .ml-auto { margin-left: auto !important; }
body.ax-shell .mr-1 { margin-right: .25rem !important; }
body.ax-shell .mr-2 { margin-right: .5rem !important; }
body.ax-shell .mr-3 { margin-right: 1rem !important; }
body.ax-shell .ml-1 { margin-left: .25rem !important; }
body.ax-shell .ml-2 { margin-left: .5rem !important; }
body.ax-shell .ml-3 { margin-left: 1rem !important; }
body.ax-shell .pl-1 { padding-left: .25rem !important; }
body.ax-shell .pr-1 { padding-right: .25rem !important; }
body.ax-shell .pr-3 { padding-right: 1rem !important; }
body.ax-shell .text-right { text-align: right !important; }
body.ax-shell .float-right { float: right !important; }
body.ax-shell .font-weight-bold { font-weight: 700 !important; }
body.ax-shell .font-weight-semibold { font-weight: 600 !important; }
body.ax-shell .text-monospace { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important; }
body.ax-shell .border-left { border-left: 1px solid var(--ax-line) !important; }
body.ax-shell .border-right { border-right: 1px solid var(--ax-line) !important; }
body.ax-shell #sidebar .chev { margin-left: auto !important; }
body.ax-shell .btn-block { display: block; width: 100%; }
body.ax-shell .badge-pill { padding-right: .65em; padding-left: .65em; border-radius: 10rem; }
body.ax-shell .form-row { display: flex; flex-wrap: wrap; margin-right: -5px; margin-left: -5px; }
body.ax-shell .form-row > .col,
body.ax-shell .form-row > [class*="col-"] { padding-right: 5px; padding-left: 5px; }
body.ax-shell .form-inline { display: flex; flex-flow: row wrap; align-items: center; }
body.ax-shell .input-group-prepend,
body.ax-shell .input-group-append { display: flex; }
body.ax-shell .input-group-prepend { margin-right: -1px; }
body.ax-shell .input-group-append { margin-left: -1px; }
body.ax-shell .custom-file { position: relative; display: inline-block; width: 100%; height: 42px; margin-bottom: 0; }
body.ax-shell .custom-file-input { position: relative; z-index: 2; width: 100%; height: 42px; margin: 0; opacity: 0; }
body.ax-shell .custom-file-label { position: absolute; z-index: 1; top: 0; right: 0; left: 0; overflow: hidden; height: 42px; margin: 0; padding-right: 92px; text-overflow: ellipsis; white-space: nowrap; }
body.ax-shell .custom-file-label::after { position: absolute; top: 0; right: 0; bottom: 0; display: flex; min-width: 82px; align-items: center; justify-content: center; padding: 0 12px; content: "Procurar"; color: #344054; border-left: 1px solid var(--ax-line-strong); background: #f2f4f7; }
body.ax-shell .form-control-file { display: block; width: 100%; }
body.ax-shell .close { float: right; color: #000; border: 0; background: transparent; font-size: 1.5rem; font-weight: 700; line-height: 1; opacity: .5; text-shadow: 0 1px 0 #fff; }
body.ax-shell .close:not(:disabled):not(.disabled):hover,
body.ax-shell .close:not(:disabled):not(.disabled):focus { color: #000; opacity: .75; text-decoration: none; }
body.ax-shell .modal-header .close:not(:disabled):not(.disabled):hover,
body.ax-shell .modal-header .close:not(:disabled):not(.disabled):focus { color: #fff; opacity: 1; }
body.ax-shell .sr-only { position: absolute; overflow: hidden; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
body.ax-shell .form-group { margin-bottom: 1rem; }
body.ax-shell .custom-control { position: relative; z-index: 1; display: block; min-height: 1.5rem; padding-left: 1.5rem; }
body.ax-shell .custom-control-input { position: absolute; z-index: -1; left: 0; width: 1rem; height: 1.25rem; opacity: 0; }
body.ax-shell .custom-control-label { position: relative; margin-bottom: 0; cursor: pointer; }
body.ax-shell .custom-control-label::before,
body.ax-shell .custom-control-label::after { position: absolute; top: .18rem; left: -1.5rem; display: block; width: 1rem; height: 1rem; content: ""; }
body.ax-shell .custom-control-label::before { border: 1px solid var(--ax-line-strong); background: #fff; }
body.ax-shell .custom-switch { padding-left: 2.25rem; }
body.ax-shell .custom-switch .custom-control-label::before { left: -2.25rem; width: 1.75rem; border-radius: .65rem; }
body.ax-shell .custom-switch .custom-control-label::after { top: calc(.18rem + 2px); left: calc(-2.25rem + 2px); width: calc(1rem - 4px); height: calc(1rem - 4px); border-radius: 50%; background: #98a2b3; transition: transform .15s ease, background .15s ease; }
body.ax-shell .custom-switch .custom-control-input:checked ~ .custom-control-label::before { border-color: var(--ax-violet); background: var(--ax-violet); }
body.ax-shell .custom-switch .custom-control-input:checked ~ .custom-control-label::after { background: #fff; transform: translateX(.75rem); }
body.ax-shell .custom-control-input:focus ~ .custom-control-label::before { box-shadow: 0 0 0 3px rgba(109,93,252,.12); }

/* Login */
body.ax-login-shell {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    color: var(--ax-ink);
    background: linear-gradient(145deg,#05121b 0%,#092332 55%,#0d3141 100%);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.ax-login-backdrop { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.ax-login-backdrop::before { position: absolute; top: -30%; right: -12%; width: 62vw; height: 62vw; content: ""; border: 1px solid rgba(255,255,255,.06); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.012),0 0 0 140px rgba(255,255,255,.009); }
.ax-login-backdrop::after { position: absolute; bottom: -33%; left: -12%; width: 55vw; height: 55vw; content: ""; border-radius: 50%; background: radial-gradient(circle,rgba(109,93,252,.2),transparent 66%); }
.ax-login-backdrop span { position: absolute; display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--ax-teal); box-shadow: 0 0 20px rgba(37,198,194,.9); animation: ax-float 7s ease-in-out infinite; }
.ax-login-backdrop span:nth-child(1) { top: 18%; left: 14%; }
.ax-login-backdrop span:nth-child(2) { top: 68%; right: 16%; animation-delay: -2s; }
.ax-login-backdrop span:nth-child(3) { top: 36%; right: 31%; animation-delay: -4s; }
.ax-login-wrapper { position: relative; z-index: 1; padding: 24px; }
body.ax-login-shell main { width: min(100%,470px); margin: 0 auto; padding: 0 !important; }
body.ax-login-shell main > * { border-radius: 22px !important; }
body.ax-login-shell .card,
body.ax-login-shell .ax-login-panel { border: 1px solid rgba(255,255,255,.6); background: rgba(255,255,255,.97); box-shadow: 0 30px 90px rgba(0,0,0,.28); backdrop-filter: blur(20px); }
body.ax-login-shell .form-control { min-height: 46px; border: 1px solid var(--ax-line-strong); border-radius: 11px; }
body.ax-login-shell .form-control:focus { border-color: #8c7cf8; box-shadow: 0 0 0 3px rgba(109,93,252,.12); }
body.ax-login-shell .btn-primary { min-height: 45px; border-color: var(--ax-coral); border-radius: 11px; background: var(--ax-coral); box-shadow: 0 9px 20px rgba(255,77,85,.22); font-weight: 750; }
.ax-login-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--ax-teal-dark); font-size: 9px; font-weight: 850; letter-spacing: .16em; }
.ax-login-kicker i { display: grid; width: 31px; height: 31px; place-items: center; color: #0b2935; border-radius: 10px; background: #9cf0e8; font-size: 14px; }

@keyframes ax-hero-in { from { opacity: 0; transform: translateY(-7px) scale(.995); } to { opacity: 1; transform: none; } }
@keyframes ax-loading-line { 0% { transform: translateX(-100%); } 55%,100% { transform: translateX(100%); } }
@keyframes ax-dot { 0%,100% { opacity: .3; transform: translateY(0); } 45% { opacity: 1; transform: translateY(-3px); } }
@keyframes ax-float { 0%,100% { transform: translate(0,0); opacity: .55; } 50% { transform: translate(12px,-18px); opacity: 1; } }

@media (max-width: 991.98px) {
    .ax-page-stage { padding: 18px 18px 45px !important; }
    body.ax-shell .ch-page,
    body.ax-shell .st-page.cx-enhanced,
    body.ax-shell .obj-page.cx-enhanced { margin: -18px -18px -45px; }
    .ax-page-hero { align-items: flex-start; flex-direction: column; padding: 23px 24px; }
    .ax-hero-context { width: 100%; }
    .ax-context-pill { flex: 1; justify-content: center; }
    .ax-section-nav { top: auto; }
}

@media (max-width: 768px) {
    :root { --ax-topbar-height: 62px; }
    body.ax-shell #sidebar.ax-sidebar { top: var(--ax-topbar-height); width: min(86vw,var(--ax-sidebar-width)); height: calc(100vh - var(--ax-topbar-height)); box-shadow: 18px 0 60px rgba(0,0,0,.28); }
    body.ax-shell.ax-sidebar-modal-open { overflow: hidden; }
    body.ax-shell .ax-sidebar-backdrop { position: fixed; z-index: 1025; inset: var(--ax-topbar-height) 0 0; display: block; margin: 0; padding: 0; border: 0; background: rgba(3,13,20,.38); backdrop-filter: blur(2px); }
    body.ax-shell .ax-sidebar-backdrop[hidden] { display: none; }
    .ax-topbar-inner { grid-template-columns: 40px minmax(0,1fr) auto; gap: 9px; padding: 8px 12px; }
    .ax-topbar-inner--database { grid-template-columns: 40px minmax(0,1fr) auto auto; }
    .ax-sidebar-toggle { width: 38px; height: 38px; }
    .ax-user-link { padding: 3px; }
    .ax-user-link > .bi-chevron-right { display: none; }
    .ax-page-stage { padding: 13px 12px 36px !important; }
    .ax-page-hero { min-height: 0; padding: 20px 17px; border-radius: 17px; }
    .ax-hero-copy { grid-template-columns: 43px minmax(0,1fr); column-gap: 12px; }
    .ax-hero-icon { width: 43px; height: 43px; flex-basis: 43px; border-radius: 13px; font-size: 18px; }
    .ax-page-hero h1 { font-size: 1.55rem; }
    .ax-page-hero p { font-size: 10px; }
    .ax-section-nav { position: relative; top: auto; margin-bottom: 13px; }
    body.ax-shell .ax-page-content .card-body { padding: 14px; }
    body.ax-shell .modal-dialog { margin: 0; }
    body.ax-shell .modal-content { min-height: 100vh; border-radius: 0; }
    body.ax-shell .ch-page,
    body.ax-shell .st-page.cx-enhanced,
    body.ax-shell .obj-page.cx-enhanced { margin: -13px -12px -36px; }
}

@media (prefers-reduced-motion: reduce) {
    body.ax-shell *, body.ax-shell *::before, body.ax-shell *::after,
    body.ax-login-shell *, body.ax-login-shell *::before, body.ax-login-shell *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    .ax-reveal { opacity: 1; transform: none; }
}
