/* Spiros Hub live-ready SaaS shell. Loaded after hub.css and intentionally owns app chrome. */
:root {
    --app-bg: #eef3f7;
    --app-surface: rgba(255, 255, 255, 0.78);
    --app-surface-strong: #ffffff;
    --app-text: #121826;
    --app-muted: #647084;
    --app-line: rgba(18, 24, 38, 0.12);
    --app-accent: #0f766e;
    --app-accent-2: #155eef;
    --app-danger: #b42318;
    --app-warning: #b45309;
    --app-success: #047857;
    --app-radius: 16px;
    --app-radius-sm: 11px;
    --app-gutter: 24px;
    --app-gap: 16px;
    --app-shadow: 0 18px 45px rgba(24, 32, 47, 0.10);
}

html[data-theme="dark"] {
    --app-bg: #101418;
    --app-surface: rgba(27, 33, 42, 0.78);
    --app-surface-strong: #202833;
    --app-text: #f4f7fb;
    --app-muted: #9ba7b8;
    --app-line: rgba(244, 247, 251, 0.12);
    --app-accent: #2dd4bf;
    --app-accent-2: #8bb7ff;
    --app-shadow: 0 20px 54px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

body.app-layout {
    display: block;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--app-text);
    background:
        radial-gradient(circle at 20% -10%, rgba(15, 118, 110, 0.14), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 220px),
        var(--app-bg);
}

html[data-theme="dark"] body.app-layout {
    background:
        radial-gradient(circle at 20% -10%, rgba(45, 212, 191, 0.10), transparent 34%),
        var(--app-bg);
}

body.app-layout::before,
.app-layout .main::before,
.app-layout .brand,
.app-layout .rail-toggle,
.app-layout .page-kicker {
    display: none;
}

.app-layout .main {
    width: 100vw;
    min-height: 100vh;
    margin: 0;
    padding: 88px var(--app-gutter) 112px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.app-layout .topbar {
    position: fixed;
    z-index: 90;
    inset: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(280px, 520px) minmax(180px, 1fr);
    align-items: center;
    gap: 18px;
    min-height: 64px;
    width: 100vw;
    margin: 0;
    padding: 12px var(--app-gutter);
    transform: none;
    border: 0;
    border-bottom: 1px solid var(--app-line);
    border-radius: 0;
    background: rgba(246, 249, 252, 0.86);
    box-shadow: 0 12px 34px rgba(24, 32, 47, 0.06);
    backdrop-filter: blur(18px) saturate(1.08);
}

html[data-theme="dark"] .app-layout .topbar {
    background: rgba(16, 20, 24, 0.86);
}

.app-layout .topbar::before,
.app-layout .topbar::after {
    display: none;
}

.app-layout .topbar-title {
    min-width: 0;
}

.app-layout .topbar h1 {
    margin: 0;
    color: var(--app-text);
    font-size: 17px;
    font-weight: 820;
    letter-spacing: 0;
}

.app-layout .topbar-search {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 40px;
    padding: 0 13px;
    border: 1px solid var(--app-line);
    border-radius: 13px;
    background: var(--app-surface-strong);
    color: var(--app-muted);
}

.app-layout .topbar-search input {
    width: 100%;
    min-height: 0;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--app-text);
    outline: none;
    font: inherit;
    font-size: 13px;
}

