/*
 * Technolonica ERP Console theme layer (docs/design-system).
 *
 * Loaded after Filament's own CSS, which sits in a cascade layer, so these
 * unlayered rules win. Colours, radii and shadows come only from the --tl-*
 * tokens (docs/design-system/tokens.css, loaded just before this file) or the
 * Filament palette they feed. Same layout as the ERP: a dark band wrapping a
 * rounded content shell, a light sidebar with pill-shaped items, white
 * hairline cards.
 */

:root {
    --tl-band-wash: color-mix(in srgb, var(--tl-band-ink) 8%, transparent);
    --tl-band-hairline: color-mix(in srgb, var(--tl-band-ink) 16%, transparent);
    --tl-dot: color-mix(in srgb, var(--tl-accent) 16%, transparent);
    --tl-nav-hover: color-mix(in srgb, var(--tl-surface) 70%, transparent);
    --tl-row-hover: color-mix(in srgb, var(--tl-surface-tint) 40%, transparent);
    --tl-log-ground: var(--tl-band);
    --tl-log-ink: var(--tl-band-ink);
}

.dark {
    --tl-dot: color-mix(in srgb, var(--tl-accent) 9%, transparent);
}

/* Page frame: the dark band wraps a rounded content shell. */

.fi-body {
    --sidebar-width: var(--tl-sidebar-width);
    --topbar-height: var(--tl-band-height);

    font-family: var(--tl-font-sans);
    color: var(--tl-ink);
    background-color: var(--tl-ground);
}

.fi-body.fi-body-has-topbar {
    background-color: var(--tl-band);
}

.fi-body-has-topbar .fi-layout {
    min-height: calc(100dvh - var(--topbar-height));
    background-color: var(--tl-ground);
}

.fi-body-has-topbar .fi-topbar-ctn::after {
    content: '';
    position: absolute;
    top: 100%;
    inset-inline: 0;
    height: var(--tl-radius-xl);
    pointer-events: none;
    background:
        radial-gradient(circle at 100% 100%, transparent var(--tl-radius-xl), var(--tl-band) calc(var(--tl-radius-xl) + 0.5px)) left top / var(--tl-radius-xl) var(--tl-radius-xl) no-repeat,
        radial-gradient(circle at 0 100%, transparent var(--tl-radius-xl), var(--tl-band) calc(var(--tl-radius-xl) + 0.5px)) right top / var(--tl-radius-xl) var(--tl-radius-xl) no-repeat;
}

@media (min-width: 64rem) {
    .fi-body-has-topbar .fi-layout {
        width: auto;
        margin-inline-end: var(--tl-space-2);
    }

    .fi-body-has-topbar .fi-topbar-ctn::after {
        inset-inline-end: var(--tl-space-2);
    }
}

.fi-body-has-topbar .fi-main-ctn {
    position: relative;
}

.fi-body-has-topbar .fi-main-ctn::before {
    content: '';
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 28rem;
    pointer-events: none;
    background-image: radial-gradient(var(--tl-dot) 1.1px, transparent 1.4px);
    background-size: 14px 14px;
    mask-image: radial-gradient(60% 55% at 100% 0%, black 0%, transparent 70%);
}

.fi-body-has-topbar .fi-main-ctn > .fi-main:not(.fi-width-screen) {
    position: relative;
}

/* Band */

.fi-topbar {
    min-height: var(--tl-band-height);
    padding-inline: var(--tl-space-5);
    border-bottom-width: 0;
    color: var(--tl-band-ink);
    background-color: var(--tl-band);
    box-shadow: none;
}

.fi-topbar .fi-logo-light {
    display: none;
}

.fi-topbar .fi-logo-dark {
    display: flex;
}

.fi-topbar .fi-icon-btn {
    color: var(--tl-band-muted);
}

.fi-topbar .fi-icon-btn:hover,
.fi-topbar .fi-icon-btn:focus-visible {
    color: var(--tl-band-ink);
    background-color: var(--tl-band-wash);
}

.fi-topbar .fi-global-search-field .fi-input-wrp {
    background-color: var(--tl-band-wash);
    box-shadow: inset 0 0 0 1px var(--tl-band-hairline);
}

.fi-topbar .fi-global-search-field .fi-input {
    color: var(--tl-band-ink);
}

.fi-topbar .fi-global-search-field .fi-input::placeholder,
.fi-topbar .fi-global-search-field .fi-icon {
    color: var(--tl-band-muted);
}

/* The console's name next to the wordmark, as the ERP shows its module. */
.tl-console-eyebrow {
    display: none;
    align-items: center;
    gap: var(--tl-space-3);
    margin-inline-start: var(--tl-space-3);
    font-family: var(--tl-font-display);
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--tl-band-muted);
}

