:root {
    --bg: #edf3f9;
    --surface: rgba(255, 255, 255, 0.76);
    --surface-strong: rgba(255, 255, 255, 0.92);
    --surface-dark: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    --border: rgba(255, 255, 255, 0.42);
    --line: rgba(148, 163, 184, 0.16);

    --text: #0f172a;
    --muted: #64748b;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.12);

    --success-bg: rgba(220, 252, 231, 0.92);
    --success-text: #166534;

    --danger-bg: rgba(254, 226, 226, 0.94);
    --danger-text: #991b1b;

    --warning-bg: rgba(254, 243, 199, 0.94);
    --warning-text: #92400e;

    --shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.06);
    --shadow-card: 0 22px 50px rgba(15, 23, 42, 0.10);
    --shadow-blue: 0 10px 24px rgba(37, 99, 235, 0.18);

    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 12px;

    --sidebar-width: 250px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.16), transparent 24%),
        radial-gradient(circle at 85% 10%, rgba(255,255,255,0.88), transparent 20%),
        linear-gradient(135deg, #edf3f9, #e7eef7 40%, #f7fbff);
    color: var(--text);
    min-height: 100vh;
}

/* Layout */
.app {
    display: flex;
    min-height: 100vh;
    gap: 16px;
    padding: 14px;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface-dark);
    color: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: 12px 10px;
    position: sticky;
    top: 10px;
    height: calc(100vh - 20px);
    overflow-y: auto;
    scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.14);
    border-radius: 999px;
}

.content {
    flex: 1;
    min-width: 0;
}

/* Brand */
.brand-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 2px 4px;
}

.brand-logo-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    flex-shrink: 0;
}

.brand-text h2 {
    margin: 0;
    font-size: 16px;
    color: white;
    letter-spacing: -0.1px;
    line-height: 1.05;
}

.brand-text p {
    margin: 1px 0 0;
    font-size: 10px;
    color: rgba(255,255,255,0.68);
    line-height: 1.15;
}

.brand-wrap-logo-only {
    justify-content: center;
    margin-bottom: 12px;
}

.brand-logo-big {
    width: 140px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* User panel */
.user-panel {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 14px;
}

.user-panel .label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255,255,255,0.56);
    margin-bottom: 4px;
}

.user-panel .username {
    font-size: 13px;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
    word-break: break-word;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.role-admin {
    background: rgba(191, 219, 254, 0.16);
    color: #93c5fd;
    border: 1px solid rgba(147, 197, 253, 0.25);
}

.role-user {
    background: rgba(187, 247, 208, 0.12);
    color: #86efac;
    border: 1px solid rgba(134, 239, 172, 0.2);
}

/* Navigation */
.nav-section {
    margin-bottom: 10px;
}

.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.42);
    margin: 0 0 6px 6px;
    font-weight: 700;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar nav a {
    display: block;
    text-decoration: none;
    color: rgba(255,255,255,0.92);
    padding: 10px 12px;
    border-radius: 13px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.15;
    transition: all 0.2s ease;
    background: transparent;
    border: 1px solid transparent;
}

.sidebar nav a:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.sidebar nav a.nav-active {
    background: linear-gradient(135deg, rgba(59,130,246,0.34), rgba(255,255,255,0.12));
    border-color: rgba(96,165,250,0.22);
    color: white;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
}

/* Top welcome */
.top-welcome {
    background: var(--surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px 22px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-soft);
}

.top-welcome h1 {
    margin: 0 0 6px;
    font-size: 30px;
    letter-spacing: -0.5px;
}

.top-welcome p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

/* Typography */
h1 {
    margin: 0 0 14px;
    font-size: 28px;
    letter-spacing: -0.4px;
}

h2 {
    margin: 0 0 12px;
    font-size: 24px;
}

h3 {
    margin: 0 0 12px;
    font-size: 19px;
}

h4 {
    margin: 0 0 10px;
    font-size: 15px;
}

/* Cards */
.card {
    background: var(--surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-card);
    margin-bottom: 16px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.stat-card {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    color: white;
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.22);
    min-height: 125px;
}

.stat-card h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.92);
}

.stat-card p {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.4px;
}

/* Forms */
form {
    display: grid;
    gap: 14px;
}

.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.82);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

input::placeholder,
textarea::placeholder {
    color: #7b8797;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(37, 99, 235, 0.38);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
    background: rgba(255,255,255,0.94);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

/* Buttons */
button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-width: 100px;
    padding: 11px 16px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    color: white;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-blue);
    white-space: nowrap;
}

button:hover,
.btn:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
    transform: translateY(-1px);
}

button:active,
.btn:active {
    transform: translateY(0);
}

.inline-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Payment box */
.payment-box {
    background: rgba(255,255,255,0.42);
    border: 1px solid rgba(255,255,255,0.55);
    border-radius: 16px;
    padding: 14px;
}

.payment-box label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #243244;
}

/* Alerts */
.alert {
    padding: 13px 15px;
    border-radius: 16px;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.45);
    box-shadow: var(--shadow-soft);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger-text);
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.54);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(255,255,255,0.7);
}

th {
    text-align: left;
    padding: 13px 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #5f6f83;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    vertical-align: middle;
}

tbody tr:hover {
    background: rgba(255,255,255,0.42);
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-red {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.badge-green {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-yellow {
    background: var(--warning-bg);
    color: var(--warning-text);
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 20%, rgba(59,130,246,0.16), transparent 26%),
        linear-gradient(135deg, #edf3f9, #f7fbff);
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: var(--surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 26px;
    box-shadow: var(--shadow-card);
}

.login-card h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 28px;
}

.login-card p {
    color: var(--muted);
    margin-bottom: 18px;
}

/* Utility */
canvas {
    max-width: 100%;
}

.search-bar-form {
    display: grid;
    gap: 12px;
}

.search-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 1100px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        overflow: visible;
    }
}

@media (max-width: 700px) {
    .app {
        padding: 12px;
        gap: 12px;
    }

    .sidebar,
    .card,
    .top-welcome,
    .login-card,
    .stat-card {
        border-radius: 20px;
    }

    .top-welcome h1,
    h1 {
        font-size: 24px;
    }

    .card {
        padding: 16px;
    }

    .row {
        grid-template-columns: 1fr;
    }

    button,
    .btn {
        width: 100%;
    }

    th,
    td {
        padding: 11px 10px;
        font-size: 12px;
    }
}