.app-layout .topbar-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.app-layout .sidebar {
    position: fixed;
    z-index: 85;
    left: 50%;
    right: auto;
    top: auto;
    bottom: 18px;
    width: auto;
    max-width: calc(100vw - 32px);
    height: auto;
    padding: 8px;
    transform: translateX(-50%);
    border: 1px solid var(--app-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(20px) saturate(1.1);
}

html[data-theme="dark"] .app-layout .sidebar {
    background: rgba(27, 33, 42, 0.84);
}

.app-layout nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.app-layout nav::-webkit-scrollbar {
    display: none;
}

.app-layout nav a {
    position: relative;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 13px;
    color: var(--app-muted);
    text-decoration: none;
    transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.app-layout nav a:hover {
    background: rgba(15, 118, 110, 0.09);
    color: var(--app-text);
    transform: translateY(-1px);
}

.app-layout nav a.active {
    background: var(--app-accent);
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.20);
}

.app-layout nav a.active::before {
    display: none;
}

.app-layout nav a .material-symbols-rounded {
    font-size: 20px;
}

.app-layout nav a .nav-label {
    display: none;
}

.app-layout nav a:hover .nav-label {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    display: block;
    width: max-content;
    max-width: 180px;
    padding: 6px 9px;
    transform: translateX(-50%);
    border: 1px solid var(--app-line);
    border-radius: 10px;
    background: var(--app-surface-strong);
    color: var(--app-text);
    box-shadow: var(--app-shadow);
    font-size: 11px;
    font-weight: 760;
    white-space: nowrap;
}

.app-layout .icon-button,
.app-layout .button,
.app-layout button,
.app-layout .user-trigger,
.app-layout .row-action,
.app-layout .panel-header a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 11px;
    border: 1px solid rgba(15, 118, 110, 0.24);
    background: var(--app-accent);
    color: #ffffff;
    box-shadow: none;
    font: inherit;
    font-size: 13px;
    font-weight: 760;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.app-layout .button::after,
.app-layout button::after,
.app-layout .icon-button::after {
    display: none;
}

.app-layout .button.secondary,
.app-layout button.secondary,
.app-layout .icon-button,
.app-layout .user-trigger,
.app-layout .row-action,
.app-layout .panel-header a {
    border-color: var(--app-line);
    background: var(--app-surface-strong);
    color: var(--app-text);
}

.app-layout .icon-button {
    width: 40px;
    height: 40px;
    padding: 0;
}

.app-layout .material-symbols-rounded {
    font-size: 19px;
    line-height: 1;
}

.user-menu {
    position: relative;
}

.user-trigger {
    padding-left: 6px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--app-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 820;
}

.user-avatar.large {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 24px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    display: none;
    min-width: 220px;
    padding: 8px;
    border: 1px solid var(--app-line);
    border-radius: 15px;
    background: var(--app-surface-strong);
    box-shadow: var(--app-shadow);
}

.user-menu.is-open .user-dropdown {
    display: grid;
    gap: 4px;
}

.user-dropdown a {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 10px;
    border-radius: 11px;
    color: var(--app-text);
    font-size: 13px;
    font-weight: 720;
    text-decoration: none;
}

.user-dropdown a:hover {
    background: rgba(15, 118, 110, 0.08);
}

.page-hero,
.command-strip-ops {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 18px;
    min-height: 118px;
    margin-bottom: var(--app-gap);
    padding: 22px;
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius);
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 42%),
        var(--app-surface);
    box-shadow: none;
}

.page-hero p,
.command-strip-ops p {
    margin: 0 0 7px;
    color: var(--app-muted);
    font-size: 11px;
    font-weight: 820;
    letter-spacing: 0;
    text-transform: uppercase;
}

.page-hero h2,
.command-strip-ops h2 {
    max-width: 880px;
    margin: 0;
    color: var(--app-text);
    font-size: clamp(28px, 3vw, 48px);
    line-height: 1.02;
    letter-spacing: 0;
}

.page-hero span {
    display: block;
    max-width: 660px;
    margin-top: 8px;
    color: var(--app-muted);
    font-size: 14px;
    line-height: 1.5;
}

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 0;
}

.metric-row,
.ops-status-strip,
.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--app-gap);
    margin-bottom: var(--app-gap);
}

.metric-card,
.ops-pill,
.metric {
    position: relative;
    min-height: 86px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px 12px;
    padding: 15px;
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    color: var(--app-text);
    box-shadow: none;
    text-decoration: none;
}

.metric-card span,
.ops-pill span,
.metric span {
    color: var(--app-muted);
    font-size: 12px;
    font-weight: 780;
}

.metric-card strong,
.ops-pill strong,
.metric strong {
    grid-column: 2;
    grid-row: 1 / span 2;
    font-size: 34px;
    line-height: 1;
}

.metric-card em,
.ops-pill em,
.metric em {
    color: var(--app-muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.panel,
.ops-focus-card,
.ops-lane,
.roadmap-toolbar,
.mindmap-core,
.mind-branch {
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: none;
}

.panel,
.ops-focus-card,
.ops-lane,
.roadmap-toolbar {
    padding: 16px;
}

.data-panel {
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 13px;
}

.panel-header h2,
.roadmap-toolbar h2 {
    margin: 0 0 4px;
    color: var(--app-text);
    font-size: 18px;
    line-height: 1.15;
}

.panel-header p,
.roadmap-toolbar p {
    margin: 0;
    color: var(--app-muted);
    font-size: 13px;
}

.ops-board,
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr);
    grid-template-areas:
        "focus runtime"
        "focus licenses"
        "flow flow";
    gap: var(--app-gap);
}

.ops-focus-card,
.panel-large {
    grid-area: focus;
    min-height: 360px;
}

