/* ============================================================
   TimeTrack Pro — Accounting Firm Aesthetic
   Refined, professional, with a warm navy + amber accent palette
   ============================================================ */

:root {
    --bg:           #f4f2ee;
    --bg-card:      #ffffff;
    --bg-sidebar:   #1a1f2e;
    --bg-sidebar-hover: #252b3d;
    --bg-sidebar-active: #2e3650;
    --text:         #2c2c2c;
    --text-muted:   #7a7a7a;
    --text-sidebar: #b0b8cc;
    --text-sidebar-active: #ffffff;
    --accent:       #c8873e;
    --accent-hover: #a96f2e;
    --accent-light: #faf3ea;
    --border:       #e2ddd6;
    --success:      #3a8a5c;
    --error:        #c14848;
    --warning:      #d4953a;
    --radius:       6px;
    --radius-lg:    10px;
    --shadow:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg:    0 4px 16px rgba(0,0,0,.08);
    --sidebar-w:    250px;
    --topbar-h:     56px;
    --font:         'DM Sans', -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', monospace;
    --transition:   .18s ease;
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
input, select, textarea, button { font: inherit; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-icon {
    font-size: 1.5rem;
    filter: grayscale(.3);
}
.brand-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.02em;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}

.nav-section {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.25);
    padding: 18px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    font-size: .88rem;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}
.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}
.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
}
.nav-icon {
    width: 20px;
    text-align: center;
    font-size: .85rem;
    opacity: .7;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    margin-bottom: 4px;
}
.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}
.user-info { line-height: 1.3; }
.user-name { color: #fff; font-size: .85rem; display: block; font-weight: 600; }
.user-role { color: rgba(255,255,255,.4); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }

.logout-btn { font-size: .82rem; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -.01em;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    margin-right: 12px;
    cursor: pointer;
    color: var(--text);
}

.content-area {
    padding: 28px;
    flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h2 {
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: -.01em;
}
.card-body { padding: 20px; }

/* ============================================================
   STAT CARDS (dashboard)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--accent);
    border-radius: 3px 0 0 3px;
}
.stat-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
    font-family: var(--font-mono);
}
.stat-sub {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: .9rem;
    transition: border-color var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200,135,62,.12);
}
select.form-control { cursor: pointer; }
textarea.form-control { min-height: 80px; resize: vertical; }
.form-control-sm { padding: 6px 10px; font-size: .82rem; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: .85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

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

.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #a33a3a; color: #fff; }

.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-xs { padding: 3px 8px; font-size: .72rem; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: .85rem;
}
th {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    background: var(--bg);
    position: sticky;
    top: 0;
}
tr:hover td { background: rgba(200,135,62,.03); }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-mono { font-family: var(--font-mono); font-size: .82rem; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.badge-active { background: #e8f5ec; color: var(--success); }
.badge-inactive { background: #fde8e8; color: var(--error); }
.badge-amber { background: var(--accent-light); color: var(--accent); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: .88rem;
    font-weight: 500;
}
.alert-success { background: #e8f5ec; color: var(--success); border-left: 3px solid var(--success); }
.alert-error { background: #fde8e8; color: var(--error); border-left: 3px solid var(--error); }

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.filters-bar .form-group { margin-bottom: 0; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    gap: 4px;
    padding: 16px 0;
    justify-content: center;
    list-style: none;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: .82rem;
    font-weight: 600;
}
.pagination a { border: 1px solid var(--border); color: var(--text); }
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .active { background: var(--accent); color: #fff; border: 1px solid var(--accent); }

/* ============================================================
   GRID HELPERS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-sidebar);
}
.login-box {
    width: 380px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px;
}
.login-box h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -.02em;
}
.login-box p { font-size: .85rem; color: var(--text-muted); margin-bottom: 28px; }
.login-box .form-group { margin-bottom: 18px; }
.login-box .btn { width: 100%; justify-content: center; padding: 12px; }

/* ============================================================
   CHART WRAPPER
   ============================================================ */
.chart-container {
    position: relative;
    height: 300px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
}
.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: .95rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ============================================================
   ACTION BUTTONS (tables)
   ============================================================ */
.actions { display: flex; gap: 4px; }

/* ============================================================
   EXPORT BAR
   ============================================================ */
.export-bar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 12px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card, .stat-card { animation: fadeIn .3s ease both; }
.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .1s; }
.stat-card:nth-child(4) { animation-delay: .15s; }
