/* ============================================================
   DeskHub CRM — дизайн-система
   ============================================================ */
:root {
  --c-bg: #eef1f6;
  --c-surface: #ffffff;
  --c-surface-2: #f8fafc;
  --c-border: #e2e8f0;
  --c-border-2: #cbd5e1;

  --c-text: #0f172a;
  --c-text-2: #475569;
  --c-text-3: #94a3b8;

  --c-primary: #6366f1;
  --c-primary-600: #4f46e5;
  --c-primary-50: #eef2ff;
  --c-violet: #8b5cf6;
  --c-cyan: #0ea5e9;
  --c-amber: #f59e0b;
  --c-green: #10b981;
  --c-red: #ef4444;
  --c-slate: #64748b;

  --gradient-brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --sidebar-w: 264px;
  --topbar-h: 68px;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 4px 16px -2px rgba(15, 23, 42, .10);
  --shadow-lg: 0 20px 50px -12px rgba(15, 23, 42, .22);

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary-600); text-decoration: none; }
a:hover { text-decoration: none; }

img { max-width: 100%; }

h1,h2,h3,h4 { font-weight: 700; color: var(--c-text); line-height: 1.3; }

/* ---------------- Layout ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 55%, #4338ca 130%);
  color: #c7d2fe;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 50;
  overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 22px;
}
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--gradient-brand);
  display: grid; place-items: center;
  color: #fff; font-size: 20px; font-weight: 800;
  box-shadow: 0 8px 20px -6px rgba(99,102,241,.6);
  flex-shrink: 0;
}
.brand-name { font-size: 18px; font-weight: 800; color: #fff; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: #a5b4fc; margin-top: 2px; }

.nav-section {
  padding: 14px 16px 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: #818cf8;
  font-weight: 700;
}
.nav { padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #c7d2fe;
  font-weight: 500;
  font-size: 13.5px;
  transition: background .15s, color .15s, transform .1s;
  position: relative;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 20%; bottom: 20%;
  width: 4px; border-radius: 4px; background: var(--gradient-brand);
}
.nav-item .badge {
  margin-left: auto; background: var(--gradient-brand);
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 1px 8px; border-radius: 999px;
}

.sidebar-footer {
  margin-top: auto; padding: 16px 18px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 40;
}
.topbar .page-title { font-size: 17px; font-weight: 700; }
.topbar-search {
  flex: 1; max-width: 380px;
  position: relative;
}
.topbar-search input {
  width: 100%; padding: 9px 14px 9px 38px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-surface-2);
  font-size: 13.5px; font-family: var(--font);
  outline: none;
  transition: border .15s, box-shadow .15s, background .15s;
}
.topbar-search input:focus {
  border-color: var(--c-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.topbar-search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--c-text-3);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--c-border);
  background: #fff; color: var(--c-text-2);
  display: grid; place-items: center; cursor: pointer;
  position: relative;
  transition: all .15s;
}
.icon-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--c-red); color: #fff;
  font-size: 10.5px; font-weight: 700;
  border-radius: 999px; display: grid; place-items: center;
  border: 2px solid #fff;
}

.content { padding: 26px 30px; flex: 1; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 12px;
}
.card-header h3 { font-size: 15px; }
.card-body { padding: 22px; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--c-border); }

/* ---------------- Grid stats ---------------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; margin-bottom: 14px;
}
.stat-card .stat-icon svg { width: 22px; height: 22px; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-card .stat-label { color: var(--c-text-2); font-size: 13px; margin-top: 6px; }
.stat-card .stat-trend { position: absolute; top: 18px; right: 18px; font-size: 12px; font-weight: 600; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  text-decoration: none; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 6px 16px -6px rgba(99,102,241,.55); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 10px 22px -6px rgba(99,102,241,.6); }
.btn-outline { background: #fff; border-color: var(--c-border-2); color: var(--c-text-2); }
.btn-outline:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn-ghost { background: transparent; color: var(--c-text-2); }
.btn-ghost:hover { background: var(--c-surface-2); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--c-red); }
.btn-danger:hover { background: #fef2f2; border-color: var(--c-red); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--c-text-2); margin-bottom: 7px; }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--c-border-2);
  border-radius: 10px;
  font-size: 14px; font-family: var(--font);
  background: #fff; color: var(--c-text);
  outline: none;
  transition: border .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
textarea.form-control { resize: vertical; min-height: 110px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-hint { font-size: 12px; color: var(--c-text-3); margin-top: 5px; }
.form-check { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.form-check input { width: 17px; height: 17px; accent-color: var(--c-primary); cursor: pointer; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

.field-error { color: var(--c-red); font-size: 12.5px; margin-top: 5px; }

/* ---------------- Alerts ---------------- */
.alert {
  padding: 12px 16px; border-radius: 10px;
  font-size: 13.5px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 12px 16px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--c-text-3); font-weight: 700;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--c-border); font-size: 13.5px; vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--c-surface-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------------- Badges & chips ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.badge .b-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.priority-low { background: #f1f5f9; color: #64748b; }
.priority-medium { background: #fef3c7; color: #b45309; }
.priority-high { background: #fee2e2; color: #b91c1c; }
.priority-urgent { background: #dc2626; color: #fff; }

/* ---------------- Avatar ---------------- */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
  background: var(--gradient-brand);
  object-fit: cover;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid #fff; margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------------- Task list ---------------- */
.task-list { display: flex; flex-direction: column; }
.task-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-surface);
  margin-bottom: 10px;
  transition: box-shadow .15s, transform .15s, border-color .15s;
  text-decoration: none; color: inherit;
}
.task-row:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--c-primary); }
.task-row .task-id { color: var(--c-text-3); font-size: 12px; font-weight: 600; min-width: 46px; }
.task-row .task-title { font-weight: 600; font-size: 14px; color: var(--c-text); }
.task-row .task-title small { color: var(--c-text-3); font-weight: 400; display: block; margin-top: 2px; }
.task-row .task-meta { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.task-row .due { font-size: 12.5px; color: var(--c-text-2); white-space: nowrap; }
.task-row .due.overdue { color: var(--c-red); font-weight: 700; }
.task-row .due.today { color: var(--c-amber); font-weight: 600; }
.task-row .proj-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap;
}

