:root {
    --navy: #2d2d44;
    --indigo: #5b5fc7;
    --indigo-light: #7a7ed4;
    --indigo-bg: #eeeffe;
    --green: #2d8a4e;
    --green-bg: #e6f5ec;
    --red: #c0392b;
    --red-bg: #fdecea;
    --orange: #d68910;
    --orange-bg: #fef5e7;
    --slate: #4a4a6a;
    --text: #333346;
    --text-light: #6b6b80;
    --bg: #f8f8fc;
    --white: #ffffff;
    --border: #e0e0ec;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    line-height: 1.6;
    background: var(--bg);
}

/* --- Nav --- */
.nav {
    background: var(--navy);
    padding: 0.65rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand {
    color: var(--white);
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
}
.nav-brand span { color: var(--indigo-light); }
.nav-links {
    display: flex;
    gap: 1.25rem;
    list-style: none;
    align-items: center;
}
.nav-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s;
}
.nav-links a:hover { color: var(--white); }
.nav-links a.active { color: var(--white); border-bottom: 2px solid var(--indigo-light); padding-bottom: 2px; }
.nav-user {
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
}

/* --- Layout --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* --- Flash messages --- */
.flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.95rem; }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-danger { background: var(--red-bg); color: var(--red); }
.flash-warning { background: var(--orange-bg); color: var(--orange); }
.flash-info { background: var(--indigo-bg); color: var(--indigo); }

/* --- Cards --- */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.card h2 {
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
    color: var(--navy);
}
.card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--navy);
}

/* --- Stat cards (dashboard) --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
}
.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--indigo);
    line-height: 1.2;
}
.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* --- Tables --- */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
th, td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    background: var(--bg);
    font-weight: 600;
    color: var(--slate);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
tr:hover { background: #fafaff; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-pending { background: var(--orange-bg); color: var(--orange); }
.badge-approved { background: var(--green-bg); color: var(--green); }
.badge-rejected { background: var(--red-bg); color: var(--red); }

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--indigo); color: var(--white); }
.btn-primary:hover { background: var(--indigo-light); }
.btn-success { background: var(--green); color: var(--white); }
.btn-success:hover { background: #34a85c; }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #e74c3c; }
.btn-outline { background: transparent; border: 2px solid var(--indigo); color: var(--indigo); }
.btn-outline:hover { background: var(--indigo-bg); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

/* --- Forms --- */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    color: var(--slate);
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--white);
    color: var(--text);
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(91,95,199,0.12);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

/* --- Auth forms --- */
.auth-wrap {
    max-width: 420px;
    margin: 4rem auto;
    padding: 0 1.5rem;
}
.auth-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}
.auth-card h1 {
    font-size: 1.5rem;
    color: var(--navy);
    margin-bottom: 0.35rem;
}
.auth-card .subtitle {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* --- Section headers --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.section-header h2 {
    font-size: 1.25rem;
    color: var(--navy);
    margin: 0;
}

/* --- Empty state --- */
.empty { text-align: center; padding: 2rem; color: var(--text-light); font-size: 0.95rem; }

/* --- Page header --- */
.page-header {
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.6rem;
    color: var(--navy);
    margin-bottom: 0.25rem;
}
.page-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* --- Action cells --- */
.action-cell { white-space: nowrap; }
.action-cell form { display: inline; }

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.25rem;
}
.tab {
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.tab.active { color: var(--indigo); border-bottom-color: var(--indigo); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Agreement body --- */
.agreement-body {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
    white-space: pre-wrap;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* --- Card grid --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.card-grid .card { margin-bottom: 0; }

/* --- Task meta --- */
.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0.5rem 0;
}

/* --- Action buttons (inline forms) --- */
.action-btns form { display: inline-flex; gap: 0.35rem; }
.action-btns { white-space: nowrap; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr; }
    .nav-links { gap: 0.75rem; }
    .nav-links a { font-size: 0.8rem; }
}