.ops-lane:nth-of-type(2) {
    grid-area: runtime;
}

.ops-lane:nth-of-type(3) {
    grid-area: licenses;
}

.roadmap-lane {
    grid-area: flow;
}

.ticket-feed,
.stack-list,
.branch-items {
    display: grid;
    gap: 9px;
}

.ticket-card,
.stack-item,
.mind-node {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    padding: 11px;
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius-sm);
    background: rgba(255, 255, 255, 0.56);
    color: var(--app-text);
    text-decoration: none;
}

html[data-theme="dark"] .ticket-card,
html[data-theme="dark"] .stack-item,
html[data-theme="dark"] .mind-node {
    background: rgba(255, 255, 255, 0.045);
}

.ticket-card strong,
.stack-item strong,
.mind-node strong {
    color: var(--app-text);
    font-size: 13px;
}

.ticket-card span,
.ticket-card em,
.stack-item small,
.mind-node small {
    color: var(--app-muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 13px;
}

.table-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 13px;
}

.table-tools label {
    flex: 1;
    min-width: 220px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--app-line);
    border-radius: 12px;
    background: var(--app-surface-strong);
    color: var(--app-muted);
}

.table-tools input {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.filter-tabs a {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: var(--app-surface-strong);
    color: var(--app-muted);
    font-size: 12px;
    font-weight: 760;
    text-decoration: none;
}

.filter-tabs a.active {
    background: rgba(15, 118, 110, 0.12);
    color: var(--app-accent);
    border-color: rgba(15, 118, 110, 0.24);
}

.filter-tabs span {
    color: inherit;
    opacity: 0.72;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--app-text);
    font-size: 13px;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--app-line);
    text-align: left;
}

th {
    color: var(--app-muted);
    font-size: 11px;
    font-weight: 820;
    text-transform: uppercase;
}

td {
    color: var(--app-text);
    font-weight: 600;
}

tr:last-child td {
    border-bottom: 0;
}

.action-col {
    width: 1%;
}

.empty-state {
    padding: 28px;
    color: var(--app-muted);
    text-align: center;
}

.status-badge {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 9px;
    background: rgba(100, 112, 132, 0.10);
    color: var(--app-muted);
    font-size: 11px;
    font-weight: 820;
    text-transform: capitalize;
}

.status-active,
.status-online,
.status-open,
.status-won,
.status-shipped,
.status-1 {
    background: rgba(4, 120, 87, 0.12);
    color: var(--app-success);
}

.status-high,
.status-urgent,
.status-expired,
.status-revoked,
.status-suspended,
.status-blocked,
.status-lost {
    background: rgba(180, 35, 24, 0.10);
    color: var(--app-danger);
}

.status-pending,
.status-planned,
.status-in-progress,
.status-qualified,
.status-proposal {
    background: rgba(21, 94, 239, 0.10);
    color: var(--app-accent-2);
}

.drawer-open {
    overflow: hidden;
}

.drawer-shell.is-hidden {
    display: none;
}

.drawer-shell.is-open {
    position: fixed;
    z-index: 110;
    inset: 0;
    display: grid;
    justify-content: end;
    align-items: stretch;
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.26);
    backdrop-filter: blur(8px);
}

.drawer-panel {
    position: relative;
    z-index: 1;
    width: min(560px, calc(100vw - 34px));
    height: calc(100vh - 28px);
    display: grid;
    grid-template-rows: auto 1fr auto;
    margin: 14px;
    overflow: hidden;
    border: 1px solid var(--app-line);
    border-radius: 20px;
    background: var(--app-surface-strong);
    box-shadow: var(--app-shadow);
}

.drawer-header,
.drawer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--app-line);
}

.drawer-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--app-line);
    border-bottom: 0;
}

.drawer-header p {
    margin: 0 0 4px;
    color: var(--app-muted);
    font-size: 11px;
    font-weight: 820;
    text-transform: uppercase;
}

.drawer-header h2 {
    margin: 0;
    font-size: 22px;
}

.drawer-body {
    overflow: auto;
    padding: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid label,
.reply label {
    display: grid;
    gap: 7px;
    color: var(--app-muted);
    font-size: 12px;
    font-weight: 760;
}

.form-grid label:has(textarea),
.form-grid .form-section-title,
.form-grid button,
.reply label {
    grid-column: 1 / -1;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--app-line);
    border-radius: 11px;
    background: var(--app-surface-strong);
    color: var(--app-text);
    font: inherit;
    outline: none;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

label small {
    color: var(--app-muted);
    font-size: 11px;
    font-weight: 600;
}

.form-section-title {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius-sm);
    background: rgba(15, 118, 110, 0.06);
}

