/* Brand Experience Layer
   Global visual refinement built on top of tenant CSS variables. */

:root {
    --header-height: 50px;
    --app-shell-max: 1480px;
    --app-page-gap: clamp(1rem, 2vw, 1.75rem);
    --app-panel-radius: 8px;
    --app-field-height: 2.75rem;
    --app-focus-ring: 0 0 0 3px var(--glow-primary-sm);
    --app-border-subtle: color-mix(in srgb, var(--border-primary) 78%, transparent);
    --app-surface-soft: color-mix(in srgb, var(--overlay-card-a) 82%, transparent);
    --app-surface-strong: color-mix(in srgb, var(--overlay-card-b) 92%, var(--bg-secondary));
    --ops-graphite: #101820;
    --ops-steel: #7D8A92;
    --ops-teal: #1AA6A6;
    --ops-bio: #4B8F5A;
    --ops-grain: #C99A43;
    --ops-copper: #B46A3C;
    --ops-alert: #D05A47;
    --ops-panel-line: color-mix(in srgb, var(--primary) 28%, var(--border-primary));
    --ops-ivory: #F4F1E8;
    --ops-ink: #071117;
    --ops-depth: 0 24px 60px rgba(0, 0, 0, 0.22);
    --ops-hairline: color-mix(in srgb, var(--text-primary) 11%, transparent);
}

body {
    background:
        radial-gradient(circle at 12% 10%, color-mix(in srgb, var(--ops-teal) 12%, transparent) 0, transparent 28rem),
        radial-gradient(circle at 88% 4%, color-mix(in srgb, var(--ops-grain) 10%, transparent) 0, transparent 24rem),
        linear-gradient(180deg, color-mix(in srgb, var(--bg-primary) 88%, var(--ops-graphite) 12%), var(--bg-primary) 24rem),
        var(--bg-primary);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    opacity: 0.42;
    background-image:
        linear-gradient(90deg, color-mix(in srgb, var(--ops-steel) 12%, transparent) 1px, transparent 1px),
        linear-gradient(color-mix(in srgb, var(--ops-steel) 10%, transparent) 1px, transparent 1px),
        linear-gradient(135deg, transparent 0 47%, color-mix(in srgb, var(--ops-grain) 8%, transparent) 48% 52%, transparent 53% 100%);
    background-size: 96px 96px, 96px 96px, 28px 28px;
    mask-image: linear-gradient(180deg, black, transparent 68%);
}

.content-shell,
.app-main .container,
.app-main .list-page,
.app-main .form-page,
.app-main .detail-page,
.app-main .confirm-page,
.app-main .content-page {
    width: min(100%, var(--app-shell-max));
}

.app-main {
    padding-top: clamp(1rem, 2vw, 1.75rem);
}

.site-header {
    border-bottom-color: var(--app-border-subtle);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--primary) 12%, transparent), transparent 34%),
        color-mix(in srgb, var(--overlay-header) 94%, var(--ops-graphite)) !important;
    height: var(--header-height) !important;
    min-height: var(--header-height) !important;
    padding: 0 clamp(0.75rem, 1.5vw, 1.25rem) !important;
}

.site-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ops-teal), var(--ops-grain), transparent);
    opacity: 0.72;
}

.site-header .brand-title {
    max-width: min(34vw, 28rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-header .brand-logo {
    width: 30px !important;
    height: 30px !important;
    padding: 0.18rem !important;
    border-radius: var(--app-panel-radius);
    background: var(--app-surface-soft);
    border: 1px solid var(--ops-hairline);
}

.site-header .brand-title {
    font-family: var(--font-display);
    font-size: clamp(0.86rem, 1vw, 1rem) !important;
    letter-spacing: 0.025em;
    filter: none;
}

.site-header .logo-sub {
    display: none;
    color: color-mix(in srgb, var(--ops-grain) 88%, var(--text-secondary));
    letter-spacing: 0.28em;
}

.site-header .header-brand,
.site-header [data-user-menu],
header > nav > ul,
header > nav > ul > li {
    height: var(--header-height) !important;
}

.site-header .brand-link {
    gap: 0.5rem !important;
}

header > nav {
    margin: 0 clamp(0.4rem, 1vw, 0.9rem) !important;
}

header > nav > ul {
    gap: 0.15rem !important;
}

header > nav > ul > li > span,
[data-user-menu] > span {
    min-height: 1.78rem;
    padding: 0.32rem 0.5rem !important;
    border-radius: 6px !important;
    font-size: 0.62rem !important;
    letter-spacing: 0.055em !important;
}

.site-header [data-user-menu] > span {
    max-width: 13rem;
}

.user-menu-greeting {
    max-width: 7.5rem;
}

.user-theme-badge {
    min-height: 1.18rem !important;
    padding: 0.05rem 0.34rem !important;
    font-size: 0.52rem !important;
}

.site-header [data-user-menu] > span {
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--ops-teal) 10%, transparent), transparent),
        color-mix(in srgb, var(--overlay-card-a) 82%, transparent) !important;
}

.site-header [data-user-menu] > span::after {
    content: "" !important;
    width: 0.42rem;
    height: 0.42rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
    opacity: 0.72;
}

.site-header [data-user-menu] > ul.user-menu-panel {
    width: min(19rem, calc(100vw - 1rem));
    padding: 0.48rem !important;
}

.user-menu-summary {
    padding: 0.62rem 0.68rem 0.58rem;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--ops-teal) 18%, transparent);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--ops-teal) 10%, transparent), transparent 58%),
        color-mix(in srgb, var(--bg-primary) 42%, transparent);
}

.user-menu-summary strong,
.user-menu-summary small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-summary strong {
    color: var(--text-primary);
    font-size: 0.82rem;
    line-height: 1.25;
}

.user-menu-summary small {
    margin-top: 0.18rem;
    color: var(--text-secondary);
    font-size: 0.68rem;
}

.site-header [data-user-menu] > ul.user-menu-panel > li > a {
    min-height: 2rem;
    display: flex;
    align-items: center;
    margin-top: 0.32rem;
    padding: 0 0.62rem !important;
    border-radius: 6px;
    font-size: 0.76rem !important;
    font-weight: 800;
}

.site-header [data-user-menu] > ul.user-menu-panel > li:last-child > a {
    color: color-mix(in srgb, var(--danger) 84%, var(--text-primary)) !important;
}

.theme-switcher-item {
    margin-top: 0.32rem;
    padding: 0.58rem !important;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--border-secondary) 72%, transparent) !important;
    background: color-mix(in srgb, var(--overlay-card-a) 54%, transparent);
}

.theme-switcher-label {
    margin-bottom: 0.42rem !important;
    color: color-mix(in srgb, var(--text-secondary) 82%, var(--ops-grain)) !important;
    font-size: 0.6rem !important;
    font-weight: 900 !important;
}

.theme-switcher-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.28rem !important;
}

.theme-switcher-btn {
    width: 100%;
    min-height: 1.72rem;
    padding: 0 0.45rem !important;
    border-radius: 6px !important;
    font-size: 0.68rem !important;
    font-weight: 900;
    background: color-mix(in srgb, var(--bg-primary) 48%, transparent) !important;
}

.theme-switcher-btn.is-active {
    background: linear-gradient(180deg, var(--ops-teal), color-mix(in srgb, var(--ops-teal) 70%, var(--primary))) !important;
    color: var(--text-inverse) !important;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--ops-teal) 22%, transparent) !important;
}

header > nav > ul > li > span,
[data-user-menu] > span {
    border: 1px solid transparent;
}

header > nav > ul > li:hover > span,
[data-user-menu]:hover > span {
    border-color: var(--app-border-subtle);
}

header > nav > ul > li > ul,
[data-user-menu] > ul {
    border-radius: 8px !important;
    border: 1px solid var(--app-border-subtle) !important;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--overlay-card-a) 96%, var(--ops-graphite)), var(--overlay-card-b)) !important;
    box-shadow: var(--ops-depth) !important;
    backdrop-filter: blur(18px);
    top: calc(var(--header-height) - 1px) !important;
}

header > nav > ul > li {
    isolation: isolate;
}

header > nav > ul > li > ul.nav-mega {
    width: min(26rem, calc(100vw - 2rem));
    max-height: min(68vh, 560px);
    overflow: auto;
    padding: 0.52rem !important;
}

header > nav > ul > li > ul.nav-mega-wide {
    position: fixed !important;
    top: calc(var(--header-height) + 0.35rem) !important;
    left: 50% !important;
    right: auto !important;
    width: min(54rem, calc(100vw - 1.5rem));
    max-height: min(72vh, 600px);
    display: grid;
    grid-template-columns: 14rem repeat(3, minmax(0, 1fr));
    gap: 0.42rem;
    transform: translate(-50%, -8px) !important;
}

header > nav > ul > li:hover > ul.nav-mega-wide,
header > nav > ul > li > ul.nav-mega-wide.open {
    transform: translate(-50%, 0) !important;
}

.nav-mega-summary,
.nav-mega-section {
    list-style: none;
}

.nav-mega-summary {
    padding: 0.58rem !important;
    border-radius: 8px;
    border: 1px solid var(--ops-hairline);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--ops-teal) 14%, transparent), transparent 56%),
        color-mix(in srgb, var(--bg-primary) 50%, var(--overlay-card-a));
}

.nav-mega-summary strong {
    display: block;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.92rem;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.nav-mega-summary small {
    display: block;
    margin-top: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.45;
}

.nav-mega-wide .nav-mega-summary {
    grid-row: span 4;
}

.nav-mega-section {
    padding: 0.34rem !important;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--border-secondary) 70%, transparent);
    background: color-mix(in srgb, var(--overlay-card-a) 62%, transparent);
}

