@font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/InstrumentSans-Regular.ttf") format("truetype");
}

@font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("fonts/InstrumentSans-Semibold.ttf") format("truetype");
}

@font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("fonts/InstrumentSans-Bold.ttf") format("truetype");
}

:root {
    --shell-bg: #f4f1e8;
    --sidebar-bg: #f8f5ef;
    --surface: #ffffff;
    --surface-muted: #f1ece3;
    --border: #d8d0c4;
    --text: #1f1a14;
    --muted: #6c6255;
    --accent: #111827;
    --accent-soft: #e5ded2;
    --success: #198754;
    --danger: #b42318;
    --shadow: 0 24px 60px rgba(24, 21, 16, 0.12);
}

* {
    box-sizing: border-box;
}

body.app-shell {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 35%),
        linear-gradient(180deg, #f8f4ed 0%, #efe8db 100%);
    color: var(--text);
}

/* Keep content headings compact across the application shell. */
body.app-shell h2 {
    font-size: 1.25rem;
}

.shell-root {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 252px;
    padding: 1rem 0.85rem;
    background: rgba(248, 245, 239, 0.9);
    border-right: 1px solid rgba(216, 208, 196, 0.9);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 11;
}

.skip-link {
    left: 1rem;
    position: fixed;
    top: -4rem;
    z-index: 1100;
}