.form-section-title h3,
.form-section-title p {
    margin: 0;
}

.form-section-title h3 {
    font-size: 14px;
}

.form-section-title p {
    color: var(--app-muted);
    font-size: 12px;
}

.detail-layout,
.settings-grid {
    display: grid;
    grid-template-columns: minmax(260px, 0.34fr) minmax(0, 0.66fr);
    gap: var(--app-gap);
    align-items: start;
}

.detail-panel,
.settings-panel {
    grid-column: 2;
}

.detail-layout.single {
    grid-template-columns: minmax(0, 760px);
}

.detail-layout.single .detail-panel {
    grid-column: 1;
}

.account-card {
    display: grid;
    justify-items: start;
    gap: 8px;
}

.account-card h2,
.account-card p {
    margin: 0;
}

.account-card p {
    color: var(--app-muted);
}

.security-icon {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: rgba(15, 118, 110, 0.12);
    color: var(--app-accent);
    font-size: 32px;
}

.ticket-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.36fr);
    gap: var(--app-gap);
    align-items: start;
}

.conversation-panel {
    display: grid;
    gap: 12px;
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--app-muted);
    font-size: 12px;
    font-weight: 760;
}

.message {
    max-width: 78%;
    padding: 12px;
    border: 1px solid var(--app-line);
    border-radius: 14px;
    background: var(--app-surface-strong);
}

.message.hub {
    justify-self: end;
    background: rgba(15, 118, 110, 0.10);
}

.message strong,
.message p {
    margin: 0;
}

.message p {
    margin-top: 6px;
    color: var(--app-muted);
    line-height: 1.5;
}

.reply-panel {
    display: grid;
    gap: 10px;
}

.reply-panel h2,
.reply-panel p {
    margin: 0;
}

.reply-panel p {
    color: var(--app-muted);
    font-size: 13px;
}

.reply {
    display: grid;
    gap: 12px;
}

.mindmap {
    display: grid;
    grid-template-columns: 260px repeat(5, minmax(190px, 1fr));
    gap: var(--app-gap);
    align-items: start;
    overflow-x: auto;
}

.mindmap-core,
.mind-branch {
    padding: 16px;
}

.mindmap-core {
    display: grid;
    gap: 8px;
    min-height: 150px;
}

.mindmap-core .material-symbols-rounded {
    color: var(--app-accent);
    font-size: 28px;
}

.mindmap-core small {
    color: var(--app-muted);
}

.branch-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 820;
}

.flash {
    max-width: 720px;
    margin: 0 0 var(--app-gap);
    border: 1px solid rgba(15, 118, 110, 0.20);
    border-radius: 13px;
    background: rgba(15, 118, 110, 0.08);
    color: var(--app-accent);
}

.auth-layout .auth-card {
    border-radius: 18px;
    background: var(--app-surface-strong);
    box-shadow: var(--app-shadow);
}

@media (max-width: 1100px) {
    .metric-row,
    .ops-status-strip,
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ops-board,
    .dashboard-grid,
    .ticket-detail,
    .settings-grid,
    .detail-layout {
        grid-template-columns: 1fr;
        grid-template-areas: none;
    }

    .ops-focus-card,
    .panel-large,
    .ops-lane,
    .roadmap-lane,
    .detail-panel,
    .settings-panel {
        grid-area: auto;
        grid-column: auto;
    }

    .mindmap {
        grid-template-columns: repeat(3, minmax(220px, 1fr));
    }
}

@media (max-width: 760px) {
    :root {
        --app-gutter: 12px;
        --app-gap: 10px;
    }

    .app-layout .main {
        padding: 78px var(--app-gutter) 102px;
    }

    .app-layout .topbar {
        grid-template-columns: 1fr auto;
        min-height: 58px;
        padding: 9px var(--app-gutter);
    }

    .app-layout .topbar-search {
        display: none;
    }

    .app-layout .user-trigger > span:not(.user-avatar):not(.material-symbols-rounded) {
        display: none;
    }

    .app-layout .sidebar {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
        transform: none;
    }

    .app-layout nav a {
        flex-basis: 42px;
    }

    .page-hero,
    .command-strip-ops {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 16px;
    }

    .page-hero h2,
    .command-strip-ops h2 {
        font-size: 28px;
    }

    .hero-actions {
        justify-content: flex-start;
    }

    .metric-row,
    .ops-status-strip,
    .metrics,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .drawer-panel {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        margin: 10px;
    }

    .message {
        max-width: 100%;
    }
}