.nav-section-title {
    display: flex !important;
    align-items: center;
    min-height: 1.45rem !important;
    padding: 0 0.35rem 0.35rem !important;
    color: color-mix(in srgb, var(--ops-grain) 84%, var(--text-secondary)) !important;
    font-size: 0.66rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase;
}

.nav-section-title::after {
    content: "" !important;
    display: none !important;
}

.nav-section-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.2rem;
}

.nav-section-links a {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
    min-height: 1.95rem;
    padding: 0.3rem 0.4rem !important;
    border-radius: 6px;
    color: var(--text-primary) !important;
    text-decoration: none;
    font-size: 0.82rem !important;
    line-height: 1.25;
}

.nav-section-links a:hover {
    background: color-mix(in srgb, var(--ops-teal) 12%, transparent) !important;
}

.nav-item-tag {
    min-width: 2.15rem;
    min-height: 1.18rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--ops-teal);
    background: color-mix(in srgb, var(--ops-teal) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--ops-teal) 28%, transparent);
    font-family: var(--font-mono);
    font-size: 0.56rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.nav-item-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-header,
.card,
.dashboard-card,
.app-form,
.table-wrapper,
.list-filter-panel,
.dashboard-premium .stat-card,
.dashboard-premium .chart-card,
.dashboard-premium .recent-activities,
.dashboard-premium .notification-table-wrapper,
.dashboard-premium .notification-overview-card,
.dashboard-premium .module-overview-card {
    border-radius: var(--app-panel-radius) !important;
    border: 1px solid var(--app-border-subtle) !important;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--ops-teal) 10%, transparent), transparent 28%),
        linear-gradient(180deg, var(--app-surface-soft), var(--app-surface-strong)) !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.14) !important;
    position: relative;
}

.page-header::before,
.card::before,
.dashboard-card::before,
.app-form::before,
.table-wrapper::before,
.dashboard-premium .stat-card::before,
.dashboard-premium .chart-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--ops-teal), var(--ops-grain));
    opacity: 0.78;
    border-radius: var(--app-panel-radius) 0 0 var(--app-panel-radius);
}

.page-header {
    padding: clamp(1rem, 2vw, 1.5rem) !important;
}

.page-header-content {
    gap: 1rem;
}

.page-header-left h1,
.dashboard-section-title,
.card-header h2,
.card-header h3 {
    letter-spacing: 0;
}

.page-breadcrumb {
    gap: 0.5rem !important;
}

.page-breadcrumb a,
.page-breadcrumb span {
    min-height: 2rem;
    display: inline-flex;
    align-items: center;
}

.action-buttons {
    gap: 0.5rem !important;
}

.btn,
button,
input[type="submit"],
input[type="button"],
table td a,
.actions-cell .btn {
    border-radius: var(--app-panel-radius) !important;
    min-height: 2.35rem;
    font-weight: 700;
    letter-spacing: 0;
}

.btn-primary,
button[type="submit"],
input[type="submit"] {
    background: linear-gradient(180deg, var(--primary-light), var(--primary-dark)) !important;
    color: var(--text-inverse) !important;
    border-color: color-mix(in srgb, var(--primary) 70%, var(--border-primary)) !important;
}

.btn-secondary,
.btn-outline,
table td a {
    background: color-mix(in srgb, var(--overlay-card-a) 88%, transparent) !important;
    border: 1px solid var(--app-border-subtle) !important;
    color: var(--text-primary) !important;
}

.btn:hover,
button:hover,
table td a:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px var(--glow-primary-sm) !important;
}

.form-grid {
    gap: clamp(0.85rem, 1.6vw, 1.25rem) !important;
}

.form-group label,
.form-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.page-header-left h1,
.hero-greeting,
.dashboard-section-title {
    font-weight: 800 !important;
    color: var(--text-primary);
}

.dashboard-section-kicker,
.hero-kicker,
.brand-section-kicker,
.brand-preview-kicker {
    color: var(--ops-grain) !important;
}

.form-control,
input,
select,
textarea {
    min-height: var(--app-field-height);
    border-radius: var(--app-panel-radius) !important;
    border: 1px solid var(--app-border-subtle) !important;
    background: var(--overlay-input) !important;
    color: var(--text-primary) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

textarea.form-control,
textarea {
    min-height: 7rem;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: var(--app-focus-ring) !important;
    outline: none !important;
}

input[type="color"].form-control {
    min-height: 3.25rem;
    padding: 0.3rem;
    cursor: pointer;
}

.form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--primary);
}

.table-wrapper {
    overflow: hidden;
}

table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

thead th,
.dashboard-premium .data-table th {
    background: color-mix(in srgb, var(--overlay-search) 88%, var(--primary-soft)) !important;
    color: var(--text-secondary) !important;
    font-size: 0.72rem !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tbody td {
    border-color: var(--border-secondary) !important;
}

tbody tr:hover td {
    background: var(--bg-hover) !important;
}

.badge,
.status-badge,
.stat-trend,
.chart-card-badge {
    border-radius: 999px !important;
    border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}

.dashboard-premium .hero-section {
    position: relative;
    border-radius: var(--app-panel-radius) !important;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--ops-teal) 16%, transparent), transparent 36%),
        linear-gradient(135deg, color-mix(in srgb, var(--ops-grain) 14%, transparent), transparent 62%),
        linear-gradient(180deg, var(--app-surface-soft), var(--app-surface-strong)) !important;
    border: 1px solid var(--app-border-subtle) !important;
    overflow: hidden;
    box-shadow: var(--ops-depth) !important;
}

.dashboard-premium .hero-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(90deg, color-mix(in srgb, var(--text-primary) 8%, transparent) 1px, transparent 1px),
        linear-gradient(color-mix(in srgb, var(--text-primary) 6%, transparent) 1px, transparent 1px);
    background-size: 44px 44px;
    opacity: 0.36;
    mask-image: linear-gradient(90deg, transparent, black 18%, transparent 92%);
    pointer-events: none;
}

.dashboard-premium .hero-layout {
    position: relative;
    z-index: 1;
    gap: clamp(1.25rem, 2.6vw, 2.5rem) !important;
}

.dashboard-premium .hero-content {
    max-width: 760px;
}

.dashboard-premium .hero-greeting {
    font-size: clamp(2rem, 4.2vw, 4.7rem) !important;
    line-height: 0.95 !important;
    max-width: 11ch;
    margin-bottom: 1rem !important;
}

.dashboard-premium .hero-subtitle {
    max-width: 680px;
    font-size: clamp(0.98rem, 1.4vw, 1.18rem) !important;
    color: color-mix(in srgb, var(--text-secondary) 86%, var(--ops-ivory));
}

.dashboard-premium .hero-meta {
    gap: 0.6rem !important;
    flex-wrap: wrap;
}

.dashboard-premium .hero-meta-item,
.dashboard-premium .status-badge {
    min-height: 2.25rem;
    display: inline-flex;
    align-items: center;
    border-radius: 999px !important;
    background: color-mix(in srgb, var(--overlay-card-a) 70%, transparent) !important;
    border: 1px solid var(--ops-hairline) !important;
}

.dashboard-premium .hero-side-panel {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 0.8rem;
}

.ops-blueprint-card,
.dashboard-premium .hero-side-card {
    border-radius: 8px !important;
    border: 1px solid var(--ops-hairline) !important;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--ops-teal) 10%, transparent), transparent 48%),
        color-mix(in srgb, var(--overlay-card-a) 86%, transparent) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 16px 34px rgba(0, 0, 0, 0.12);
}

.ops-blueprint-card {
    padding: 1rem;
}

.ops-blueprint-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.ops-blueprint-header span {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ops-blueprint-header strong {
    color: var(--ops-grain);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ops-process-map {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    position: relative;
}

.ops-process-map::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0.6rem;
    right: 0.6rem;
    height: 1px;
    background: linear-gradient(90deg, var(--ops-teal), var(--ops-grain), var(--primary));
    opacity: 0.44;
}

.ops-process-map span {
    position: relative;
    min-height: 2.25rem;
    display: inline-flex;
    align-items: center;
    padding: 0 0.72rem 0 1.95rem;
    border-radius: 6px;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--bg-primary) 58%, var(--overlay-card-a));
    border: 1px solid var(--ops-hairline);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.ops-process-map span::before {
    content: "";
    position: absolute;
    left: 0.72rem;
    width: 0.52rem;
    height: 0.52rem;
    border-radius: 50%;
    background: var(--ops-teal);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--ops-teal) 16%, transparent);
}

.ops-process-map span:nth-child(2n)::before {
    background: var(--ops-grain);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--ops-grain) 16%, transparent);
}

.ops-intelligence-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: calc(var(--app-page-gap) * -0.25) 0 calc(var(--app-page-gap) * 1.35);
    border: 1px solid var(--app-border-subtle);
    border-radius: 8px;
    overflow: hidden;
    background: var(--app-border-subtle);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.10);
}

.ops-intelligence-item {
    min-width: 0;
    padding: 1rem;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--ops-grain) 9%, transparent), transparent 58%),
        color-mix(in srgb, var(--overlay-card-a) 90%, var(--bg-secondary));
}

.ops-intelligence-code {
    display: inline-flex;
    min-width: 3rem;
    min-height: 1.55rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.7rem;
    border-radius: 999px;
    color: var(--ops-teal);
    background: color-mix(in srgb, var(--ops-teal) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--ops-teal) 28%, transparent);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.ops-intelligence-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.92rem;
    margin-bottom: 0.25rem;
}

.ops-intelligence-item small {
    display: block;
    color: var(--text-secondary);
    line-height: 1.45;
}

.dashboard-premium .stats-grid {
    gap: var(--app-page-gap) !important;
}

