:root {
    --primary-color: #F96302;
    /* Noblelift Orange */
    --primary-hover: #d95602;
    --secondary-color: #64748b;
    --background-color: #f1f5f9;
    /* Slightly darker background for contrast */
    --surface-color: #ffffff;
    --text-color: #1e293b;
    /* Darker text */
    --border-color: #e2e8f0;
    --error-color: #ef4444;
    --success-color: #22c55e;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
    --radius: 0.75rem;
    /* More rounded corners */
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #0f172a;
    font-weight: 700;
    margin-top: 0;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 1.875rem;
}

h2 {
    font-size: 1.5rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.card {
    background: var(--surface-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
    background: transparent;
    color: var(--text-color);
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.btn:focus,
.btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-sm);
}

button.btn::-moz-focus-inner {
    border: 0;
    padding: 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #334155;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font-family);
    transition: all 0.2s;
    background-color: #f8fafc;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(249, 99, 2, 0.1);
    /* Orange glow */
}

/* Custom Checkbox specific */
input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 1.25rem;
    height: 1.25rem;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

th,
td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #64748b;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #fafafa;
}

.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    border: none;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
}

.alert-error,
.alert-warning {
    background-color: #fef2f2;
    color: #991b1b;
}

.alert-info {
    background-color: #eff6ff;
    color: #1e40af;
}

.nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
}

.checkbox-row span {
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.95rem;
    color: var(--text-color);
}

.form-help {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-top: 0.25rem;
}

/* Navbar specific */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    font-weight: 800;
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand span {
    color: var(--primary-color);
}

.stat-value {
    font-size: 1.125rem;
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-success {
    background-color: #dcfce7;
    color: #166534;
}

.status-error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Chart containers */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Layout helpers */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.dashboard-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Week selector form used on multiple pages */
.week-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
}

.week-form select {
    width: auto;
    min-width: 260px;
    padding: 0.5rem;
    font-weight: 500;
}

/* Search bar on user list */
.search-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-bar form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
}

.search-bar input[type="text"] {
    width: 250px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

/* ── Mobile ── */
@media (max-width: 768px) {

    /* Двухколоночная сетка → одна колонка */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Неделя + кнопки — переносятся */
    .dashboard-actions {
        width: 100%;
    }

    .dashboard-actions select {
        width: 100%;
        min-width: 0;
    }

    .container {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }

    h1 {
        font-size: 1.375rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    /* Navbar */
    .navbar .container {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .brand {
        font-size: 1.1rem;
    }

    .nav {
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }

    .nav>div {
        display: none;
        /* скрываем блок с именем — экономим место */
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.8rem;
    }

    /* Header (заголовок + кнопка добавить) */
    .header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    /* Таблицы */
    th,
    td {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Формы — убираем лишние горизонтальные отступы */
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    select {
        font-size: 0.95rem;
    }

    /* Week selector stretches full width on mobile */
    .week-form {
        width: 100%;
    }

    .week-form select {
        flex: 1;
        min-width: 0;
        width: 100%;
    }

    /* Search bar stacks on mobile */
    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-bar form {
        width: 100%;
        flex-wrap: wrap;
    }

    .search-bar input[type="text"] {
        flex: 1;
        min-width: 0;
        width: auto;
    }
}