:root {
    --sidebar-w: 272px;
    --header-h: 82px;
    --bg: #eef2ff;
    --bg-accent: #f8fafc;
    --sidebar-bg: #111827;
    --sidebar-hover: #1f2937;
    --sidebar-active: #1d4ed8;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #f8fafc;
    --card: rgba(255, 255, 255, 0.88);
    --card-strong: #ffffff;
    --border: rgba(148, 163, 184, 0.24);
    --text: #0f172a;
    --text-secondary: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.12);
    --success: #059669;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --warning: #b45309;
    --warning-bg: #fffbeb;
    --warning-border: #fcd34d;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --info: #0369a1;
    --info-bg: #f0f9ff;
    --info-border: #bae6fd;
    --radius: 12px;
    --radius-lg: 22px;
    --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 24px 70px rgba(15, 23, 42, 0.14);
    --font-sans: "Manrope", "Segoe UI", Arial, sans-serif;
    --font-mono: "Cascadia Code", "Consolas", monospace;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 32%),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.14), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, #eef3ff 50%, #f8fafc 100%);
}

body.login-body {
    overflow-x: hidden;
    position: relative;
}

body.login-body::before,
body.login-body::after {
    content: "";
    position: fixed;
    inset: auto;
    border-radius: 999px;
    filter: blur(0);
    z-index: 0;
    pointer-events: none;
}

body.login-body::before {
    top: 56px;
    left: -120px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.24) 0%, rgba(37, 99, 235, 0) 70%);
}

body.login-body::after {
    right: -140px;
    bottom: 48px;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.2) 0%, rgba(15, 118, 110, 0) 72%);
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

img {
    max-width: 100%;
}

.auth-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    border: 1px solid rgba(255, 255, 255, 0.56);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.auth-card-header {
    padding: 28px 28px 18px;
    background:
        linear-gradient(135deg, rgba(17, 24, 39, 0.96), rgba(29, 78, 216, 0.88)),
        linear-gradient(135deg, #0f172a, #1d4ed8);
    color: #f8fafc;
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(248, 250, 252, 0.72);
    margin-bottom: 12px;
}

.auth-kicker::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #38bdf8;
    box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.18);
}

.auth-title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.auth-subtitle {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.7;
    color: rgba(248, 250, 252, 0.82);
}

.auth-card-body {
    padding: 28px;
}

.auth-logo {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 18px 30px rgba(15, 23, 42, 0.12);
    margin-bottom: 20px;
    background: #fff;
}

.auth-footer {
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 700;
}

.auth-link:hover {
    color: var(--primary-hover);
}

.info-note {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--warning-border);
    background: linear-gradient(180deg, rgba(255, 251, 235, 0.98), rgba(254, 243, 199, 0.72));
    color: var(--warning);
    font-size: 13px;
    line-height: 1.6;
}

.info-note strong {
    color: #92400e;
}

.auth-message {
    margin-bottom: 18px;
}

.field-group {
    margin-bottom: 18px;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.form-input,
.form-control {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--text);
    font: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

textarea.form-input,
textarea.form-control {
    min-height: 124px;
    resize: vertical;
}

.form-input:focus,
.form-control:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.52);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    background: #ffffff;
}

.form-help {
    margin-top: 7px;
    font-size: 12px;
    color: var(--text-secondary);
}

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

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.checkbox-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.ui-btn,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

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

.ui-btn:focus,
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.ui-btn-primary,
.btn-primary,
.btn-info,
.btn-warning {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
    color: #fff;
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.18);
}

.ui-btn-primary:hover,
.btn-primary:hover,
.btn-info:hover,
.btn-warning:hover {
    color: #fff;
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.ui-btn-secondary,
.btn-secondary,
.btn-default {
    background: rgba(255, 255, 255, 0.92);
    border-color: var(--border);
    color: var(--text);
}

.ui-btn-secondary:hover,
.btn-secondary:hover,
.btn-default:hover {
    color: var(--text);
    background: #fff;
}

.ui-btn-danger,
.btn-danger {
    background: linear-gradient(135deg, #fff1f2, #fee2e2);
    border-color: rgba(220, 38, 38, 0.2);
    color: var(--danger);
}

.ui-btn-danger:hover,
.btn-danger:hover {
    color: #b91c1c;
    background: linear-gradient(135deg, #ffe4e6, #fecdd3);
}

.ui-btn-block {
    width: 100%;
}

.ui-btn-sm,
.btn-sm {
    min-height: 38px;
    padding: 0 14px;
    font-size: 12px;
    border-radius: 12px;
}

.panel-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background:
        radial-gradient(circle at top, rgba(56, 189, 248, 0.16), transparent 28%),
        linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: var(--sidebar-text-active);
    display: flex;
    flex-direction: column;
    z-index: 120;
    box-shadow: 18px 0 40px rgba(2, 6, 23, 0.2);
    transition: transform 0.2s ease;
}

.sidebar-brand {
    padding: 26px 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-mark {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(37, 99, 235, 0.3));
    color: #f8fafc;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 14px;
}

.sidebar-kicker {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.72);
    margin-bottom: 8px;
}

.sidebar-brand h1 {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: #f8fafc;
}

.sidebar-brand p {
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.6;
    color: rgba(226, 232, 240, 0.7);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
}

.nav-section {
    padding: 16px 10px 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.52);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 6px;
    border-radius: 14px;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 700;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-item:hover {
    color: var(--sidebar-text-active);
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(2px);
}

.nav-item.active {
    color: var(--sidebar-text-active);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.96), rgba(30, 64, 175, 0.98));
    box-shadow: 0 14px 26px rgba(29, 78, 216, 0.18);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    color: #f8fafc;
}