.tl-console-eyebrow::before {
    content: '';
    width: 1px;
    height: 20px;
    background-color: var(--tl-band-hairline);
}

@media (min-width: 40rem) {
    .tl-console-eyebrow {
        display: inline-flex;
    }
}

/* Sidebar */

.fi-sidebar {
    border-inline-end: 1px solid var(--tl-line);
    background-color: var(--tl-sidebar);
}

.fi-sidebar-header {
    border-bottom-color: var(--tl-line);
    background-color: var(--tl-sidebar);
}

.fi-sidebar-nav {
    padding: var(--tl-space-5) var(--tl-space-3) var(--tl-space-6);
}

.fi-sidebar-nav-groups,
.fi-sidebar-group,
.fi-sidebar-group-items {
    gap: 2px;
}

.fi-sidebar-group-btn {
    padding: 14px var(--tl-space-3) 6px;
}

.fi-sidebar-group-label {
    font-family: var(--tl-font-display);
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--tl-accent);
}

.fi-sidebar-item-btn {
    justify-content: flex-start;
    gap: var(--tl-space-3);
    padding: 9px var(--tl-space-3);
    border-width: 0;
    border-radius: var(--tl-radius-md);

    & > .fi-icon {
        width: 20px;
        height: 20px;
        color: var(--tl-ink-muted);
    }

    & > .fi-sidebar-item-label {
        font-size: 14px;
        font-weight: 400;
        line-height: 20px;
        color: var(--tl-ink);
    }
}

.fi-sidebar-item.fi-sidebar-item-has-url:not(.fi-active) > .fi-sidebar-item-btn:hover,
.fi-sidebar-item.fi-sidebar-item-has-url:not(.fi-active) > .fi-sidebar-item-btn:focus-visible {
    background-color: var(--tl-nav-hover);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background-color: var(--tl-surface);
    box-shadow: var(--tl-shadow-pill);

    & > .fi-icon {
        color: var(--tl-accent);
    }

    & > .fi-sidebar-item-label {
        font-weight: 500;
        color: var(--tl-ink);
    }
}

.fi-sidebar .fi-sidebar-item-badge-ctn .fi-badge {
    min-width: 0;
    padding: 0 var(--tl-space-1);
    font-size: 12px;
}

/* Page header */

.fi-header-heading {
    font-family: var(--tl-font-display);
    font-size: 28px;
    font-weight: 600;
    line-height: 34px;
    letter-spacing: -0.015em;
    color: var(--tl-ink);
}

.fi-header-subheading {
    color: var(--tl-ink-muted);
}

/* Cards: sections, stats, tables */

.fi-section:not(.fi-section-not-contained):not(.fi-aside) {
    border-radius: var(--tl-radius-lg);
    background-color: var(--tl-surface);
    box-shadow: var(--tl-shadow-card);
}

.fi-section .fi-section-header-heading,
.fi-ta-ctn .fi-ta-header-heading {
    font-family: var(--tl-font-display);
    font-size: 18px;
    font-weight: 600;
    line-height: 26px;
    letter-spacing: -0.01em;
    color: var(--tl-ink);
}

.fi-section .fi-section-header-description,
.fi-ta-ctn .fi-ta-header-description {
    color: var(--tl-ink-muted);
}

.fi-wi-stats-overview-stat {
    border-radius: var(--tl-radius-lg);
    background-color: var(--tl-surface);
    box-shadow: var(--tl-shadow-card);
}

.fi-wi-stats-overview-stat-label {
    font-size: 13px;
    color: var(--tl-ink-muted);
}

.fi-wi-stats-overview-stat-value {
    font-family: var(--tl-font-display);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--tl-ink);
}

.fi-ta-ctn {
    border-radius: var(--tl-radius-lg);
    background-color: var(--tl-surface);
    box-shadow: var(--tl-shadow-card);
}

.fi-ta-table > thead > tr {
    background-color: var(--tl-surface-tint);
}

.fi-ta-header-cell {
    padding-block: 11px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tl-accent-strong);
    background-color: var(--tl-surface-tint);

    & .fi-ta-header-cell-sort-btn {
        color: inherit;
    }

    & .fi-icon {
        color: var(--tl-accent);
    }
}

.fi-ta-row:hover {
    background-color: var(--tl-row-hover);
}

/* Status badges */

.fi-badge {
    padding-inline: var(--tl-space-2);
    border-radius: var(--tl-radius-sm);
    font-weight: 600;
    box-shadow: none;
}

