:root {
    color-scheme: dark;
    --bg: #0e0f11;
    --surface: #17191c;
    --surface-2: #1d2024;
    --surface-3: #24282d;
    --line: #333941;
    --line-soft: #272c32;
    --text: #f1f4f8;
    --muted: #a9b3bf;
    --muted-2: #788390;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --cyan: #22d3ee;
    --green: #22c55e;
    --red: #f43f5e;
    --amber: #f59e0b;
    --shadow: 0 18px 52px rgba(0, 0, 0, 0.34);
    --radius: 8px;
}

* {
    letter-spacing: 0;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 50% -18%, rgba(59, 130, 246, 0.08), transparent 28rem),
        linear-gradient(180deg, #111315 0%, var(--bg) 18rem);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
}

a {
    color: #c7e4ff;
    text-decoration: none;
}

a:hover {
    color: #ffffff;
}

.app-navbar {
    min-height: 54px;
    padding: 0;
    background: rgba(24, 27, 30, 0.95);
    border-bottom: 1px solid var(--line-soft);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(16px);
}

.app-nav-inner {
    max-width: 1320px;
    min-height: 54px;
    padding-inline: 18px;
}

.app-brand {
    color: var(--text) !important;
    font-size: 18px;
    font-weight: 750;
    margin-right: 22px;
}

.app-nav-links {
    gap: 3px;
}

.app-nav-links .nav-link {
    color: var(--muted) !important;
    border-radius: 7px;
    padding: 7px 10px;
    transition: background-color 150ms ease, color 150ms ease;
}

.app-nav-links .nav-link:hover,
.app-nav-links .nav-link.active {
    color: var(--text) !important;
    background: rgba(255, 255, 255, 0.06);
}

.navbar-toggler {
    border-color: var(--line);
}

.app-userbar {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.navbar-text {
    color: var(--text);
    font-weight: 600;
}

.badge-region {
    min-width: 52px;
    padding: 6px 10px;
    border-radius: 7px;
    background: rgba(34, 211, 238, 0.14);
    color: #9beafe;
    border: 1px solid rgba(34, 211, 238, 0.32);
    font-weight: 700;
}

.app-container {
    max-width: 1320px;
    padding: 28px 18px 48px;
}

.page-fade {
    animation: pageIn 220ms ease-out;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.page-title {
    margin: 0;
    color: var(--text);
    font-size: 26px;
    line-height: 1.18;
    font-weight: 760;
}

.page-meta {
    color: var(--muted);
    font-weight: 600;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.surface,
.card {
    background: color-mix(in srgb, var(--surface) 94%, #ffffff 6%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card {
    color: var(--text);
}

.card-body {
    padding: 18px;
}

.auth-shell {
    min-height: calc(100vh - 138px);
    display: grid;
    place-items: start center;
    padding-top: 18px;
}

.auth-card {
    width: min(100%, 410px);
    animation: panelIn 260ms ease-out;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: scale(0.985) translateY(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.auth-title {
    margin: 0 0 18px;
    font-size: 22px;
    font-weight: 760;
}

.form-label {
    color: var(--text);
    font-weight: 700;
    margin-bottom: 7px;
}

.form-control,
.form-select {
    min-height: 42px;
    color: var(--text);
    background-color: #121417;
    border: 1px solid #454b54;
    border-radius: 7px;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.form-control::placeholder {
    color: var(--muted-2);
    opacity: 1;
}

.form-control:focus,
.form-select:focus {
    color: var(--text);
    background-color: #15181b;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.24);
}

.form-control:disabled {
    color: var(--muted);
    background: #181b1f;
    border-color: var(--line);
}

.form-text,
.text-muted {
    color: var(--muted) !important;
}

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

.form-grid .full-span {
    grid-column: 1 / -1;
}

.btn {
    min-height: 38px;
    border-radius: 7px;
    font-weight: 720;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    border-color: #3b82f6;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #4f8df7, #1d4ed8);
    border-color: #60a5fa;
}

.btn-success {
    background: #16a34a;
    border-color: #22c55e;
}

.btn-secondary {
    color: var(--text);
    background: #2a2f35;
    border-color: #3d444d;
}

.btn-secondary:hover {
    color: var(--text);
    background: #343a42;
    border-color: #59616d;
}

.btn-danger {
    background: #be123c;
    border-color: var(--red);
}

.btn-ghost,
.btn-outline-light {
    color: var(--text);
    background: transparent;
    border-color: #59616d;
}

.btn-ghost:hover,
.btn-outline-light:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
    border-color: #87909d;
}

.btn-outline-info {
    color: #9beafe;
    border-color: rgba(34, 211, 238, 0.78);
}

.btn-outline-info:hover {
    color: #061014;
    background: #67e8f9;
    border-color: #67e8f9;
}

.btn-outline-danger {
    color: #fecdd3;
    border-color: rgba(244, 63, 94, 0.86);
}

.btn-outline-danger:hover {
    color: #ffffff;
    background: #e11d48;
    border-color: #fb7185;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(170px, max-content) max-content;
    gap: 10px;
    width: min(100%, 520px);
}

.table-surface {
    overflow: hidden;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.035);
    --bs-table-color: var(--text);
    --bs-table-striped-color: var(--text);
    --bs-table-border-color: var(--line);
    margin: 0;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #f9fbfd;
    background: #20252a;
    border-bottom-color: #4b535d;
    font-size: 14px;
    font-weight: 780;
    white-space: nowrap;
}

.table tbody td {
    vertical-align: middle;
    font-weight: 600;
}

.table tbody tr {
    transition: background-color 120ms ease;
}

.table tbody tr:hover {
    background: rgba(59, 130, 246, 0.08);
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-actions .btn {
    min-height: 32px;
    padding: 4px 10px;
}

.empty-state {
    padding: 24px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.025);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

.region-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
    max-width: 860px;
}

.region-card {
    position: relative;
    overflow: hidden;
    transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.region-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-top: 3px solid rgba(34, 211, 238, 0.62);
    opacity: 0.7;
    pointer-events: none;
}

.region-card:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 211, 238, 0.45);
    background: #1b1f24;
}

.region-title {
    position: relative;
    margin: 0 0 18px;
    font-size: 22px;
    font-weight: 780;
}

.danger-panel {
    border-color: rgba(244, 63, 94, 0.52);
}

.danger-panel .card-body {
    display: grid;
    gap: 16px;
}

.detail-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.detail-list li {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
}

.detail-list strong {
    color: var(--muted);
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.app-alert {
    border-radius: var(--radius);
    border-width: 1px;
    margin: 0;
}

@media (max-width: 991.98px) {
    .app-userbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding: 12px 0 4px;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .search-form {
        width: 100%;
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: 14px;
    }

    .app-container {
        padding-top: 20px;
    }

    .page-title {
        font-size: 22px;
    }

    .form-grid,
    .region-grid {
        grid-template-columns: 1fr;
    }

    .detail-list li {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .table-actions {
        min-width: 132px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