/* ---------------- Kanban ---------------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(260px, 1fr));
  gap: 16px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}
@media (max-width: 1500px) { .kanban { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1000px) { .kanban { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .kanban { grid-template-columns: 1fr; } }

.kanban-col {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  min-height: 300px;
  display: flex; flex-direction: column;
}
.kanban-col-header {
  padding: 13px 16px;
  display: flex; align-items: center; gap: 9px;
  border-bottom: 1px solid var(--c-border);
  border-radius: var(--radius) var(--radius) 0 0;
  position: sticky; top: 0;
}
.kanban-col-header .k-dot { width: 10px; height: 10px; border-radius: 50%; }
.kanban-col-header .k-title { font-weight: 700; font-size: 13.5px; }
.kanban-col-header .k-count {
  margin-left: auto; background: var(--c-border);
  color: var(--c-text-2); font-size: 12px; font-weight: 700;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; display: grid; place-items: center;
}
.kanban-col-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }

.kanban-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 11px;
  padding: 13px 14px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s, border-color .15s, opacity .15s;
  user-select: none;
}
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--c-primary); }
.kanban-card.dragging { opacity: .55; transform: rotate(2deg) scale(1.02); }
.kanban-card .k-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.kanban-card .k-card-id { font-size: 11px; color: var(--c-text-3); font-weight: 700; }
.kanban-card .k-card-title { font-weight: 600; font-size: 13.5px; color: var(--c-text); margin-bottom: 10px; line-height: 1.4; }
.kanban-card .k-card-title a { color: inherit; }
.kanban-card .k-card-foot { display: flex; align-items: center; gap: 10px; }
.kanban-card .k-due { font-size: 11.5px; color: var(--c-text-2); display: inline-flex; align-items: center; gap: 4px; }
.kanban-card .k-due.overdue { color: var(--c-red); font-weight: 700; }
.kanban-card .k-icons { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--c-text-3); font-size: 12px; }
.kanban-card .k-icons svg { width: 13px; height: 13px; }

.kanban-col.drag-over { border-color: var(--c-primary); background: var(--c-primary-50); }

/* ---------------- Detail page (task show) ---------------- */
.task-hero {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 20px;
}
.task-hero .th-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.task-hero .th-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 18px; }
.task-hero .th-meta-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--c-text-2); }
.task-hero .th-meta-item svg { width: 18px; height: 18px; color: var(--c-text-3); }
.task-hero .th-meta-item b { color: var(--c-text); font-weight: 600; }

