:root {
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --card: #ffffff;
    --card-soft: #f8fafc;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 20px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 18px 35px rgba(15, 23, 42, 0.1);
    --nav-bg: rgba(248, 250, 252, 0.94);
    --layout-max-width: 1120px;
    --layout-max-wide: 1180px;
    --topbar-offset: 8px;
    --header-top-gap: 32px;
    --header-nav-min-height: 70px;
    --header-logo-size: 182px;
    --header-logo-left: clamp(0.55rem, 1.2vw, 1.25rem);
    --header-logo-top: 0.2rem;
    --header-logo-visible-right-ratio: 0.84;
    --header-logo-clearance: clamp(0.5rem, 0.9vw, 0.8rem);
    --header-nav-padding-left: clamp(7.35rem, 8.1vw, 8.85rem);
    --header-nav-padding-right: clamp(0.95rem, 2vw, 1.75rem);
    --header-wordmark-size: clamp(1.48rem, 0.28vw + 1.3rem, 1.74rem);
    --header-wordmark-max: min(36vw, 330px);
    --header-wordmark-gap: clamp(1rem, 1vw, 1.25rem);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background-color: var(--bg);
    background-image: radial-gradient(900px 360px at 10% -18%, rgba(37, 99, 235, 0.06), transparent 62%);
    font-family: "Plus Jakarta Sans", "Segoe UI", Tahoma, sans-serif;
}

.container {
    max-width: var(--layout-max-width);
    padding-left: clamp(0.95rem, 1.8vw, 1.35rem);
    padding-right: clamp(0.95rem, 1.8vw, 1.35rem);
}

body.theme-dark {
    --bg: #0b1220;
    --bg-elevated: #111827;
    --card: #111827;
    --card-soft: #172033;
    --border: #263449;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --accent: #60a5fa;
    --accent-soft: rgba(96, 165, 250, 0.16);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px rgba(2, 8, 23, 0.45);
    --shadow-md: 0 14px 24px rgba(2, 8, 23, 0.45);
    --shadow-lg: 0 24px 40px rgba(2, 8, 23, 0.5);
    --nav-bg: rgba(11, 18, 32, 0.92);
    background-image: radial-gradient(960px 380px at 12% -20%, rgba(96, 165, 250, 0.12), transparent 62%);
}

main {
    min-height: calc(100vh - 140px);
    margin-top: 40px;
}

a {
    color: var(--accent);
}

code {
    color: #1d4ed8;
}

body.theme-dark code {
    color: #93c5fd;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    overflow: visible;
    padding-top: var(--header-top-gap);
}

.app-topbar-offset {
    height: var(--topbar-offset);
    background: transparent;
    pointer-events: none;
}

.app-floating-logo {
    position: absolute;
    left: var(--header-logo-left);
    top: var(--header-logo-top);
    transform: none;
    z-index: 1045;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.app-floating-logo:hover {
    text-decoration: none;
}

.app-brand-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    min-height: var(--header-nav-min-height);
    padding-left: 0;
    margin-left: 0;
    margin-right: clamp(0.75rem, 1.5vw, 1.5rem);
    line-height: 1;
    z-index: 9;
    flex-shrink: 0;
}

.app-brand-link:hover {
    color: var(--text);
}

.app-header {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--nav-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.08);
}

.app-navbar {
    background: transparent;
}

.app-navbar .container {
    max-width: none;
    width: 100%;
    min-height: var(--header-nav-min-height);
    position: relative;
    overflow: visible;
    align-items: center;
    /* Keep the wordmark clear of the floating logo on wide screens. */
    padding-left: max(
        var(--header-nav-padding-left),
        calc(
            var(--header-logo-left) +
            (var(--header-logo-size) * var(--header-logo-visible-right-ratio)) +
            var(--header-logo-clearance)
        )
    );
    padding-right: var(--header-nav-padding-right);
}

.app-navbar .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(1.28rem, 0.42vw + 1.08rem, 1.58rem);
    font-weight: 700;
    letter-spacing: -0.018em;
    line-height: 1;
    color: var(--text);
}

.app-navbar .navbar-brand:hover {
    color: var(--text);
}

.brand-logo {
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    box-shadow: none;
}

.brand-logo-hero {
    width: 88px;
    height: 88px;
    position: static;
    transform: translateY(2px);
    z-index: auto;
    pointer-events: auto;
}

.brand-logo-floating {
    width: var(--header-logo-size);
    height: var(--header-logo-size);
    object-fit: contain;
    object-position: center;
}