/* Editorial SaaS refinement: quieter pages, smaller hierarchy, less generated-dashboard feeling. */
:root {
    --app-bg: #f5f7fa;
    --app-surface: #ffffff;
    --app-surface-strong: #ffffff;
    --app-text: #111827;
    --app-muted: #667085;
    --app-line: rgba(17, 24, 39, 0.10);
    --app-accent: #0b766d;
    --app-accent-2: #2563eb;
    --app-radius: 12px;
    --app-radius-sm: 9px;
    --app-gutter: 28px;
    --app-gap: 14px;
    --app-content: 1420px;
    --app-shadow: 0 10px 28px rgba(17, 24, 39, 0.06);
}

html[data-theme="dark"] {
    --app-bg: #111418;
    --app-surface: #191f27;
    --app-surface-strong: #202630;
    --app-text: #f8fafc;
    --app-muted: #a3adbb;
    --app-line: rgba(248, 250, 252, 0.11);
    --app-accent: #2dd4bf;
    --app-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
}

body.app-layout,
html[data-theme="dark"] body.app-layout {
    background: var(--app-bg);
}

.app-layout .main {
    padding: 88px var(--app-gutter) 110px;
}

.app-layout .main > .flash,
.app-layout .main > .page-hero,
.app-layout .main > .command-strip-ops,
.app-layout .main > .metric-row,
.app-layout .main > .ops-status-strip,
.app-layout .main > .metrics,
.app-layout .main > .ops-board,
.app-layout .main > .dashboard-grid,
.app-layout .main > .panel,
.app-layout .main > .settings-grid,
.app-layout .main > .detail-layout,
.app-layout .main > .ticket-detail,
.app-layout .main > .mindmap,
.app-layout .main > .roadmap-toolbar {
    width: min(var(--app-content), 100%);
    margin-left: auto;
    margin-right: auto;
}

.app-layout .topbar {
    min-height: 62px;
    background: rgba(245, 247, 250, 0.88);
    box-shadow: none;
}

html[data-theme="dark"] .app-layout .topbar {
    background: rgba(17, 20, 24, 0.88);
}

.app-layout .topbar h1 {
    font-size: 16px;
    font-weight: 760;
}

.app-layout .topbar-search,
.app-layout .icon-button,
.app-layout .user-trigger,
.app-layout .button.secondary,
.app-layout button.secondary,
.app-layout .row-action,
.app-layout .panel-header a {
    border-color: var(--app-line);
    box-shadow: none;
}

.app-layout .topbar-search {
    height: 38px;
    border-radius: 10px;
}

.app-layout .sidebar {
    padding: 7px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.90);
    box-shadow: 0 14px 38px rgba(17, 24, 39, 0.10);
}

html[data-theme="dark"] .app-layout .sidebar {
    background: rgba(25, 31, 39, 0.92);
}

.app-layout nav {
    gap: 4px;
}

.app-layout nav a {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: 11px;
}

.app-layout nav a.active {
    box-shadow: none;
}

.dock-hover-zone {
    display: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 821px) {
    .app-layout .sidebar {
        transform: translate(-50%, calc(100% + 34px));
        opacity: 0;
        pointer-events: none;
        transition: transform 240ms cubic-bezier(0.2, 0.9, 0.2, 1), opacity 180ms ease, box-shadow 180ms ease;
    }

    body.dock-revealed .sidebar,
    .app-layout .sidebar:focus-within {
        transform: translateX(-50%);
        opacity: 1;
        pointer-events: auto;
    }

    body.dock-revealed .sidebar {
        box-shadow: 0 18px 48px rgba(17, 24, 39, 0.16);
    }

    .dock-hover-zone {
        position: fixed;
        z-index: 84;
        left: 50%;
        bottom: 0;
        display: block;
        width: min(620px, 48vw);
        height: 74px;
        transform: translateX(-50%);
    }
}