.dashboard-premium .stat-card,
.dashboard-premium .chart-card {
    min-height: 100%;
}

.dashboard-premium .stat-card {
    overflow: hidden;
    padding: clamp(1rem, 1.8vw, 1.25rem) !important;
}

.dashboard-premium .stat-card::after {
    content: "";
    position: absolute;
    inset: auto 1rem 1rem auto;
    width: 5.5rem;
    height: 5.5rem;
    border: 1px solid color-mix(in srgb, var(--stat-accent, var(--ops-teal)) 28%, transparent);
    border-radius: 50%;
    opacity: 0.18;
    background:
        linear-gradient(90deg, transparent 48%, color-mix(in srgb, var(--stat-accent, var(--ops-teal)) 55%, transparent) 49% 51%, transparent 52%),
        linear-gradient(0deg, transparent 48%, color-mix(in srgb, var(--stat-accent, var(--ops-teal)) 55%, transparent) 49% 51%, transparent 52%);
}

.dashboard-premium .stat-card-product { --stat-accent: var(--ops-teal); }
.dashboard-premium .stat-card-production { --stat-accent: var(--primary); }
.dashboard-premium .stat-card-alert { --stat-accent: var(--ops-alert); }
.dashboard-premium .stat-card-quality { --stat-accent: var(--ops-bio); }
.dashboard-premium .stat-card-cost { --stat-accent: var(--ops-copper); }
.dashboard-premium .stat-card-revenue { --stat-accent: var(--success); }
.dashboard-premium .stat-card-cash { --stat-accent: var(--ops-grain); }

.dashboard-premium .stat-icon {
    width: 3rem !important;
    height: 2rem !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 6px !important;
    font-family: var(--font-mono);
    font-size: 0.72rem !important;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: color-mix(in srgb, var(--stat-accent, var(--ops-teal)) 82%, var(--text-primary));
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--stat-accent, var(--ops-teal)) 16%, transparent), transparent),
        color-mix(in srgb, var(--overlay-card-a) 88%, transparent);
    border: 1px solid color-mix(in srgb, var(--stat-accent, var(--ops-teal)) 34%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.dashboard-premium .stat-value {
    font-family: var(--font-display);
    letter-spacing: 0;
    font-size: clamp(1.65rem, 2.6vw, 2.45rem) !important;
    color: color-mix(in srgb, var(--text-primary) 94%, var(--stat-accent, var(--ops-teal)));
}

.dashboard-premium .stat-footer {
    border-top: 1px solid var(--border-secondary);
    padding-top: 0.75rem;
}

.dashboard-premium .module-overview-card {
    overflow: hidden;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.dashboard-premium .module-overview-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--ops-teal) 42%, var(--border-primary)) !important;
    box-shadow: var(--ops-depth) !important;
}

.dashboard-premium .module-overview-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--ops-teal), var(--ops-grain), var(--primary));
    opacity: 0.72;
}

.dashboard-premium .module-overview-tag,
.chart-card-badge,
.stat-trend {
    background: color-mix(in srgb, var(--ops-grain) 14%, transparent) !important;
    color: color-mix(in srgb, var(--ops-grain) 84%, var(--text-primary)) !important;
}

.quick-action-btn {
    border-radius: var(--app-panel-radius) !important;
    border: 1px solid var(--app-border-subtle) !important;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--primary) 10%, transparent), transparent),
        linear-gradient(180deg, var(--app-surface-soft), var(--app-surface-strong)) !important;
}

.quick-action-arrow {
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--ops-teal) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--ops-teal) 26%, transparent);
}

.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
    gap: var(--app-page-gap);
    margin-bottom: 2.25rem;
}

.insight-panel {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--app-border-subtle);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--ops-teal) 10%, transparent), transparent 48%),
        linear-gradient(180deg, var(--app-surface-soft), var(--app-surface-strong));
    box-shadow: var(--ops-depth);
}

.insight-panel::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--ops-teal), var(--ops-grain));
}

.insight-panel-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border-secondary) 74%, transparent);
}

.insight-kicker {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--ops-grain);
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.insight-panel h3 {
    margin: 0;
    font-size: 0.98rem;
}

.insight-panel p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
}

.insight-bars {
    display: grid;
    gap: 0.72rem;
    padding: 0.95rem 1rem 1rem;
}

.insight-bar-row {
    display: grid;
    gap: 0.38rem;
}

.insight-bar-meta {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
}

.insight-code {
    min-width: 2.4rem;
    min-height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--insight-color, var(--ops-teal));
    background: color-mix(in srgb, var(--insight-color, var(--ops-teal)) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--insight-color, var(--ops-teal)) 28%, transparent);
    font-family: var(--font-mono);
    font-size: 0.56rem;
    font-weight: 900;
    letter-spacing: 0.07em;
}

.insight-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.insight-bar-meta strong {
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: var(--font-mono);
}

.insight-track {
    height: 0.42rem;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-primary) 58%, var(--overlay-card-a));
    border: 1px solid color-mix(in srgb, var(--border-secondary) 70%, transparent);
}

.insight-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--insight-color, var(--ops-teal)), color-mix(in srgb, var(--insight-color, var(--ops-teal)) 58%, var(--ops-grain)));
    box-shadow: 0 0 16px color-mix(in srgb, var(--insight-color, var(--ops-teal)) 24%, transparent);
}

.insight-tone-teal,
.insight-tone-primary {
    --insight-color: var(--ops-teal);
}

.insight-tone-grain {
    --insight-color: var(--ops-grain);
}

.insight-tone-alert {
    --insight-color: var(--danger);
}

.insight-tone-bio {
    --insight-color: var(--ops-bio);
}

.quick-action-btn:hover {
    border-color: color-mix(in srgb, var(--ops-teal) 42%, var(--border-primary)) !important;
}

.chart-svg rect[fill] {
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.18));
}

.chart-placeholder-icon,
.recent-empty-icon {
    width: 3.25rem !important;
    height: 2.25rem !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.78rem !important;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: var(--ops-grain);
    border: 1px solid color-mix(in srgb, var(--ops-grain) 36%, transparent);
    background: color-mix(in srgb, var(--ops-grain) 12%, transparent);
}

/* Dashboard notifications */
.dashboard-premium .notification-command-panel {
    overflow: hidden;
}

.dashboard-premium .notification-command-panel .recent-header {
    padding: clamp(1rem, 2vw, 1.35rem) clamp(1rem, 2vw, 1.5rem) !important;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--ops-teal) 12%, transparent), transparent 40%),
        color-mix(in srgb, var(--overlay-card-a) 92%, var(--ops-graphite)) !important;
}

.dashboard-premium .notification-command-panel .recent-title {
    margin-top: 0.18rem;
    font-size: clamp(1.15rem, 1.8vw, 1.45rem) !important;
    letter-spacing: 0;
}

.dashboard-premium .notification-command-panel .recent-title::before {
    width: 0.55rem;
    height: 0.55rem;
    background: var(--ops-grain);
    box-shadow: 0 0 0 0.3rem color-mix(in srgb, var(--ops-grain) 14%, transparent);
}

.dashboard-premium .notification-overview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem !important;
}

.dashboard-premium .notification-overview-card {
    min-height: 5.4rem;
    justify-content: space-between;
    border-radius: 8px !important;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--ops-teal) 10%, transparent), transparent 58%),
        color-mix(in srgb, var(--overlay-card-a) 86%, var(--bg-primary)) !important;
}

.dashboard-premium .notification-overview-card strong {
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 3vw, 2.2rem) !important;
    line-height: 1;
}

.notification-feed {
    display: grid;
    gap: 0.65rem;
}

.notification-feed-card {
    --notification-accent: var(--ops-teal);
    display: grid;
    grid-template-columns: minmax(5rem, auto) minmax(0, 1fr);
    gap: 0.85rem;
    align-items: start;
    padding: 0.82rem;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--notification-accent) 22%, var(--border-primary));
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--notification-accent) 10%, transparent), transparent 44%),
        color-mix(in srgb, var(--overlay-card-b) 88%, var(--bg-primary));
}

.notification-feed-warning {
    --notification-accent: var(--warning);
}

.notification-feed-error {
    --notification-accent: var(--danger);
}

.notification-feed-success {
    --notification-accent: var(--success);
}

.notification-feed-signal {
    display: flex;
    align-items: flex-start;
}

.notification-feed-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.notification-feed-title-row strong {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.35;
}

.notification-feed-content p {
    margin: 0.35rem 0 0;
    max-width: 72rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

.notification-feed-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.7rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 0.68rem;
}

.notification-feed-meta a {
    min-height: 1.55rem;
    display: inline-flex;
    align-items: center;
    padding: 0 0.5rem;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--ops-teal) 28%, transparent);
    color: color-mix(in srgb, var(--ops-teal) 86%, var(--text-primary));
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 850;
}

.notification-feed-meta a:hover {
    background: color-mix(in srgb, var(--ops-teal) 12%, transparent);
}

@media (max-width: 720px) {
    .notification-feed-card {
        grid-template-columns: 1fr;
    }

    .notification-feed-title-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Enterprise detail pages */
.detail-page {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: clamp(0.9rem, 1.6vw, 1.25rem);
    margin-top: 0 !important;
    align-items: start;
}

.detail-page > * {
    grid-column: 1 / -1;
}

.detail-page .page-header {
    position: relative;
    margin: 0 !important;
    padding: 0.62rem 0.72rem !important;
    border-radius: 8px !important;
    overflow: hidden;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--ops-teal) 14%, transparent), transparent 44%),
        linear-gradient(180deg, color-mix(in srgb, var(--overlay-card-a) 94%, var(--ops-graphite)), var(--overlay-card-b)) !important;
}

.detail-page .page-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: auto;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--ops-teal), var(--ops-grain));
}