.brand-wordmark {
    line-height: 1;
    display: inline-block;
    transform: none;
}

.brand-wordmark-hero {
    font-size: var(--header-wordmark-size);
    font-weight: 400;
    letter-spacing: -0.03em;
    position: static;
    line-height: 1;
    margin: 0;
    white-space: nowrap;
    max-width: var(--header-wordmark-max);
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: var(--header-wordmark-gap);
}

@media (min-width: 1200px) {
    .app-brand-link { min-height: 72px; }
}

body.theme-dark .brand-logo {
    filter: invert(1) brightness(1.15);
}

.app-navbar .navbar-collapse {
    justify-content: flex-end;
}

.app-navbar .navbar-nav > .nav-item {
    margin-left: 0.15rem;
}

.app-navbar .nav-item form {
    margin: 0;
}

.navbar .nav-link {
    color: var(--muted);
    font-weight: 600;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus-visible {
    color: var(--text);
    background: var(--accent-soft);
}

.navbar-toggler {
    color: var(--text);
    border: 1px solid var(--border) !important;
    border-radius: 12px;
    width: 46px;
    height: 46px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
    position: relative;
    z-index: 1065;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.18);
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.92);
}

.navbar-toggler-icon {
    width: 1.42rem;
    height: 1.42rem;
    background-image: none;
    background:
        linear-gradient(currentColor, currentColor) center calc(50% - 6px) / 20px 2px no-repeat,
        linear-gradient(currentColor, currentColor) center / 20px 2px no-repeat,
        linear-gradient(currentColor, currentColor) center calc(50% + 6px) / 20px 2px no-repeat;
}

body.theme-dark .navbar-toggler {
    background: rgba(11, 18, 32, 0.78);
    border-color: var(--border) !important;
}

body.theme-dark .navbar-toggler:hover {
    background: rgba(11, 18, 32, 0.92);
}

.nav-auth-btn {
    border-radius: 10px;
    padding-inline: 0.9rem;
}

.nav-logout-btn {
    border-radius: 10px;
    padding: 0.38rem 0.82rem;
    font-weight: 600;
}

.theme-toggle-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
}

.lang-form {
    margin: 0;
}

.language-select {
    width: 76px;
    min-width: 76px;
    border-radius: 10px;
    font-weight: 600;
    padding-right: 1.8rem;
}

.theme-icon-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1;
    display: grid;
    place-items: center;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.theme-icon-btn:hover {
    background: var(--card-soft);
    color: var(--text);
}

.theme-icon-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.hero-section {
    background: transparent;
    padding-top: 1.1rem;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    border: 1px solid #bfdbfe;
    background: var(--accent-soft);
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

body.theme-dark .hero-pill {
    border-color: rgba(96, 165, 250, 0.35);
    color: #bfdbfe;
}

.hero-title {
    max-width: 750px;
    letter-spacing: -0.03em;
    line-height: 1.06;
}

.hero-subtitle {
    max-width: 660px;
}

.hero-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hero-metric {
    min-width: 180px;
    flex: 1 1 190px;
    display: grid;
    gap: 0.2rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    box-shadow: var(--shadow-sm);
}

.hero-metric strong {
    font-size: 0.84rem;
    line-height: 1.1;
}

.hero-metric span {
    font-size: 0.79rem;
    color: var(--muted);
}

.glass-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.highlight-list {
    display: grid;
    gap: 0.65rem;
}

.highlight-item {
    display: grid;
    gap: 0.2rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-soft);
}

.highlight-item strong {
    font-size: 0.9rem;
}

.highlight-item span {
    font-size: 0.82rem;
}

.app-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #bfdbfe;
}

body.theme-dark .app-card:hover {
    border-color: rgba(96, 165, 250, 0.45);
}

.app-icon {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 0.2rem;
}

