:root {
    --bg-main: #f3f2fb;
    --bg-accent: #e6e3f9;
    --glass: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.72);
    --text-main: #1f1b3a;
    --text-muted: #6c6690;
    --primary: #6d4ae6;
    --primary-2: #9b5df0;
    --danger: #dc4a6b;
    --warning: #d68a2c;
    --success: #2d9d78;
    --shadow: 0 10px 30px rgba(46, 33, 90, 0.14);
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

html[data-theme="dark"] {
    --bg-main: #100e1c;
    --bg-accent: #181530;
    --glass: rgba(24, 20, 42, 0.64);
    --glass-border: rgba(168, 150, 224, 0.2);
    --text-main: #ece9f6;
    --text-muted: #aaa2ce;
    --primary: #8b6ff2;
    --primary-2: #ac85f8;
    --danger: #ef6f8c;
    --warning: #e0a54e;
    --success: #4dbd93;
    --shadow: 0 16px 36px rgba(4, 2, 12, 0.55);
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: "Sora", sans-serif;
    color: var(--text-main);
    background: radial-gradient(1300px 800px at 5% 0%, #fbfaff 0%, #f3f2fb 55%, #ece9f9 100%);
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html[data-theme="dark"] body {
    background: radial-gradient(1300px 800px at 5% 0%, #17142a 0%, #100e1c 55%, #0c0a18 100%);
}

.liquid-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(420px circle at 15% 12%, rgba(126, 90, 230, 0.22), transparent 65%),
        radial-gradient(540px circle at 90% 5%, rgba(120, 110, 245, 0.16), transparent 60%),
        radial-gradient(460px circle at 65% 90%, rgba(232, 110, 190, 0.14), transparent 63%);
}

html[data-theme="dark"] .liquid-background {
    background:
        radial-gradient(420px circle at 15% 12%, rgba(139, 111, 242, 0.24), transparent 65%),
        radial-gradient(540px circle at 90% 5%, rgba(108, 92, 226, 0.2), transparent 60%),
        radial-gradient(460px circle at 65% 90%, rgba(210, 96, 176, 0.16), transparent 63%);
}

.glass-panel,
.glass-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.glass-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.glass-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 34px rgba(46, 33, 90, 0.2);
    border-color: rgba(255, 255, 255, 0.8);
}

.glass-input,
.form-control.glass-input,
.form-select.glass-input {
    background: rgba(255, 255, 255, 0.48);
    border: 1px solid rgba(255, 255, 255, 0.85);
    color: var(--text-main);
    border-radius: var(--radius-sm);
}

.glass-input:focus {
    border-color: rgba(109, 74, 230, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(109, 74, 230, 0.16);
    background: rgba(255, 255, 255, 0.7);
}

.glass-input::placeholder,
.form-control.glass-input::placeholder {
    color: var(--text-muted);
    opacity: 0.9;
}

.btn {
    border-radius: 999px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

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

.btn-emerald {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border: none;
    box-shadow: 0 12px 24px rgba(109, 74, 230, 0.28);
}

.btn-emerald:hover {
    color: #fff;
    box-shadow: 0 15px 30px rgba(109, 74, 230, 0.34);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.35);
    color: var(--text-main);
}

.icon-btn {
    width: 2.4rem;
    height: 2.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.55);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.icon-btn:hover {
    transform: translateY(-2px) scale(1.02);
    color: var(--primary);
}

.theme-toggle-btn.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(109, 74, 230, 0.34);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.62rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
}

.status-badge.pending {
    background: rgba(214, 138, 44, 0.14);
    color: #94661f;
}

.status-badge.completed,
.status-badge.approved,
.status-badge.success {
    background: rgba(45, 157, 120, 0.14);
    color: #1f7758;
}

.status-badge.rejected,
.status-badge.timed_out,
.status-badge.danger {
    background: rgba(220, 74, 107, 0.14);
    color: #9e3148;
}

.status-badge.info {
    background: rgba(109, 74, 230, 0.14);
    color: #5636be;
}

.status-badge.warning {
    background: rgba(214, 138, 44, 0.14);
    color: #94661f;
}

.metric-box {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.85rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.72);
}