.detail-page .page-header-content,
.detail-page .page-header-left {
    width: 100%;
    display: flex !important;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.35rem 0.65rem;
}

.detail-page .page-header-left h1 {
    flex: 1 1 24rem;
    min-width: 0;
    max-width: calc(100% - 24rem);
    margin: 0 !important;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 1.7vw, 1.42rem) !important;
    line-height: 1.12 !important;
    letter-spacing: 0 !important;
    overflow-wrap: anywhere;
}

.detail-page .page-breadcrumb {
    order: 2;
    flex: 1 1 100%;
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.32rem !important;
    margin: 0 !important;
}

.detail-page .page-breadcrumb::before {
    content: "DET";
    min-height: 1.48rem;
    display: inline-flex;
    align-items: center;
    padding: 0 0.42rem;
    border-radius: 6px;
    color: var(--ops-grain);
    border: 1px solid color-mix(in srgb, var(--ops-grain) 32%, transparent);
    background: color-mix(in srgb, var(--ops-grain) 10%, transparent);
    font-family: var(--font-mono);
    font-size: 0.56rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.detail-page .page-breadcrumb > a {
    min-height: 1.48rem !important;
    padding: 0 0.44rem !important;
    border-radius: 6px !important;
    font-size: 0.65rem !important;
    font-weight: 800;
}

.detail-page .page-header-right,
.detail-page .page-breadcrumb .page-header-right {
    order: 1;
    flex: 0 1 auto;
    margin-left: auto !important;
}

.detail-page .page-breadcrumb .page-header-right {
    position: absolute;
    top: 0.62rem;
    right: 0.72rem;
    max-width: min(52%, 38rem);
}

.detail-page .action-buttons {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.25rem !important;
}

.detail-page .action-buttons form {
    margin: 0 !important;
}

.detail-page .page-header-right .btn,
.detail-page .section-header .btn,
.detail-page .section-header .action-buttons > *,
.detail-page .action-buttons button {
    min-height: 1.62rem !important;
    padding: 0 0.48rem !important;
    border-radius: 6px !important;
    font-size: 0.62rem !important;
    font-weight: 850 !important;
}

.detail-page .page-header .badge,
.detail-page .page-header .super-admin-badge {
    min-height: 1.35rem !important;
    padding: 0.08rem 0.42rem !important;
    font-size: 0.58rem !important;
}

.detail-page .status-bar {
    margin: 0 !important;
    padding: 0.5rem 0.65rem !important;
    border-radius: 8px !important;
    border: 1px solid var(--app-border-subtle) !important;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--ops-grain) 9%, transparent), transparent),
        color-mix(in srgb, var(--overlay-card-a) 78%, transparent) !important;
    box-shadow: none !important;
}

.detail-page .status-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem !important;
}

.detail-page .status-bar .badge,
.detail-page .info-value .badge {
    min-height: 1.45rem;
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.55rem;
    border-radius: 999px !important;
    font-size: 0.68rem;
    font-weight: 850;
}

.detail-page .dashboard-grid {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    grid-auto-flow: dense;
    align-items: start;
    gap: 0.9rem !important;
    margin: 0 !important;
}

.detail-secondary-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    align-items: start;
}

.detail-secondary-grid > .table-wrapper,
.detail-secondary-grid > .dashboard-card,
.detail-secondary-grid > .card {
    min-width: 0;
    margin: 0 !important;
}

.detail-page .dashboard-grid > .dashboard-card,
.detail-page .dashboard-grid > .card {
    grid-column: span 4;
}

.detail-page .dashboard-grid > .dashboard-card:only-child,
.detail-page .dashboard-grid > .card:only-child {
    grid-column: 1 / -1;
}

.detail-page .dashboard-grid:has(> .dashboard-card:nth-child(2):last-child) > .dashboard-card,
.detail-page .dashboard-grid:has(> .card:nth-child(2):last-child) > .card {
    grid-column: span 6;
}

.detail-page .dashboard-grid:has(> .dashboard-card:nth-child(3):last-child) > .dashboard-card,
.detail-page .dashboard-grid:has(> .card:nth-child(3):last-child) > .card {
    grid-column: span 4;
}

.detail-page .dashboard-grid:has(> .dashboard-card:nth-child(4):last-child) > .dashboard-card,
.detail-page .dashboard-grid:has(> .card:nth-child(4):last-child) > .card {
    grid-column: span 3;
}

.detail-page .dashboard-card,
.detail-page .card,
.detail-page > .table-wrapper {
    border-radius: 8px !important;
    border: 1px solid var(--app-border-subtle) !important;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--overlay-card-a) 88%, transparent), color-mix(in srgb, var(--overlay-card-b) 94%, var(--bg-secondary))) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.13) !important;
}

.detail-page .dashboard-card,
.detail-page .card {
    min-width: 0;
    overflow: hidden;
}

.detail-page .dashboard-card::after,
.detail-page .card::after {
    display: none !important;
}

.detail-page .dashboard-card > .card-header,
.detail-page .card > .card-header {
    padding: 0.68rem 0.78rem 0.35rem !important;
    border-bottom: 0 !important;
    background: transparent !important;
}

.detail-page .dashboard-card > .card-header::before,
.detail-page .card > .card-header::before,
.detail-page > .table-wrapper > h2::before {
    content: "";
    width: 0.48rem;
    height: 0.48rem;
    display: inline-flex;
    flex: 0 0 auto;
    border-radius: 2px;
    background: var(--ops-teal);
    box-shadow: 0 0 0 0.22rem color-mix(in srgb, var(--ops-teal) 12%, transparent);
}

.detail-page .card-header h2,
.detail-page .card-header h3,
.detail-page > .table-wrapper > h2 {
    margin: 0 !important;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.86rem !important;
    line-height: 1.25;
    letter-spacing: 0 !important;
}

.detail-page .dashboard-card > .card-header,
.detail-page .card > .card-header,
.detail-page > .table-wrapper > h2 {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.detail-page > .table-wrapper > h2 {
    padding: 0.68rem 0.78rem 0.45rem;
}

.detail-page .dashboard-card > .card-body,
.detail-page .card > .card-body {
    padding: 0.18rem 0.78rem 0.78rem !important;
}

.detail-page .info-grid {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 0.3rem !important;
}

.detail-page .info-row {
    display: grid !important;
    grid-template-columns: minmax(6.7rem, 0.42fr) minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 0.55rem !important;
    min-height: 2.05rem;
    padding: 0.38rem 0.5rem !important;
    border: 1px solid color-mix(in srgb, var(--border-secondary) 58%, transparent) !important;
    border-radius: 6px;
    background: color-mix(in srgb, var(--bg-primary) 28%, transparent);
}

.detail-page .info-row:has(.info-value p),
.detail-page .info-row:has(.info-value br),
.detail-page .info-row:has(.info-value ul),
.detail-page .info-row:has(.info-value ol) {
    grid-column: 1 / -1;
}

.detail-page .info-label {
    color: color-mix(in srgb, var(--text-secondary) 82%, var(--ops-grain)) !important;
    font-size: 0.58rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.08em !important;
    line-height: 1.35;
    text-transform: uppercase;
}

.detail-page .info-value {
    min-width: 0;
    color: var(--text-primary) !important;
    font-size: 0.79rem !important;
    line-height: 1.35 !important;
    overflow-wrap: anywhere;
}

.detail-page .info-value p {
    margin: 0;
}

.detail-page .info-value strong {
    font-family: var(--font-display);
    font-size: 0.9rem;
}

.detail-page .dashboard-card img,
.detail-page .card img {
    max-width: min(12rem, 100%);
    border-radius: 8px !important;
    border: 1px solid var(--app-border-subtle) !important;
}

.detail-page .help-text {
    margin: 0.75rem 0 0 !important;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--ops-teal) 20%, transparent);
    background: color-mix(in srgb, var(--ops-teal) 8%, transparent);
}

.detail-page > .dashboard-card,
.detail-page > .card,
.detail-page > .table-wrapper,
.detail-page > .dashboard-grid {
    margin-top: 0 !important;
}

.detail-page > .table-wrapper {
    box-shadow: var(--ops-depth) !important;
}

.detail-page > .table-wrapper:not(:first-child) {
    align-self: start;
}

.detail-page > .table-wrapper table {
    min-width: 680px;
}

.detail-page > .table-wrapper tbody th {
    width: 32%;
    min-width: 11rem;
    padding: 0.56rem 0.72rem !important;
    color: color-mix(in srgb, var(--text-secondary) 86%, var(--ops-grain)) !important;
    font-size: 0.66rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--overlay-search) 72%, transparent) !important;
}

.detail-page pre {
    margin: 0 !important;
    padding: 0.85rem !important;
    border-radius: 6px !important;
    border: 1px solid color-mix(in srgb, var(--ops-teal) 18%, transparent);
    background: color-mix(in srgb, var(--bg-primary) 76%, var(--ops-graphite)) !important;
    color: color-mix(in srgb, var(--text-primary) 88%, var(--ops-teal));
    font-size: 0.75rem !important;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-x: auto;
}