.skip-link:focus {
    top: 1rem;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.brand-mark {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-copy span,
.workspace-label,
.eyebrow,
.section-note,
.metric-label,
.nav-section h2,
.nav-link-item small,
.muted-copy {
    color: var(--muted);
}

.sidebar-toggle {
    margin-left: auto;
    border: 0;
    background: transparent;
    font-size: 1.25rem;
    display: none;
}

.workspace-badge {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    margin-bottom: 0.85rem;
}

.workspace-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.2rem;
}

.workspace-value {
    font-size: 1rem;
    font-weight: 700;
}

.workspace-time {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
}

.tenant-switcher {
    background-color: rgba(255, 255, 255, 0.92);
    border-color: var(--border);
}

.nav-groups {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

body.app-shell .nav-section h2 {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.35rem 0.35rem;
}

.nav-link-item {
    display: flex;
    flex-direction: column;
    gap: 0;
    text-decoration: none;
    color: inherit;
    padding: 0.48rem 0.65rem;
    border-radius: 10px;
    margin-bottom: 0.15rem;
    font-size: 0.9rem;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.nav-link-item small {
    display: none;
}

.nav-link-item:hover,
.nav-link-item:focus {
    background: rgba(255, 255, 255, 0.78);
    transform: translateX(2px);
    box-shadow: 0 10px 24px rgba(24, 21, 16, 0.08);
}

.nav-link-item.active {
    background: var(--accent);
    color: #fff;
}

.nav-link-item.active small {
    color: rgba(255, 255, 255, 0.72);
}

.app-main {
    flex: 1;
    padding: 1rem 1.35rem 1.5rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.page-title {
    margin: 0;
    font-size: clamp(1.45rem, 2vw, 2.1rem);
    letter-spacing: -0.03em;
}

.eyebrow {
    margin: 0 0 0.3rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.content-frame {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.panel-card {
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(216, 208, 196, 0.9);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 8px 24px rgba(24, 21, 16, 0.07);
}

.panel-card__header,
.section-header,
.topbar-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 0.65rem;
    margin-top: 0.75rem;
}

.metric-card,
.compact-panel,
.form-panel,
.auth-panel,
.correlation-box {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
}

.metric-card {
    padding: 0.7rem;
    border-radius: 12px;
}

.metric-card strong {
    display: block;
    font-size: 1rem;
    margin-top: 0.15rem;
}

.status-pill {
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: #e6f4ea;
    color: #1f6f3f;
    font-size: 0.8rem;
    font-weight: 700;
}

.user-chip {
    display: flex;
    flex-direction: column;
    padding: 0.45rem 0.7rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border);
}

.user-chip__name {
    font-weight: 700;
}

.user-chip__meta {
    color: var(--muted);
    font-size: 0.78rem;
}

.auth-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 1.5rem;
}

.auth-main {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding-top: 3rem;
}

.auth-topbar {
    margin-bottom: 2.5rem;
}

.auth-panel,
.form-panel,
.compact-panel,
.narrow-panel {
    padding: 1rem;
}

.feature-list {
    padding-left: 1.1rem;
    margin: 0.65rem 0 0;
}

.feature-list li + li {
    margin-top: 0.3rem;
}

.compact {
    margin-top: 0.75rem;
}

.field-error {
    display: block;
    margin-top: 0.3rem;
    color: var(--danger);
    font-size: 0.85rem;
}

.correlation-box {
    padding: 0.7rem 0.85rem;
    font-family: Consolas, "Courier New", monospace;
    word-break: break-all;
    background: var(--surface-muted);
}

.table-slate {
    width: 100%;
    margin-bottom: 0;
    font-size: 0.84rem;
}

.table-slate > tbody > tr > td,
.table-slate > thead > tr > th,
.table-slate.table > :not(caption) > * > * {
    background: transparent;
    border-color: rgba(216, 208, 196, 0.8);
    vertical-align: middle;
    padding: 0.45rem 0.55rem;
}

.panel-card.mb-4 {
    margin-bottom: 0.9rem !important;
}

.panel-card.mt-4 {
    margin-top: 0.9rem !important;
}

.content-frame .row.g-4 {
    --bs-gutter-x: 0.9rem;
    --bs-gutter-y: 0.9rem;
}

.panel-card .mt-4 {
    margin-top: 0.85rem !important;
}

.panel-card .mb-4 {
    margin-bottom: 0.85rem !important;
}

.panel-card .form-control,
.panel-card .form-select,
.workspace-badge .form-select {
    min-height: calc(1.5em + 0.55rem + 2px);
    padding: 0.28rem 0.55rem;
    font-size: 0.88rem;
}

.panel-card .btn {
    padding: 0.32rem 0.6rem;
    font-size: 0.88rem;
}

.selection-list {
    gap: 0.4rem 0.75rem;
    padding: 0.7rem;
    border-radius: 12px;
}

.workspace-tabs__nav {
    display: flex;
    gap: 0.3rem;
    overflow-x: auto;
    padding: 0.25rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
}

.workspace-tabs__tab {
    flex: 0 0 auto;
    border: 0;
    border-radius: 8px;
    padding: 0.38rem 0.62rem;
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.workspace-tabs__tab:hover,
.workspace-tabs__tab:focus-visible {
    background: var(--accent-soft);
    color: var(--text);
}

.workspace-tabs__tab[aria-selected="true"] {
    background: var(--accent);
    color: #fff;
}

.workspace-tabs > [data-tab-label][hidden] {
    display: none !important;
}

/* Campaign settings uses the calmer, task-focused configuration treatment. */
.campaign-settings {
    --campaign-teal: #0f766e;
    --campaign-teal-soft: #f0fdfa;
    --campaign-slate: #0f172a;
    --campaign-muted: #64748b;
    --campaign-border: #e2e8f0;
    background: #ffffff;
    border-color: var(--campaign-border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.campaign-settings__header {
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--campaign-border);
}

.campaign-settings__header h2,
.campaign-settings__panel-heading h3 {
    color: var(--campaign-slate);
    font-weight: 700;
}

.campaign-settings__header .section-note,
.campaign-settings__panel-heading p,
.campaign-settings .form-text {
    color: var(--campaign-muted);
}

.campaign-settings .eyebrow {
    color: var(--campaign-teal);
    font-size: 0.68rem;
    font-weight: 700;
}

.campaign-settings__tabs {
    margin-top: 0.75rem;
}

.campaign-settings .workspace-tabs__nav {
    gap: 0;
    padding: 0;
    margin: 0 0 1rem;
    border: 0;
    border-bottom: 1px solid var(--campaign-border);
    border-radius: 0;
    background: transparent;
}

.campaign-settings .workspace-tabs__tab {
    border-radius: 0;
    padding: 0.58rem 0.72rem;
    color: var(--campaign-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.campaign-settings .workspace-tabs__tab:hover,
.campaign-settings .workspace-tabs__tab:focus-visible {
    background: #f8fafc;
    color: var(--campaign-teal);
}

.campaign-settings .workspace-tabs__tab[aria-selected="true"] {
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--campaign-teal);
    color: var(--campaign-teal);
}

.campaign-settings__panel {
    padding: 1rem;
    border: 1px solid var(--campaign-border);
    border-radius: 8px;
    background: #ffffff;
}

.campaign-settings__effective-stack {
    display: grid;
    gap: 0.9rem;
}

.campaign-settings__table {
    width: 100%;
}

.campaign-settings__table .table-slate {
    min-width: 760px;
}

.campaign-settings__panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.campaign-settings__panel-heading h3 {
    margin: 0;
    font-size: 1rem;
}

.campaign-settings__panel-heading p {
    max-width: 30rem;
    margin: 0;
    font-size: 0.82rem;
}

.campaign-settings .form-label {
    color: var(--campaign-slate);
    font-size: 0.8rem;
    font-weight: 600;
}

.campaign-settings .form-control,
.campaign-settings .form-select {
    min-height: 36px;
    border-color: var(--campaign-border);
    border-radius: 6px;
    background: #ffffff;
}

.campaign-settings .form-control:focus,
.campaign-settings .form-select:focus {
    border-color: var(--campaign-teal);
    box-shadow: 0 0 0 0.16rem rgba(15, 118, 110, 0.14);
}

.campaign-settings .form-check {
    padding: 0.6rem 0.75rem 0.6rem 2.1rem;
    border: 1px solid var(--campaign-border);
    border-radius: 6px;
    background: #f8fafc;
}

.campaign-settings .form-check-input:checked {
    background-color: var(--campaign-teal);
    border-color: var(--campaign-teal);
}

.campaign-settings .btn-dark {
    border-color: var(--campaign-teal);
    background: var(--campaign-teal);
}

.campaign-settings .btn-dark:hover,
.campaign-settings .btn-dark:focus-visible {
    border-color: #0b5e58;
    background: #0b5e58;
}

.campaign-settings .compact-panel,
.campaign-settings .metric-card {
    border-color: var(--campaign-border);
    border-radius: 8px;
    box-shadow: none;
}

.campaign-settings .metric-card {
    background: #f8fafc;
}

@media (max-width: 991.98px) {
    .campaign-settings__panel-heading {
        flex-direction: column;
    }
}

/* Authority Campaigns visual system. This layer deliberately reuses the existing
   WebForms shell and Bootstrap controls so application behavior stays unchanged. */
:root {
    --authority-canvas: #faf9f4;
    --authority-surface: #ffffff;
    --authority-sunken: #f5f4f0;
    --authority-ink: #20284d;
    --authority-ink-hover: #2a3561;
    --authority-ink-muted: #b6bfd4;
    --authority-primary: #4055b8;
    --authority-primary-dark: #33459d;
    --authority-teal: #118f89;
    --authority-teal-dark: #0d746f;
    --authority-teal-soft: #e7f7f5;
    --authority-text: #20284d;
    --authority-muted: #68718a;
    --authority-border: #e6e5df;
    --authority-focus: rgba(17, 143, 137, 0.22);
    --authority-shadow: 0 1px 2px rgba(32, 40, 77, 0.07);
}

body.app-shell {
    background: var(--authority-canvas);
    color: var(--authority-text);
    font-family: "Instrument Sans", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body.app-shell .skip-link {
    border-radius: 6px;
    background: var(--authority-teal);
    color: #fff;
    padding: 0.5rem 0.75rem;
}

body.app-shell .app-sidebar {
    width: 248px;
    padding: 0;
    background: var(--authority-ink);
    border-right: 0;
    box-shadow: none;
    color: #f7f8fb;
}

body.app-shell .brand-block {
    min-height: 56px;
    margin: 0;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

body.app-shell .brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: var(--authority-teal);
    color: #fff;
    font-size: 0.9rem;
    letter-spacing: 0;
}

body.app-shell .brand-copy strong {
    color: #f8fafc;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

body.app-shell .brand-copy span {
    margin-top: 0.08rem;
    color: var(--authority-ink-muted);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body.app-shell .workspace-badge {
    margin: 0;
    padding: 0.75rem;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0;
    background: transparent;
}

body.app-shell .workspace-label {
    color: var(--authority-ink-muted);
    font-size: 0.64rem;
    font-weight: 600;
}

body.app-shell .workspace-value,
body.app-shell .workspace-time {
    color: #f8fafc;
}

body.app-shell .workspace-value {
    font-size: 0.82rem;
}

body.app-shell .workspace-time {
    font-size: 0.7rem;
    font-weight: 500;
}

body.app-shell .tenant-switcher {
    border-color: rgba(255, 255, 255, 0.15);
    background-color: var(--authority-ink-hover);
    color: #f8fafc;
    font-size: 0.75rem;
}

body.app-shell .nav-groups {
    gap: 0.8rem;
    padding: 0.85rem 0.5rem 1rem;
}

body.app-shell .nav-section h2 {
    margin: 0 0 0.3rem;
    padding: 0 0.55rem;
    color: var(--authority-ink-muted);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.09em;
}

body.app-shell .nav-link-item {
    position: relative;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    color: var(--authority-ink-muted);
    font-size: 0.82rem;
    font-weight: 600;
    transition: background-color 0.16s ease, color 0.16s ease;
}

body.app-shell .nav-link-item:hover,
body.app-shell .nav-link-item:focus {
    transform: none;
    box-shadow: none;
    background: var(--authority-ink-hover);
    color: #fff;
}

body.app-shell .nav-link-item.active {
    background: var(--authority-ink-hover);
    color: #fff;
}

body.app-shell .nav-link-item.active::before {
    position: absolute;
    top: 0.4rem;
    bottom: 0.4rem;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--authority-teal);
    content: "";
}

body.app-shell .app-main {
    padding: 0;
}

body.app-shell .topbar {
    position: sticky;
    top: 0;
    z-index: 9;
    min-height: 56px;
    margin: 0;
    padding: 0.65rem clamp(1rem, 3vw, 1.75rem);
    border-bottom: 1px solid var(--authority-border);
    background: rgba(247, 245, 239, 0.94);
    backdrop-filter: blur(12px);
}

body.app-shell .eyebrow {
    margin-bottom: 0.14rem;
    color: var(--authority-muted);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.09em;
}

body.app-shell .page-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

body.app-shell .content-frame {
    width: min(100%, 1240px);
    margin: 0 auto;
    padding: 1.25rem clamp(1rem, 3vw, 1.75rem) 1.75rem;
    gap: 0.9rem;
}

body.app-shell .app-main > .alert {
    width: min(calc(100% - 2rem), 1240px);
    margin: 1rem auto 0;
}

body.app-shell .user-chip {
    padding: 0.32rem 0.55rem;
    border-color: var(--authority-border);
    border-radius: 8px;
    background: var(--authority-surface);
}

body.app-shell .user-chip__name {
    font-size: 0.78rem;
}

body.app-shell .user-chip__meta {
    color: var(--authority-muted);
    font-size: 0.66rem;
}

body.app-shell .topbar .btn,
body.app-shell .panel-card .btn {
    border-radius: 7px;
    font-weight: 600;
}

body.app-shell .btn-outline-secondary {
    border-color: var(--authority-border);
    background: var(--authority-surface);
    color: var(--authority-text);
}

body.app-shell .btn-outline-secondary:hover,
body.app-shell .btn-outline-secondary:focus-visible {
    border-color: var(--authority-teal);
    background: var(--authority-teal-soft, #e9f8f7);
    color: var(--authority-teal-dark);
}

body.app-shell .btn-dark,
body.app-shell .btn-primary {
    border-color: var(--authority-primary);
    background: var(--authority-primary);
}

body.app-shell .btn-dark:hover,
body.app-shell .btn-dark:focus-visible,
body.app-shell .btn-primary:hover,
body.app-shell .btn-primary:focus-visible {
    border-color: var(--authority-primary-dark);
    background: var(--authority-primary-dark);
}

body.app-shell .panel-card,
body.app-shell .compact-panel,
body.app-shell .form-panel,
body.app-shell .auth-panel,
body.app-shell .correlation-box {
    border-color: var(--authority-border);
    border-radius: 10px;
    background: var(--authority-surface);
    box-shadow: var(--authority-shadow);
}

body.app-shell .panel-card {
    padding: 1rem 1.1rem;
}

body.app-shell .panel-card__header,
body.app-shell .section-header {
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--authority-border);
}

body.app-shell .panel-card h2 {
    margin: 0;
    color: var(--authority-text);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

body.app-shell .section-note,
body.app-shell .muted-copy,
body.app-shell .metric-label {
    color: var(--authority-muted);
}

body.app-shell .muted-copy {
    font-size: 0.86rem;
    line-height: 1.55;
}

body.app-shell .metric-grid {
    gap: 0.7rem;
}

body.app-shell .metric-card {
    padding: 0.75rem;
    border-color: var(--authority-border);
    border-radius: 8px;
    background: var(--authority-surface);
}

body.app-shell .metric-card strong {
    color: var(--authority-text);
    font-size: 1.15rem;
}

body.app-shell .metric-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

body.app-shell .status-pill {
    padding: 0.22rem 0.5rem;
    border: 1px solid #b9e8d7;
    border-radius: 999px;
    background: #ecfaf3;
    color: #18794e;
    font-size: 0.72rem;
}

body.app-shell .table-slate {
    font-size: 0.8rem;
}

body.app-shell .table-slate > tbody > tr > td,
body.app-shell .table-slate > thead > tr > th,
body.app-shell .table-slate.table > :not(caption) > * > * {
    padding: 0.55rem 0.7rem;
    border-color: var(--authority-border);
}

body.app-shell .table-slate > thead > tr > th {
    color: var(--authority-muted);
    background: var(--authority-sunken);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

body.app-shell .form-control,
body.app-shell .form-select {
    border-color: var(--authority-border);
    border-radius: 7px;
    background: var(--authority-surface);
    color: var(--authority-text);
}

body.app-shell .form-control:focus,
body.app-shell .form-select:focus {
    border-color: var(--authority-teal);
    box-shadow: 0 0 0 0.16rem var(--authority-focus);
}

body.app-shell .workspace-tabs__nav {
    gap: 0;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--authority-border);
    border-radius: 0;
    background: transparent;
}

body.app-shell .workspace-tabs__tab {
    padding: 0.55rem 0.7rem;
    border-radius: 0;
    color: var(--authority-muted);
    font-size: 0.76rem;
    font-weight: 600;
}

body.app-shell .workspace-tabs__tab:hover,
body.app-shell .workspace-tabs__tab:focus-visible {
    background: transparent;
    color: var(--authority-teal-dark);
}

body.app-shell .workspace-tabs__tab[aria-selected="true"] {
    box-shadow: inset 0 -2px 0 var(--authority-teal);
    background: transparent;
    color: var(--authority-teal-dark);
}

body.app-shell .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    margin-left: auto;
    color: var(--authority-ink-muted);
    font-size: 1rem;
    line-height: 1;
}

body.app-shell .sidebar-toggle:hover,
body.app-shell .sidebar-toggle:focus-visible {
    background: var(--authority-ink-hover);
    color: #fff;
}

body.app-shell.sidebar-collapsed .app-sidebar {
    width: 68px;
}

body.app-shell.sidebar-collapsed .brand-block {
    justify-content: center;
    padding-right: 0;
    padding-left: 0;
}

body.app-shell.sidebar-collapsed .nav-groups {
    padding-right: 0.4rem;
    padding-left: 0.4rem;
}

body.app-shell.sidebar-collapsed .nav-link-item {
    min-height: 38px;
}

body.app-shell.auth-shell {
    background: var(--authority-canvas);
}

body.app-shell .auth-main {
    max-width: 980px;
    padding-top: clamp(1.5rem, 8vh, 4.5rem);
}

body.app-shell .auth-topbar {
    min-height: auto;
    padding: 0 0 1rem;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
}

body.app-shell .auth-topbar .brand-copy strong {
    color: var(--authority-text);
}

body.app-shell .auth-main .content-frame {
    width: 100%;
    padding: 0;
}

body.app-shell .auth-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--authority-border);
    border-radius: 12px;
    background: var(--authority-surface);
    box-shadow: var(--authority-shadow);
}

body.app-shell .auth-main .auth-panel,
body.app-shell .auth-main .form-panel {
    min-height: 100%;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

body.app-shell .auth-main .auth-panel {
    background: var(--authority-ink);
    color: #f8fafc;
}

body.app-shell .auth-main .auth-panel h2 {
    color: #fff;
}

body.app-shell .auth-main .auth-panel .muted-copy,
body.app-shell .auth-main .auth-panel .feature-list {
    color: var(--authority-ink-muted);
}

body.app-shell .auth-main .auth-panel .feature-list {
    font-size: 0.86rem;
    line-height: 1.6;
}

body.app-shell .auth-main .form-panel {
    background: var(--authority-surface);
}

body.app-shell .auth-main .form-label {
    color: var(--authority-text);
    font-size: 0.8rem;
    font-weight: 600;
}

body.app-shell .auth-main a {
    color: var(--authority-teal-dark);
    font-weight: 600;
}

body.app-shell .auth-main .btn-dark {
    min-height: 38px;
    font-size: 0.84rem;
}

@media (max-width: 991.98px) {
    body.app-shell .app-sidebar {
        width: 264px;
    }

    body.app-shell .topbar {
        position: static;
        align-items: center;
    }

    body.app-shell .content-frame {
        padding-top: 1rem;
    }

    body.app-shell .auth-grid {
        grid-template-columns: 1fr;
    }

    body.app-shell .auth-main .auth-panel {
        display: none;
    }

    body.app-shell .topbar-actions {
        align-items: center;
        flex-direction: row;
    }

    body.app-shell .user-chip {
        display: none;
    }
}

.selection-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.65rem 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
}

.selection-list input {
    margin-right: 0.45rem;
}

.shell-backdrop {
    display: none;
}

body.sidebar-collapsed .app-sidebar {
    width: 76px;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .workspace-badge,
body.sidebar-collapsed .nav-section h2,
body.sidebar-collapsed .nav-link-item small,
body.sidebar-collapsed .nav-link-item span {
    display: none;
}

body.sidebar-collapsed .nav-link-item {
    align-items: center;
    justify-content: center;
    min-height: 42px;
}

@media (max-width: 991.98px) {
    .app-main {
        padding: 1rem;
    }

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

    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: var(--shadow);
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .shell-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(24, 21, 16, 0.34);
        z-index: 10;
    }

    body.sidebar-open .shell-backdrop {
        display: block;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .topbar,
    .panel-card__header,
    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Dashboard composition: high-signal overview first, detailed telemetry on tabs. */
body.app-shell .authority-dashboard {
    display: grid;
    gap: 1rem;
}

body.app-shell .authority-dashboard__overview {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 1rem;
}

body.app-shell .authority-dashboard__summary .muted-copy {
    max-width: 46rem;
    margin: 0.8rem 0 0;
}

body.app-shell .authority-dashboard__identity-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 1rem;
}

body.app-shell .authority-dashboard__security .feature-list {
    margin: 0.75rem 0 0;
    color: var(--authority-muted);
    font-size: 0.83rem;
    line-height: 1.55;
}

body.app-shell .authority-dashboard__tabs .workspace-tabs__nav {
    margin-bottom: 1rem;
}

body.app-shell .authority-dashboard__tabs .panel-card {
    min-height: 226px;
}

body.app-shell .authority-dashboard__tabs .section-header {
    align-items: flex-start;
}

body.app-shell .authority-dashboard__tabs .section-note {
    max-width: 28rem;
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: right;
}

body.app-shell .authority-dashboard__metric-grid--five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

body.app-shell .authority-dashboard__metric-grid--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.app-shell .authority-dashboard__metric-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.app-shell .authority-dashboard__rate-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

body.app-shell .authority-dashboard__rate-list span {
    min-width: 9rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--authority-border);
    border-radius: 8px;
    background: var(--authority-sunken);
    color: var(--authority-muted);
    font-size: 0.78rem;
}

body.app-shell .authority-dashboard__rate-list strong {
    display: block;
    margin-top: 0.1rem;
    color: var(--authority-text);
    font-size: 0.98rem;
}

@media (max-width: 991.98px) {
    body.app-shell .authority-dashboard__overview {
        grid-template-columns: 1fr;
    }

    body.app-shell .authority-dashboard__metric-grid--five,
    body.app-shell .authority-dashboard__metric-grid--four,
    body.app-shell .authority-dashboard__metric-grid--three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.app-shell .authority-dashboard__tabs .section-note {
        max-width: none;
        text-align: left;
    }
}

@media (max-width: 575.98px) {
    body.app-shell .authority-dashboard__identity-grid,
    body.app-shell .authority-dashboard__metric-grid--five,
    body.app-shell .authority-dashboard__metric-grid--four,
    body.app-shell .authority-dashboard__metric-grid--three {
        grid-template-columns: 1fr;
    }
}

/* Campaign settings adapts the Lovable administration layout to the existing controls. */
body.app-shell .campaign-settings {
    padding: 1.1rem;
    border-color: var(--authority-border);
    border-radius: 10px;
    background: var(--authority-surface);
    box-shadow: var(--authority-shadow);
}

body.app-shell .campaign-settings__header {
    align-items: center;
    padding-bottom: 1rem;
    border-bottom-color: var(--authority-border);
}

body.app-shell .campaign-settings__header h2,
body.app-shell .campaign-settings__panel-heading h3 {
    color: var(--authority-text);
    font-weight: 600;
}

body.app-shell .campaign-settings__actions {
    display: flex;
    align-items: end;
    gap: 0.65rem;
}

body.app-shell .campaign-settings__scope-label {
    display: block;
    margin-bottom: 0.22rem;
    color: var(--authority-muted);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

body.app-shell .campaign-settings__current-scope {
    display: grid;
    gap: 0.15rem;
    min-width: 8.5rem;
    padding: 0.38rem 0.55rem;
    border: 1px solid var(--authority-border);
    border-radius: 7px;
    background: var(--authority-sunken);
    line-height: 1.2;
}

body.app-shell .campaign-settings__current-scope span {
    color: var(--authority-muted);
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

body.app-shell .campaign-settings__current-scope strong {
    color: var(--authority-text);
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

body.app-shell .campaign-settings__actions .form-select {
    min-width: 10.5rem;
    min-height: 34px;
}

body.app-shell .campaign-settings__actions .btn {
    min-height: 34px;
    white-space: nowrap;
}

body.app-shell .campaign-settings__tabs {
    margin-top: 1rem;
}

body.app-shell .campaign-settings .workspace-tabs__nav {
    margin-bottom: 1.15rem;
}

body.app-shell .campaign-settings__panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

body.app-shell .campaign-settings__panel-heading {
    margin-bottom: 1.15rem;
}

body.app-shell .campaign-settings__panel-heading p {
    color: var(--authority-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

body.app-shell .campaign-settings .form-label {
    color: var(--authority-text);
    font-size: 0.76rem;
    font-weight: 600;
}

body.app-shell .campaign-settings .form-text {
    color: var(--authority-muted);
    font-size: 0.74rem;
    line-height: 1.4;
}

body.app-shell .campaign-settings .form-check {
    min-height: 58px;
    padding: 0.75rem 0.8rem 0.75rem 2.25rem;
    border-color: var(--authority-border);
    border-radius: 8px;
    background: var(--authority-sunken);
}

body.app-shell .campaign-settings .form-check-input:checked {
    border-color: var(--authority-teal);
    background-color: var(--authority-teal);
}

body.app-shell .campaign-settings__effective-stack {
    gap: 1rem;
}

body.app-shell .campaign-settings__effective-stack .compact-panel {
    padding: 1rem;
    border-color: var(--authority-border);
    border-radius: 8px;
    box-shadow: none;
}

body.app-shell .campaign-settings__effective-stack .metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

body.app-shell .campaign-settings__effective-stack .metric-card strong {
    overflow-wrap: anywhere;
    font-size: 0.9rem;
}

@media (max-width: 767.98px) {
    body.app-shell .campaign-settings__header,
    body.app-shell .campaign-settings__actions {
        align-items: stretch;
        flex-direction: column;
    }

    body.app-shell .campaign-settings__actions .form-select {
        width: 100%;
    }
}