.btn {
    border-radius: 10px;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-primary:hover,
.btn-primary:focus {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

body.theme-dark .btn-primary:hover,
body.theme-dark .btn-primary:focus {
    background: #3b82f6;
    border-color: #3b82f6;
}

.btn-outline-secondary {
    border-color: #d1d5db;
    color: #374151;
}

.btn-outline-secondary:hover {
    background: #f3f4f6;
    border-color: #cbd5e1;
    color: #111827;
}

body.theme-dark .btn-outline-secondary {
    border-color: #334155;
    color: #cbd5e1;
}

body.theme-dark .btn-outline-secondary:hover {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}

.btn-outline-light {
    border-color: #cbd5e1;
    color: #334155;
}

.btn-outline-light:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

body.theme-dark .btn-outline-light {
    border-color: #334155;
    color: #cbd5e1;
}

body.theme-dark .btn-outline-light:hover {
    background: #1f2937;
    border-color: #475569;
    color: #e2e8f0;
}

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.btn-accent:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

body.theme-dark .btn-accent:hover {
    background: #3b82f6;
    border-color: #3b82f6;
}

.text-muted,
.text-secondary {
    color: var(--muted) !important;
}

.small-link {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.small-link:hover {
    text-decoration: underline;
}

.feature-list {
    margin: 0;
    padding-left: 1rem;
    color: var(--muted);
    line-height: 1.8;
    font-size: 0.92rem;
}

.auth-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 0.1rem;
    scrollbar-width: none;
}

.auth-tabs-shell {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 0.38rem;
    align-items: center;
}

.auth-tabs-viewport {
    min-width: 0;
    overflow: hidden;
}

.auth-tabs-scroll {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--muted);
    box-shadow: var(--shadow-sm);
    transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.auth-tabs-scroll span {
    font-size: 1.3rem;
    line-height: 1;
    margin-top: -1px;
}

.auth-tabs-scroll:hover,
.auth-tabs-scroll:focus-visible {
    color: var(--text);
    border-color: #93c5fd;
    background: var(--card-soft);
}

.auth-tabs-scroll:disabled,
.auth-tabs-scroll.is-hidden {
    opacity: 0.35;
    pointer-events: none;
}

body.theme-dark .auth-tabs-scroll {
    background: #0f172a;
    border-color: #334155;
}

.auth-tabs .nav-item {
    flex: 0 0 auto;
    min-width: max-content;
    scroll-snap-align: center;
}

.auth-tabs .nav-link {
    width: auto;
    min-width: 126px;
    padding: 0.5rem 0.9rem;
    text-align: center;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 700;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.auth-tabs .nav-link.active {
    background: var(--accent-soft);
    color: #1d4ed8;
}

body.theme-dark .auth-tabs .nav-link.active {
    color: #bfdbfe;
}

.auth-tabs::-webkit-scrollbar {
    display: none;
}

@media (max-width: 575px) {
    .auth-tabs-shell {
        grid-template-columns: 32px minmax(0, 1fr) 32px;
        gap: 0.32rem;
    }

    .auth-tabs-scroll {
        width: 32px;
        height: 32px;
    }

    .auth-tabs .nav-link {
        min-width: 118px;
        padding: 0.48rem 0.76rem;
    }
}

.form-control,
.form-select {
    border-color: var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text);
}

.input-group-text {
    border-color: var(--border);
    background: var(--card-soft);
    color: var(--muted);
}

.form-control::placeholder {
    color: #9ca3af;
}

.form-floating > .form-control::placeholder,
.form-floating > .form-control-plaintext::placeholder {
    color: transparent !important;
    opacity: 0 !important;
}

.form-floating > label {
    color: #9ca3af;
}

.form-control:focus,
.form-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.12);
}

body.theme-dark .form-control::placeholder {
    color: #64748b;
}

body.theme-dark .form-floating > .form-control::placeholder,
body.theme-dark .form-floating > .form-control-plaintext::placeholder {
    color: transparent !important;
    opacity: 0 !important;
}

body.theme-dark .form-floating > label {
    color: #94a3b8;
}

body.theme-dark .form-check-input {
    background-color: #111827;
    border-color: #475569;
}

body.theme-dark .form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

body.theme-dark .input-group-text {
    border-color: var(--border);
    background: #1e293b;
    color: #cbd5e1;
}

.robot-check-box {
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    background: var(--card-soft);
}

.legal-check-box {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    background: var(--card-soft);
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    color: #374151;
    border-radius: 999px;
    font-size: 0.72rem;
    padding: 0.2rem 0.55rem;
}

body.theme-dark .tag-chip {
    border-color: #334155;
    background: #1e293b;
    color: #cbd5e1;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.25px;
    padding: 0.22rem 0.6rem;
}

