:root {
    --app-bg: #eef2f7;
    --app-surface: #f8fafc;
    --app-panel: #ffffff;
    --app-panel-muted: #e2e8f0;
    --app-border: #d7e0ea;
    --app-border-strong: #c1cedd;
    --app-text: #0f172a;
    --app-text-soft: #475569;
    --app-heading: #0b1324;
    --app-navy: #132238;
    --app-navy-soft: #1d3557;
    --app-accent: #1f7a8c;
    --app-success: #2f855a;
    --app-warning: #c77700;
    --app-danger: #b83246;
    --app-shadow: 0 20px 55px rgba(15, 23, 42, 0.09);
    --app-radius-xl: 28px;
    --app-radius-lg: 18px;
    --app-radius-md: 14px;
    --sidebar-width: 18rem;
    --sidebar-width-collapsed: 6rem;
    --header-height: 5.5rem;
    --transition-base: 180ms ease;
}

html,
body {
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at top right, rgba(31, 122, 140, 0.12), transparent 24rem),
        linear-gradient(180deg, #f8fafc 0%, var(--app-bg) 100%);
    color: var(--app-text);
    font-family: "Fira Sans", sans-serif;
}

a {
    color: inherit;
}

a:hover {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 1100;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: var(--app-heading);
    color: #f8fafc;
    transition: top var(--transition-base);
}

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

.app-body {
    margin: 0;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns var(--transition-base);
}

.app-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: 100vh;
    padding: 1.25rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 28%),
        linear-gradient(180deg, var(--app-navy) 0%, #0b1324 100%);
    color: #e2e8f0;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
    overflow-y: auto;
    z-index: 1030;
}

.app-sidebar__brand,
.app-sidebar__footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex: 1;
    min-width: 0;
    text-decoration: none;
}

.app-brand:hover {
    text-decoration: none;
}

.app-brand__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    background: rgba(248, 250, 252, 0.08);
    border: 1px solid rgba(248, 250, 252, 0.08);
    flex-shrink: 0;
}

.app-brand__logo img {
    width: 2rem;
    height: 2rem;
}