@media (max-width: 820px) {
    .detail-page .page-header-content,
    .detail-page .page-header-left {
        align-items: stretch;
    }

    .detail-page .page-header-left h1,
    .detail-page .page-header-right,
    .detail-page .page-breadcrumb .page-header-right {
        flex-basis: 100%;
        max-width: none;
        position: static;
    }

    .detail-page .action-buttons {
        justify-content: stretch;
    }

    .detail-page .action-buttons > * {
        flex: 1 1 auto;
    }

    .detail-page .dashboard-grid,
    .detail-secondary-grid,
    .detail-page .dashboard-grid > .dashboard-card,
    .detail-page .dashboard-grid > .card,
    .detail-page .dashboard-grid:has(> .dashboard-card:nth-child(2):last-child) > .dashboard-card,
    .detail-page .dashboard-grid:has(> .card:nth-child(2):last-child) > .card,
    .detail-page .dashboard-grid:has(> .dashboard-card:nth-child(3):last-child) > .dashboard-card,
    .detail-page .dashboard-grid:has(> .card:nth-child(3):last-child) > .card,
    .detail-page .dashboard-grid:has(> .dashboard-card:nth-child(4):last-child) > .dashboard-card,
    .detail-page .dashboard-grid:has(> .card:nth-child(4):last-child) > .card {
        grid-template-columns: 1fr !important;
        grid-column: 1 / -1 !important;
    }
}

@media (max-width: 640px) {
    .detail-page .info-grid {
        grid-template-columns: 1fr;
    }

    .detail-page .info-row {
        grid-template-columns: 1fr !important;
        gap: 0.28rem !important;
    }

    .detail-page .page-breadcrumb {
        align-items: flex-start;
    }

    .dashboard-premium .notification-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 460px) {
    .dashboard-premium .notification-overview {
        grid-template-columns: 1fr;
    }
}

/* Ultra compact detail identity bar */
.detail-page > .page-header {
    width: fit-content !important;
    max-width: 100% !important;
    min-width: min(100%, 28rem);
    justify-self: start !important;
}

.detail-page > .page-header .page-header-content,
.detail-page > .page-header .page-header-left {
    width: auto !important;
    max-width: 100% !important;
}

.detail-page > .page-header .page-header-left {
    display: grid !important;
    grid-template-columns: minmax(12rem, max-content) auto;
    grid-template-areas:
        "title actions"
        "crumb actions";
    align-items: center;
    justify-content: start;
    column-gap: 0.75rem;
    row-gap: 0.22rem;
}

.detail-page > .page-header .page-header-left > h1 {
    grid-area: title;
    flex: 0 1 auto !important;
    max-width: 22rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detail-page > .page-header .page-breadcrumb {
    grid-area: crumb;
    flex: 0 1 auto !important;
    width: fit-content !important;
}

.detail-page > .page-header .page-header-left > .page-header-right {
    grid-area: actions;
    position: static !important;
    max-width: none !important;
    margin-left: 0 !important;
}

.detail-page > .page-header .page-breadcrumb .page-header-right {
    position: static !important;
    max-width: none !important;
    margin-left: 0.35rem !important;
}

.detail-page > .page-header .action-buttons {
    max-width: 22rem;
}

/* Company detail workspace */
.empresa-detail-page {
    display: grid;
    gap: 0.85rem;
}

.empresa-identity-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.85rem;
    width: min(100%, 72rem);
    padding: 0.72rem;
    border-radius: 8px;
    border: 1px solid var(--app-border-subtle);
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--ops-teal) 12%, transparent), transparent 44%),
        color-mix(in srgb, var(--overlay-card-a) 88%, var(--bg-primary));
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.13);
}

.empresa-brand-mark,
.empresa-preview-logo {
    width: 2.8rem;
    height: 2.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--ops-teal) 28%, transparent);
    background: color-mix(in srgb, var(--ops-teal) 10%, var(--overlay-card-a));
    color: var(--ops-teal);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 900;
    text-transform: uppercase;
}

.empresa-brand-mark img,
.empresa-preview-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.empresa-identity-main {
    min-width: 0;
}

.empresa-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.empresa-title-row h1 {
    max-width: 44rem;
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 1.8vw, 1.55rem);
    line-height: 1.1;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empresa-identity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.42rem;
}

.empresa-identity-meta span {
    min-height: 1.45rem;
    display: inline-flex;
    align-items: center;
    padding: 0 0.48rem;
    border-radius: 999px;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--bg-primary) 38%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-secondary) 58%, transparent);
    font-size: 0.66rem;
    font-weight: 750;
}

.empresa-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.28rem;
}

.empresa-actions .btn {
    min-height: 1.72rem !important;
    padding: 0 0.55rem !important;
    border-radius: 6px !important;
    font-size: 0.66rem !important;
}

.empresa-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.34fr);
    gap: 0.85rem;
    align-items: start;
}

.empresa-detail-main,
.empresa-detail-side {
    display: grid;
    gap: 0.85rem;
    min-width: 0;
}

.empresa-panel {
    min-width: 0;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--app-border-subtle);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--overlay-card-a) 88%, transparent), color-mix(in srgb, var(--overlay-card-b) 94%, var(--bg-secondary)));
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.empresa-panel-primary {
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--ops-grain) 8%, transparent), transparent 58%),
        color-mix(in srgb, var(--overlay-card-a) 90%, var(--bg-primary));
}

.empresa-panel-compact {
    padding: 0.68rem;
}

.empresa-panel-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border-secondary) 60%, transparent);
}

.empresa-panel-header span {
    color: color-mix(in srgb, var(--ops-grain) 86%, var(--text-secondary));
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.empresa-panel-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.92rem;
    line-height: 1.2;
}

.empresa-info-grid,
.empresa-info-stack,
.empresa-metrics-grid,
.empresa-toggle-list {
    display: grid;
    gap: 0.38rem;
}

.empresa-info-grid-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.empresa-info-item,
.empresa-address-box,
.empresa-metrics-grid div,
.empresa-toggle-list div,
.empresa-swatches div {
    min-width: 0;
    padding: 0.48rem 0.55rem;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--border-secondary) 58%, transparent);
    background: color-mix(in srgb, var(--bg-primary) 30%, transparent);
}

.empresa-info-item span,
.empresa-address-box span,
.empresa-metrics-grid span,
.empresa-toggle-list span,
.empresa-swatches strong {
    display: block;
    color: color-mix(in srgb, var(--text-secondary) 84%, var(--ops-grain));
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    line-height: 1.25;
    text-transform: uppercase;
}

.empresa-info-item strong,
.empresa-address-box strong,
.empresa-metrics-grid strong,
.empresa-toggle-list strong {
    display: block;
    margin-top: 0.14rem;
    color: var(--text-primary);
    font-size: 0.78rem;
    line-height: 1.32;
    overflow-wrap: anywhere;
}

.empresa-info-item .mono,
.empresa-info-item strong.mono {
    font-family: var(--font-mono);
    font-size: 0.68rem;
}

.empresa-two-column,
.empresa-brand-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.78fr) minmax(16rem, 1fr);
    gap: 0.65rem;
    align-items: start;
}

.empresa-address-box {
    min-height: 100%;
}

.empresa-address-box small {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1.35;
}

.empresa-brand-preview {
    min-width: 0;
    padding: 0.65rem;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--ops-teal) 22%, transparent);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--ops-teal) 12%, transparent), transparent 62%),
        color-mix(in srgb, var(--bg-primary) 48%, transparent);
}

.empresa-preview-top {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.empresa-preview-top strong,
.empresa-preview-top small {
    display: block;
}

.empresa-preview-top strong {
    color: var(--text-primary);
    font-size: 0.88rem;
}

.empresa-preview-top small {
    margin-top: 0.12rem;
    color: var(--text-secondary);
    font-size: 0.68rem;
}

.empresa-brand-preview p {
    margin: 0.65rem 0 0;
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.45;
}

.empresa-brand-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.6rem;
}

.empresa-brand-links a,
.empresa-side-action a {
    min-height: 1.55rem;
    display: inline-flex;
    align-items: center;
    padding: 0 0.48rem;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--ops-teal) 30%, transparent);
    color: color-mix(in srgb, var(--ops-teal) 86%, var(--text-primary));
    text-decoration: none;
    font-size: 0.66rem;
    font-weight: 850;
}

.empresa-swatches {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.38rem;
}

.empresa-swatches div {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 0.45rem;
}

.empresa-swatches .color-swatch {
    grid-row: span 2;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 5px;
}

.empresa-swatches small {
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 0.62rem;
}

.empresa-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.empresa-metrics-grid div {
    text-align: center;
}

.empresa-metrics-grid strong {
    font-family: var(--font-display);
    font-size: 1.02rem;
}

.empresa-toggle-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.empresa-toggle-list strong {
    margin: 0;
    font-size: 0.68rem;
}

.empresa-toggle-list .on {
    color: var(--success);
}

.empresa-toggle-list .off {
    color: var(--danger);
}

@media (max-width: 1100px) {
    .empresa-detail-layout,
    .empresa-two-column,
    .empresa-brand-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .empresa-identity-bar,
    .empresa-info-grid-wide,
    .empresa-swatches {
        grid-template-columns: 1fr;
    }

    .empresa-actions {
        justify-content: stretch;
    }

    .empresa-actions .btn {
        flex: 1 1 auto;
    }

    .empresa-title-row h1 {
        white-space: normal;
    }
}

/* Compact edit forms */
.form-page {
    display: grid;
    gap: 0.85rem;
    align-items: start;
}

.form-page > .page-header {
    width: fit-content !important;
    max-width: 100% !important;
    min-width: min(100%, 24rem);
    justify-self: start;
    padding: 0.62rem 0.72rem !important;
}

.form-page > .page-header .page-header-content,
.form-page > .page-header .page-header-left {
    width: auto !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(12rem, max-content) auto;
    grid-template-areas:
        "title actions"
        "crumb actions";
    align-items: center;
    justify-content: start;
    column-gap: 0.72rem;
    row-gap: 0.22rem;
}

