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

:root {
  --bg: #0f1117;
  --bg2: #161b27;
  --bg3: #1e2535;
  --border: #2d3748;
  --border2: #3d4f6b;
  --text: #e2e8f0;
  --text2: #a0aec0;
  --text3: #718096;
  --text4: #4a5568;
  --accent: #7f77dd;
  --accent2: #afa9ec;
  --green: #1d9e75;
  --amber: #ef9f27;
  --red: #e24b4a;
  --blue: #378add;
  --teal: #5dcaa5;
  --pink: #d4537e;
  --radius: 8px;
  --radius-lg: 12px;
}

html, body { height: 100%; font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

.hidden { display: none !important; }

/* LOGIN */
.login-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 1000; }
.login-box { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 40px 36px; width: 340px; display: flex; flex-direction: column; gap: 14px; }
.login-logo { font-size: 22px; font-weight: 500; color: var(--accent2); }
.login-sub { font-size: 12px; color: var(--text3); margin-top: -10px; margin-bottom: 6px; }
.login-box input { background: var(--bg3); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 10px 14px; color: var(--text); font-size: 14px; outline: none; width: 100%; }
.login-box input:focus { border-color: var(--accent); }
.login-box button { background: var(--accent); border: none; border-radius: var(--radius); padding: 10px; color: white; font-size: 14px; font-weight: 500; cursor: pointer; }
.login-box button:hover { background: var(--accent2); }
.login-error { background: #e24b4a22; border: 0.5px solid #e24b4a44; color: #f09595; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; }

/* APP LAYOUT */
.app { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
.sidebar { width: 220px; background: var(--bg2); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; }
.sidebar-logo { padding: 18px 16px 14px; border-bottom: 0.5px solid var(--border); }
.logo-text { display: block; font-size: 15px; font-weight: 500; color: var(--text); }
.logo-sub { display: block; font-size: 11px; color: var(--text3); margin-top: 2px; }
.nav { flex: 1; padding: 8px 0; }
.nav-section { padding: 4px 0 8px; }
.nav-label { font-size: 10px; color: var(--text4); text-transform: uppercase; letter-spacing: 0.08em; padding: 6px 16px 4px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 7px 16px; font-size: 13px; color: var(--text2); cursor: pointer; border-left: 2px solid transparent; text-decoration: none; transition: background 0.1s; }
.nav-item i { font-size: 16px; width: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--bg3); color: var(--accent); border-left-color: var(--accent); }
.nav-badge { margin-left: auto; background: #7f77dd22; color: var(--accent2); font-size: 10px; padding: 1px 7px; border-radius: 10px; }
.sidebar-footer { padding: 12px 16px; border-top: 0.5px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.kimai-status { font-size: 12px; color: var(--text3); display: flex; align-items: center; gap: 6px; }
.kimai-status.connected i { color: var(--green); }
.kimai-status.disconnected i { color: var(--red); }
.logout-btn { background: none; border: 0.5px solid var(--border); border-radius: var(--radius); padding: 6px 8px; color: var(--text3); cursor: pointer; }
.logout-btn:hover { color: var(--red); border-color: var(--red); }

/* MAIN */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 0.5px solid var(--border); gap: 12px; flex-shrink: 0; }
.page-title { font-size: 16px; font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.search-wrap { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 7px 12px; }
.search-wrap i { color: var(--text4); font-size: 15px; }
.search-wrap input { background: none; border: none; outline: none; color: var(--text); font-size: 13px; width: 200px; }
.search-wrap input::placeholder { color: var(--text4); }
.page-content { flex: 1; overflow-y: auto; padding: 20px; }

/* BUTTONS */
.btn-primary { background: var(--accent); border: none; border-radius: var(--radius); padding: 7px 14px; color: white; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-primary:hover { opacity: 0.85; }
.btn-secondary { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 7px 14px; color: var(--text2); font-size: 13px; cursor: pointer; }
.btn-secondary:hover { border-color: var(--border2); color: var(--text); }
.btn-danger { background: #e24b4a22; border: 0.5px solid #e24b4a44; border-radius: var(--radius); padding: 5px 12px; color: #f09595; font-size: 12px; cursor: pointer; }
.btn-icon { background: none; border: 0.5px solid var(--border); border-radius: var(--radius); padding: 5px 8px; color: var(--text3); cursor: pointer; font-size: 15px; }
.btn-icon:hover { border-color: var(--border2); color: var(--text); }

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.stat-card { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 11px; color: var(--text3); margin-bottom: 6px; }
.stat-val { font-size: 22px; font-weight: 500; }
.stat-sub { font-size: 11px; color: var(--text3); margin-top: 3px; }

/* TILES */
.tiles-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.tile { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 16px; cursor: pointer; position: relative; overflow: hidden; transition: border-color 0.15s, background 0.15s; }
.tile:hover { border-color: var(--border2); background: var(--bg3); }
.tile-accent { position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.tile-icon { font-size: 24px; margin-bottom: 10px; }
.tile-name { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 3px; }
.tile-desc { font-size: 11px; color: var(--text3); line-height: 1.4; }
.tile-count { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; }

/* SECTION HEADERS */
.section-hdr { font-size: 12px; color: var(--text3); font-weight: 500; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; letter-spacing: 0.04em; text-transform: uppercase; }
.section-hdr::after { content: ''; flex: 1; height: 0.5px; background: var(--border); }

/* TABLE */
.table-wrap { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.table-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 0.5px solid var(--border); }
.filter-select { background: var(--bg3); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 6px 10px; color: var(--text2); font-size: 12px; outline: none; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 10px 16px; text-align: left; font-size: 11px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 0.5px solid var(--border); white-space: nowrap; }
tbody tr { border-bottom: 0.5px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }
tbody td { padding: 10px 16px; font-size: 13px; color: var(--text); vertical-align: middle; }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* TAGS & BADGES */
.tag { display: inline-flex; align-items: center; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; white-space: nowrap; }
.tag-purple { background: #534ab722; color: var(--accent2); }
.tag-green  { background: #3b6d1122; color: var(--teal); }
.tag-amber  { background: #854f0b22; color: var(--amber); }
.tag-red    { background: #a32d2d22; color: #f09595; }
.tag-blue   { background: #185fa522; color: #85b7eb; }
.tag-gray   { background: #4a556822; color: var(--text2); }
.tag-pink   { background: #99355622; color: #ed93b1; }
.tag-teal   { background: #0f6e5622; color: var(--teal); }

.priority-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; flex-shrink: 0; }
.p-critical { background: #e24b4a; }
.p-high     { background: var(--amber); }
.p-medium   { background: var(--blue); }
.p-low      { background: var(--green); }

.status-badge { display: inline-flex; align-items: center; font-size: 11px; padding: 3px 10px; border-radius: 10px; font-weight: 500; }

/* MODAL */
.modal { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-box { position: relative; background: var(--bg2); border: 0.5px solid var(--border2); border-radius: var(--radius-lg); width: 540px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 0.5px solid var(--border); font-size: 15px; font-weight: 500; }
.modal-header button { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 18px; }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; color: var(--text3); }
.form-group input, .form-group select, .form-group textarea { background: var(--bg3); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 8px 12px; color: var(--text); font-size: 13px; outline: none; width: 100%; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 0.5px solid var(--border); }

/* TASK LIST */
.task-list { display: flex; flex-direction: column; gap: 6px; }
.task-item { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 10px 14px; display: flex; align-items: center; gap: 12px; transition: border-color 0.1s; }
.task-item:hover { border-color: var(--border2); }
.task-check { width: 17px; height: 17px; border-radius: 4px; border: 1.5px solid var(--border2); flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.task-check.done { background: var(--green); border-color: var(--green); }
.task-text { flex: 1; font-size: 13px; }
.task-text.done { color: var(--text4); text-decoration: line-through; }
.task-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-date { font-size: 11px; color: var(--text4); }

/* KIMAI */
.kimai-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.kimai-client-card { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.kimai-client-name { font-size: 14px; font-weight: 500; margin-bottom: 10px; }
.kimai-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); padding: 3px 0; }
.kimai-row span:last-child { color: var(--text); font-weight: 500; }
.kimai-total { border-top: 0.5px solid var(--border); margin-top: 8px; padding-top: 8px; }

/* COPY BUTTON for commands */
.command-box { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 10px 14px; font-family: monospace; font-size: 12px; color: #97c459; position: relative; }
.copy-btn { position: absolute; top: 6px; right: 6px; background: var(--bg3); border: 0.5px solid var(--border); border-radius: 4px; padding: 3px 8px; font-size: 11px; color: var(--text3); cursor: pointer; }
.copy-btn:hover { color: var(--text); }

/* TOAST */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--bg3); border: 0.5px solid var(--border2); border-radius: var(--radius); padding: 12px 18px; font-size: 13px; z-index: 9999; animation: slideIn 0.2s ease; }
.toast.success { border-color: var(--green); color: var(--teal); }
.toast.error { border-color: var(--red); color: #f09595; }
@keyframes slideIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* FINANCE */
.finance-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.progress-bar { background: var(--bg3); border-radius: 4px; height: 4px; margin-top: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--accent); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state i { font-size: 40px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