.app-brand__eyebrow,
.app-header__eyebrow,
.sidebar-section__label,
.auth-kicker {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.app-brand__eyebrow,
.sidebar-section__label {
    color: rgba(226, 232, 240, 0.62);
}

.app-brand__title {
    display: block;
    color: #f8fafc;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.app-sidebar__user {
    padding: 1rem 1.1rem;
    border-radius: var(--app-radius-lg);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.app-sidebar__user strong,
.app-header__title,
.auth-panel h1,
.page-card__title,
.page-title {
    color: var(--app-heading);
}

.app-sidebar__user strong {
    display: block;
    color: #f8fafc;
}

.app-sidebar__user span {
    display: block;
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.92rem;
}

.sidebar-nav {
    display: grid;
    gap: 1rem;
}

.sidebar-section {
    display: grid;
    gap: 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.8rem 0.95rem;
    border: 0;
    border-radius: 1rem;
    background: transparent;
    color: #dbe7f3;
    text-align: left;
    text-decoration: none;
    transition:
        background-color var(--transition-base),
        color var(--transition-base),
        transform var(--transition-base);
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
    background: rgba(148, 163, 184, 0.14);
    color: #f8fafc;
    text-decoration: none;
    transform: translateX(2px);
}

.sidebar-link--active {
    background: linear-gradient(90deg, rgba(31, 122, 140, 0.28), rgba(255, 255, 255, 0.1));
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.12);
}

.sidebar-link__icon {
    width: 1.4rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-link__title {
    font-weight: 500;
}

.sidebar-link__meta {
    color: rgba(226, 232, 240, 0.64);
    font-size: 0.75rem;
}

.sidebar-submenu {
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(226, 232, 240, 0.12);
}

.sidebar-submenu .sidebar-link {
    padding-block: 0.7rem;
}

.app-sidebar__footer {
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(226, 232, 240, 0.1);
}

.app-sidebar__footer-meta {
    flex: 1;
    min-width: 0;
}

.app-sidebar__footer-meta a,
.app-sidebar__footer-meta p {
    margin: 0;
    color: rgba(226, 232, 240, 0.72);
    text-decoration: none;
    font-size: 0.9rem;
}

.app-sidebar__footer-meta a:hover {
    color: #f8fafc;
}

.app-content {
    min-width: 0;
    padding: 1.5rem;
}

.app-header {
    position: sticky;
    top: 0.75rem;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: var(--header-height);
    padding: 1.15rem 1.35rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(193, 206, 221, 0.9);
    border-radius: var(--app-radius-xl);
    background: rgba(248, 250, 252, 0.88);
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(18px);
}

.app-header__intro,
.app-header__meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.app-header__eyebrow {
    color: var(--app-accent);
}

.app-header__title {
    margin: 0.2rem 0 0;
    font-size: clamp(1.6rem, 2vw, 2.2rem);
    font-weight: 700;
    line-height: 1.05;
}

.app-header__title a {
    text-decoration: none;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.header-links a {
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.05);
    color: var(--app-text-soft);
    font-size: 0.92rem;
    text-decoration: none;
}

.header-links a:hover {
    background: rgba(19, 34, 56, 0.1);
    color: var(--app-heading);
}

.app-header__user {
    min-width: 0;
    text-align: right;
}

.app-header__user strong {
    display: block;
    color: var(--app-heading);
}

.app-header__user span {
    display: block;
    color: var(--app-text-soft);
    font-size: 0.9rem;
}

.app-main {
    min-width: 0;
}

.page-messages {
    display: grid;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.page-card,
.auth-card,
.panel-card,
.data-panel {
    background: var(--app-panel);
    border: 1px solid rgba(193, 206, 221, 0.85);
    border-radius: var(--app-radius-xl);
    box-shadow: var(--app-shadow);
}

.page-card {
    padding: 1.5rem;
}

.page-card__title,
.page-title {
    margin: 0;
    font-size: clamp(1.45rem, 1.6vw, 1.9rem);
    font-weight: 700;
}

.page-card__subtitle,
.page-subtitle,
.auth-copy {
    color: var(--app-text-soft);
}

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

.toolbar__group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.toolbar__search {
    min-width: min(100%, 22rem);
}

.toolbar__search .form-control,
.toolbar__search .form-select,
.filter-card .form-control,
.filter-card .form-select,
.auth-card .form-control,
.page-card .form-control,
.page-card .form-select,
.page-card textarea,
.data-panel .form-control,
.data-panel .form-select {
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    background: var(--app-surface);
    color: var(--app-text);
    min-height: 3rem;
}

.page-card textarea,
.data-panel textarea {
    min-height: 7rem;
}

.form-check-input {
    border-color: var(--app-border-strong);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.btn:focus-visible,
.sidebar-link:focus-visible,
.sidebar-toggle:focus-visible {
    border-color: rgba(31, 122, 140, 0.55);
    box-shadow: 0 0 0 0.22rem rgba(31, 122, 140, 0.16);
    outline: 0;
}

.btn {
    border-radius: 999px;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, var(--app-accent), var(--app-navy-soft));
    border-color: transparent;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: linear-gradient(135deg, #1b8da0, #27466d);
    border-color: transparent;
}

.btn-outline-dark {
    color: var(--app-heading);
    border-color: rgba(15, 23, 42, 0.16);
}

.btn-outline-dark:hover {
    background: var(--app-heading);
    border-color: var(--app-heading);
}

.btn-link,
.page-link {
    color: var(--app-accent);
}

.page-link {
    border-radius: 999px;
    margin: 0 0.15rem;
    border-color: transparent;
    color: var(--app-text-soft);
}

.page-item.active .page-link {
    background: var(--app-heading);
    border-color: var(--app-heading);
}

.table-shell,
.table-responsive {
    border-radius: var(--app-radius-lg);
}

.table-responsive {
    background: var(--app-panel);
    border: 1px solid rgba(193, 206, 221, 0.75);
    box-shadow: 0 10px 35px rgba(15, 23, 42, 0.06);
}

.table {
    margin-bottom: 0;
    color: var(--app-text);
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: var(--app-text-soft);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table > :not(caption) > * > * {
    padding: 0.95rem 1rem;
    border-color: rgba(215, 224, 234, 0.9);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(31, 122, 140, 0.05);
}

.table a {
    color: var(--app-heading);
    text-decoration-color: rgba(31, 122, 140, 0.35);
}

.table a:hover {
    color: var(--app-accent);
}

.status-badge,
.badge {
    border-radius: 999px;
    font-weight: 500;
}

.mono {
    font-family: "Fira Code", monospace;
}

.dashboard-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.5rem 1.6rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(193, 206, 221, 0.85);
    border-radius: var(--app-radius-xl);
    background:
        radial-gradient(circle at top right, rgba(31, 122, 140, 0.12), transparent 16rem),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: var(--app-shadow);
}

.dashboard-hero__eyebrow,
.dashboard-section__eyebrow {
    margin: 0;
    color: var(--app-accent);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.dashboard-hero__title {
    margin: 0.35rem 0 0.65rem;
    color: var(--app-heading);
    font-size: clamp(1.8rem, 2.1vw, 2.6rem);
    line-height: 1;
}

.dashboard-hero__copy {
    margin: 0;
    max-width: 48rem;
    color: var(--app-text-soft);
    font-size: 1rem;
}

.dashboard-pills {
    display: grid;
    gap: 0.75rem;
    min-width: min(100%, 19rem);
}

.dashboard-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(193, 206, 221, 0.8);
    border-radius: 1rem;
    background: rgba(248, 250, 252, 0.82);
}

.dashboard-pill strong {
    color: var(--app-heading);
    font-size: 1rem;
}

.dashboard-pill span {
    color: var(--app-text-soft);
    font-size: 0.9rem;
}

.dashboard-metrics {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.automation-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}

.automation-card {
    display: grid;
    gap: 1rem;
    padding: 1.2rem;
    border: 1px solid rgba(193, 206, 221, 0.82);
    border-radius: 1.25rem;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98)),
        radial-gradient(circle at top right, rgba(31, 122, 140, 0.08), transparent 14rem);
}

.automation-card__eyebrow {
    margin: 0 0 0.4rem;
    color: var(--app-accent);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.automation-card__title {
    margin: 0 0 0.45rem;
    color: var(--app-heading);
    font-size: 1.15rem;
}

.automation-card__title i {
    margin-right: 0.45rem;
    color: var(--app-accent);
}

.automation-card__copy {
    margin: 0;
    color: var(--app-text-soft);
}

.automation-layout {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: minmax(0, 1.7fr) minmax(20rem, 0.9fr);
}

.automation-layout__main,
.automation-layout__side {
    min-width: 0;
}

.automation-callout {
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    border: 1px solid rgba(193, 206, 221, 0.78);
}

.automation-callout--soft {
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
}

.automation-callout--warning {
    background: rgba(217, 119, 6, 0.08);
    border-color: rgba(217, 119, 6, 0.18);
    color: #92400e;
}

.automation-script-list {
    display: grid;
    gap: 1rem;
}

.automation-script-card {
    display: grid;
    gap: 1rem;
    padding: 1.2rem;
    border: 1px solid rgba(193, 206, 221, 0.82);
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.04);
}

.automation-script-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.automation-script-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    color: var(--app-text-soft);
    font-size: 0.9rem;
}

.automation-code-preview,
.automation-editor {
    border-radius: 1rem;
    background: #0f172a;
    color: #e2e8f0;
}

.automation-code-preview {
    margin: 0;
    padding: 1rem 1.1rem;
    min-height: 9rem;
    border: 1px solid rgba(15, 23, 42, 0.14);
    font-family: "Fira Code", monospace;
    font-size: 0.84rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.automation-editor-panel .automation-editor {
    min-height: 26rem;
}

.automation-empty-state {
    padding: 2rem;
    border: 1px dashed rgba(148, 163, 184, 0.6);
    border-radius: 1.25rem;
    text-align: center;
    background: rgba(248, 250, 252, 0.78);
    color: var(--app-text-soft);
}

.automation-empty-state h4 {
    margin-bottom: 0.5rem;
    color: var(--app-heading);
}

.script-builder-modal__dialog {
    max-width: min(92vw, 88rem);
}

.script-builder-modal__content {
    border: 0;
    border-radius: 1.4rem;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(15, 23, 42, 0.26);
}

.script-builder-modal__header {
    align-items: flex-start;
    padding: 1.5rem 1.6rem 1.2rem;
    border-bottom: 1px solid rgba(193, 206, 221, 0.78);
    background:
        radial-gradient(circle at top right, rgba(31, 122, 140, 0.12), transparent 16rem),
        linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.98));
}