.form-page > .page-header h1 {
    grid-area: title;
    max-width: 24rem;
    margin: 0 !important;
    font-size: clamp(1.05rem, 1.7vw, 1.42rem) !important;
    line-height: 1.12 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-page > .page-header .brand-section-kicker {
    grid-column: 1 / -1;
    margin: 0 0 -0.12rem;
    font-size: 0.56rem;
}

.form-page > .page-header .page-breadcrumb {
    grid-area: crumb;
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.32rem !important;
    width: fit-content;
    margin: 0 !important;
}

.form-page > .page-header .page-breadcrumb > a {
    min-height: 1.48rem !important;
    padding: 0 0.44rem !important;
    font-size: 0.65rem !important;
    border-radius: 6px !important;
}

.form-page > .page-header .page-header-right,
.form-page > .page-header .page-breadcrumb .page-header-right {
    grid-area: actions;
    position: static !important;
    max-width: none !important;
    margin-left: 0 !important;
}

.form-page > .page-header .action-buttons {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.25rem !important;
}

.form-page > .page-header .btn {
    min-height: 1.62rem !important;
    padding: 0 0.48rem !important;
    border-radius: 6px !important;
    font-size: 0.62rem !important;
}

.form-page .app-form:not(.brand-console) {
    width: min(100%, 74rem);
    padding: 0.82rem !important;
    border-radius: 8px !important;
    justify-self: start;
}

.form-page .app-form:not(.brand-console) > .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.55rem !important;
}

.form-page .form-group {
    min-width: 0;
    margin: 0 !important;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.form-page .form-group,
.form-page .form-group *,
.form-page input,
.form-page select,
.form-page textarea {
    box-sizing: border-box;
    max-width: 100%;
}

.form-page .form-group label {
    margin-bottom: 0.24rem !important;
    color: color-mix(in srgb, var(--text-secondary) 84%, var(--ops-grain));
    font-size: 0.61rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.07em;
    line-height: 1.25;
    text-transform: uppercase;
}

.form-page input,
.form-page select,
.form-page textarea {
    width: 100%;
    min-width: 0;
    min-height: 2.08rem !important;
    padding: 0.42rem 0.55rem !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-page textarea {
    min-height: 5.6rem !important;
}

.form-page input[type="checkbox"],
.form-page input[type="radio"] {
    min-height: auto !important;
    padding: 0 !important;
}

.form-page input[type="color"] {
    min-height: 2.08rem !important;
    padding: 0.2rem !important;
}

.form-page input[type="file"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 0.3rem !important;
    font-size: 0.68rem !important;
    line-height: 1.2;
    overflow: hidden !important;
    white-space: nowrap;
}

.form-page input[type="file"]::file-selector-button {
    max-width: 8rem;
    margin-right: 0.35rem;
    padding: 0.28rem 0.48rem;
    border: 0;
    border-radius: 5px;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--ops-teal) 18%, var(--overlay-card-a));
    font-size: 0.66rem;
    font-weight: 800;
}

.form-page .form-group a {
    max-width: 100%;
    color: color-mix(in srgb, var(--ops-teal) 86%, var(--text-primary));
    overflow-wrap: anywhere;
    word-break: break-word;
}

.form-page .form-group:has(input[type="file"]) {
    display: grid;
    gap: 0.34rem;
    align-content: start;
}

.form-page .form-group:has(input[type="file"]) a {
    width: 100%;
    display: block;
    padding: 0.36rem 0.48rem;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--border-secondary) 58%, transparent);
    background: color-mix(in srgb, var(--bg-primary) 40%, transparent);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-page .form-group:has(input[type="file"]) label + br,
.form-page .form-group:has(input[type="file"]) br {
    display: none;
}

.form-page .form-group:has(input[type="file"]) input[type="checkbox"] {
    width: auto;
    justify-self: start;
}

.brand-file-control {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
}

.brand-file-preview {
    display: grid;
    grid-template-columns: 3.1rem minmax(0, 1fr);
    align-items: center;
    gap: 0.58rem;
    min-width: 0;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--ops-teal) 22%, transparent);
    background: color-mix(in srgb, var(--bg-primary) 42%, transparent);
}

.brand-file-preview img {
    width: 3.1rem;
    height: 3.1rem;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--app-border-subtle);
    background: color-mix(in srgb, var(--overlay-card-b) 84%, var(--bg-primary));
}

.brand-file-preview-favicon {
    grid-template-columns: 2.4rem minmax(0, 1fr);
}

.brand-file-preview-favicon img {
    width: 2.4rem;
    height: 2.4rem;
}

.brand-file-preview strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.76rem;
    line-height: 1.25;
}

.brand-file-missing {
    display: grid;
    gap: 0.34rem;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--warning) 34%, transparent);
    background: color-mix(in srgb, var(--warning) 9%, transparent);
}

.brand-file-missing strong {
    color: color-mix(in srgb, var(--warning) 86%, var(--text-primary));
    font-size: 0.72rem;
    line-height: 1.3;
}

.brand-file-clear {
    width: fit-content;
    display: inline-flex !important;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.32rem !important;
    color: var(--text-secondary) !important;
    font-size: 0.66rem !important;
    font-weight: 750 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.brand-file-clear input {
    width: auto !important;
}

.brand-file-input {
    display: grid !important;
    gap: 0.34rem;
    margin: 0 !important;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px dashed color-mix(in srgb, var(--ops-teal) 34%, var(--border-secondary));
    background: color-mix(in srgb, var(--ops-teal) 7%, transparent);
}

.brand-file-input span {
    color: color-mix(in srgb, var(--ops-teal) 86%, var(--text-primary));
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.form-page .help-text {
    margin-top: 0.22rem !important;
    font-size: 0.68rem !important;
    line-height: 1.35;
}

.form-page .form-actions {
    position: sticky;
    bottom: 0.75rem;
    z-index: 5;
    display: flex !important;
    justify-content: flex-end;
    gap: 0.35rem !important;
    margin-top: 0.75rem !important;
    padding: 0.52rem !important;
    border-radius: 8px !important;
    border: 1px solid var(--app-border-subtle);
    background: color-mix(in srgb, var(--overlay-card-b) 94%, var(--bg-primary));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.form-page .form-actions .btn,
.form-page .form-actions button,
.form-page .form-actions a {
    min-height: 1.9rem !important;
    padding: 0 0.72rem !important;
    border-radius: 6px !important;
    font-size: 0.72rem !important;
}

.brand-console-page .brand-console {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.34fr);
    gap: 0.85rem;
    width: min(100%, 86rem);
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.brand-console-page .brand-console::before {
    display: none !important;
}

.brand-console-page .brand-console-main {
    display: grid;
    gap: 0.65rem;
}

.brand-console-page .brand-form-section {
    margin: 0 !important;
    padding: 0.72rem !important;
    border-radius: 8px !important;
}

.brand-console-page .brand-section-header {
    margin-bottom: 0.55rem !important;
    padding-bottom: 0.42rem !important;
}

.brand-console-page .brand-section-header h2 {
    font-size: 0.9rem !important;
}

.brand-console-page .brand-section-header p {
    display: none;
}

.brand-console-page .brand-section-kicker,
.brand-console-page .brand-preview-kicker {
    font-size: 0.56rem !important;
    margin-bottom: 0.1rem !important;
}

.brand-console-page .brand-form-section .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
}

.brand-console-page .brand-form-section .field-wide {
    grid-column: span 2;
}

.brand-console-page .brand-color-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.45rem;
}

.brand-console-page .brand-color-grid label {
    min-height: auto;
}

.brand-console-page .brand-console-side {
    position: sticky;
    top: calc(var(--header-height) + 0.75rem);
}

.brand-console-page .brand-preview-panel {
    position: static;
    border-radius: 8px;
}

.brand-console-page .brand-preview-head,
.brand-console-page .brand-preview-body {
    padding: 0.72rem;
}

.brand-console-page .brand-preview-head h2 {
    font-size: 0.92rem !important;
}

.brand-console-page .brand-preview-head p {
    font-size: 0.72rem !important;
}

.brand-console-page .brand-preview-card {
    margin: 0.72rem;
}

.brand-console-page .brand-preview-topbar,
.brand-console-page .brand-preview-metric {
    padding: 0.62rem;
}

.brand-console-page .brand-preview-logo {
    width: 2rem;
    height: 2rem;
}

.brand-console-page .brand-preview-metric + .brand-preview-metric {
    margin-top: 0.45rem;
}

.brand-console-page .brand-preview-actions {
    margin-top: 0.6rem;
}

.brand-console-page .brand-preview-button {
    min-height: 1.85rem;
    font-size: 0.68rem;
}

.brand-console-page .brand-preview-swatches {
    padding: 0 0.72rem 0.72rem;
}

.brand-console-page .brand-preview-swatch {
    height: 1.45rem;
}

@media (max-width: 1120px) {
    .form-page .app-form:not(.brand-console) > .form-grid,
    .brand-console-page .brand-form-section .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .brand-console-page .brand-console {
        grid-template-columns: 1fr;
    }

    .brand-console-page .brand-console-side {
        position: static;
        order: -1;
    }
}

@media (max-width: 700px) {
    .form-page > .page-header .page-header-content,
    .form-page > .page-header .page-header-left {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "crumb"
            "actions";
    }

    .form-page > .page-header h1 {
        max-width: 100%;
        white-space: normal;
    }

    .form-page .app-form:not(.brand-console) > .form-grid,
    .brand-console-page .brand-form-section .form-grid,
    .brand-console-page .brand-color-grid {
        grid-template-columns: 1fr !important;
    }

    .brand-console-page .brand-form-section .field-wide {
        grid-column: auto;
    }

    .form-page .form-actions {
        position: static;
        flex-direction: column;
    }
}

/* Enterprise Data Grids */
.table-wrapper,
.notification-table-wrapper,
.avicultura-table-wrap {
    position: relative;
    overflow: auto;
    border-radius: 8px !important;
    border: 1px solid var(--app-border-subtle) !important;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--overlay-card-a) 94%, var(--ops-graphite)), var(--overlay-card-b)) !important;
    box-shadow: var(--ops-depth) !important;
}