.status-active,
.bg-status-active {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.status-maintenance,
.bg-status-maintenance {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.status-hidden,
.status-offline,
.bg-status-hidden {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.support-status-open {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.support-status-in_progress {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.support-status-waiting_user {
    background: #e0f2fe;
    color: #075985;
    border-color: #7dd3fc;
}

.support-status-resolved,
.support-status-closed {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.support-priority-low {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

.support-priority-normal {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.support-priority-high {
    background: #ffedd5;
    color: #9a3412;
    border-color: #fdba74;
}

.support-priority-urgent {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.showcase-preview {
    background: var(--card-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.showcase-preview iframe,
.showcase-preview img {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 10px;
    object-fit: cover;
}

.showcase-preview iframe {
    opacity: 0;
    transition: opacity 0.28s ease;
    background: #e5e7eb;
}

body.theme-dark .showcase-preview iframe {
    background: #1e293b;
}

.showcase-preview iframe.preview-loaded {
    opacity: 1;
}

.preview-loader {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(248, 250, 252, 0.84);
    color: #6b7280;
    font-size: 0.85rem;
}

body.theme-dark .preview-loader {
    background: rgba(15, 23, 42, 0.76);
    color: #94a3b8;
}

.showcase-slide-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.showcase-slide-meta {
    margin-top: 0.55rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.page-login #showcaseCarousel .carousel-item > div {
    padding-bottom: 0.6rem !important;
}

.page-login #showcaseCarousel .mt-3.d-flex.justify-content-end {
    margin-top: 0.65rem !important;
}

.preview-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(248, 250, 252, 0.92);
    text-align: center;
}

body.theme-dark .preview-fallback {
    background: rgba(15, 23, 42, 0.92);
}

.skeleton-card {
    min-height: 210px;
    position: relative;
    overflow: hidden;
}

.skeleton-preview,
.skeleton-card::before {
    background: linear-gradient(90deg, #f1f5f9 25%, #e5e7eb 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite linear;
}

body.theme-dark .skeleton-preview,
body.theme-dark .skeleton-card::before {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

.skeleton-card::before {
    content: "";
    position: absolute;
    inset: 0;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.carousel-control-prev,
.carousel-control-next {
    width: 8%;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    filter: invert(39%) sepia(11%) saturate(784%) hue-rotate(185deg);
}

body.theme-dark .carousel-control-prev-icon,
body.theme-dark .carousel-control-next-icon {
    filter: invert(82%) sepia(6%) saturate(488%) hue-rotate(179deg);
}

.notify-dialog {
    position: fixed;
    top: 150px;
    right: 18px;
    z-index: 1200;
    width: min(420px, calc(100vw - 1.25rem));
    max-height: min(64vh, 560px);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notify-dialog.is-hidden {
    display: none;
}

.notify-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.62rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--card-soft);
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.notify-dialog-header.is-dragging {
    cursor: grabbing;
}

.notify-dialog-title {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.notify-dialog-body {
    display: grid;
    gap: 0.5rem;
    padding: 0.65rem;
    overflow: auto;
}

.notify-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 4px solid #cbd5e1;
    box-shadow: var(--shadow-sm);
    border-radius: 10px;
    padding: 0.68rem 0.75rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
}

.notify-item-text {
    font-size: 0.9rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.notify-success { border-left-color: var(--success); }
.notify-danger { border-left-color: var(--danger); }
.notify-warning { border-left-color: var(--warning); }
.notify-info { border-left-color: var(--accent); }

.app-modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.table-dark {
    --bs-table-bg: var(--bg-elevated);
    --bs-table-striped-bg: var(--card-soft);
    --bs-table-hover-bg: var(--card-soft);
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
}

.table {
    --bs-table-bg: var(--bg-elevated);
    --bs-table-color: var(--text);
}

.list-group-item {
    color: var(--text);
    border-color: var(--border);
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.48rem 0;
    border-bottom: 1px solid var(--border);
}

.profile-row span {
    flex: 0 0 auto;
}

.profile-row strong {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
}

.profile-email-value {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal !important;
    word-break: normal !important;
}

.profile-row:last-child {
    border-bottom: none;
}

.project-flow-list {
    display: grid;
    gap: 1rem;
}

.project-flow-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--card-soft) 100%);
}

.project-flow-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.project-flow-identity {
    min-width: 0;
}

.project-flow-name {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.012em;
}

.project-flow-desc {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.project-flow-url {
    display: inline-block;
    max-width: 100%;
    word-break: break-all;
}

.project-flow-date {
    color: var(--muted);
    font-size: 0.78rem;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: 999px;
    padding: 0.22rem 0.58rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.project-flow-badges {
    margin-top: 0.76rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.project-flow-note {
    margin-top: 0.72rem;
    padding: 0.58rem 0.7rem;
    border: 1px solid #fcd34d;
    border-left: 3px solid #f59e0b;
    border-radius: 9px;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.84rem;
}

body.theme-dark .project-flow-note {
    border-color: rgba(251, 191, 36, 0.45);
    background: rgba(245, 158, 11, 0.12);
    color: #fcd34d;
}

.project-flow-grid {
    margin-top: 0.8rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.7rem;
}

.project-flow-section {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    padding: 0.72rem;
    min-width: 0;
}

.project-flow-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    color: var(--muted);
    text-transform: uppercase;
}

.project-flow-detail {
    color: var(--muted);
    font-size: 0.83rem;
    line-height: 1.35;
}

.project-flow-error {
    color: #b45309;
}

body.theme-dark .project-flow-error {
    color: #fbbf24;
}

.project-flow-controls {
    margin-top: 0.84rem;
    padding-top: 0.74rem;
    border-top: 1px dashed var(--border);
}

.admin-ops-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.admin-ops-btn {
    display: flex;
    gap: 0.56rem;
    align-items: center;
    justify-content: flex-start;
    padding: 0.72rem 0.78rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font: inherit;
    text-align: left;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.admin-ops-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    color: var(--accent);
    flex: 0 0 auto;
}

.admin-ops-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-ops-label {
    line-height: 1.25;
}

.admin-ops-btn:hover {
    color: var(--text);
    border-color: #93c5fd;
    background: var(--accent-soft);
    transform: translateY(-1px);
}

.project-control-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.38rem;
}

.project-control-group form {
    margin: 0;
}

.metric-card .metric-label {
    color: var(--muted);
    font-size: 0.85rem;
}

.metric-card .metric-value {
    margin-top: 0.25rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
}

.admin-role-card {
    height: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-soft);
}

.admin-role-card strong {
    display: inline-block;
    margin-bottom: 0.28rem;
}

.admin-thumb {
    width: 84px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.app-footer {
    background: transparent;
    border-color: var(--border) !important;
}

.footer-version-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.footer-version-editor {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.footer-version-editor summary {
    cursor: pointer;
    list-style: none;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
}

.footer-version-editor summary::-webkit-details-marker {
    display: none;
}

.footer-version-popover {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    z-index: 25;
    width: min(460px, calc(100vw - 2rem));
    padding: 0.55rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-md);
}

.footer-version-form {
    margin: 0;
    display: grid;
    grid-template-columns: 128px minmax(220px, 1fr) auto;
    gap: 0.35rem;
    align-items: center;
}

.footer-version-form .form-control {
    min-height: 32px;
}

.footer-version-history {
    margin-top: 0.4rem;
    max-height: 120px;
    overflow: auto;
    display: grid;
    gap: 0.15rem;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.35;
}

.footer-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem 0.7rem;
}

.footer-tagline {
    white-space: normal;
    overflow-wrap: anywhere;
}

.footer-lilya-link {
    font-family: Arial, "Plus Jakarta Sans", sans-serif;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
    text-decoration: none;
    background: linear-gradient(135deg, var(--accent) 0%, #0f172a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.footer-lilya-link:hover {
    text-decoration: none;
    filter: brightness(1.08);
}

body.theme-dark .footer-lilya-link {
    background: linear-gradient(135deg, #60a5fa 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.state-box {
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--muted);
    padding: 1rem;
}

.runtime-console-log {
    margin: 0;
    max-height: 240px;
    overflow: auto;
    padding: 0.75rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-soft);
    color: var(--text);
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.78rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.legal-snapshot {
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text);
    padding: 0.95rem;
    margin: 0;
}

.tooltip.op-tooltip .tooltip-inner {
    max-width: 340px;
    text-align: left;
    font-size: 0.78rem;
    line-height: 1.35;
    border-radius: 10px;
    padding: 0.55rem 0.68rem;
}

.guide-list li:last-child {
    margin-bottom: 0 !important;
}

.ticket-thread {
    display: grid;
    gap: 0.75rem;
}

.ticket-thread-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    padding: 0.75rem 0.85rem;
}

.ticket-thread-item.is-admin {
    border-left: 3px solid #2563eb;
}

.ticket-message {
    margin-top: 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    color: var(--text);
    background: transparent;
    border: 0;
}

body.theme-dark .state-box {
    border-color: #334155;
}

@media (min-width: 1400px) {
    .container {
        max-width: var(--layout-max-wide);
    }
}

@media (max-width: 991px) {
    :root {
        --topbar-offset: 3px;
        --header-top-gap: 12px;
        --header-nav-min-height: 64px;
        --header-logo-size: 138px;
        --header-logo-left: 0.22rem;
        --header-logo-top: 0.08rem;
        --header-logo-clearance: 0.3rem;
        --header-nav-padding-left: clamp(4.35rem, 11.8vw, 5.35rem);
        --header-nav-padding-right: 0.9rem;
        --header-wordmark-size: clamp(1.1rem, 1.3vw, 1.24rem);
        --header-wordmark-max: min(46vw, 220px);
        --header-wordmark-gap: 0.8rem;
    }

    .app-brand-link {
        margin-right: 0.6rem;
    }

    .app-navbar .container {
        padding-left: var(--header-nav-padding-left);
    }

    main {
        margin-top: 24px;
    }

    .app-navbar .navbar-brand {
        font-size: 1.22rem;
    }

    .brand-logo:not(.brand-logo-floating) {
        width: 44px;
        height: 44px;
    }

    .app-floating-logo {
        pointer-events: none;
    }

    .app-navbar .navbar-collapse {
        display: none;
        position: absolute;
        top: calc(100% + 0.45rem);
        left: 0.55rem;
        right: 0.55rem;
        z-index: 1060;
        justify-content: flex-start;
        padding: 0.65rem;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: rgba(248, 250, 252, 0.92);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
    }

    .app-navbar .navbar-collapse.show,
    .app-navbar .navbar-collapse.collapsing {
        display: block;
    }

    body.theme-dark .app-navbar .navbar-collapse {
        background: rgba(11, 18, 32, 0.92);
    }

    .app-navbar .navbar-nav {
        width: 100%;
        align-items: stretch !important;
    }

    .app-navbar .navbar-nav > .nav-item {
        margin-left: 0;
        width: 100%;
    }

    .navbar .nav-link {
        display: block;
        width: 100%;
        padding: 0.5rem 0.65rem;
    }

    .app-navbar .nav-item form .nav-logout-btn {
        width: 100%;
    }

    .nav-lang-select .language-select {
        width: 100%;
        min-width: 0;
    }

    .nav-theme-toggle .theme-toggle-inline {
        width: 100%;
        justify-content: space-between;
    }

    .nav-lang-select {
        padding-top: 0.35rem;
    }

    .notify-dialog {
        top: 150px;
        right: 12px;
    }

    .project-flow-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.48rem;
    }

    .project-flow-grid {
        grid-template-columns: 1fr;
    }

    .project-flow-section .btn {
        flex: 1 1 110px;
    }

    .admin-ops-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-version-popover {
        left: auto;
        right: 0;
        width: min(420px, calc(100vw - 1.25rem));
    }

    .footer-version-form {
        grid-template-columns: 1fr;
    }

    .project-control-group {
        width: 100%;
    }

    .project-control-group form {
        flex: 1 1 92px;
    }

    .project-control-group form .btn {
        width: 100%;
    }

    .hero-title {
        font-size: clamp(2.15rem, 8.2vw, 3rem);
    }
}

@media (max-width: 575px) {
    :root {
        --topbar-offset: 2px;
        --header-top-gap: 8px;
        --header-nav-min-height: 58px;
        --header-logo-size: 114px;
        --header-logo-left: 0.12rem;
        --header-logo-top: 0.02rem;
        --header-logo-clearance: 0.18rem;
        --header-nav-padding-left: clamp(3.85rem, 15.2vw, 4.55rem);
        --header-nav-padding-right: 0.7rem;
        --header-wordmark-size: clamp(1rem, 4vw, 1.12rem);
        --header-wordmark-max: min(54vw, 175px);
        --header-wordmark-gap: 0.55rem;
    }

    .app-brand-link {
        margin-right: 0.2rem;
    }

    .app-navbar .navbar-collapse {
        top: calc(100% + 0.35rem);
        left: 0.4rem;
        right: 0.4rem;
        padding: 0.55rem;
    }

    main {
        margin-top: 16px;
    }

    .footer-line {
        justify-content: flex-start;
        gap: 0.38rem 0.58rem;
    }

    .footer-lilya-link {
        font-size: 0.95rem;
    }

    .notify-dialog {
        top: 134px;
        right: 8px;
        width: min(420px, calc(100vw - 0.75rem));
    }

    .project-flow-card {
        padding: 0.85rem;
    }

    .admin-ops-grid {
        grid-template-columns: 1fr;
    }
}