.page-hero,
.command-strip-ops {
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0 18px;
    border: 0;
    border-bottom: 1px solid var(--app-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.page-hero p,
.command-strip-ops p {
    margin: 0 0 5px;
    font-size: 10px;
    font-weight: 800;
    color: var(--app-muted);
}

.page-hero h2,
.command-strip-ops h2 {
    max-width: 720px;
    font-size: clamp(21px, 1.55vw, 26px);
    line-height: 1.12;
    font-weight: 800;
}

.page-hero span {
    max-width: 580px;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.45;
}

.hero-actions {
    flex: 0 0 auto;
}

.metric-row,
.ops-status-strip,
.metrics {
    gap: 12px;
}

.metric-card,
.ops-pill,
.metric {
    min-height: 76px;
    padding: 14px;
    border-radius: var(--app-radius);
    background: var(--app-surface);
}

.metric-card strong,
.ops-pill strong,
.metric strong {
    font-size: 28px;
}

.metric-card span,
.ops-pill span,
.metric span,
.metric-card em,
.ops-pill em,
.metric em {
    font-size: 11px;
}

.panel,
.ops-focus-card,
.ops-lane,
.roadmap-toolbar,
.mindmap-core,
.mind-branch {
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: none;
}

.panel,
.ops-focus-card,
.ops-lane,
.roadmap-toolbar {
    padding: 14px;
}

.settings-grid {
    grid-template-columns: 300px minmax(420px, 720px);
    align-items: start;
}

.account-card {
    min-height: 0;
    align-content: center;
    padding: 20px;
}

.account-card h2 {
    font-size: 18px;
}

.settings-panel,
.detail-panel {
    padding: 20px;
}

.form-section-title {
    padding: 0 0 14px;
    border: 0;
    border-bottom: 1px solid var(--app-line);
    border-radius: 0;
    background: transparent;
}

.form-section-title h3 {
    font-size: 15px;
}

.form-section-title p {
    font-size: 12px;
}

input,
select,
textarea {
    min-height: 38px;
    border-radius: 9px;
}

.app-layout .button,
.app-layout button,
.app-layout .icon-button,
.app-layout .user-trigger,
.app-layout .row-action,
.app-layout .panel-header a {
    min-height: 36px;
    border-radius: 9px;
    font-size: 12px;
}

.drawer-backdrop {
    background: rgba(17, 24, 39, 0.22);
    backdrop-filter: blur(5px);
}

.drawer-panel {
    width: min(520px, calc(100vw - 32px));
    height: calc(100vh - 24px);
    margin: 12px;
    border-radius: 16px;
}

.drawer-header,
.drawer-footer,
.drawer-body {
    padding: 14px;
}

.drawer-header h2 {
    font-size: 20px;
}

.drawer-header p {
    font-size: 10px;
}

.table-wrap {
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-strong);
}

th,
td {
    padding: 11px 12px;
}

th {
    font-size: 10px;
}

.status-badge {
    min-height: 22px;
    padding: 3px 8px;
    font-size: 10px;
}

.ticket-card,
.stack-item,
.mind-node {
    border-radius: var(--app-radius-sm);
}

.mindmap {
    grid-template-columns: 240px repeat(5, minmax(180px, 1fr));
}

@media (max-width: 760px) {
    :root {
        --app-gutter: 12px;
    }

    .app-layout .main {
        padding-top: 74px;
    }

    .page-hero,
    .command-strip-ops {
        align-items: flex-start;
        padding: 14px;
    }

    .page-hero h2,
    .command-strip-ops h2 {
        font-size: 22px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Final correction layer: hybrid SaaS width, usable filters, compact drawers, stable icons. */
:root {
    --app-content: 1520px;
}

.app-layout .main {
    padding-left: clamp(18px, 2.1vw, 34px);
    padding-right: clamp(18px, 2.1vw, 34px);
}

.app-layout .main > * {
    width: min(var(--app-content), 100%);
    margin-left: auto;
    margin-right: auto;
}

.app-layout .main > .drawer-shell {
    width: auto;
    margin: 0;
}

.page-hero {
    min-height: auto;
    padding: 22px 24px;
    gap: 18px;
}

.page-hero h2 {
    max-width: 760px;
    font-size: clamp(22px, 1.45vw, 26px);
    line-height: 1.12;
}

.page-hero p {
    max-width: 720px;
    font-size: 14px;
}

.hero-actions {
    align-items: center;
    gap: 10px;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    margin-bottom: 14px;
}

.filter-tabs a {
    display: inline-flex;
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-height: 36px;
    padding: 0 12px;
    gap: 8px;
    border-radius: 11px;
    line-height: 1;
    white-space: nowrap;
}

.app-layout .filter-tabs a {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    height: 36px;
    min-height: 36px;
    padding: 0 12px;
}

.filter-tabs a:hover {
    border-color: rgba(15, 118, 110, 0.28);
    background: rgba(15, 118, 110, 0.06);
    color: var(--app-ink);
}

.filter-tabs a.active {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.18);
}

.filter-tabs .filter-label {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    opacity: 1;
}

.filter-tabs .filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.12);
    color: var(--app-muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    opacity: 1;
}

.filter-tabs a.active .filter-count {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.app-layout .button,
.app-layout button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    gap: 8px;
    line-height: 1;
}

.app-layout .button .material-symbols-rounded,
.app-layout button .material-symbols-rounded,
.app-layout .user-menu a .material-symbols-rounded {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: currentColor;
    font-size: 18px;
    line-height: 1;
    opacity: 1;
}

.app-layout .button:not(.secondary) .material-symbols-rounded,
.app-layout button:not(.secondary):not(.icon-button):not(.user-trigger) .material-symbols-rounded {
    color: #ffffff;
}

.app-layout .button.secondary .material-symbols-rounded,
.app-layout button.secondary .material-symbols-rounded,
.app-layout .icon-button .material-symbols-rounded,
.app-layout .user-trigger .material-symbols-rounded {
    color: currentColor;
}

.drawer-backdrop {
    background: rgba(15, 23, 42, 0.36);
    backdrop-filter: blur(3px);
}

.drawer-panel {
    width: min(500px, calc(100vw - 28px));
    height: calc(100vh - 24px);
    margin: 12px;
    border-radius: 16px;
}

.drawer-header {
    min-height: 82px;
    padding: 16px 18px;
}

.drawer-header h2 {
    font-size: 22px;
    line-height: 1.12;
}

.drawer-header p {
    margin-bottom: 5px;
    font-size: 11px;
}

.drawer-body {
    padding: 16px 18px 18px;
}

.drawer-body.form-grid,
.drawer-panel .form-grid {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 12px;
}

.drawer-panel .form-section-title,
.drawer-panel .form-grid button {
    grid-column: auto;
}

.drawer-panel label {
    gap: 6px;
    font-size: 12px;
}

.drawer-panel input:not([type="hidden"]),
.drawer-panel select {
    width: 100%;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    padding: 0 11px;
    font-size: 14px;
    line-height: 40px;
}

.drawer-panel textarea {
    width: 100%;
    min-height: 104px;
    max-height: 150px;
    padding: 10px 11px;
    font-size: 14px;
    line-height: 1.45;
}

.drawer-panel label small {
    margin-top: -2px;
    font-size: 11px;
    line-height: 1.35;
}

.drawer-footer {
    padding: 12px 18px 16px;
    gap: 10px;
}

.drawer-footer .button,
.drawer-footer button {
    min-height: 40px;
    padding: 0 15px;
}

.table-tools label {
    min-height: 42px;
}

.table-tools input {
    height: 40px;
    min-height: 40px;
}

.table-tools .button,
.row-action,
.hero-actions .button {
    min-height: 40px;
    padding: 0 15px;
}

.settings-grid {
    grid-template-columns: minmax(280px, 0.7fr) minmax(420px, 1fr);
    align-items: start;
}

.settings-panel,
.security-panel {
    max-width: 760px;
}

@media (max-width: 980px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .page-hero {
        align-items: flex-start;
    }
}

@media (max-width: 760px) {
    .app-layout .main {
        padding-left: 14px;
        padding-right: 14px;
    }

    .page-hero {
        padding: 18px;
    }

    .filter-tabs {
        gap: 7px;
    }

    .filter-tabs a {
        height: 34px;
        min-height: 34px;
        padding: 0 10px;
    }

    .drawer-panel {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
}

/* Viewport data pages: let operational registries use the full screen height while the dock floats above them. */
body.page-dashboard,
body.page-instances,
body.page-licenses,
body.page-customers,
body.page-leads,
body.page-deals,
body.page-releases {
    --workspace-dock-safe: 96px;
}

body.page-dashboard .main,
body.page-instances .main,
body.page-licenses .main,
body.page-customers .main,
body.page-leads .main,
body.page-deals .main,
body.page-releases .main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: 0;
}

body.page-dashboard .page-hero,
body.page-instances .page-hero,
body.page-licenses .page-hero,
body.page-customers .page-hero,
body.page-leads .page-hero,
body.page-deals .page-hero,
body.page-releases .page-hero,
body.page-dashboard .metric-row,
body.page-instances .metric-row,
body.page-licenses .metric-row {
    flex: 0 0 auto;
}

body.page-instances .data-panel,
body.page-licenses .data-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: calc(100vh - 328px);
    min-height: calc(100dvh - 328px);
    overflow: hidden;
}