.table-wrapper::after,
.notification-table-wrapper::after,
.avicultura-table-wrap::after {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--ops-teal), var(--ops-grain), var(--primary), transparent);
    opacity: 0.86;
    pointer-events: none;
}

.table-wrapper table,
.notification-table-wrapper table,
.avicultura-table-wrap table,
table.notification-table,
table.data-table,
table.dashboard-table {
    width: 100% !important;
    min-width: 820px;
    margin: 0 !important;
    border: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    table-layout: auto;
    font-variant-numeric: tabular-nums;
}

.table-wrapper table::before,
.notification-table-wrapper table::before,
.avicultura-table-wrap table::before,
table.notification-table::before,
table.data-table::before,
table.dashboard-table::before {
    display: none !important;
}

.table-wrapper thead,
.notification-table-wrapper thead,
.avicultura-table-wrap thead,
table.notification-table thead,
table.data-table thead,
table.dashboard-table thead {
    position: relative;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--ops-graphite) 18%, var(--overlay-search)), color-mix(in srgb, var(--overlay-card-a) 84%, var(--bg-secondary))) !important;
}

.table-wrapper thead th,
.notification-table-wrapper thead th,
.avicultura-table-wrap thead th,
table.notification-table thead th,
table.data-table thead th,
table.dashboard-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 2.55rem;
    padding: 0.54rem 0.68rem !important;
    border: 0 !important;
    border-bottom: 1px solid color-mix(in srgb, var(--ops-teal) 22%, var(--border-secondary)) !important;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--overlay-search) 92%, var(--ops-graphite)), color-mix(in srgb, var(--overlay-card-a) 92%, var(--bg-secondary))) !important;
    color: color-mix(in srgb, var(--text-secondary) 80%, var(--ops-grain)) !important;
    font-family: var(--font-display);
    font-size: 0.61rem !important;
    font-weight: 900 !important;
    line-height: 1.15;
    letter-spacing: 0.105em !important;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--ops-grain) 18%, transparent);
}

.table-wrapper thead th:first-child,
.notification-table-wrapper thead th:first-child,
.avicultura-table-wrap thead th:first-child {
    padding-left: 0.85rem !important;
}

.table-wrapper tbody tr,
.notification-table-wrapper tbody tr,
.avicultura-table-wrap tbody tr,
table.notification-table tbody tr,
table.data-table tbody tr,
table.dashboard-table tbody tr {
    position: relative;
    transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.table-wrapper tbody tr:nth-child(even) td,
.notification-table-wrapper tbody tr:nth-child(even) td,
.avicultura-table-wrap tbody tr:nth-child(even) td,
table.notification-table tbody tr:nth-child(even) td,
table.data-table tbody tr:nth-child(even) td,
table.dashboard-table tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--overlay-card-a) 42%, transparent) !important;
}

.table-wrapper tbody tr:hover td,
.notification-table-wrapper tbody tr:hover td,
.avicultura-table-wrap tbody tr:hover td,
table.notification-table tbody tr:hover td,
table.data-table tbody tr:hover td,
table.dashboard-table tbody tr:hover td {
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--ops-teal) 10%, transparent), transparent 44%),
        color-mix(in srgb, var(--overlay-card-a) 86%, var(--bg-hover)) !important;
    color: var(--text-primary) !important;
}

.table-wrapper tbody tr:hover td:first-child,
.notification-table-wrapper tbody tr:hover td:first-child,
.avicultura-table-wrap tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--ops-teal);
}

.table-wrapper tbody td,
.notification-table-wrapper tbody td,
.avicultura-table-wrap tbody td,
table.notification-table tbody td,
table.data-table tbody td,
table.dashboard-table tbody td {
    height: 2.58rem;
    padding: 0.46rem 0.68rem !important;
    border: 0 !important;
    border-bottom: 1px solid color-mix(in srgb, var(--border-secondary) 72%, transparent) !important;
    background: transparent !important;
    color: color-mix(in srgb, var(--text-primary) 88%, var(--text-secondary)) !important;
    font-size: 0.79rem !important;
    line-height: 1.28;
    vertical-align: middle !important;
}

.table-wrapper tbody td:first-child,
.notification-table-wrapper tbody td:first-child,
.avicultura-table-wrap tbody td:first-child {
    padding-left: 0.85rem !important;
    color: var(--text-primary) !important;
    font-weight: 750;
}

.table-wrapper tbody td:nth-child(n+4),
.notification-table-wrapper tbody td:nth-child(n+4),
.avicultura-table-wrap tbody td:nth-child(n+4) {
    color: color-mix(in srgb, var(--text-secondary) 78%, var(--text-primary)) !important;
}

.table-wrapper thead th,
.notification-table-wrapper thead th,
.avicultura-table-wrap thead th,
.table-wrapper tbody td,
.notification-table-wrapper tbody td,
.avicultura-table-wrap tbody td {
    white-space: nowrap;
}

.table-wrapper th:first-child,
.table-wrapper td:first-child,
.notification-table-wrapper th:first-child,
.notification-table-wrapper td:first-child,
.avicultura-table-wrap th:first-child,
.avicultura-table-wrap td:first-child {
    max-width: 18rem;
}

.table-wrapper th,
.table-wrapper td,
.notification-table-wrapper th,
.notification-table-wrapper td,
.avicultura-table-wrap th,
.avicultura-table-wrap td {
    overflow-wrap: anywhere;
}

.table-wrapper th:not(:first-child):not(:last-child),
.table-wrapper td:not(:first-child):not(:last-child),
.notification-table-wrapper th:not(:first-child):not(:last-child),
.notification-table-wrapper td:not(:first-child):not(:last-child),
.avicultura-table-wrap th:not(:first-child):not(:last-child),
.avicultura-table-wrap td:not(:first-child):not(:last-child) {
    max-width: 11.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-wrapper tbody tr:last-child td,
.notification-table-wrapper tbody tr:last-child td,
.avicultura-table-wrap tbody tr:last-child td,
table.notification-table tbody tr:last-child td,
table.data-table tbody tr:last-child td,
table.dashboard-table tbody tr:last-child td {
    border-bottom: 0 !important;
}

.table-wrapper td strong,
.notification-table-wrapper td strong,
.avicultura-table-wrap td strong {
    color: var(--text-primary);
    font-weight: 800;
}

.table-wrapper td small,
.notification-table-wrapper td small,
.avicultura-table-wrap td small {
    color: var(--text-tertiary);
}

.table-wrapper td .badge,
.notification-table-wrapper td .badge,
.avicultura-table-wrap td .badge,
.table-wrapper td .status-badge,
.notification-table-wrapper td .status-badge,
.avicultura-table-wrap td .status-badge {
    min-height: 1.28rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.12rem 0.42rem;
    font-size: 0.67rem;
    border-radius: 999px !important;
    background: color-mix(in srgb, currentColor 9%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}

.table-wrapper td:last-child,
.notification-table-wrapper td:last-child,
.avicultura-table-wrap td:last-child,
.table-wrapper td.actions,
.table-wrapper td.actions-cell,
.app-main td:last-child:has(a),
.app-main td.actions-cell {
    white-space: nowrap;
}

.table-wrapper td:last-child a,
.notification-table-wrapper td:last-child a,
.avicultura-table-wrap td:last-child a,
.table-wrapper td.actions a,
.table-wrapper td.actions-cell a,
.table-wrapper td.actions button,
.table-wrapper td.actions-cell button,
.app-main td:last-child:has(a) a,
.app-main td.actions-cell .btn {
    min-height: 1.62rem !important;
    padding: 0 0.48rem !important;
    margin: 0.08rem 0.08rem 0.08rem 0 !important;
    border-radius: 6px !important;
    border: 1px solid color-mix(in srgb, var(--ops-hairline) 82%, var(--primary)) !important;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--overlay-card-a) 88%, transparent), color-mix(in srgb, var(--overlay-card-b) 90%, transparent)) !important;
    color: var(--text-primary) !important;
    font-size: 0.66rem !important;
    font-weight: 850 !important;
    letter-spacing: 0.015em;
    text-decoration: none !important;
    box-shadow: none !important;
}

.table-wrapper td:last-child a:hover,
.notification-table-wrapper td:last-child a:hover,
.avicultura-table-wrap td:last-child a:hover,
.table-wrapper td.actions a:hover,
.table-wrapper td.actions-cell a:hover,
.table-wrapper td.actions button:hover,
.table-wrapper td.actions-cell button:hover,
.app-main td:last-child:has(a) a:hover,
.app-main td.actions-cell .btn:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--ops-teal) 48%, var(--border-primary)) !important;
    background: color-mix(in srgb, var(--ops-teal) 12%, var(--overlay-card-a)) !important;
}

.table-wrapper td:last-child a[href*="excluir"],
.table-wrapper td.actions a[href*="excluir"],
.table-wrapper td.actions-cell a[href*="excluir"],
.app-main td:last-child:has(a) a[href*="excluir"] {
    color: color-mix(in srgb, var(--danger) 86%, var(--text-primary)) !important;
    border-color: color-mix(in srgb, var(--danger) 34%, transparent) !important;
    background: color-mix(in srgb, var(--danger) 10%, var(--overlay-card-a)) !important;
}

.table-wrapper td:last-child a[href*="editar"],
.table-wrapper td.actions a[href*="editar"],
.table-wrapper td.actions-cell a[href*="editar"],
.app-main td:last-child:has(a) a[href*="editar"] {
    color: color-mix(in srgb, var(--ops-grain) 88%, var(--text-primary)) !important;
    border-color: color-mix(in srgb, var(--ops-grain) 32%, transparent) !important;
}