.metric-box small {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.metric-box strong {
    font-size: 1rem;
    font-weight: 700;
}

.table-glass {
    margin: 0;
    color: var(--text-main);
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.18);
    --bs-table-striped-color: var(--text-main);
    --bs-table-active-bg: rgba(255, 255, 255, 0.22);
    --bs-table-active-color: var(--text-main);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.42);
    --bs-table-hover-color: var(--text-main);
    --bs-table-border-color: rgba(255, 255, 255, 0.58);
}

.table-glass > :not(caption) > * > * {
    background-color: transparent;
    color: var(--text-main);
}

.table-glass thead th {
    background: rgba(255, 255, 255, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.85);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.table-glass td {
    border-top: 1px solid rgba(255, 255, 255, 0.58);
    font-size: 0.85rem;
}

.table-glass tbody tr {
    transition: background 0.2s ease;
}

.table-glass tbody tr:hover {
    background: rgba(255, 255, 255, 0.42);
}

.empty-state-inline {
    padding: 1rem;
    text-align: center;
    border: 1px dashed rgba(108, 102, 144, 0.4);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.thumb-48 {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.link-clean {
    color: var(--primary);
    text-decoration: none;
}

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

.glass-checkbox {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.36);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.glass-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

.fade-in {
    animation: fadeInUp 0.42s ease both;
}

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

.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.38);
    border-radius: 12px;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.56), transparent);
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

html[data-theme="dark"] .btn-outline-light {
    border-color: rgba(168, 150, 224, 0.32);
    background: rgba(26, 21, 45, 0.76);
    color: var(--text-main);
}

html[data-theme="dark"] .icon-btn {
    border-color: rgba(168, 150, 224, 0.26);
    background: rgba(24, 20, 42, 0.82);
    color: var(--text-main);
}

html[data-theme="dark"] .glass-input,
html[data-theme="dark"] .form-control.glass-input,
html[data-theme="dark"] .form-select.glass-input {
    background: rgba(26, 21, 45, 0.84);
    border-color: rgba(168, 150, 224, 0.24);
    color: var(--text-main);
}

html[data-theme="dark"] .glass-input:focus {
    background: rgba(32, 26, 54, 0.9);
    border-color: rgba(139, 111, 242, 0.56);
    box-shadow: 0 0 0 0.2rem rgba(139, 111, 242, 0.24);
}

html[data-theme="dark"] .table-glass thead th {
    background: rgba(25, 20, 44, 0.84);
    border-bottom-color: rgba(168, 150, 224, 0.24);
}

html[data-theme="dark"] .table-glass td {
    border-top-color: rgba(168, 150, 224, 0.16);
}

html[data-theme="dark"] .table-glass tbody tr:hover {
    background: rgba(30, 24, 52, 0.82);
}

html[data-theme="dark"] .table-glass {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    --bs-table-striped-bg: rgba(26, 21, 45, 0.78);
    --bs-table-striped-color: var(--text-main);
    --bs-table-active-bg: rgba(26, 21, 45, 0.86);
    --bs-table-active-color: var(--text-main);
    --bs-table-hover-bg: rgba(30, 24, 52, 0.82);
    --bs-table-hover-color: var(--text-main);
    --bs-table-border-color: rgba(168, 150, 224, 0.16);
}

html[data-theme="dark"] .empty-state-inline {
    border-color: rgba(168, 150, 224, 0.28);
    background: rgba(22, 17, 40, 0.6);
}

html[data-theme="dark"] .metric-box,
html[data-theme="dark"] .glass-checkbox,
html[data-theme="dark"] .skeleton {
    background: rgba(26, 21, 45, 0.78);
    border-color: rgba(168, 150, 224, 0.2);
}
