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

  :root {
    --bg: #0a0b14;
    --bg-2: #0f1120;
    --surface: #14172a;
    --surface-2: #1c2038;
    --surface-3: #252a45;
    --border: rgba(255,255,255,0.06);
    --border-strong: rgba(255,255,255,0.12);
    --text: #e8eaf6;
    --text-dim: #9aa0c3;
    --muted: #6b7196;
    --primary: #7c5cff;
    --primary-2: #5b8cff;
    --primary-glow: #a78bfa;
    --success: #10d39a;
    --warning: #f5a623;
    --danger: #ff5577;
    --gradient: linear-gradient(135deg, #7c5cff 0%, #5b8cff 100%);
    --gradient-soft: linear-gradient(135deg, rgba(124,92,255,0.15), rgba(91,140,255,0.05));
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-lg: 0 30px 80px -20px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 40px rgba(124,92,255,0.25);
  }

  html, body { height: 100%; }
  body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
  }
  h1,h2,h3,h4 { font-weight: 600; letter-spacing: -0.02em; }
  .hidden { display: none !important; }
  .muted { color: var(--text-dim); font-size: 13px; }
  code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--primary-glow); }

  /* LOGIN */
  .login-screen {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    overflow: hidden;
  }
  .login-bg {
    position: absolute; inset: 0;
    background:
      radial-gradient(circle at 20% 20%, rgba(124,92,255,0.25), transparent 50%),
      radial-gradient(circle at 80% 60%, rgba(91,140,255,0.2), transparent 50%),
      radial-gradient(circle at 50% 100%, rgba(167,139,250,0.15), transparent 60%),
      var(--bg);
    z-index: -1;
  }
  .login-card {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(180deg, var(--surface), var(--bg-2));
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 36px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
  }
  .brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
  .brand h1 { font-size: 22px; }
  .brand p { color: var(--text-dim); font-size: 13px; }
  .brand-mark {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--gradient);
    display: grid; place-items: center;
    font-weight: 700; font-size: 20px;
    color: white;
    box-shadow: var(--shadow-glow);
  }

  label { display: block; font-size: 12px; color: var(--text-dim); margin: 14px 0 6px; font-weight: 500; }
  label:first-of-type { margin-top: 0; }

  input, select, textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
  }
  input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,92,255,0.15);
  }
  textarea { resize: vertical; }

  button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
  }
  .btn-primary {
    width: 100%;
    padding: 12px 18px;
    background: var(--gradient);
    color: white;
    margin-top: 18px;
    box-shadow: 0 8px 24px -8px rgba(124,92,255,0.6);
  }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px -8px rgba(124,92,255,0.8); }
  .btn-ghost {
    background: var(--surface-2);
    color: var(--text);
    padding: 10px 16px;
    border: 1px solid var(--border);
  }
  .btn-ghost:hover { background: var(--surface-3); border-color: var(--border-strong); }
  .btn-ghost.full { width: 100%; }
  .btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 8px; }
  .btn-success { background: rgba(16,211,154,0.15); color: var(--success); }
  .btn-success:hover { background: rgba(16,211,154,0.25); }
  .btn-danger { background: rgba(255,85,119,0.15); color: var(--danger); }
  .btn-danger:hover { background: rgba(255,85,119,0.25); }
  .btn-warning { background: rgba(245,166,35,0.15); color: var(--warning); }
  .btn-warning:hover { background: rgba(245,166,35,0.25); }

  .error-msg { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

  .default-creds { 
    margin-top: 20px; 
    padding: 14px; 
    background: var(--bg-2); 
    border-radius: 10px; 
    border: 1px dashed var(--border-strong); 
  }
  .cred-hint { display: flex; gap: 10px; align-items: flex-start; }
  .dot { 
    width: 8px; height: 8px; border-radius: 50%; 
    background: var(--success); margin-top: 6px; 
    box-shadow: 0 0 12px var(--success); 
  }
  .cred-hint strong { display: block; font-size: 13px; margin-bottom: 4px; }
  .cred-hint small { color: var(--text-dim); font-size: 12px; }

  /* APP */
  .app {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
  }
  .sidebar {
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
  .sidebar-brand span { font-weight: 600; font-size: 17px; }
  .nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
  .nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--text-dim); cursor: pointer;
    font-size: 14px; font-weight: 500;
    transition: all 0.15s;
    background: transparent; border: none; text-align: left; width: 100%;
  }
  .nav-item:hover { background: var(--surface); color: var(--text); }
  .nav-item.active {
    background: var(--gradient-soft);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(124,92,255,0.2);
  }
  .nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

  .sidebar-foot { display: flex; flex-direction: column; gap: 10px; }
  .user-pill {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; background: var(--surface); border-radius: 10px;
  }
  .avatar {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--gradient);
    display: grid; place-items: center;
    font-weight: 600; color: white;
    flex-shrink: 0;
  }
  .u-name { font-size: 13px; font-weight: 600; }
  .u-role { font-size: 11px; color: var(--text-dim); }

  .content { padding: 24px 32px; min-width: 0; }
  .topbar {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
  }
  .topbar h2 { font-size: 24px; }
  .top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

  /* STATS */
  .stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 20px; }
  .stat-grid.compact { grid-template-columns: repeat(3,1fr); }
  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    display: flex; align-items: center; gap: 12px;
  }
  .stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center; font-size: 18px;
    flex-shrink: 0;
  }
  .stat-num { font-size: 22px; font-weight: 700; }
  .stat-label { font-size: 12px; color: var(--text-dim); }

  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
  }
  .panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
  .panel-head h3 { font-size: 15px; }

  /* TASKS */
  .filters-bar {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
  }
  .tasks { display: flex; flex-direction: column; gap: 8px; }
  .task {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--muted);
    border-radius: 12px;
    padding: 14px 16px;
    transition: all 0.2s;
  }
  .task:hover { border-color: var(--border-strong); }
  .task.priority-high { border-left-color: var(--danger); }
  .task.priority-medium { border-left-color: var(--warning); }
  .task.priority-low { border-left-color: var(--success); }
  .task.status-done { opacity: 0.55; }
  .task.status-done .task-title { text-decoration: line-through; }
  .task.status-pending_approval { border-left-color: var(--warning); }
  .task.status-approved { border-left-color: var(--success); }
  .task.status-rejected { border-left-color: var(--danger); }

  .task-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
  .task-title { font-weight: 600; font-size: 14px; }
  .task-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; font-size: 12px; color: var(--text-dim); }
  .task-meta span { display: flex; align-items: center; gap: 4px; }
  .task-desc { margin-top: 8px; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
  .task-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

  .badge {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
  }
  .badge-new { background: rgba(124,92,255,0.15); color: var(--primary-glow); }
  .badge-in_progress { background: rgba(245,166,35,0.15); color: var(--warning); }
  .badge-pending_approval { background: rgba(255,85,119,0.15); color: var(--danger); }
  .badge-approved { background: rgba(16,211,154,0.15); color: var(--success); }
  .badge-rejected { background: rgba(255,85,119,0.15); color: var(--danger); }
  .badge-done { background: rgba(16,211,154,0.15); color: var(--success); }

  .empty { text-align: center; padding: 40px 20px; color: var(--text-dim); }
  .empty-icon { font-size: 32px; margin-bottom: 8px; opacity: 0.4; }

  /* WORKERS */
  .workers-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 12px; }
  .worker-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
  }
  .worker-card:hover { border-color: var(--border-strong); }
  .worker-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
  .worker-head .avatar { width: 40px; height: 40px; font-size: 15px; }
  .worker-name { font-weight: 600; font-size: 14px; }
  .worker-pos { font-size: 11px; color: var(--text-dim); }
  .worker-creds { background: var(--bg-2); border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-bottom: 10px; }
  .worker-creds div { display: flex; justify-content: space-between; padding: 2px 0; }
  .worker-creds span:first-child { color: var(--text-dim); }
  .worker-creds span:last-child { color: var(--text); }
  .worker-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; margin-bottom: 10px; }
  .worker-stats div { text-align: center; padding: 6px; background: var(--bg-2); border-radius: 6px; }
  .worker-stats b { display: block; font-size: 14px; }
  .worker-stats small { font-size: 9px; color: var(--text-dim); text-transform: uppercase; }
  .worker-actions { display: flex; gap: 6px; }
  .worker-actions button { flex: 1; }

  /* MODAL */
  .modal {
    position: fixed; inset: 0;
    background: rgba(10,11,20,0.75);
    backdrop-filter: blur(8px);
    display: grid; place-items: center;
    z-index: 100;
    padding: 20px;
  }
  .modal-card {
    width: 100%; max-width: 500px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
  .modal-head h3 { font-size: 16px; }
  .x { background: transparent; color: var(--text-dim); font-size: 22px; padding: 0; width: 30px; height: 30px; border-radius: 8px; }
  .x:hover { background: var(--surface-2); color: var(--text); }
  .modal-body { padding: 20px; }
  .modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
  .modal-foot button { width: auto; padding: 8px 18px; margin: 0; }

  .pwd-row { display: flex; gap: 8px; }
  .pwd-row input { flex: 1; }
  .pwd-row button { width: auto; padding: 0 14px; white-space: nowrap; }

  /* TOAST */
  .toast {
    position: fixed;
    bottom: 24px; right: 24px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--success);
    padding: 10px 16px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    transform: translateX(calc(100% + 30px));
    transition: transform 0.3s;
    z-index: 200;
    max-width: 320px;
  }
  .toast.show { transform: translateX(0); }
  .toast.error { border-left-color: var(--danger); }

  .workload { display: flex; flex-direction: column; gap: 10px; }
  .workload-row { display: flex; align-items: center; gap: 10px; }
  .workload-row .name { width: 100px; font-size: 13px; }
  .workload-row .bar { flex: 1; height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; }
  .workload-row .bar-fill { height: 100%; background: var(--gradient); border-radius: 3px; }
  .workload-row .count { font-size: 12px; color: var(--text-dim); width: 30px; text-align: right; }

  .fin-amount { font-weight: 700; font-size: 14px; }
  .fin-amount.income { color: var(--success); }
  .fin-amount.expense { color: var(--danger); }
  .task.type-income { border-left-color: var(--success); }
  .task.type-expense { border-left-color: var(--danger); }

  /* FILE UPLOAD */
  .file-upload-area {
    border: 2px dashed var(--border-strong);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-2);
  }
  .file-upload-area:hover { border-color: var(--primary); background: var(--surface); }
  .file-upload-area.dragover { border-color: var(--primary); background: var(--surface); }
  .file-upload-area .icon { font-size: 32px; display: block; margin-bottom: 8px; }
  .file-upload-area .text { color: var(--text-dim); font-size: 13px; }
  .file-list { margin-top: 10px; }
  .file-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 10px; background: var(--bg-2); border-radius: 6px;
    margin-bottom: 4px; font-size: 13px;
  }
  .file-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .file-item .size { color: var(--text-dim); font-size: 11px; }
  .file-item .remove { color: var(--danger); cursor: pointer; padding: 0 6px; }

  /* ZIP badge */
  .zip-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(124,92,255,0.15);
    color: var(--primary-glow);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
  }

  /* RESPONSIVE */
  @media (max-width: 768px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
      position: fixed; bottom: 0; left: 0; right: 0; top: auto;
      height: auto; flex-direction: row; padding: 8px;
      border-right: none; border-top: 1px solid var(--border);
      z-index: 50;
    }
    .sidebar-brand, .sidebar-foot { display: none; }
    .nav { flex-direction: row; justify-content: space-around; flex: 1; }
    .nav-item { flex-direction: column; gap: 2px; padding: 6px; font-size: 10px; }
    .nav-item .icon { font-size: 16px; }
    .content { padding: 14px 12px 80px; }
    .stat-grid { grid-template-columns: repeat(2,1fr); }
    .stat-grid.compact { grid-template-columns: repeat(3,1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .filters-bar { grid-template-columns: 1fr 1fr; }
    .topbar h2 { font-size: 20px; }
    .login-card { padding: 24px; }
  }

  body.theme-light {
    --bg: #f4f5fb;
    --bg-2: #ffffff;
    --surface: #ffffff;
    --surface-2: #eef0fa;
    --surface-3: #e3e6f5;
    --border: rgba(20,20,40,0.08);
    --border-strong: rgba(20,20,40,0.14);
    --text: #171a2e;
    --text-dim: #5b607e;
    --muted: #8a8fb0;
    --shadow-lg: 0 30px 80px -20px rgba(40,40,80,0.18);
  }
  body.theme-light .login-bg {
    background:
      radial-gradient(circle at 20% 20%, rgba(124,92,255,0.14), transparent 50%),
      radial-gradient(circle at 80% 60%, rgba(91,140,255,0.12), transparent 50%),
      radial-gradient(circle at 50% 100%, rgba(167,139,250,0.10), transparent 60%),
      var(--bg);
  }
  