.sidebar-contact {
    display: block;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 12px;
    line-height: 1.6;
    color: rgba(226, 232, 240, 0.78);
}

.sidebar-footer {
    padding: 18px 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.26), rgba(37, 99, 235, 0.3));
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 14px;
    font-weight: 800;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    margin-top: 2px;
    font-size: 12px;
    color: rgba(148, 163, 184, 0.82);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(220, 38, 38, 0.08);
    color: #fca5a5;
    font-size: 13px;
    font-weight: 800;
}

.sidebar-logout:hover {
    color: #fecaca;
    background: rgba(220, 38, 38, 0.14);
}

.main-shell {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: var(--header-h);
    padding: 20px 32px;
    background: rgba(248, 250, 252, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.page-header-title {
    margin: 6px 0 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.page-header-kicker {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.page-header-desc {
    margin: 8px 0 0;
    max-width: 720px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.page-content {
    padding: 30px 32px 40px;
}

#pageMessages {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    padding: 20px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.48);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72));
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.stat-value {
    margin-top: 12px;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.stat-helper {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.panel-card {
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.74));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-sm);
}

.panel-card + .panel-card {
    margin-top: 20px;
}

.panel-card-header {
    padding: 22px 24px 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.panel-card-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.panel-card-subtitle {
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.panel-card-body {
    padding: 24px;
}

.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.toolbar-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.table-shell {
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(255, 255, 255, 0.58);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: rgba(248, 250, 252, 0.82);
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    text-align: left;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 16px;
    font-size: 13px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.03);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-chip {
    display: inline-flex;
    max-width: 100%;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.06);
    font-family: var(--font-mono);
    font-size: 12px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.muted-text {
    color: var(--text-secondary);
}

.empty-panel {
    padding: 52px 22px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-panel svg {
    width: 52px;
    height: 52px;
    opacity: 0.5;
    margin-bottom: 14px;
}

.split-note {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.split-note h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.split-note p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 14px;
}

.alert {
    position: relative;
    margin: 0;
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid;
    font-size: 13px;
    line-height: 1.6;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.alert strong,
.alert h4,
.alert p {
    margin: 0;
}

.alert h4 + strong,
.alert strong + p,
.alert h4 + p {
    display: block;
    margin-top: 4px;
}

.alert-success {
    background: linear-gradient(180deg, rgba(236, 253, 245, 0.96), rgba(209, 250, 229, 0.72));
    border-color: var(--success-border);
    color: #065f46;
}

.alert-warning {
    background: linear-gradient(180deg, rgba(255, 251, 235, 0.98), rgba(254, 243, 199, 0.76));
    border-color: var(--warning-border);
    color: var(--warning);
}

.alert-danger,
.alert-error {
    background: linear-gradient(180deg, rgba(254, 242, 242, 0.98), rgba(254, 226, 226, 0.74));
    border-color: var(--danger-border);
    color: #991b1b;
}

.alert-info {
    background: linear-gradient(180deg, rgba(240, 249, 255, 0.98), rgba(224, 242, 254, 0.76));
    border-color: var(--info-border);
    color: var(--info);
}

.alert-dismissible .close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    color: inherit;
    cursor: pointer;
}

.alert ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.animated {
    animation-duration: 0.45s;
    animation-fill-mode: both;
}

.flipInX {
    animation-name: fadeSlideUp;
}

.flipOutX {
    animation-name: fadeOutDown;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(12px);
    }
}

.modal-content {
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 22px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.modal-header,
.modal-footer {
    border-color: rgba(148, 163, 184, 0.16);
    padding: 18px 22px;
}

.modal-header h2,
.modal-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.modal-body {
    padding: 22px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

.mobile-toggle {
    display: none;
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 160;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 14px;
    background: #0f172a;
    color: #f8fafc;
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.2);
    cursor: pointer;
}

.mobile-toggle svg {
    width: 20px;
    height: 20px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.46);
    z-index: 110;
}

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

@media (max-width: 1080px) {
    .form-grid,
    .split-note,
    .stat-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 840px) {
    .mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-shell {
        margin-left: 0;
    }

    .page-header {
        padding: 18px 18px 18px 72px;
    }

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

    .page-content {
        padding: 18px;
    }

    .panel-card-header,
    .panel-card-body {
        padding-left: 18px;
        padding-right: 18px;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        padding: 14px 0;
        border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    }

    .data-table tr:last-child {
        border-bottom: 0;
    }

    .data-table tbody td {
        padding: 6px 16px;
        border: 0;
    }

    .data-table tbody td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        font-size: 10px;
        font-weight: 800;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: var(--text-secondary);
    }

    .table-actions {
        padding-top: 6px;
    }
}

@media (max-width: 640px) {
    .auth-shell {
        padding: 20px 14px;
    }

    .auth-card-header,
    .auth-card-body {
        padding-left: 20px;
        padding-right: 20px;
    }

    .auth-title {
        font-size: 24px;
    }

    .auth-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