.script-builder-modal__body {
    padding: 1.35rem 1.6rem 1.5rem;
    background: #f8fafc;
}

.script-builder-modal__grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: minmax(0, 1.65fr) minmax(18rem, 0.85fr);
}

.script-builder-modal__main,
.script-builder-modal__side {
    min-width: 0;
}

.script-builder-modal__meta {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(12rem, 0.8fr) minmax(0, 1.2fr);
}

.script-builder-help {
    position: sticky;
    top: 0;
}

.script-builder-modal__footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(193, 206, 221, 0.78);
}

.automation-log {
    padding: 1rem 1.1rem;
    border: 1px solid rgba(193, 206, 221, 0.82);
    border-radius: 1rem;
    background: #f8fafc;
    color: #1e293b;
    font-family: "Fira Code", monospace;
    font-size: 0.88rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 14rem;
    max-height: 28rem;
    overflow: auto;
}

.automation-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    color: #475569;
    font-size: 0.82rem;
    font-weight: 600;
}

.automation-live-indicator::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.45;
}

.automation-live-indicator--active {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

.automation-live-indicator--active::before {
    opacity: 1;
    animation: automation-pulse 1.2s ease-in-out infinite;
}

.status-badge--neutral {
    background: rgba(148, 163, 184, 0.16);
    color: #334155;
}

.status-badge--idle {
    background: rgba(148, 163, 184, 0.16);
    color: #334155;
}

.status-badge--success {
    background: rgba(22, 163, 74, 0.14);
    color: #166534;
}

.status-badge--error,
.status-badge--danger {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.status-badge--running,
.status-badge--warning {
    background: rgba(217, 119, 6, 0.14);
    color: #92400e;
}

@keyframes automation-pulse {
    0%,
    100% {
        transform: scale(0.9);
        opacity: 0.55;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.metric-card {
    display: flex;
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid rgba(193, 206, 221, 0.82);
    border-radius: 1.25rem;
    background: var(--app-panel);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.05);
    text-decoration: none;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.1);
    text-decoration: none;
}

.metric-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.95rem;
    flex-shrink: 0;
    font-size: 1rem;
}

.metric-card__body {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.metric-card__label {
    color: var(--app-text-soft);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.metric-card__value {
    color: var(--app-heading);
    font-size: 1.65rem;
    line-height: 1;
}

.metric-card__meta {
    color: var(--app-text-soft);
    font-size: 0.9rem;
}

.metric-card--primary .metric-card__icon {
    color: #0f4c5c;
    background: rgba(31, 122, 140, 0.14);
}

.metric-card--danger .metric-card__icon {
    color: var(--app-danger);
    background: rgba(184, 50, 70, 0.14);
}

.metric-card--warning .metric-card__icon {
    color: var(--app-warning);
    background: rgba(199, 119, 0, 0.14);
}

.metric-card--success .metric-card__icon {
    color: var(--app-success);
    background: rgba(47, 133, 90, 0.14);
}

.metric-card--secondary .metric-card__icon,
.metric-card--dark .metric-card__icon {
    color: var(--app-heading);
    background: rgba(15, 23, 42, 0.09);
}

.dashboard-section {
    display: grid;
    gap: 1rem;
}

.dashboard-section__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-section__title {
    margin: 0.3rem 0 0;
    color: var(--app-heading);
    font-size: 1.35rem;
}

.dashboard-progress-list {
    display: grid;
    gap: 0.85rem;
}

.dashboard-progress-row {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 12rem) minmax(0, 1fr) auto;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.dashboard-progress-row:hover {
    text-decoration: none;
}

.dashboard-progress-row__meta {
    display: grid;
    gap: 0.15rem;
}

.dashboard-progress-row__meta strong {
    color: var(--app-heading);
}

.dashboard-progress-row__meta span,
.dashboard-list__summary,
.dashboard-list__meta,
.quick-action-card__body span,
.dashboard-inline-stats span,
.dashboard-empty {
    color: var(--app-text-soft);
}

.dashboard-progress-row__track {
    position: relative;
    height: 0.7rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.dashboard-progress-row__fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
}

.dashboard-progress-row__fill--success {
    background: linear-gradient(90deg, #61c38a, var(--app-success));
}

.dashboard-progress-row__fill--warning {
    background: linear-gradient(90deg, #f9c74f, var(--app-warning));
}

.dashboard-progress-row__fill--primary {
    background: linear-gradient(90deg, #58c4d8, var(--app-accent));
}

.dashboard-progress-row__fill--danger {
    background: linear-gradient(90deg, #f38ba0, var(--app-danger));
}

.dashboard-progress-row__fill--secondary {
    background: linear-gradient(90deg, #94a3b8, #475569);
}

.dashboard-progress-row__value {
    color: var(--app-heading);
    font-family: "Fira Code", monospace;
    font-size: 0.9rem;
}

.dashboard-inline-stats {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-inline-stats div {
    display: grid;
    gap: 0.2rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(193, 206, 221, 0.8);
    border-radius: 1rem;
    background: var(--app-surface);
}

.dashboard-inline-stats strong {
    color: var(--app-heading);
    font-size: 1.1rem;
}

.dashboard-list {
    display: grid;
    gap: 0.85rem;
}

.dashboard-list__item {
    padding: 1rem 1.05rem;
    border: 1px solid rgba(193, 206, 221, 0.78);
    border-radius: 1.1rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.dashboard-list__content {
    display: grid;
    gap: 0.45rem;
}

.dashboard-list__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
}

.dashboard-list__title {
    color: var(--app-heading);
    font-weight: 600;
    text-decoration: none;
}

.dashboard-list__title:hover {
    color: var(--app-accent);
}

.dashboard-list__summary {
    margin: 0;
}

.dashboard-list__meta {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
    font-size: 0.92rem;
}

.dashboard-list__meta a {
    color: var(--app-accent);
    text-decoration: none;
}

.dashboard-list__meta a:hover {
    text-decoration: underline;
}

.dashboard-empty {
    margin: 0;
    padding: 1rem 1.1rem;
    border: 1px dashed rgba(193, 206, 221, 0.9);
    border-radius: 1rem;
    background: var(--app-surface);
}

.quick-actions-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quick-action-card {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1rem 1.05rem;
    border: 1px solid rgba(193, 206, 221, 0.8);
    border-radius: 1.15rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: inherit;
    text-decoration: none;
    transition: transform var(--transition-base), border-color var(--transition-base);
}

.quick-action-card:hover {
    transform: translateY(-2px);
    border-color: rgba(31, 122, 140, 0.35);
    text-decoration: none;
}

.quick-action-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.95rem;
    background: rgba(31, 122, 140, 0.12);
    color: var(--app-accent);
    flex-shrink: 0;
}

.quick-action-card__body {
    display: grid;
    gap: 0.2rem;
}

.quick-action-card__body strong {
    color: var(--app-heading);
}

.detail-hero {
    display: grid;
    gap: 1.25rem;
}

.detail-hero__summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.detail-meta-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.detail-meta-card {
    padding: 1rem 1.1rem;
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    border: 1px solid rgba(215, 224, 234, 0.85);
}

.detail-meta-card h2 {
    margin: 0 0 0.4rem;
    color: var(--app-heading);
    font-size: 1rem;
}

.detail-media {
    display: grid;
    gap: 1rem;
}

.detail-media--compact {
    align-content: start;
}

.detail-media__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 18rem;
    border: 1px dashed var(--app-border-strong);
    border-radius: var(--app-radius-xl);
    background: linear-gradient(180deg, #f8fafc 0%, #edf2f7 100%);
    overflow: hidden;
}

.detail-media__preview--compact {
    min-height: 10rem;
}

.detail-media__preview img {
    max-width: 100%;
    max-height: 22rem;
    object-fit: cover;
}

.detail-media__preview--compact img {
    max-height: 12rem;
}

.detail-media__placeholder {
    display: grid;
    place-items: center;
    gap: 0.5rem;
    color: var(--app-text-soft);
    text-align: center;
}

.detail-media__empty {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--app-border);
    border-radius: 1rem;
    background: var(--app-surface);
    color: var(--app-text-soft);
    font-size: 0.95rem;
}

.action-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.action-cluster .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.auth-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-panel {
    display: grid;
    grid-template-columns: minmax(0, 28rem) minmax(0, 26rem);
    width: min(100%, 68rem);
    overflow: hidden;
    border: 1px solid rgba(193, 206, 221, 0.88);
    border-radius: 2rem;
    background: var(--app-panel);
    box-shadow: var(--app-shadow);
}

.auth-panel__brand {
    display: grid;
    align-content: space-between;
    gap: 2rem;
    padding: clamp(2rem, 4vw, 3rem);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.16), transparent 18rem),
        linear-gradient(160deg, var(--app-navy-soft), #0b1324);
    color: #f8fafc;
}

.auth-panel__brand h1,
.auth-panel__brand p {
    color: inherit;
}

.auth-panel__brand h1 {
    margin: 0.4rem 0 1rem;
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: 0.95;
}

.auth-panel__brand p {
    margin: 0;
    max-width: 24rem;
    color: rgba(248, 250, 252, 0.76);
}

.auth-panel__meta {
    display: grid;
    gap: 0.65rem;
    color: rgba(248, 250, 252, 0.78);
    font-size: 0.95rem;
}

.auth-card {
    padding: clamp(2rem, 4vw, 3rem);
    display: grid;
    gap: 1.25rem;
}

.auth-card__header {
    display: grid;
    gap: 0.4rem;
}

.auth-card__header h2 {
    margin: 0;
    font-size: 1.7rem;
    color: var(--app-heading);
}

.auth-card__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.auth-card .alert ul,
.page-card .alert ul {
    margin-bottom: 0;
    padding-left: 1rem;
}

.visually-muted {
    color: var(--app-text-soft);
}

.overlay-dismiss {
    display: none;
}

/* Bootstrap 4 compatibility helpers kept for untouched legacy templates. */
.thead-dark th {
    background: var(--app-heading) !important;
    color: #f8fafc !important;
}

.btn-default,
.badge-dark {
    color: var(--app-heading);
    border: 1px solid rgba(15, 23, 42, 0.16);
    background: rgba(15, 23, 42, 0.04);
}

.btn-default:hover,
.badge-dark:hover {
    background: rgba(15, 23, 42, 0.08);
    color: var(--app-heading);
}

.input-group-append {
    display: flex;
    align-items: stretch;
}

.form-inline {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: end;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.sidebar-collapsed .app-shell {
    grid-template-columns: var(--sidebar-width-collapsed) minmax(0, 1fr);
}

body.sidebar-collapsed .app-brand__text,
body.sidebar-collapsed .app-sidebar__user,
body.sidebar-collapsed .sidebar-section__label,
body.sidebar-collapsed .sidebar-link__text,
body.sidebar-collapsed .app-sidebar__footer-meta {
    display: none;
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .app-sidebar__brand,
body.sidebar-collapsed .app-sidebar__footer {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-submenu {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
}

body.sidebar-collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

@media (max-width: 991.98px) {
    .automation-layout {
        grid-template-columns: 1fr;
    }

    .automation-script-card__header {
        flex-direction: column;
    }

    .script-builder-modal__grid,
    .script-builder-modal__meta {
        grid-template-columns: 1fr;
    }

    .script-builder-help {
        position: static;
    }

    .app-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(86vw, 20rem);
        transform: translateX(-105%);
        transition: transform var(--transition-base);
    }

    .overlay-dismiss {
        position: fixed;
        inset: 0;
        background: rgba(11, 19, 36, 0.42);
        backdrop-filter: blur(2px);
        z-index: 1020;
    }

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

    body.sidebar-open .overlay-dismiss {
        display: block;
    }

    .app-content {
        padding: 1rem;
    }

    .app-header {
        top: 0.5rem;
        padding: 1rem 1.1rem;
    }

    .app-header,
    .app-header__intro,
    .app-header__meta,
    .toolbar,
    .toolbar__group,
    .auth-panel {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-hero,
    .dashboard-section__header,
    .dashboard-list__title-row {
        flex-direction: column;
        align-items: stretch;
    }

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

    .dashboard-inline-stats,
    .quick-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-progress-row {
        grid-template-columns: 1fr;
    }

    .app-header__user {
        text-align: left;
    }

    .auth-panel {
        display: block;
    }
}

@media (max-width: 767.98px) {
    .auth-shell {
        padding: 1rem;
    }

    .page-card,
    .auth-card {
        padding: 1.2rem;
    }

    .detail-hero__summary,
    .action-cluster,
    .dashboard-metrics,
    .dashboard-inline-stats,
    .quick-actions-grid {
        align-items: stretch;
    }

    .action-cluster .btn {
        justify-content: center;
        width: 100%;
    }

    .dashboard-metrics,
    .dashboard-inline-stats,
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }

    .automation-script-card .btn,
    .automation-card .btn {
        width: 100%;
        justify-content: center;
    }

    .script-builder-modal__footer .btn {
        width: 100%;
        justify-content: center;
    }
}