.table-wrapper td:last-child a[href*="detalhe"],
.table-wrapper td:last-child a[href*="ver"],
.table-wrapper td.actions a[href*="detalhe"],
.table-wrapper td.actions-cell a[href*="detalhe"],
.app-main td:last-child:has(a) a[href*="detalhe"] {
    color: color-mix(in srgb, var(--ops-teal) 84%, var(--text-primary)) !important;
    border-color: color-mix(in srgb, var(--ops-teal) 32%, transparent) !important;
}

.table-wrapper::-webkit-scrollbar,
.notification-table-wrapper::-webkit-scrollbar,
.avicultura-table-wrap::-webkit-scrollbar {
    height: 0.7rem;
    width: 0.7rem;
}

.table-wrapper::-webkit-scrollbar-track,
.notification-table-wrapper::-webkit-scrollbar-track,
.avicultura-table-wrap::-webkit-scrollbar-track {
    background: color-mix(in srgb, var(--bg-primary) 78%, transparent);
}

.table-wrapper::-webkit-scrollbar-thumb,
.notification-table-wrapper::-webkit-scrollbar-thumb,
.avicultura-table-wrap::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, var(--ops-teal), var(--ops-grain));
    border-radius: 999px;
}

@media (max-width: 768px) {
    :root {
        --header-height: 58px;
    }

    .site-header {
        min-height: var(--header-height) !important;
        height: auto !important;
        align-items: flex-start !important;
        padding: 0.55rem 0.7rem !important;
        gap: 0.55rem !important;
    }

    .site-header .header-brand {
        width: 100%;
        height: auto !important;
    }

    .site-header .brand-title {
        max-width: min(58vw, 18rem);
        font-size: 0.95rem !important;
    }

    .site-header .brand-logo {
        width: 32px !important;
        height: 32px !important;
    }

    .site-header > nav {
        top: calc(var(--header-height) + 0.4rem) !important;
        max-height: calc(100vh - var(--header-height) - 1rem);
        overflow: auto;
        border-radius: 8px !important;
    }

    header > nav > ul > li > ul.nav-mega,
    header > nav > ul > li > ul.nav-mega-wide {
        position: static !important;
        width: 100% !important;
        max-height: none;
        display: grid;
        grid-template-columns: 1fr;
        padding: 0.6rem !important;
        transform: none !important;
    }

    .nav-mega-wide .nav-mega-summary {
        grid-row: auto;
    }

    .nav-item-label {
        white-space: normal;
    }

    .table-wrapper.has-responsive-table,
    .notification-table-wrapper.has-responsive-table,
    .avicultura-table-wrap.has-responsive-table {
        overflow: visible !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .table-wrapper.has-responsive-table::before,
    .table-wrapper.has-responsive-table::after,
    .notification-table-wrapper.has-responsive-table::before,
    .notification-table-wrapper.has-responsive-table::after,
    .avicultura-table-wrap.has-responsive-table::before,
    .avicultura-table-wrap.has-responsive-table::after {
        display: none !important;
    }

    table.responsive-table tbody {
        gap: 0.9rem !important;
    }

    table.responsive-table tr {
        border-radius: 8px !important;
        border: 1px solid var(--app-border-subtle) !important;
        background:
            linear-gradient(135deg, color-mix(in srgb, var(--ops-teal) 9%, transparent), transparent 48%),
            linear-gradient(180deg, var(--app-surface-soft), var(--app-surface-strong)) !important;
        box-shadow: 0 16px 34px rgba(0, 0, 0, 0.12) !important;
    }

    table.responsive-table tr::before {
        height: 3px !important;
        background: linear-gradient(90deg, var(--ops-teal), var(--ops-grain), var(--primary)) !important;
    }

    table.responsive-table tbody th,
    table.responsive-table tbody td {
        grid-template-columns: minmax(6.5rem, 34%) minmax(0, 1fr) !important;
        padding: 0.68rem 0 !important;
        border-bottom: 1px solid color-mix(in srgb, var(--border-secondary) 70%, transparent) !important;
        color: var(--text-primary) !important;
        white-space: normal !important;
    }

    table.responsive-table tbody th::before,
    table.responsive-table tbody td::before {
        color: color-mix(in srgb, var(--text-secondary) 80%, var(--ops-grain)) !important;
        font-family: var(--font-display);
        font-size: 0.64rem !important;
        font-weight: 900 !important;
        letter-spacing: 0.08em !important;
    }

    table.responsive-table tbody th[data-card-role="actions"],
    table.responsive-table tbody td[data-card-role="actions"],
    table.responsive-table tbody td.actions-cell {
        padding-top: 0.8rem !important;
    }

    table.responsive-table tbody th[data-card-role="actions"] > *,
    table.responsive-table tbody td[data-card-role="actions"] > *,
    table.responsive-table tbody td.actions-cell > * {
        flex: 1 1 calc(50% - 0.3rem);
    }
}

.brand-console {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: var(--app-page-gap);
    align-items: start;
}

.brand-console-main,
.brand-console-side {
    min-width: 0;
}

.brand-form-section {
    border: 1px solid var(--app-border-subtle);
    border-radius: var(--app-panel-radius);
    background: linear-gradient(180deg, var(--app-surface-soft), color-mix(in srgb, var(--overlay-card-b) 88%, transparent));
    padding: clamp(1rem, 2vw, 1.35rem);
    margin-bottom: var(--app-page-gap);
}

.brand-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 0.85rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-secondary);
}

.brand-section-kicker,
.brand-preview-kicker {
    display: block;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}

.brand-section-header h2,
.brand-preview-panel h2 {
    margin: 0;
    font-size: 1.05rem;
}

.brand-section-header p,
.brand-preview-panel p {
    margin: 0.25rem 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.brand-form-section .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.brand-form-section .field-wide {
    grid-column: 1 / -1;
}

.brand-color-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.85rem;
}

.brand-color-grid .form-group {
    min-width: 0;
}

.brand-color-grid label {
    min-height: 2.2rem;
}

.brand-preview-panel {
    position: sticky;
    top: calc(var(--header-height) + 1rem);
    border: 1px solid var(--app-border-subtle);
    border-radius: var(--app-panel-radius);
    background: linear-gradient(180deg, var(--app-surface-soft), var(--app-surface-strong));
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.brand-preview-head {
    padding: 1.15rem;
    border-bottom: 1px solid var(--border-secondary);
}

.brand-preview-card {
    margin: 1.15rem;
    border-radius: var(--app-panel-radius);
    border: 1px solid var(--preview-border, var(--border-primary));
    background: var(--preview-bg, var(--bg-primary));
    color: var(--preview-text, var(--text-primary));
    overflow: hidden;
}

.brand-preview-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem;
    background: var(--preview-surface, var(--bg-secondary));
    border-bottom: 1px solid var(--preview-border, var(--border-primary));
}

.brand-preview-logo {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: var(--app-panel-radius);
    display: grid;
    place-items: center;
    color: var(--preview-inverse, var(--text-inverse));
    background: linear-gradient(180deg, var(--preview-primary-light, var(--primary-light)), var(--preview-primary, var(--primary)));
    font-weight: 900;
}

.brand-preview-title {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-preview-title strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-preview-title small {
    color: color-mix(in srgb, var(--preview-text, var(--text-primary)) 62%, transparent);
}

.brand-preview-body {
    padding: 1rem;
}

.brand-preview-metric {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.6rem;
    align-items: center;
    padding: 0.85rem;
    border-radius: var(--app-panel-radius);
    background: var(--preview-surface, var(--bg-secondary));
    border: 1px solid var(--preview-border, var(--border-primary));
}

.brand-preview-metric + .brand-preview-metric {
    margin-top: 0.75rem;
}

.brand-preview-metric span {
    color: color-mix(in srgb, var(--preview-text, var(--text-primary)) 68%, transparent);
    font-size: 0.78rem;
}

.brand-preview-metric strong {
    color: var(--preview-text, var(--text-primary));
}

.brand-preview-pill {
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
    background: color-mix(in srgb, var(--preview-primary, var(--primary)) 16%, transparent);
    color: var(--preview-primary, var(--primary));
    border: 1px solid color-mix(in srgb, var(--preview-primary, var(--primary)) 35%, transparent);
    font-size: 0.72rem;
    font-weight: 800;
}

.brand-preview-actions {
    display: flex;
    gap: 0.55rem;
    margin-top: 1rem;
}

.brand-preview-button {
    flex: 1;
    min-height: 2.35rem;
    border-radius: var(--app-panel-radius);
    border: 1px solid var(--preview-border, var(--border-primary));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
}

.brand-preview-button.primary {
    color: var(--preview-inverse, var(--text-inverse));
    background: linear-gradient(180deg, var(--preview-primary-light, var(--primary-light)), var(--preview-primary-dark, var(--primary-dark)));
    border-color: transparent;
}

.brand-preview-swatches {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.45rem;
    padding: 0 1.15rem 1.15rem;
}

.brand-preview-swatch {
    height: 2.1rem;
    border-radius: var(--app-panel-radius);
    border: 1px solid var(--app-border-subtle);
    background: var(--swatch-color);
}

@media (max-width: 1180px) {
    .ops-intelligence-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .brand-console {
        grid-template-columns: 1fr;
    }

    .brand-preview-panel {
        position: static;
        order: -1;
    }
}

@media (max-width: 760px) {
    .brand-form-section .form-grid,
    .brand-color-grid {
        grid-template-columns: 1fr;
    }

    .brand-section-header {
        flex-direction: column;
    }

    .dashboard-premium .hero-greeting {
        max-width: 100%;
    }

    .ops-intelligence-strip,
    .ops-process-map {
        grid-template-columns: 1fr;
    }

    .ops-process-map::before {
        display: none;
    }
}