.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }

/* Comments */
.comment { display: flex; gap: 12px; margin-bottom: 18px; }
.comment-body {
  flex: 1; background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 13px 16px;
}
.comment-body .c-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comment-body .c-author { font-weight: 700; font-size: 13px; }
.comment-body .c-time { color: var(--c-text-3); font-size: 12px; }
.comment-body .c-content { font-size: 13.5px; color: var(--c-text); white-space: pre-wrap; word-break: break-word; }

/* Time logs */
.time-log-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-surface-2);
  margin-bottom: 8px;
}
.time-log-item .tl-time { font-weight: 700; color: var(--c-primary); font-size: 14px; white-space: nowrap; }
.time-log-item .tl-note { font-size: 13px; color: var(--c-text-2); flex: 1; }
.time-log-item .tl-meta { font-size: 12px; color: var(--c-text-3); }

/* Activity feed */
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--c-border); }
.activity-item:last-child { border-bottom: none; }
.activity-item .a-icon { width: 30px; height: 30px; border-radius: 50%; background: var(--c-primary-50); color: var(--c-primary); display: grid; place-items: center; flex-shrink: 0; }
.activity-item .a-icon svg { width: 15px; height: 15px; }
.activity-item .a-text { font-size: 13px; color: var(--c-text-2); }
.activity-item .a-text b { color: var(--c-text); }
.activity-item .a-time { font-size: 11.5px; color: var(--c-text-3); display: block; margin-top: 2px; }

/* ---------------- Notifications ---------------- */
.notif-item {
  display: flex; gap: 12px; padding: 14px 18px;
  border: 1px solid var(--c-border); border-radius: 12px;
  margin-bottom: 10px; background: var(--c-surface);
  transition: background .15s;
}
.notif-item.unread { background: var(--c-primary-50); border-color: #c7d2fe; }
.notif-item .n-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.notif-item .n-icon svg { width: 19px; height: 19px; }
.notif-item .n-title { font-weight: 700; font-size: 13.5px; }
.notif-item .n-msg { color: var(--c-text-2); font-size: 13px; margin-top: 2px; }
.notif-item .n-time { color: var(--c-text-3); font-size: 12px; margin-top: 4px; }

/* Notifications dropdown */
.notif-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 360px; max-height: 420px; overflow-y: auto;
  background: #fff; border: 1px solid var(--c-border);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  z-index: 60; display: none;
}
.notif-dropdown.open { display: block; }
.notif-dropdown .nd-head { padding: 13px 16px; border-bottom: 1px solid var(--c-border); font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.notif-dropdown .nd-item { display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--c-border); transition: background .12s; }
.notif-dropdown .nd-item:hover { background: var(--c-surface-2); }
.notif-dropdown .nd-item.unread { background: var(--c-primary-50); }
.notif-dropdown .nd-item .nd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-primary); margin-top: 6px; flex-shrink: 0; }
.notif-dropdown .nd-item .nd-title { font-size: 13px; font-weight: 600; }
.notif-dropdown .nd-item .nd-time { font-size: 11.5px; color: var(--c-text-3); }
.notif-dropdown .nd-empty { padding: 30px; text-align: center; color: var(--c-text-3); }