.fi-badge:not(.fi-color),
.fi-badge.fi-color-gray {
    color: var(--tl-ink-muted);
    background-color: var(--tl-ground);
    box-shadow: inset 0 0 0 1px var(--tl-line);
}

.fi-badge.fi-color-primary {
    color: var(--tl-accent-strong);
    background-color: var(--tl-surface-tint);
}

.fi-badge.fi-color-success {
    color: var(--tl-success);
    background-color: var(--tl-success-wash);
}

.fi-badge.fi-color-warning {
    color: var(--tl-warning);
    background-color: var(--tl-warning-wash);
}

.fi-badge.fi-color-danger {
    color: var(--tl-danger);
    background-color: var(--tl-danger-wash);
}

.fi-badge.fi-color-info {
    color: var(--tl-info);
    background-color: var(--tl-info-wash);
}

.dark .fi-badge.fi-color-success,
.dark .fi-badge.fi-color-warning,
.dark .fi-badge.fi-color-danger,
.dark .fi-badge.fi-color-info {
    background-color: var(--tl-surface-tint);
}

/* Controls and floating panels */

.fi-btn {
    border-radius: var(--tl-radius-md);
}

.fi-input-wrp {
    border-radius: var(--tl-radius-md);
}

.fi-dropdown-panel {
    border-radius: var(--tl-radius-lg);
    box-shadow: var(--tl-shadow-popover);
}

/* Server names, domains, builds, keys: the mono font. */
.tl-mono,
.tl-mono .fi-ta-text-item-label,
.tl-mono .fi-in-text-item {
    font-family: var(--tl-font-mono);
    font-size: 13px;
}

.tl-tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* Sign-in page */

.fi-simple-main {
    background-color: var(--tl-surface);
    box-shadow: var(--tl-shadow-card);
}

@media (min-width: 40rem) {
    .fi-simple-main {
        border-radius: var(--tl-radius-lg);
    }
}

/* Job log: the runner's output as it happens. */

.tl-log {
    display: grid;
    gap: var(--tl-space-3);
}

.tl-log-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tl-space-2);
    font-size: 14px;
    color: var(--tl-ink-muted);
}

.tl-log-output {
    max-height: 32rem;
    margin: 0;
    padding: var(--tl-space-4);
    overflow: auto;
    border-radius: var(--tl-radius-md);
    font-family: var(--tl-font-mono);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--tl-log-ink);
    background-color: var(--tl-log-ground);
}

.tl-log-empty {
    padding: var(--tl-space-6) var(--tl-space-4);
    border-radius: var(--tl-radius-md);
    font-size: 14px;
    text-align: center;
    color: var(--tl-ink-muted);
    background-color: var(--tl-ground);
    box-shadow: inset 0 0 0 1px var(--tl-line);
}

/* Deploy key: the line to paste into GitHub. */

.tl-deploy-key {
    display: grid;
    gap: var(--tl-space-3);
    font-size: 14px;
    color: var(--tl-ink);
}

.tl-deploy-key ol {
    display: grid;
    gap: var(--tl-space-1);
    padding-inline-start: var(--tl-space-5);
    list-style: decimal;
    color: var(--tl-ink-muted);
}

.tl-deploy-key-value {
    margin: 0;
    padding: var(--tl-space-3);
    border-radius: var(--tl-radius-md);
    font-family: var(--tl-font-mono);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    color: var(--tl-ink);
    background-color: var(--tl-surface-tint);
    user-select: all;
}

.tl-deploy-key-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tl-space-2);
}

/* Footer: version and copyright */

.tl-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    column-gap: var(--tl-space-2);
    row-gap: var(--tl-space-1);
    padding: var(--tl-space-4) var(--tl-space-6);
    border-top: 1px solid var(--tl-line);
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--tl-ink-muted);
    text-align: center;
}

.tl-footer-build {
    font-family: var(--tl-font-mono);
    font-size: 0.6875rem;
    color: var(--tl-ink-subtle);
}

.tl-footer-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    column-gap: var(--tl-space-2);
}

.fi-simple-page > .tl-footer {
    flex-direction: column;
    margin-top: var(--tl-space-6);
    padding: var(--tl-space-4) 0 0;
}

.fi-simple-page > .tl-footer .tl-footer-separator {
    display: none;
}

@media (max-width: 40rem) {
    .tl-footer {
        flex-direction: column;
    }

    .tl-footer-separator {
        display: none;
    }
}

/* Phones: the band keeps the menu button, the wordmark and the avatar. */
.fi-topbar .fi-topbar-start {
    display: flex;
}

@media (max-width: 39.99rem) {
    .fi-topbar .tl-console-eyebrow,
    .fi-topbar .fi-global-search-ctn {
        display: none;
    }
}
