/* cSpell:ignore topbar hideable sidebar */

:root {
    color-scheme: dark;

    --bg: #212121;
    --bg-secondary: #171717;
    --panel: #2a2a2a;
    --panel-2: #262626;
    --input-bg: #2f2f2f;
    --input-bg-hover: #343434;

    --text: #ececec;
    --muted: #b4b4b4;
    --muted-2: #8f8f8f;

    --line: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.16);

    --accent: #10a37f;
    --accent-hover: #0d8c6d;
    --accent-light: #19c39c;

    --secondary: #3a3a3a;
    --secondary-hover: #454545;

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #10a37f;

    --radius: 12px;
    --radius-lg: 18px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.14);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.28);

    --bg-light: #f7f7f8;
    --panel-light: #ffffff;
    --panel-2-light: #f3f4f6;
    --text-light: #1f2937;
    --muted-light: #6b7280;
    --line-light: rgba(15, 23, 42, 0.08);
    --border-light: rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    letter-spacing: 0;
}

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

/* Light theme */

body.theme-light {
    background: var(--bg-light);
    color: var(--text-light);
}

body.theme-light a {
    color: inherit;
}

body.theme-light .topbar,
body.theme-light .card,
body.theme-light .auth-card,
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    width: clamp(320px, 28vw, 520px);
    min-width: 320px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.theme-light .topbar {
    border-bottom-color: var(--border-light);
    background: rgba(255, 255, 255, 0.92);
}

body.theme-light .card,
body.theme-light .auth-card {
    border-color: var(--border-light);
    background: var(--panel-light);
}

.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    width: clamp(320px, 28vw, 520px);
    min-width: 320px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.theme-light .btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: rgba(16, 163, 127, 0.36);
}

body.theme-light .btn-primary:hover {
    background: var(--accent-hover);
}

body.theme-light .btn-secondary {
    background: #ffffff;
    color: var(--text-light);
    border-color: var(--border-light);
}

body.theme-light .btn-secondary:hover {
    background: #f3f4f6;
}

body.theme-light .alert-error {
    background: rgba(254, 226, 226, 0.7);
    color: #7f1d1d;
    border-color: rgba(239, 68, 68, 0.2);
}

body.theme-light .alert-success {
    background: rgba(220, 252, 231, 0.8);
    color: #166534;
    border-color: rgba(34, 197, 94, 0.2);
}

body.theme-light .nav-item {
    color: var(--muted-light);
}

body.theme-light .nav-item:hover {
    color: var(--text-light);
    background: rgba(15, 23, 42, 0.04);
}

body.theme-light .nav-item.active {
    color: var(--text-light);
    background: rgba(15, 23, 42, 0.06);
    border-color: var(--border-light);
}

body.theme-light input[type="text"],
body.theme-light input[type="email"],
body.theme-light input[type="password"],
body.theme-light textarea,
body.theme-light select {
    background: #ffffff;
    color: var(--text-light);
    border-color: var(--border-light);
}

body.theme-light input[type="text"]:focus,
body.theme-light input[type="email"]:focus,
body.theme-light input[type="password"]:focus,
body.theme-light textarea:focus,
body.theme-light select:focus {
    border-color: rgba(16, 163, 127, 0.4);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.12);
}

/* Layout */

.app-shell {
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}

.main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px;
}

/* Sidebar */

.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    width: clamp(320px, 28vw, 520px);
    min-width: 320px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    color: var(--muted);
    background: transparent;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
    animation: slideInLeft 0.4s ease both;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-color: var(--border);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border-color: var(--border-strong);
}

.sidebar-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-strong);
}

/* Topbar */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(33, 33, 33, 0.92);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 40;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.topbar .sidebar-open {
    display: none;
}

/* Auth */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px;
}

.auth-card h1 {
    margin: 0 0 10px;
    font-size: 28px;
    line-height: 1.2;
}

.auth-card p {
    margin: 0 0 24px;
    color: var(--muted);
}

/* Forms */

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

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    outline: none;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    border-color: rgba(16, 163, 127, 0.36);
    background: var(--input-bg-hover);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.12);
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    user-select: none;
    text-align: center;
    text-decoration: none;
    min-height: 40px;
}

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

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: rgba(16, 163, 127, 0.36);
    box-shadow: 0 6px 16px rgba(16, 163, 127, 0.18);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 8px 24px rgba(16, 163, 127, 0.24);
}

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

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-strong);
}

.btn.icon-btn {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 12px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-strong);
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-strong);
}

.theme-toggle .label {
    display: none;
}

/* Alerts */

.alert {
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInLeft 0.35s ease;
    border: 1px solid transparent;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.25);
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.25);
}

/* Cards */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 28px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--border-strong);
}

.card h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

/* Animations */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }

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

.card,
.hero-card,
.summary-card,
.table-card,
.mobile-card {
    opacity: 0;
    animation: fadeInUp 0.45s ease both;
    animation-delay: 0.08s;
}

/* Accessibility */

.btn:focus-visible,
.nav-item:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(16, 163, 127, 0.35);
    outline-offset: 2px;
}

/* Scrollbars */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.24);
}

/* Responsive */

@media (min-width: 720px) {
    .theme-toggle .label {
        display: inline;
        margin-left: 8px;
        font-size: 13px;
    }
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 900px) {
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    width: clamp(320px, 28vw, 520px);
    min-width: 320px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

    .main-wrap {
        min-height: 100vh;
    }

    .dashboard-shell {
        padding-top: 18px;
    }

    .topbar {
        justify-content: space-between;
    }

    .topbar .sidebar-open {
        display: inline-flex;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    .card {
        padding: 16px;
    }

    .topbar {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 11px 12px;
        font-size: 13px;
        min-height: 40px;
    }

    .card {
        padding: 14px;
    }

    .brand {
        font-size: 18px;
    }
}

.auth-card .btn-primary {
    width: 100%;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-brand .logo {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    color: inherit;
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;

        width: 85%;
        max-width: 420px;

        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
    }

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