/* ---------------- Dropdowns / menus ---------------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 200px; background: #fff;
  border: 1px solid var(--c-border); border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 60;
  display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px;
  border: none; background: none; cursor: pointer;
  font-size: 13.5px; color: var(--c-text-2);
  border-radius: 8px; font-family: var(--font);
  text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--c-surface-2); color: var(--c-text); }
.dropdown-menu a.danger, .dropdown-menu button.danger { color: var(--c-red); }
.dropdown-menu a svg, .dropdown-menu button svg { width: 16px; height: 16px; }
.dropdown-divider { height: 1px; background: var(--c-border); margin: 6px 4px; }

/* ---------------- Modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  z-index: 100; display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn .2s; }
.modal {
  background: #fff; border-radius: var(--radius-lg);
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
  max-height: 92vh; overflow-y: auto;
}
.modal.modal-lg { max-width: 720px; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--c-border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--c-text-3); line-height: 1; }
.modal-close:hover { color: var(--c-text); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------------- Toasts ---------------- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: #1e293b; color: #fff;
  padding: 13px 18px; border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 500;
  min-width: 280px; max-width: 400px;
  animation: slideIn .25s ease;
}
.toast-success { background: #065f46; }
.toast-error { background: #991b1b; }
.toast-info { background: #1e3a8a; }
.toast .t-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast .t-close { margin-left: auto; background: none; border: none; color: rgba(255,255,255,.7); cursor: pointer; font-size: 16px; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---------------- Empty state ---------------- */
.empty {
  text-align: center; padding: 48px 20px; color: var(--c-text-3);
}
.empty .empty-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--c-primary-50); color: var(--c-primary);
  display: grid; place-items: center; margin: 0 auto 16px;
}
.empty .empty-icon svg { width: 34px; height: 34px; }
.empty h4 { color: var(--c-text-2); margin-bottom: 6px; font-size: 15px; }

/* ---------------- Charts (CSS/SVG) ---------------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; }
.bar {
  flex: 1; background: var(--gradient-brand);
  border-radius: 6px 6px 0 0;
  position: relative; min-height: 4px;
  transition: filter .15s;
  opacity: .9;
}
.bar:hover { filter: brightness(1.12); }
.bar .bar-label { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--c-text-3); white-space: nowrap; }
.bar .bar-value { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--c-text-2); }

.progress-track { height: 8px; background: var(--c-border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gradient-brand); border-radius: 999px; }

/* ---------------- Auth pages ---------------- */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 600px at 85% -10%, rgba(139,92,246,.25), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(99,102,241,.22), transparent 60%),
    linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
  position: relative; overflow: hidden;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: rgba(255,255,255,.97);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px;
  animation: slideUp .4s ease;
}
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 24px; }
.auth-logo .brand-logo { width: 52px; height: 52px; font-size: 24px; }
.auth-logo .brand-name { font-size: 22px; }
.auth-title { font-size: 20px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--c-text-2); font-size: 13.5px; margin-bottom: 24px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 13px; color: var(--c-text-2); }

/* ---------------- Misc ---------------- */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--c-text-2); } .text-sm { font-size: 13px; } .text-xs { font-size: 12px; }
.font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.w-full { width: 100%; }
.muted { color: var(--c-text-3); }
.mono { font-family: 'Consolas', monospace; font-size: 12.5px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .page-desc { color: var(--c-text-2); font-size: 13.5px; margin-top: 3px; }

.filters-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 14px 18px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 12px; margin-bottom: 18px;
}
.filters-bar select, .filters-bar input { padding: 8px 12px; border: 1px solid var(--c-border-2); border-radius: 8px; font-size: 13px; font-family: var(--font); background: #fff; outline: none; }
.filters-bar select:focus, .filters-bar input:focus { border-color: var(--c-primary); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-border); margin-bottom: 20px; }
.tab {
  padding: 10px 16px; font-size: 13.5px; font-weight: 600;
  color: var(--c-text-2); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; border-top: none; border-left: none; border-right: none; font-family: var(--font);
}
.tab:hover { color: var(--c-primary); }
.tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }

.side-sticky { position: sticky; top: calc(var(--topbar-h) + 20px); }

/* Timeline for activity */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--c-border); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border-2); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-3); border: 2px solid transparent; background-clip: content-box; }

/* Timer pulse */
.timer-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fef2f2; color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 8px 14px; border-radius: 999px;
  font-weight: 700; font-size: 13px;
}
.timer-pill .pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--c-red); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .35; transform: scale(.8);} }

/* Project cards */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.project-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 20px;
  position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.project-card .pc-accent { position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.project-card .pc-name { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.project-card .pc-desc { color: var(--c-text-2); font-size: 13px; min-height: 40px; }
.project-card .pc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }

/* Secret key reveal */
.secret-box {
  background: #0f172a; color: #e2e8f0; font-family: Consolas, monospace;
  padding: 14px 16px; border-radius: 10px; font-size: 13px;
  word-break: break-all; position: relative;
}
.secret-box .copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,.1); border: none; color: #fff;
  border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.secret-box .copy-btn:hover { background: rgba(255,255,255,.2); }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .burger { display: grid !important; }
}
.burger { display: none; }
