:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--gray-100); color: var(--gray-900); font-size: 14px; line-height: 1.5; }

/* Navbar */
.navbar { display: flex; align-items: center; background: var(--gray-900); color: #fff; padding: 0 1.5rem; height: 56px; position: sticky; top: 0; z-index: 100; }
.nav-brand { font-weight: 700; font-size: 1.1rem; margin-right: 2rem; }
.nav-links { display: flex; gap: .5rem; }
.nav-links a { color: var(--gray-300); text-decoration: none; padding: .5rem .75rem; border-radius: var(--radius); transition: .15s; }
.nav-links a:hover, .nav-links a.active { color: #fff; background: rgba(255,255,255,.1); }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .85rem; color: var(--gray-300); }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* Cards */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem; }
.card h3 { margin-bottom: .75rem; font-size: 1rem; color: var(--gray-700); }
.card-highlight { border-left: 4px solid var(--warning); }
.card-header-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.card-header-actions h3 { margin-bottom: 0; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; text-align: center; }
.stat-label { font-size: .8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-top: .25rem; }
.stat-value a { color: inherit; text-decoration: none; }
.stat-warning { border-bottom: 3px solid var(--warning); }
.stat-warning .stat-value { color: var(--warning); }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: .25rem; min-width: 120px; flex: 1; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--gray-500); }
.form-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.form-actions { flex: 0 0 auto; }
.form-inline { display: flex; gap: .5rem; align-items: center; }
input[type="text"], input[type="password"], input[type="date"], input[type="time"], input[type="number"], input[type="email"], select, textarea {
    padding: .5rem .625rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: .875rem; width: 100%; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.input-sm { width: 80px; }
.input-md { width: 160px; }

/* Buttons */
.btn, .btn-sm { display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: var(--radius); font-weight: 600; cursor: pointer; text-decoration: none; transition: .15s; }
.btn { padding: .5rem 1rem; font-size: .875rem; }
.btn-sm { padding: .25rem .5rem; font-size: .75rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-success, .btn-sm.btn-success { background: var(--success); color: #fff; }
.btn-danger, .btn-sm.btn-danger { background: var(--danger); color: #fff; }
.btn-warning, .btn-sm.btn-warning { background: #f59e0b; color: #fff; }
.btn-full { width: 100%; }
.inline { display: inline; }

/* Tables */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .5rem .625rem; text-align: left; border-bottom: 1px solid var(--gray-200); }
.table th { font-size: .75rem; text-transform: uppercase; color: var(--gray-500); font-weight: 600; }
.table-sm td { padding: .35rem .5rem; font-size: .8rem; }
.text-right { text-align: right; }
.actions { white-space: nowrap; display: flex; gap: .25rem; }
.day-summary td { background: var(--gray-50); font-size: .8rem; }
.month-total td { background: var(--primary); color: #fff; font-size: .9rem; }
.holiday-row { background: #fef3c7; }
.inactive-row { opacity: .5; }
.completed-row { opacity: .6; background: #f0fdf4; }

/* Alerts */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .875rem; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* Badges */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .7rem; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* Tabs */
.tab-bar { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 2px solid var(--gray-200); padding-bottom: 0; }
.tab { padding: .5rem 1rem; text-decoration: none; color: var(--gray-500); font-weight: 600; font-size: .875rem; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: .15s; }
.tab:hover { color: var(--gray-900); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: .5rem; }
.toolbar-info { font-weight: 600; }

/* Timer */
.timer-running { text-align: center; }
.timer-display { font-size: 2.5rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); margin: .75rem 0; }
.timer-info { margin-bottom: .5rem; }
.timer-earnings { font-size: 1.4rem; font-weight: 600; color: var(--success); margin-bottom: .5rem; font-variant-numeric: tabular-nums; }
.timer-paused { color: var(--warning); animation: blink 1.5s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.timer-actions { display: flex; gap: .5rem; justify-content: center; margin-top: .75rem; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Holidays */
.holiday-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .5rem; }
.holiday-item { display: flex; gap: .75rem; padding: .35rem 0; }
.holiday-date { font-weight: 600; color: var(--gray-500); min-width: 90px; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #3a6f9a, #4582B4); }
.login-box { background: #fff; border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 380px; box-shadow: 0 4px 24px rgba(0,0,0,.15); }
.login-box h1 { text-align: center; margin-bottom: 1.5rem; color: var(--gray-900); }
.login-box .form-group { margin-bottom: 1.25rem; }
.login-box .btn-full { margin-top: 1rem; }

/* Empty state */
.empty-state { text-align: center; padding: 2rem; color: var(--gray-500); }

/* Checkbox */
.checkbox-label { display: flex; align-items: center; gap: .4rem; font-size: .875rem; cursor: pointer; white-space: nowrap; padding: .5rem 0; }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

/* Budget bar */
.budget-bar { display: inline-block; width: 60px; height: 8px; background: var(--gray-200); border-radius: 4px; vertical-align: middle; margin-left: .5rem; }
.budget-fill { display: block; height: 100%; background: var(--success); border-radius: 4px; transition: width .3s; }
.budget-fill.over75 { background: var(--warning); }
.budget-fill.over90 { background: var(--danger); }
.text-danger { color: var(--danger); font-weight: 700; }

/* Progress bars */
.progress-bar { position: relative; height: 22px; background: var(--gray-200); border-radius: 11px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 11px; transition: width .5s ease; }
.progress-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; color: var(--gray-700); }

/* Overtime bars */
.overtime-row { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--gray-100); }
.overtime-row:last-of-type { border-bottom: none; }
.overtime-name { min-width: 110px; font-weight: 600; font-size: .85rem; }
.overtime-bar-wrap { flex: 1; }
.overtime-bar { position: relative; height: 16px; background: var(--gray-100); border-radius: 8px; overflow: hidden; }
.overtime-target { position: absolute; height: 100%; background: var(--gray-200); border-radius: 8px; }
.overtime-actual { position: absolute; height: 100%; border-radius: 8px; opacity: .85; }
.overtime-value { min-width: 65px; text-align: right; font-size: .85rem; }
.overtime-detail { min-width: 100px; text-align: right; font-size: .75rem; color: var(--gray-500); }

/* Vacation bars */
.vacation-row { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--gray-100); }
.vacation-row:last-of-type { border-bottom: none; }
.vacation-name { min-width: 110px; font-weight: 600; font-size: .85rem; }
.vacation-bar-wrap { flex: 1; }
.vacation-bar { display: flex; height: 16px; background: var(--gray-200); border-radius: 8px; overflow: hidden; }
.vac-used { background: var(--primary); }
.vac-pending { background: var(--warning); }
.vacation-value { min-width: 110px; text-align: right; font-size: .85rem; font-weight: 600; }

/* Week chart */
.week-chart { display: flex; flex-direction: column; gap: .75rem; }
.week-day { padding: .5rem; border-radius: var(--radius); background: var(--gray-50); }
.week-today { background: #eff6ff; border: 1px solid var(--primary); }
.week-holiday { background: #fef3c7; }
.week-day-label { font-weight: 700; font-size: .8rem; margin-bottom: .4rem; color: var(--gray-700); }
.week-day-bars { display: flex; flex-direction: column; gap: .25rem; }
.week-bar-row { display: flex; align-items: center; gap: .5rem; }
.week-bar-name { min-width: 65px; font-size: .75rem; color: var(--gray-500); }
.week-bar-track { flex: 1; position: relative; height: 14px; background: var(--gray-200); border-radius: 7px; overflow: hidden; min-width: 0; }
.week-bar-fill { height: 100%; border-radius: 7px; transition: width .3s; min-width: 2px; }
.week-bar-target { position: absolute; top: -2px; width: 2px; height: 18px; background: var(--gray-500); border-radius: 1px; }
.week-bar-hours { min-width: 35px; font-size: .75rem; font-weight: 600; text-align: right; }

/* Dashboard invoice buttons */
.invoice-btn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; }
.invoice-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem .75rem; background: var(--primary); color: #fff; border-radius: var(--radius); text-decoration: none; text-align: center; transition: all .15s ease; box-shadow: 0 2px 4px rgba(0,0,0,.15); cursor: pointer; }
.invoice-btn:hover { background: var(--primary-dark, #1a3350); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.invoice-btn:active { transform: translateY(0); }
.invoice-btn-name { font-weight: 700; font-size: .95rem; line-height: 1.2; margin-bottom: .4rem; }
.invoice-btn-amount { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
.invoice-btn-detail { font-size: .7rem; opacity: .7; margin-top: .3rem; }
.invoice-btn-project { background: var(--primary-dark); }
.invoice-btn-project:hover { background: #15295a; }
.invoice-btn-project-name { font-size: .75rem; opacity: .85; margin-bottom: .3rem; padding: .1rem .5rem; background: rgba(255,255,255,.15); border-radius: 3px; }

/* Project budget cards */
.project-budget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem; }
.project-budget-card { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1rem; }
.pbc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .75rem; }
.pbc-name { font-weight: 700; font-size: .95rem; color: var(--gray-900); }
.pbc-client { font-size: .8rem; color: var(--gray-500); margin-top: .1rem; }
.pbc-bar-wrap { position: relative; height: 22px; background: var(--gray-200); border-radius: 6px; overflow: hidden; margin-bottom: .5rem; }
.pbc-bar { height: 100%; border-radius: 6px; transition: width .5s ease; min-width: 4px; }
.pbc-bar-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); pointer-events: none; }
.pbc-stats { display: flex; justify-content: space-between; font-size: .8rem; color: var(--gray-600); }

/* Compact timer (dashboard) */
.timer-compact { border-left: 4px solid var(--primary); }
.timer-compact-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.timer-compact-info { flex: 1; font-size: .875rem; min-width: 150px; }

/* Revenue chart */
.revenue-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.revenue-month { text-align: center; }
.revenue-month-label { font-size: .8rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; margin-bottom: .5rem; }
.revenue-bars { display: flex; justify-content: center; align-items: flex-end; gap: 4px; height: 120px; padding: 0 .5rem; }
.revenue-bar { position: relative; min-width: 18px; max-width: 40px; flex: 1; border-radius: 4px 4px 0 0; background: var(--primary); transition: height .5s ease; cursor: default; }
.revenue-bar:hover { opacity: .8; }
.revenue-bar-label { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: .6rem; color: var(--gray-500); white-space: nowrap; }
.revenue-bar-value { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: .65rem; font-weight: 700; white-space: nowrap; }
.revenue-total { font-size: 1.2rem; font-weight: 700; color: var(--primary); margin-top: .5rem; }

/* Employee personal stats */
.personal-stat-row { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--gray-100); }
.personal-stat-row:last-child { border-bottom: none; }
.personal-stat-icon { font-size: 1.3rem; width: 36px; text-align: center; }
.personal-stat-info { flex: 1; }
.personal-stat-label { font-size: .75rem; color: var(--gray-500); }
.personal-stat-value { font-size: 1rem; font-weight: 700; }

/* Mobile */
@media (max-width: 768px) {
    .nav-links { display: none; position: absolute; top: 56px; left: 0; right: 0; background: var(--gray-900); flex-direction: column; padding: .5rem; }
    .nav-links.open { display: flex; }
    .nav-toggle { display: block; margin-left: auto; }
    .nav-user span { display: none; }
    .form-row { flex-direction: column; }
    .form-group { min-width: 100%; }
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .timer-display { font-size: 2rem; }
}