body.page-customers .data-panel,
body.page-leads .data-panel,
body.page-deals .data-panel,
body.page-releases .data-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: calc(100vh - 238px);
    min-height: calc(100dvh - 238px);
    overflow: hidden;
}

body.page-instances .data-panel .table-wrap,
body.page-licenses .data-panel .table-wrap,
body.page-customers .data-panel .table-wrap,
body.page-leads .data-panel .table-wrap,
body.page-deals .data-panel .table-wrap,
body.page-releases .data-panel .table-wrap {
    flex: 1 1 auto;
    min-height: 260px;
    overflow: auto;
    padding-bottom: var(--workspace-dock-safe);
    scroll-padding-bottom: var(--workspace-dock-safe);
}

body.page-instances .data-panel .table-wrap table,
body.page-licenses .data-panel .table-wrap table,
body.page-customers .data-panel .table-wrap table,
body.page-leads .data-panel .table-wrap table,
body.page-deals .data-panel .table-wrap table,
body.page-releases .data-panel .table-wrap table {
    min-width: 760px;
}

body.page-dashboard .ops-board {
    flex: 1 1 auto;
    min-height: calc(100vh - 320px);
    min-height: calc(100dvh - 320px);
    padding-bottom: var(--workspace-dock-safe);
}

@media (max-width: 980px) {
    body.page-dashboard .main,
    body.page-instances .main,
    body.page-licenses .main,
    body.page-customers .main,
    body.page-leads .main,
    body.page-deals .main,
    body.page-releases .main {
        padding-bottom: 110px;
    }

    body.page-instances .data-panel,
    body.page-licenses .data-panel,
    body.page-customers .data-panel,
    body.page-leads .data-panel,
    body.page-deals .data-panel,
    body.page-releases .data-panel {
        min-height: 420px;
    }
}

