/* ════════════════════════════════════════════════════════
   CSS ПЕРЕМЕННЫЕ
════════════════════════════════════════════════════════ */
:root {
      --bg-primary:     #FFFFFF;
      --bg-secondary:   #F3F4F6;
      --bg-tertiary:    #E9ECF0;
      --text-primary:   #111827;
      --text-secondary: #6B7280;
      --text-muted:     #9CA3AF;
      --accent:         #1E3A5F;
      --accent-dark:    #152b47;
      --accent-light:   #2563EB;
      --accent-hover:   #1D4ED8;
      --success:        #10B981;
      --warning:        #F59E0B;
      --danger:         #EF4444;
      --info:           #3B82F6;
      --border:         #E5E7EB;
      --border-focus:   #2563EB;
      --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
      --shadow-md:  0 4px 16px rgba(0,0,0,.10);
      --shadow-lg:  0 8px 32px rgba(0,0,0,.15);
      --radius-sm:  4px;
      --radius-md:  8px;
      --radius-lg:  12px;
      --sidebar-w:  240px;
      --header-h:   60px;
      --tr:         200ms ease;
    }
    [data-theme="dark"] {
      --bg-primary:     #1F2937;
      --bg-secondary:   #111827;
      --bg-tertiary:    #374151;
      --text-primary:   #F9FAFB;
      --text-secondary: #D1D5DB;
      --text-muted:     #9CA3AF;
      --border:         #374151;
      --shadow-sm:  0 1px 3px rgba(0,0,0,.30);
      --shadow-md:  0 4px 16px rgba(0,0,0,.40);
      --shadow-lg:  0 8px 32px rgba(0,0,0,.50);
      color-scheme: dark;
    }

    /* ════════════════════════════════════════════════════════
       СБРОС
    ════════════════════════════════════════════════════════ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html { font-size: 14px; }
    body {
      font-family: 'Inter', system-ui, -apple-system, sans-serif;
      background: var(--bg-secondary);
      color: var(--text-primary);
      line-height: 1.5;
      transition: background var(--tr), color var(--tr);
    }
    a { color: var(--accent-light); text-decoration: none; }
    a:hover { text-decoration: underline; }
    ::-webkit-scrollbar { width: 6px; height: 6px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
    ::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

    /* ════════════════════════════════════════════════════════
       ЛЕЙАУТ
    ════════════════════════════════════════════════════════ */
    #app {
      display: flex;
      min-height: 100vh;
    }
    #main-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      background: var(--bg-secondary);
    }

    /* ════════════════════════════════════════════════════════
       САЙДБАР
    ════════════════════════════════════════════════════════ */
    #sidebar {
      width: var(--sidebar-w);
      flex-shrink: 0;
      background: linear-gradient(175deg, #1c3d72 0%, #0c1e40 100%);
      color: #fff;
      display: flex;
      flex-direction: column;
      position: sticky;
      top: 0;
      height: 100vh;
      overflow: hidden;
      z-index: 200;
      transition: transform var(--tr);
      box-shadow: 2px 0 20px rgba(0,0,0,.2);
    }
    .sidebar-logo {
      padding: 14px 16px 12px;
      flex-shrink: 0;
      border-bottom: 1px solid rgba(255,255,255,.06);
      margin-bottom: 6px;
    }
    .sidebar-logos {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .sidebar-logo-img {
      display: block;
      height: auto;
    }
    /* Both logos: white silhouette on dark sidebar */
    .sidebar-logo-img--aunig {
      max-width: 148px;
      filter: brightness(0) invert(1);
      opacity: .85;
    }
    .sidebar-logo-img--aihub {
      max-width: 96px;
      filter: brightness(0) invert(1);
      opacity: .82;
    }
    .sidebar-logos-divider {
      height: 1px;
      background: rgba(255,255,255,.08);
    }
    .sidebar-logo-text .title    { font-size: 16px; font-weight: 700; letter-spacing: .4px; }
    .sidebar-logo-text .subtitle { font-size: 10px; opacity: .55; line-height: 1.3; }
    /* User card — clickable, links to profile */
    .sidebar-user {
      margin: 0 10px 6px;
      padding: 10px 12px;
      background: rgba(255,255,255,.07);
      border: 1px solid rgba(255,255,255,.08);
      border-radius: var(--radius-md);
      display: flex;
      align-items: center;
      gap: 10px;
      flex-shrink: 0;
      text-decoration: none;
      color: inherit;
      cursor: pointer;
      transition: background var(--tr);
    }
    .sidebar-user:hover { background: rgba(255,255,255,.12); text-decoration: none; }
    .sidebar-user-info  { min-width: 0; }
    .sidebar-user-avatar {
      width: 34px; height: 34px; border-radius: 10px;
      display: flex; align-items: center; justify-content: center;
      font-weight: 700; font-size: 13px; color: #fff;
      flex-shrink: 0;
      box-shadow: 0 2px 8px rgba(0,0,0,.3);
    }
    .sidebar-user-info .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sidebar-user-info .dept { font-size: 11px; opacity: .6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sidebar-user-info .role { font-size: 10px; opacity: .4; }
    /* Nav list — internal scroll, no visible scrollbar */
    #sidebar-nav {
      list-style: none;
      padding: 4px 0;
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      scrollbar-width: none;
    }
    #sidebar-nav::-webkit-scrollbar { display: none; }
    #sidebar-nav li { margin: 1px 8px; }
    .nav-item {
      display: flex; align-items: center; gap: 10px;
      padding: 9px 12px; border-radius: var(--radius-md);
      color: rgba(255,255,255,.58); font-size: 13px; font-weight: 500;
      cursor: pointer;
      transition: background var(--tr), color var(--tr), box-shadow var(--tr);
      text-decoration: none;
    }
    .nav-item:hover  { background: rgba(255,255,255,.08); color: rgba(255,255,255,.92); text-decoration: none; }
    .nav-item.active {
      background: rgba(255,255,255,.11);
      color: #fff;
      box-shadow: inset 3px 0 0 0 #60a5fa;
    }
    .nav-item i      { width: 16px; text-align: center; flex-shrink: 0; font-size: 14px; }
    .nav-item span   { flex: 1; }
    .nav-badge {
      background: #EF4444; color: #fff;
      font-size: 10px; font-weight: 700;
      min-width: 18px; height: 18px; border-radius: 9px;
      display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
    }
    .sidebar-section-title {
      padding: 12px 20px 4px;
      font-size: 9px; text-transform: uppercase; letter-spacing: 1px;
      color: rgba(255,255,255,.28); font-weight: 600;
      display: flex; align-items: center; gap: 8px;
    }
    .sidebar-section-title::after {
      content: '';
      flex: 1;
      height: 1px;
      background: rgba(255,255,255,.07);
    }
    .saved-view-item .view-del {
      margin-left: auto; background: none; border: none;
      color: rgba(255,255,255,.5); cursor: pointer; font-size: 11px; display: none;
    }
    .saved-view-item:hover .view-del { display: inline-flex; }
    #sidebar-backdrop {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,.5); z-index: 199;
    }
    #sidebar-backdrop.show { display: block; }

    /* ════════════════════════════════════════════════════════
       ШАПКА
    ════════════════════════════════════════════════════════ */
    #header {
      height: var(--header-h);
      background: var(--bg-primary);
      border-bottom: 1px solid var(--border);
      display: flex; align-items: center; gap: 12px; padding: 0 20px;
      position: sticky; top: 0; z-index: 100;
      box-shadow: var(--shadow-sm); flex-shrink: 0;
    }
    #burger-menu {
      display: none; background: none; border: none; cursor: pointer;
      font-size: 18px; color: var(--text-secondary); padding: 4px;
    }
    .header-title { font-size: 15px; font-weight: 700; color: var(--accent); white-space: nowrap; }
    .header-search { flex: 1; max-width: 400px; position: relative; }
    .header-search input {
      width: 100%; padding: 7px 36px; border: 1px solid var(--border);
      border-radius: 20px; background: var(--bg-secondary);
      color: var(--text-primary); font-size: 13px; outline: none;
      transition: border-color var(--tr), box-shadow var(--tr);
    }
    .header-search input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
    .header-search i   { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; pointer-events: none; }
    .header-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--text-muted); background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 3px; padding: 1px 4px; }
    .header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
    .header-btn {
      padding: 6px 9px; border-radius: 999px;
      background: transparent; border: none;
      color: var(--text-secondary); font-size: 16px;
      cursor: pointer; position: relative;
      transition: background var(--tr);
    }
    .header-btn:hover { background: rgba(148,163,184,.12); }
    .lang-btn {
      background: none; border: 1px solid var(--border); cursor: pointer;
      padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 600;
      color: var(--text-secondary); transition: all var(--tr);
    }
    .lang-btn:hover { border-color: var(--accent-light); color: var(--accent-light); }
    .notif-badge {
      position: absolute; top: 2px; right: 2px;
      background: #EF4444; color: #fff;
      font-size: 9px; font-weight: 700;
      min-width: 16px; height: 16px; border-radius: 8px;
      display: none; align-items: center; justify-content: center; padding: 0 3px;
    }
    .notif-badge.show { display: flex; }
    .header-avatar {
      width: 34px; height: 34px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-weight: 700; font-size: 13px; color: #fff; cursor: pointer;
    }
    /* Dropdown */
    .dropdown-wrap { position: relative; }
    #user-dropdown, #notif-dropdown {
      display: none; position: absolute; right: 0; top: calc(100% + 8px);
      background: var(--bg-primary); border: 1px solid var(--border);
      border-radius: var(--radius-md); box-shadow: var(--shadow-md); z-index: 300;
    }
    #user-dropdown { min-width: 180px; overflow: hidden; }
    #notif-dropdown { width: 340px; }
    #user-dropdown.show, #notif-dropdown.show { display: block; }
    .dropdown-item {
      display: flex; align-items: center; gap: 8px;
      padding: 10px 14px; font-size: 13px; cursor: pointer;
      color: var(--text-primary); transition: background var(--tr);
    }
    .dropdown-item:hover { background: var(--bg-secondary); }
    .dropdown-item i { width: 14px; color: var(--text-secondary); }
    .dropdown-item.danger { color: var(--danger); }
    .dropdown-item.danger i { color: var(--danger); }
    .dropdown-divider { height: 1px; background: var(--border); }
    /* Notifications dropdown */
    .notif-dropdown-wrap { position: relative; }
    .notif-dropdown-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 12px 14px; border-bottom: 1px solid var(--border);
    }
    .notif-dropdown-header span { font-size: 13px; font-weight: 600; }
    .notif-list { max-height: 360px; overflow-y: auto; }
    .notif-item {
      display: flex; gap: 10px; padding: 12px 14px;
      border-bottom: 1px solid var(--border); cursor: pointer;
      transition: background var(--tr);
    }
    .notif-item:hover { background: var(--bg-secondary); }
    .notif-item.unread { background: #EFF6FF; }
    [data-theme="dark"] .notif-item.unread { background: rgba(30,58,95,.2); }
    .notif-item-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
    .notif-item-icon.success { background: #D1FAE5; color: var(--success); }
    .notif-item-icon.warning { background: #FEF3C7; color: var(--warning); }
    .notif-item-icon.danger  { background: #FEE2E2; color: var(--danger); }
    .notif-item-icon.info    { background: #DBEAFE; color: var(--info); }
    .notif-item-body { flex: 1; min-width: 0; }
    .notif-item-title { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
    .notif-item-msg   { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .notif-item-time  { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
    .notif-unread-dot { width: 7px; height: 7px; background: var(--accent-light); border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
    .notif-page-item {
      display: flex; gap: 12px; padding: 14px;
      background: var(--bg-primary); border: 1px solid var(--border);
      border-radius: var(--radius-md); margin-bottom: 8px; cursor: pointer;
      transition: box-shadow var(--tr);
    }
    .notif-page-item:hover { box-shadow: var(--shadow-md); }
    .notif-page-item.unread { border-left: 3px solid var(--accent-light); }

    /* ════════════════════════════════════════════════════════
       ТРЕКЕР РАБОЧЕГО ВРЕМЕНИ (УРВ)
    ════════════════════════════════════════════════════════ */
    .workday-tracker-bar {
      display: flex; align-items: center; gap: 10px;
      padding: 0 20px; height: 42px;
      background: var(--bg-primary); border-bottom: 1px solid var(--border);
      position: sticky; top: var(--header-h); z-index: 90; flex-shrink: 0;
    }
    .wt-offline { border-left: 3px solid var(--text-muted); }
    .wt-working { border-left: 3px solid var(--success); background: rgba(16,185,129,.04); }
    .wt-paused  { border-left: 3px solid var(--warning); background: rgba(245,158,11,.04); }
    .wt-label {
      display: flex; align-items: center; gap: 5px;
      font-size: 11px; font-weight: 700; text-transform: uppercase;
      letter-spacing: .6px; color: var(--text-muted); flex-shrink: 0;
    }
    .wt-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .wt-dot-offline { background: var(--text-muted); }
    .wt-dot-working { background: var(--success); animation: wt-pulse 2s infinite; }
    .wt-dot-paused  { background: var(--warning); }
    @keyframes wt-pulse {
      0%,100% { box-shadow: 0 0 0 3px rgba(16,185,129,.25); }
      50%      { box-shadow: 0 0 0 6px rgba(16,185,129,.10); }
    }
    .wt-status-text { font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
    .wt-timer {
      font-family: 'SF Mono','Fira Code',monospace;
      font-size: 15px; font-weight: 700; letter-spacing: 1px;
      color: var(--text-primary); min-width: 72px; flex-shrink: 0;
    }
    .wt-sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; flex-shrink: 0; }
    .wt-btn {
      display: inline-flex; align-items: center; gap: 5px;
      padding: 4px 12px; border-radius: var(--radius-sm);
      border: 1px solid transparent; font-size: 12px; font-weight: 600;
      cursor: pointer; transition: background var(--tr); flex-shrink: 0;
    }
    .wt-btn:active { transform: scale(.97); }
    .wt-btn-start { background: var(--success); color: #fff; border-color: var(--success); }
    .wt-btn-start:hover { background: #059669; }
    .wt-btn-pause { background: transparent; border-color: var(--warning); color: var(--warning); }
    .wt-btn-pause:hover { background: rgba(245,158,11,.1); }
    .wt-btn-end   { background: transparent; border-color: var(--danger); color: var(--danger); }
    .wt-btn-end:hover { background: rgba(239,68,68,.1); }

    /* ════════════════════════════════════════════════════════
       СТРАНИЦЫ
    ════════════════════════════════════════════════════════ */
    .page-section { display: none; padding: 24px; flex: 1; }
    .page-section.active { display: block; }
    .page-header {
      display: flex; align-items: center; gap: 12px;
      margin-bottom: 20px; flex-wrap: wrap;
    }
    .page-header h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); flex: 1; }
    .page-header h1 i { color: var(--accent-light); margin-right: 6px; }

    /* ════════════════════════════════════════════════════════
       КНОПКИ
    ════════════════════════════════════════════════════════ */
    .btn {
      display: inline-flex; align-items: center; justify-content: center; gap: 6px;
      padding: 7px 12px; border-radius: 8px; border: 1px solid transparent;
      font-size: 14px; font-family: inherit; cursor: pointer;
      background: transparent; color: var(--text-primary);
      white-space: nowrap; text-decoration: none;
      transition: background .15s, transform .1s, box-shadow .15s, border-color .15s;
    }
    .btn:disabled { opacity: .5; cursor: not-allowed; }
    .btn-primary {
      background: linear-gradient(180deg,#3b82f6 0%,#2563eb 100%);
      color: #fff; border: 1px solid #1d4ed8; font-weight: 600;
      box-shadow:
        0 1px 0 rgba(255,255,255,.14) inset,
        0 4px 12px rgba(37,99,235,.30),
        0 1px 3px rgba(0,0,0,.10);
    }
    .btn-primary:hover:not(:disabled) {
      background: linear-gradient(180deg,#60a5fa 0%,#3b82f6 100%);
      border-color: #2563eb; transform: translateY(-1px);
      box-shadow:
        0 1px 0 rgba(255,255,255,.14) inset,
        0 6px 16px rgba(37,99,235,.40),
        0 2px 5px rgba(0,0,0,.12);
    }
    .btn-primary:active:not(:disabled) { transform: translateY(0); box-shadow: 0 1px 3px rgba(37,99,235,.20); }
    .btn-success {
      background: linear-gradient(180deg,#10b981 0%,#059669 100%);
      color: #fff; border: 1px solid #047857; font-weight: 600;
      box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 4px 12px rgba(5,150,105,.28), 0 1px 3px rgba(0,0,0,.08);
    }
    .btn-success:hover:not(:disabled) {
      background: linear-gradient(180deg,#34d399 0%,#10b981 100%);
      transform: translateY(-1px);
      box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 6px 16px rgba(5,150,105,.38), 0 2px 4px rgba(0,0,0,.1);
    }
    .btn-danger {
      background: linear-gradient(180deg,#f87171 0%,#dc2626 100%);
      color: #fff; border: 1px solid #b91c1c; font-weight: 600;
      box-shadow: 0 1px 0 rgba(255,255,255,.10) inset, 0 4px 12px rgba(220,38,38,.26), 0 1px 3px rgba(0,0,0,.08);
    }
    .btn-danger:hover:not(:disabled) {
      background: linear-gradient(180deg,#fca5a5 0%,#ef4444 100%);
      transform: translateY(-1px);
      box-shadow: 0 1px 0 rgba(255,255,255,.10) inset, 0 6px 16px rgba(220,38,38,.36), 0 2px 4px rgba(0,0,0,.1);
    }
    .btn-warning { background: var(--warning); color: #fff; }
    .btn-outline { background: transparent; border-color: rgba(15,23,42,.2); }
    .btn-outline:hover:not(:disabled) { background: rgba(15,23,42,.04); }
    .btn-ghost   { background: transparent; border-color: transparent; color: var(--text-muted); }
    .btn-ghost:hover { background: rgba(148,163,184,.12); }
    .btn-sm   { padding: 5px 10px; font-size: 12px; }
    .btn-lg   { padding: 11px 22px; font-size: 15px; }
    .btn-icon { padding: 6px; width: 32px; height: 32px; }
    .btn-group { display: flex; gap: 4px; }

    /* Neumorphic task action buttons */
    .btn-neumorphic {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 8px 16px; border-radius: 10px;
      font-size: 13px; font-weight: 600; cursor: pointer; border: none;
      transition: all 150ms ease;
      background: linear-gradient(145deg, #e6e9ef, #ffffff);
      box-shadow: 4px 4px 8px rgba(0,0,0,.1), -4px -4px 8px rgba(255,255,255,.9), inset 0 1px 0 rgba(255,255,255,.6);
    }
    .btn-neumorphic:hover    { transform: translateY(-1px); }
    .btn-neumorphic:active   { transform: translateY(1px); box-shadow: inset 3px 3px 6px rgba(0,0,0,.12), inset -2px -2px 4px rgba(255,255,255,.5); }
    .btn-neumorphic.btn-take    { background: linear-gradient(145deg,#dbeafe,#eff6ff); color: #1D4ED8; }
    .btn-neumorphic.btn-review  { background: linear-gradient(145deg,#fef3c7,#fffbeb); color: #92400E; }
    .btn-neumorphic.btn-approve { background: linear-gradient(145deg,#d1fae5,#ecfdf5); color: #065F46; }
    .btn-neumorphic.btn-return  { background: linear-gradient(145deg,#fee2e2,#fef2f2); color: #991B1B; }
    [data-theme="dark"] .btn-neumorphic {
      background: linear-gradient(145deg,#374151,#1F2937);
      box-shadow: 4px 4px 8px rgba(0,0,0,.4), -4px -4px 8px rgba(75,85,99,.3), inset 0 1px 0 rgba(255,255,255,.06);
      color: var(--text-primary);
    }
    [data-theme="dark"] .btn-neumorphic.btn-take    { background: linear-gradient(145deg,#1E3A5F,#1a2e4a); color: #93C5FD; }
    [data-theme="dark"] .btn-neumorphic.btn-review  { background: linear-gradient(145deg,#78350F,#5c2a0c); color: #FCD34D; }
    [data-theme="dark"] .btn-neumorphic.btn-approve { background: linear-gradient(145deg,#064E3B,#053d2f); color: #6EE7B7; }
    [data-theme="dark"] .btn-neumorphic.btn-return  { background: linear-gradient(145deg,#7F1D1D,#601616); color: #FCA5A5; }

    /* ════════════════════════════════════════════════════════
       БЕЙДЖИ
    ════════════════════════════════════════════════════════ */
    .badge {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 2px 8px; border-radius: 12px;
      font-size: 11px; font-weight: 600;
      background: var(--bg-tertiary); color: var(--text-secondary); white-space: nowrap;
    }
    .badge-success { background: #D1FAE5; color: #065F46; }
    .badge-danger  { background: #FEE2E2; color: #991B1B; }
    .badge-warning { background: #FEF3C7; color: #92400E; }
    .badge-info    { background: #DBEAFE; color: #1E40AF; }
    [data-theme="dark"] .badge-success { background: #064E3B; color: #6EE7B7; }
    [data-theme="dark"] .badge-danger  { background: #7F1D1D; color: #FCA5A5; }
    [data-theme="dark"] .badge-warning { background: #78350F; color: #FCD34D; }
    [data-theme="dark"] .badge-info    { background: #1E3A5F; color: #93C5FD; }

    /* Статус задачи */
    .status-badge {
      display: inline-flex; align-items: center; padding: 2px 8px;
      border-radius: 12px; font-size: 11px; font-weight: 600;
    }
    .status-badge.status-new          { background: #EFF6FF; color: #1D4ED8; }
    .status-badge.status-in_progress  { background: #FEF3C7; color: #92400E; }
    .status-badge.status-on_review    { background: #F3E8FF; color: #6B21A8; }
    .status-badge.status-approved     { background: #D1FAE5; color: #065F46; }
    .status-badge.status-done         { background: #D1FAE5; color: #065F46; }
    .status-badge.status-rejected     { background: #FEE2E2; color: #991B1B; }
    .status-badge.status-rejected_fraud { background: #1a0000; color: #FF5252; font-weight: 700; }
    .status-badge.status-archived     { background: var(--bg-tertiary); color: var(--text-muted); }
    [data-theme="dark"] .status-badge.status-new          { background: #1E3A5F; color: #93C5FD; }
    [data-theme="dark"] .status-badge.status-in_progress  { background: #78350F; color: #FCD34D; }
    [data-theme="dark"] .status-badge.status-on_review    { background: #3B0764; color: #D8B4FE; }
    [data-theme="dark"] .status-badge.status-approved,
    [data-theme="dark"] .status-badge.status-done         { background: #064E3B; color: #6EE7B7; }
    [data-theme="dark"] .status-badge.status-rejected     { background: #7F1D1D; color: #FCA5A5; }

    /* Приоритет */
    .priority-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
    .priority-critical { background: #EF4444; box-shadow: 0 0 0 2px rgba(239,68,68,.25); }
    .priority-high     { background: #F59E0B; }
    .priority-normal   { background: #3B82F6; }
    .priority-low      { background: #9CA3AF; }

    /* Дедлайн */
    .deadline-badge { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; }
    .dl-badge       { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; }
    .dl-ok      { background: #D1FAE5; color: #065F46; }
    .dl-soon    { background: #FEF9C3; color: #713F12; }
    .dl-warning { background: #FEF3C7; color: #92400E; }
    .dl-overdue { background: #FEE2E2; color: #991B1B; }
    .dl-none    { background: var(--bg-tertiary); color: var(--text-muted); }
    [data-theme="dark"] .dl-ok      { background: #064E3B; color: #6EE7B7; }
    [data-theme="dark"] .dl-warning { background: #78350F; color: #FCD34D; }
    [data-theme="dark"] .dl-overdue { background: #7F1D1D; color: #FCA5A5; }

    /* ════════════════════════════════════════════════════════
       ФОРМЫ
    ════════════════════════════════════════════════════════ */
    .form-group { margin-bottom: 16px; }
    .form-group label {
      display: block; font-size: 13px; font-weight: 500;
      color: var(--text-secondary); margin-bottom: 6px;
    }
    .form-group label .req { color: var(--danger); margin-left: 2px; }
    input[type="text"], input[type="password"], input[type="email"],
    input[type="date"], input[type="datetime-local"], input[type="number"],
    select, textarea {
      width: 100%; padding: 8px 12px;
      border: 1px solid var(--border); border-radius: var(--radius-sm);
      background: var(--bg-primary); color: var(--text-primary);
      font-size: 13px; font-family: inherit; outline: none; appearance: none;
      transition: border-color var(--tr), box-shadow var(--tr);
    }
    input:focus, select:focus, textarea:focus {
      border-color: var(--border-focus);
      box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    }
    textarea { resize: vertical; min-height: 80px; }
    select {
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236B7280'/%3E%3C/svg%3E");
      background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
    }
    .form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
    .tags-input-wrap {
      display: flex; flex-wrap: wrap; gap: 6px; padding: 6px;
      border: 1px solid var(--border); border-radius: var(--radius-sm);
      min-height: 40px; background: var(--bg-primary); cursor: text;
    }
    .tags-input-wrap input { border: none; outline: none; padding: 2px 4px; background: none; flex: 1; min-width: 80px; font-size: 13px; }
    .tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; background: #DBEAFE; color: #1E40AF; border-radius: 12px; font-size: 11px; font-weight: 500; }
    .tag .tag-del { cursor: pointer; opacity: .6; font-size: 10px; }
    .tag .tag-del:hover { opacity: 1; }
    [data-theme="dark"] .tag { background: #1E3A5F; color: #93C5FD; }

    /* Multi-select */
    .multi-select-wrap { position: relative; }
    .multi-select-tags { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 38px; background: var(--bg-primary); cursor: pointer; }
    .multi-select-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); z-index: 50; max-height: 200px; overflow-y: auto; }
    .multi-select-dropdown.open { display: block; }
    .multi-select-option { padding: 8px 12px; font-size: 13px; cursor: pointer; }
    .multi-select-option:hover { background: var(--bg-secondary); }
    .multi-select-option.selected { background: #EFF6FF; color: var(--accent-light); }

    /* ════════════════════════════════════════════════════════
       КАРТОЧКИ / ТАБЛИЦА
    ════════════════════════════════════════════════════════ */
    .card {
      background: var(--bg-primary); border-radius: var(--radius-md);
      border: 1px solid var(--border); box-shadow: var(--shadow-sm); padding: 16px;
    }
    .table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
    .data-table { width: 100%; border-collapse: collapse; }
    .data-table th {
      background: var(--bg-secondary); padding: 10px 14px; text-align: left;
      font-size: 12px; font-weight: 600; color: var(--text-secondary);
      text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border);
    }
    .data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
    .data-table tr:last-child td { border-bottom: none; }
    .data-table tbody tr:hover { background: var(--bg-secondary); }

    /* ════════════════════════════════════════════════════════
       ЗАДАЧИ — СПИСОК
    ════════════════════════════════════════════════════════ */
    .tasks-list { display: flex; flex-direction: column; gap: 4px; }
    .task-row {
      background: var(--bg-primary); border-radius: var(--radius-md);
      padding: 10px 14px; display: flex; align-items: center; justify-content: space-between;
      cursor: pointer; border: 1px solid var(--border); border-left-width: 3px;
      transition: box-shadow var(--tr), transform var(--tr);
    }
    .task-row:hover { box-shadow: var(--shadow-md); transform: translateX(2px); }
    .task-row.dl-ok      { border-left-color: var(--success); }
    .task-row.dl-soon    { border-left-color: var(--warning); }
    .task-row.dl-warning { border-left-color: var(--warning); }
    .task-row.dl-overdue { border-left-color: var(--danger); }
    .task-row.dl-none    { border-left-color: var(--border); }
    .task-row-left  { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0; }
    .task-row-info  { flex: 1; min-width: 0; }
    .task-row-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
    .task-row-meta  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
    .task-row-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: 12px; }
    .checklist-badge, .comment-badge { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 3px; }
    .user-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); }

    /* Task action row buttons */
    .task-action-btn {
      padding: 5px 10px; border-radius: 8px; border: none;
      font-size: 11px; font-weight: 600; cursor: pointer;
      transition: all 150ms ease;
      background: linear-gradient(145deg,#e6e9ef,#ffffff);
      box-shadow: 2px 2px 4px rgba(0,0,0,.08), -2px -2px 4px rgba(255,255,255,.8), inset 0 1px 0 rgba(255,255,255,.5);
    }
    .task-action-btn.btn-take    { color: #1D4ED8; background: linear-gradient(145deg,#dbeafe,#eff6ff); }
    .task-action-btn.btn-review  { color: #92400E; background: linear-gradient(145deg,#fef3c7,#fffbeb); }
    .task-action-btn.btn-approve { color: #065F46; background: linear-gradient(145deg,#d1fae5,#ecfdf5); }
    .task-action-btn.btn-return  { color: #991B1B; background: linear-gradient(145deg,#fee2e2,#fef2f2); }
    [data-theme="dark"] .task-action-btn { background: linear-gradient(145deg,#374151,#1F2937); box-shadow: 2px 2px 4px rgba(0,0,0,.3), -2px -2px 4px rgba(75,85,99,.2), inset 0 1px 0 rgba(255,255,255,.05); }
    [data-theme="dark"] .task-action-btn.btn-take    { color: #93C5FD; background: linear-gradient(145deg,#1E3A5F,#1a2e4a); }
    [data-theme="dark"] .task-action-btn.btn-review  { color: #FCD34D; background: linear-gradient(145deg,#78350F,#5c2a0c); }
    [data-theme="dark"] .task-action-btn.btn-approve { color: #6EE7B7; background: linear-gradient(145deg,#064E3B,#053d2f); }
    [data-theme="dark"] .task-action-btn.btn-return  { color: #FCA5A5; background: linear-gradient(145deg,#7F1D1D,#601616); }

    /* ════════════════════════════════════════════════════════
       ПРОГРЕСС / МИНИ-АВАТАР
    ════════════════════════════════════════════════════════ */
    .progress-bar-wrap { height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; }
    .progress-bar { height: 100%; background: var(--accent-light); border-radius: 3px; transition: width .3s; }
    .progress-bar.green { background: var(--success); }
    .progress-bar.red   { background: var(--danger); }
    .mini-avatar {
      width: 26px; height: 26px; border-radius: 50%;
      display: inline-flex; align-items: center; justify-content: center;
      font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
    }

    /* ════════════════════════════════════════════════════════
       СОТРУДНИКИ / ПРОЕКТЫ
    ════════════════════════════════════════════════════════ */
    .employees-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 12px; }
    .employee-card  { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-sm); }
    .emp-avatar     { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: #fff; flex-shrink: 0; }
    .emp-info       { flex: 1; min-width: 0; }
    .emp-name       { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .emp-dept       { font-size: 11px; color: var(--text-muted); margin: 2px 0 4px; }
    .projects-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 16px; }
    .project-card   { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow var(--tr); }
    .project-card:hover { box-shadow: var(--shadow-md); }

    /* ════════════════════════════════════════════════════════
       НАСТРОЙКИ
    ════════════════════════════════════════════════════════ */
    .settings-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
    .settings-tab {
      background: none; border: none; padding: 10px 16px; cursor: pointer;
      font-size: 13px; font-weight: 500; color: var(--text-secondary);
      border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--tr);
    }
    .settings-tab:hover { color: var(--text-primary); }
    .settings-tab.active { color: var(--accent-light); border-bottom-color: var(--accent-light); }
    .settings-section { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; }
    .settings-section h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

    /* ════════════════════════════════════════════════════════
       КАРМА / ГЕЙМИФИКАЦИЯ
    ════════════════════════════════════════════════════════ */
    .karma-badges-wrap { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
    .karma-badge, .streak-badge {
      display: inline-flex; align-items: center; gap: 3px;
      padding: 2px 8px; border-radius: 20px;
      font-size: 12px; font-weight: 700; cursor: default; white-space: nowrap;
      transition: transform 150ms;
    }
    .karma-badge:hover, .streak-badge:hover { transform: scale(1.08); }
    .karma-badge  { background: rgba(245,158,11,.15); color: #92400E; border: 1px solid rgba(245,158,11,.35); }
    .streak-badge { background: rgba(239,68,68,.12);  color: #991B1B; border: 1px solid rgba(239,68,68,.3); }
    [data-theme="dark"] .karma-badge  { background: rgba(245,158,11,.18); color: #FCD34D; border-color: rgba(245,158,11,.4); }
    [data-theme="dark"] .streak-badge { background: rgba(239,68,68,.18);  color: #FCA5A5; border-color: rgba(239,68,68,.4); }

    /* ════════════════════════════════════════════════════════
       ПУСТЫЕ СОСТОЯНИЯ
    ════════════════════════════════════════════════════════ */
    .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; text-align: center; color: var(--text-muted); gap: 12px; }
    .empty-state i { font-size: 48px; opacity: .35; }
    .empty-state p { font-size: 15px; }
    .access-denied { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 20px; text-align: center; color: var(--text-muted); gap: 12px; }
    .access-denied i  { font-size: 64px; opacity: .3; }
    .access-denied h2 { font-size: 20px; color: var(--text-secondary); }

    /* ════════════════════════════════════════════════════════
       FAB
    ════════════════════════════════════════════════════════ */
    #fab-create {
      position: fixed; bottom: 28px; right: 28px;
      width: 52px; height: 52px; border-radius: 50%;
      background: var(--accent-light); color: #fff; border: none;
      font-size: 22px; cursor: pointer; box-shadow: var(--shadow-lg);
      display: flex; align-items: center; justify-content: center;
      transition: transform var(--tr), box-shadow var(--tr); z-index: 150;
    }
    #fab-create:hover { transform: scale(1.08); box-shadow: 0 12px 40px rgba(37,99,235,.45); }

    /* ════════════════════════════════════════════════════════
       ТОСТЫ
    ════════════════════════════════════════════════════════ */
    #toast-container {
      position: fixed; bottom: 24px; left: 24px; z-index: 9999;
      display: flex; flex-direction: column; gap: 8px; max-width: 340px;
      pointer-events: none;
    }
    .toast {
      display: flex; align-items: center; gap: 10px;
      padding: 12px 16px; border-radius: var(--radius-md);
      background: var(--bg-primary); border: 1px solid var(--border);
      box-shadow: var(--shadow-lg); font-size: 13px; color: var(--text-primary);
      opacity: 0; transform: translateX(-20px);
      transition: opacity .25s, transform .25s; pointer-events: auto;
    }
    .toast.show { opacity: 1; transform: translateX(0); }
    .toast span { flex: 1; }
    .toast-success i { color: var(--success); }
    .toast-error   i { color: var(--danger); }
    .toast-warning i { color: var(--warning); }
    .toast-info    i { color: var(--info); }
    .toast-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 12px; padding: 2px; }
    [data-theme="dark"] .toast { background: #374151; border-color: #4B5563; }

    /* ════════════════════════════════════════════════════════
       МОДАЛКИ
    ════════════════════════════════════════════════════════ */
    .modal {
      display: none; position: fixed; inset: 0; z-index: 1500;
      background: rgba(0,0,0,.55); align-items: center; justify-content: center; padding: 16px;
    }
    .modal.open { display: flex; }
    .modal-box {
      background: var(--bg-primary); border-radius: var(--radius-lg);
      box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
      max-height: calc(100vh - 32px); overflow: hidden; width: 100%;
    }
    .modal-sm   { max-width: 420px; }
    .modal-md   { max-width: 580px; }
    .modal-lg   { max-width: 780px; }
    .modal-xl   { max-width: 960px; }
    .modal-full { max-width: 900px; height: calc(100vh - 32px); }
    .modal-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
    }
    .modal-header h2 { font-size: 16px; font-weight: 700; }
    .modal-close { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text-muted); padding: 4px; border-radius: 4px; }
    .modal-close:hover { background: var(--bg-secondary); }
    .modal-body   { padding: 20px; overflow-y: auto; flex: 1; }
    .modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }
    /* Вкладки внутри модалок задач */
    .task-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; margin-top: -4px; }
    .task-tab  { background: none; border: none; padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--tr); }
    .task-tab:hover { color: var(--text-primary); }
    .task-tab.active { color: var(--accent-light); border-bottom-color: var(--accent-light); }
    .task-tab-content { display: none; }
    .task-tab-content.active { display: block; }

    /* Подтверждение */
    #confirm-dialog { display: none; }
    #confirm-dialog.open { display: flex; position: fixed; inset: 0; z-index: 9990; align-items: center; justify-content: center; background: rgba(0,0,0,.5); }
    .confirm-box { background: var(--bg-primary); border-radius: var(--radius-lg); padding: 28px; max-width: 380px; width: calc(100% - 32px); box-shadow: var(--shadow-lg); }
    .confirm-box h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
    .confirm-box p  { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; }
    .confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

    /* HR Блокирующее окно */
    #hr-event-blocking-modal {
      display: none; position: fixed; inset: 0; z-index: 9998;
      background: rgba(0,0,0,.88); align-items: center; justify-content: center; padding: 20px;
    }
    #hr-event-blocking-modal.open { display: flex; }
    .hr-blocking-box { background: var(--bg-primary); border-radius: var(--radius-lg); max-width: 560px; width: 100%; padding: 32px; box-shadow: var(--shadow-lg); }
    .hr-blocking-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--danger); margin-bottom: 8px; }
    .hr-blocking-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
    .hr-blocking-body  { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; white-space: pre-wrap; line-height: 1.6; }
    .hr-blocking-ack-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 13px; cursor: pointer; user-select: none; }
    .hr-blocking-btn { width: 100%; padding: 12px; border-radius: var(--radius-md); border: none; background: var(--success); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; transition: background var(--tr); }
    .hr-blocking-btn:hover:not(:disabled) { background: #059669; }
    .hr-blocking-btn:disabled { background: var(--bg-tertiary); color: var(--text-muted); cursor: not-allowed; }

    /* ════════════════════════════════════════════════════════
       ЭКРАН ВХОДА
    ════════════════════════════════════════════════════════ */
    #login-screen {
      display: flex; align-items: center; justify-content: center;
      min-height: 100vh; background: linear-gradient(135deg, var(--accent) 0%, #2563EB 100%);
    }
    [data-theme="dark"] #login-screen { background: linear-gradient(135deg, #111827 0%, #1E3A5F 100%); }
    .login-box {
      background: var(--bg-primary); border-radius: var(--radius-lg);
      box-shadow: var(--shadow-lg); padding: 40px; width: 100%; max-width: 400px; margin: 16px;
    }
    .login-logo        { display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; gap: 4px; }
    .login-logo-text h1 { font-size: 22px; font-weight: 800; color: var(--accent); text-align: center; letter-spacing: .5px; }
    .login-logo-text p  { font-size: 12px; color: var(--text-muted); text-align: center; }
    /* Partner logos bar on login */
    .login-partner-logos {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0;
      margin-bottom: 16px;
    }
    .login-partner-logo-wrap {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 160px;
      height: 48px;
      overflow: hidden;
    }
    .login-partner-logo {
      display: block;
      max-width: 90%;
      max-height: 100%;
      object-fit: contain;
      object-position: center;
    }
    .login-partner-sep {
      width: 1px;
      height: 36px;
      background: var(--border);
      flex-shrink: 0;
      margin: 0 4px;
    }
    .login-card-divider {
      height: 1px;
      background: var(--border);
      margin: 0 0 20px;
    }
    .login-subtitle    { text-align: center; font-size: 15px; font-weight: 600; margin-bottom: 24px; color: var(--text-primary); }
    .login-error       { color: var(--danger); font-size: 12px; margin-bottom: 12px; min-height: 16px; }
    .ms-login-btn {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      padding: 10px 16px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--bg-primary);
      color: var(--text-primary);
      font-size: .875rem;
      font-weight: 500;
      text-decoration: none;
      justify-content: center;
      transition: background .15s, border-color .15s;
      box-sizing: border-box;
    }
    .ms-login-btn:hover {
      background: var(--bg-secondary);
      border-color: #2563EB;
    }

    /* ════════════════════════════════════════════════════════
       УТИЛИТЫ
    ════════════════════════════════════════════════════════ */
    .text-muted       { color: var(--text-muted); }
    .text-secondary   { color: var(--text-secondary); }
    .text-danger      { color: var(--danger); }
    .text-success     { color: var(--success); }
    .text-warning     { color: var(--warning); }
    .text-center      { text-align: center; }
    .text-right       { text-align: right; }
    .d-flex           { display: flex; align-items: center; gap: 8px; }
    .d-flex-between   { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
    .flex-1           { flex: 1; }
    .mt-8  { margin-top: 8px; }    .mt-16 { margin-top: 16px; }   .mt-24 { margin-top: 24px; }
    .mb-8  { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
    .gap-8 { gap: 8px; }           .gap-12 { gap: 12px; }
    .hidden { display: none !important; }

    /* ════════════════════════════════════════════════════════
       АДАПТИВ
    ════════════════════════════════════════════════════════ */
    @media (max-width: 768px) {
      #sidebar { position: fixed; left: 0; top: 0; height: 100%; transform: translateX(-100%); }
      #sidebar.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,.35); }
      #burger-menu { display: flex; }
      .header-title { display: none; }
      .header-search { max-width: none; }
      .form-row   { grid-template-columns: 1fr; }
      .form-row-3 { grid-template-columns: 1fr 1fr; }
      .page-section { padding: 16px; }
      .projects-grid   { grid-template-columns: 1fr; }
      .employees-grid  { grid-template-columns: 1fr; }
      #toast-container { left: 12px; right: 12px; max-width: none; }
    }
    @media (max-width: 480px) {
      .form-row-3    { grid-template-columns: 1fr; }
      .page-header   { flex-wrap: wrap; }
      .header-search kbd { display: none; }
      .header-actions { gap: 4px; }
      .lang-btn      { display: none; }
    }

/* ════════════════════════════════════════════════════════
   LAYOUT (added)
════════════════════════════════════════════════════════ */
#app { display: flex; min-height: 100vh; }
#main-wrapper { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
#main-content { flex: 1; overflow-y: auto; }

/* ════════════════════════════════════════════════════════
   SIDEBAR FOOTER
════════════════════════════════════════════════════════ */
.sidebar-footer {
  padding: 8px 8px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  background: rgba(0,0,0,.12);
  flex-shrink: 0;
}
.nav-item-btn {
  width: 100%; background: none; border: none; cursor: pointer;
  text-align: left; font-family: inherit; font-size: 13px;
}

/* ════════════════════════════════════════════════════════
   STAT CARDS
════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--tr);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card-danger { border-color: rgba(239,68,68,.3); }
.stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.stat-value { font-size: 24px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

/* ════════════════════════════════════════════════════════
   FILTER CHIPS
════════════════════════════════════════════════════════ */
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 20px; cursor: pointer;
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  transition: background var(--tr), border-color var(--tr), color var(--tr);
  user-select: none;
}
.filter-chip:hover { border-color: var(--accent-light); color: var(--accent-light); }
.filter-chip-active {
  background: var(--accent); color: #fff !important;
  border-color: var(--accent);
}

/* ════════════════════════════════════════════════════════
   TASK PANEL (slide-over)
════════════════════════════════════════════════════════ */
#task-panel-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 400;
}
#task-panel-overlay.show { display: block; }
#task-panel {
  position: fixed; top: 0; right: 0;
  width: 560px; max-width: 100%; height: 100%;
  background: var(--bg-primary); z-index: 401;
  overflow-y: auto; transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
}
#task-panel.open { transform: translateX(0); }

/* ════════════════════════════════════════════════════════
   TASK DETAIL META
════════════════════════════════════════════════════════ */
.detail-meta-item { display: flex; flex-direction: column; gap: 3px; }
.detail-meta-label { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.detail-meta-value { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }

/* ════════════════════════════════════════════════════════
   TOASTS
════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  font-size: 13px; min-width: 260px; max-width: 380px;
  animation: toastIn .2s ease;
}
.toast-success { border-left: 4px solid var(--success); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-error   { border-left: 4px solid var(--danger); }
.toast-info    { border-left: 4px solid var(--info); }
.toast-success i { color: var(--success); }
.toast-warning i { color: var(--warning); }
.toast-error   i { color: var(--danger); }
.toast-info    i { color: var(--info); }
.toast-hide    { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { to   { transform: translateX(120%); opacity: 0; } }

/* ════════════════════════════════════════════════════════
   MOBILE
════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #sidebar {
    position: fixed; top: 0; left: 0; height: 100%;
    transform: translateX(-100%); transition: transform .25s; z-index: 200;
  }
  #sidebar.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,.35); }
  #sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 199;
  }
  #sidebar-backdrop.show { display: block; }
  #burger-menu { display: flex !important; }
  #task-panel { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ════════════════════════════════════════════════════════
   HTMX loading indicator
════════════════════════════════════════════════════════ */
.htmx-indicator { opacity: 0; transition: opacity 200ms; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator  { opacity: 1; }