/* Resource edit/list polish: tighter SaaS layout and stable header controls. */
.app-layout .topbar-actions {
    align-items: center;
    gap: 10px;
}

.app-layout .topbar .icon-button,
.app-layout .topbar .user-trigger {
    height: 42px;
    min-height: 42px;
    border-radius: 12px;
}

.app-layout .topbar .icon-button {
    width: 42px;
    flex: 0 0 42px;
    padding: 0;
}

.app-layout .topbar .user-trigger {
    padding: 0 10px 0 8px;
}

.app-layout .topbar .user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 9px;
}

.resource-edit-layout.detail-layout.single {
    display: grid;
    grid-template-columns: minmax(560px, 820px);
    justify-content: center;
    gap: 16px;
}

.resource-edit-card.detail-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    max-width: none;
    padding: 22px;
    border-radius: 16px;
}

.resource-edit-card .form-section-title,
.resource-edit-card .field-textarea,
.resource-edit-card .resource-form-actions {
    grid-column: 1 / -1;
}

.resource-edit-card .form-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 2px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--app-line);
}

.resource-edit-card .form-section-title > .material-symbols-rounded {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: rgba(15, 118, 110, 0.10);
    color: var(--app-accent);
    font-size: 18px;
}

.resource-edit-card .form-section-title h3,
.resource-edit-card .form-section-title p {
    margin: 0;
}

.resource-edit-card .form-section-title h3 {
    color: var(--app-text);
    font-size: 17px;
    line-height: 1.2;
}

.resource-edit-card .form-section-title p {
    margin-top: 2px;
    color: var(--app-muted);
    font-size: 13px;
    font-weight: 650;
}

.resource-edit-card label {
    gap: 7px;
    font-size: 12px;
}

.resource-edit-card input,
.resource-edit-card select {
    height: 42px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 11px;
}

.resource-edit-card textarea {
    min-height: 118px;
    padding: 12px;
    border-radius: 12px;
    line-height: 1.45;
}

.resource-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding-top: 2px;
}

.resource-form-actions .button,
.resource-form-actions button {
    min-width: 132px;
}

body.page-customers .data-panel,
body.page-leads .data-panel,
body.page-deals .data-panel,
body.page-releases .data-panel {
    flex: 0 0 auto;
    min-height: auto;
}

body.page-customers .data-panel .table-wrap,
body.page-leads .data-panel .table-wrap,
body.page-deals .data-panel .table-wrap,
body.page-releases .data-panel .table-wrap {
    flex: 0 1 auto;
    min-height: auto;
    max-height: calc(100dvh - 380px);
    padding-bottom: 0;
}

@media (max-width: 760px) {
    .resource-edit-layout.detail-layout.single {
        grid-template-columns: 1fr;
    }

    .resource-edit-card.detail-panel {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .resource-form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
}
