/* Pulse — Design System */

:root {
  /* Base palette */
  --bg: #F7F8FA;
  --bg-2: #F1F3F7;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --border: #E7E9EE;
  --border-strong: #D7DAE2;

  /* Text */
  --text: #1C1F26;
  --text-2: #4A5260;
  --text-3: #7B8494;
  --text-4: #A3ACBA;

  /* Accent (indigo) */
  --accent: #5B67F1;
  --accent-2: #4C56D8;
  --accent-soft: #EEF0FF;
  --accent-tint: rgba(91, 103, 241, 0.08);

    /* Status palette (тёмный читаемый текст) */
  --status-not_started: #6B7280;
  --status-proposal_sent: #6D4CCB;
  --status-in_progress: #3B67C8;
  --status-paused: #A66A00;
  --status-completed: #27864A;
  --status-cancelled: #C04444;
  --status-planned: #6B7280;
  --status-needs: #B45309;
  --status-done: #27864A;
  --status-postponed: #92400E;

/* Priority */
  --prio-low: #94A3B8;
  --prio-normal: #64748B;
  --prio-high: #F97316;
  --prio-urgent: #EF4444;

  /* Soft backgrounds */
  --soft-warn: #FEF6E7;
  --soft-warn-border: #F5D38B;
  --soft-danger: #FEE9E9;
  --soft-danger-border: #F4B5B5;
  --soft-ok: #E6F8F0;
  --soft-ok-border: #A7E5C5;
  --soft-info: #EAF1FE;
  --soft-info-border: #B8CFF7;

  /* Sizing */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-1: 0 1px 2px rgba(28, 31, 38, 0.04),
              0 1px 1px rgba(28, 31, 38, 0.03);
  --shadow-2: 0 4px 12px rgba(28, 31, 38, 0.06),
              0 1px 2px rgba(28, 31, 38, 0.04);
  --shadow-3: 0 12px 28px rgba(28, 31, 38, 0.10),
              0 4px 10px rgba(28, 31, 38, 0.06);

  --sidebar-w: 232px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 60px;

  --font: "Inter", "Manrope", -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body { min-height: 100vh; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; color: var(--text); }
h1 { font-size: 26px; letter-spacing: -0.01em; }
h2 { font-size: 20px; letter-spacing: -0.005em; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p  { margin: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D7DAE2; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #B3BAC6; }


/* ---------- LAYOUT ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

/* ---------- SIDEBAR ---------- */

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.sidebar-brand .logo {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 8px;
  display: grid; place-items: center;
  color: white;
  box-shadow: 0 4px 10px rgba(91,103,241,0.32);
}
.sidebar-brand .logo svg { width: 16px; height: 16px; }
.sidebar.collapsed .sidebar-brand .name { display: none; }

.sidebar nav { padding: 6px 12px; flex: 1; }
.sidebar nav .group {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-4); padding: 14px 10px 6px;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-weight: 500;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
}
.sidebar nav a:hover { background: var(--bg-2); color: var(--text); }
.sidebar nav a.active {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar.collapsed nav a .label,
.sidebar.collapsed nav .group { display: none; }
.sidebar.collapsed nav a { justify-content: center; }

.sidebar-user {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar.collapsed .sidebar-user .info { display: none; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar-user .info { line-height: 1.2; }
.sidebar-user .info .name { font-weight: 600; color: var(--text); font-size: 13px; }
.sidebar-user .info .role { color: var(--text-3); font-size: 12px; }
.sidebar-user .logout {
  margin-left: auto;
  background: none; border: 0;
  color: var(--text-3);
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
}
.sidebar-user .logout:hover { background: var(--bg-2); color: var(--text); }


/* ---------- TOPBAR ---------- */

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .title {
  font-size: 18px; font-weight: 600;
  letter-spacing: -0.005em;
}
.topbar .right {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
}
.topbar .search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 7px 12px;
  min-width: 240px;
  transition: border-color 0.15s, background 0.15s;
}
.topbar .search:focus-within {
  background: var(--surface);
  border-color: var(--border-strong);
}
.topbar .search svg { width: 16px; height: 16px; color: var(--text-3); }
.topbar .search input {
  background: transparent; border: 0; outline: none;
  width: 100%;
  color: var(--text);
}
.topbar .search input::placeholder { color: var(--text-4); }


/* ---------- BUTTONS ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s, color 0.15s, transform 0.05s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 10px rgba(91,103,241,0.22);
}
.btn-primary:hover { background: var(--accent-2); color: white; }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-2); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg-2); color: var(--text); }
.btn-danger {
  background: var(--status-cancelled);
  color: white;
}
.btn-danger:hover { background: #DC2626; color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 11px 18px; font-size: 14px; }
.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn-icon:hover { background: var(--bg-2); color: var(--text); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }


/* ---------- CONTENT ---------- */

.content {
  flex: 1;
  padding: 28px 28px 60px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}
.page-head h1 { font-size: 26px; }
.page-head .sub { color: var(--text-3); font-size: 14px; margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 8px; }


/* ---------- CARDS ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card-hover:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.card-2 { padding: 16px; }
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title h2, .card-title h3 { font-size: 15px; font-weight: 600; }


/* ---------- BADGES (status / priority) ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  line-height: 1.4;
  background: var(--bg-2);
  color: var(--text-2);
  white-space: nowrap;
}
.badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}
.badge.status-not_started    { background: #F1F3F5; color: #6B7280; }
.badge.status-proposal_sent  { background: #F1ECFF; color: #6D4CCB; }
.badge.status-in_progress    { background: #EAF2FF; color: #3B67C8; }
.badge.status-paused         { background: #FFF6D8; color: #A66A00; }
.badge.status-completed      { background: #E8F7EE; color: #27864A; }
.badge.status-cancelled      { background: #FDECEC; color: #C04444; }
.badge.status-planned        { background: #F1F3F5; color: #6B7280; }
.badge.status-done           { background: #E8F7EE; color: #27864A; }
.badge.status-needs_clarification,
.badge.status-needs          { background: #FFF6D8; color: #B45309; }
.badge.status-postponed      { background: #FFF6D8; color: #92400E; }
.badge.prio-low     { background: rgba(148,163,184,0.15); color: var(--prio-low); }
.badge.prio-normal  { background: rgba(100,116,139,0.10); color: var(--prio-normal); }
.badge.prio-high    { background: rgba(249,115,22,0.12); color: #C2410C; }
.badge.prio-urgent  { background: rgba(239,68,68,0.12);  color: #B91C1C; }

.badge.is-overdue {
  background: var(--soft-danger);
  color: #B91C1C;
  border: 1px solid var(--soft-danger-border);
}


/* ---------- AVATARS ---------- */

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: white;
  letter-spacing: 0.02em;
  background: var(--accent);
  flex-shrink: 0;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 42px; height: 42px; font-size: 14px; }
.avatar-row { display: inline-flex; align-items: center; }
.avatar-row .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatar-row .avatar:first-child { margin-left: 0; }
.avatar-stack-more {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 11px; font-weight: 600;
  margin-left: -8px;
  border: 2px solid var(--surface);
}


/* ---------- FORMS ---------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }

.input, .textarea, .select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,103,241,0.15);
}
.textarea { min-height: 90px; resize: vertical; font-family: inherit; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .form-row { grid-template-columns: 1fr; } }


/* ---------- OBSERVER MULTISELECT ---------- */

.observer-picker {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px;
  min-height: 42px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  cursor: pointer;
  position: relative;
}
.observer-picker .placeholder { color: var(--text-4); font-size: 13px; padding: 0 6px; }
.observer-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-2);
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
}
.observer-chip .avatar { width: 22px; height: 22px; font-size: 9px; }
.observer-chip .x {
  border: 0; background: transparent;
  color: var(--text-3);
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
}
.observer-chip .x:hover { background: var(--border); color: var(--text); }

.observer-dropdown {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  z-index: 30;
  max-height: 280px;
  display: none;
  flex-direction: column;
}
.observer-dropdown.open { display: flex; }
.observer-dropdown .search-box {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.observer-dropdown .search-box input {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: none;
}
.observer-dropdown .list {
  overflow-y: auto;
  padding: 6px;
}
.observer-option {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.observer-option:hover { background: var(--bg-2); }
.observer-option.selected { background: var(--accent-tint); }
.observer-option .name { font-size: 13px; font-weight: 500; }
.observer-option .check {
  margin-left: auto;
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  color: transparent;
}
.observer-option.selected .check {
  background: var(--accent); border-color: var(--accent);
  color: white;
}


/* ---------- STATUS DROPDOWN (inline change) ---------- */

.status-dropdown {
  position: relative;
  display: inline-block;
}
.status-dropdown .menu {
  position: absolute;
  top: calc(100% + 4px); left: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  z-index: 30;
  min-width: 200px;
  padding: 4px;
  display: none;
}
.status-dropdown.open .menu { display: block; }
.status-dropdown .item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.status-dropdown .item:hover { background: var(--bg-2); }
.status-dropdown .item .dot {
  width: 9px; height: 9px; border-radius: 50%;
}


/* ---------- DASHBOARD ---------- */

.greeting {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.greeting-sub { color: var(--text-3); margin-bottom: 22px; }

.metrics-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
@media (max-width: 980px) { .metrics-row { grid-template-columns: repeat(2, 1fr); } }

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.metric:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.metric .ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-tint);
  color: var(--accent);
}
.metric .ico svg { width: 18px; height: 18px; }
.metric.warn .ico   { background: var(--soft-warn); color: var(--status-needs); }
.metric.danger .ico { background: var(--soft-danger); color: var(--status-cancelled); }
.metric.ok .ico     { background: var(--soft-ok); color: var(--status-done); }
.metric .v { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1; }
.metric .l { color: var(--text-3); font-size: 12px; margin-top: 2px; }

.split-2 {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 980px) { .split-2 { grid-template-columns: 1fr; } }


/* ---------- PROJECT CARDS GRID ---------- */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.project-card:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.project-card .top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.project-card h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}
.project-card .client { color: var(--text-3); font-size: 12px; margin-bottom: 12px; }
.project-card .meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-3);
  margin-top: 12px;
}
.project-card .meta svg { width: 14px; height: 14px; }
.project-card .progress {
  height: 6px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}
.project-card .progress .bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}
.project-card .progress.done .bar { background: var(--status-done); }
.project-card .progress-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-3); margin-top: 6px;
}


/* ---------- MY DAY ACCORDION ---------- */

.day-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.day-block.today { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.day-block.past-complete { opacity: 0.78; }

.day-block .head {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}
.day-block .head .chev {
  margin-left: auto;
  transition: transform 0.2s;
  color: var(--text-3);
}
.day-block.open .head .chev { transform: rotate(180deg); }
.day-block .head h3 { font-size: 16px; font-weight: 600; }
.day-block .head .sub { color: var(--text-3); font-size: 12px; }
.day-block .head .counts {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-3); font-size: 13px;
}
.day-block .head .progress {
  flex: 1; max-width: 220px;
  height: 6px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
}
.day-block .head .progress .bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}
.day-block .head .progress.done .bar { background: var(--status-done); }

.day-block .body {
  border-top: 1px solid var(--border);
  padding: 6px 0;
  display: none;
}
.day-block.open .body { display: block; }


/* ---------- TASK ROW ---------- */

.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--surface-2); }
.task-row .check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  cursor: pointer;
  display: grid; place-items: center;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.task-row .check:hover { border-color: var(--accent); }
.task-row.done .check {
  background: var(--status-done);
  border-color: var(--status-done);
  color: white;
}
.task-row.done .check svg { width: 14px; height: 14px; }
.task-row .title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  min-width: 0;
  text-decoration: none;
}
.task-row.done .title {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: var(--text-4);
}
.task-row .title:hover { color: var(--accent); }
.task-row .meta { display: flex; align-items: center; gap: 10px; }
.task-row .meta .due { font-size: 12px; color: var(--text-3); }
.task-row .meta .due.overdue { color: var(--status-cancelled); font-weight: 600; }
.task-row .project-chip {
  font-size: 11px; color: var(--text-3);
  background: var(--bg-2);
  padding: 2px 8px; border-radius: 999px;
  max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.task-row .actions {
  display: flex; align-items: center; gap: 4px;
  margin-left: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.task-row:hover .actions { opacity: 1; }
.task-row .actions button {
  background: transparent; border: 0;
  color: var(--text-3);
  width: 28px; height: 28px;
  border-radius: 6px;
  display: grid; place-items: center;
}
.task-row .actions button:hover { background: var(--bg-2); color: var(--text); }
.task-row .actions svg { width: 15px; height: 15px; }


/* ---------- PROJECT DETAIL ---------- */

.detail-head {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 16px;
}
.detail-head .row1 {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 12px;
}
.detail-head h1 { font-size: 24px; line-height: 1.25; }
.detail-head .client {
  color: var(--text-3);
  margin-top: 4px;
}
.detail-head .badges {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 12px 0;
}
.detail-head .info-row {
  display: flex; flex-wrap: wrap; gap: 16px 24px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 12px;
}
.detail-head .info-row .item { display: flex; align-items: center; gap: 6px; }
.detail-head .info-row .item .lbl { color: var(--text-3); }
.detail-head .progress-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 6px;
}
.detail-head .progress-row .bar {
  flex: 1; height: 8px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
}
.detail-head .progress-row .fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}
.detail-head .progress-row.done .fill { background: var(--status-done); }

.detail-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
}
@media (max-width: 980px) { .detail-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.panel h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.panel h3 svg { width: 16px; height: 16px; color: var(--text-3); }

.panel.warn    { background: var(--soft-warn); border-color: var(--soft-warn-border); }
.panel.warn h3 { color: #92400E; }
.panel.warn h3 svg { color: var(--status-needs); }
.panel.danger  { background: var(--soft-danger); border-color: var(--soft-danger-border); }
.panel.danger h3 { color: #991B1B; }
.panel.danger h3 svg { color: var(--status-cancelled); }
.panel.ok      { background: var(--soft-ok); border-color: var(--soft-ok-border); }
.panel.ok h3 { color: #065F46; }

.panel .body-text {
  font-size: 13px; line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.panel .empty { color: var(--text-4); font-size: 13px; font-style: italic; }

.panel.editing .body-text { display: none; }
.panel.editing .edit-area { display: block; }
.panel .edit-area { display: none; }


/* ---------- STAGES TIMELINE ---------- */

.stages-timeline {
  position: relative;
  padding-left: 22px;
}
.stages-timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border);
}
.stage {
  position: relative;
  padding: 8px 0 14px;
}
.stage::before {
  content: '';
  position: absolute;
  left: -22px; top: 16px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-strong);
}
.stage.done::before { background: var(--status-done); border-color: var(--status-done); }
.stage.in_progress::before { background: var(--accent); border-color: var(--accent); }
.stage.needs_clarification::before { background: var(--status-needs); border-color: var(--status-needs); }
.stage.cancelled::before { background: var(--status-cancelled); border-color: var(--status-cancelled); }
.stage .top {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.stage .top .title { font-weight: 600; font-size: 14px; }
.stage .body {
  padding: 10px 0 0 8px;
  font-size: 13px;
  color: var(--text-2);
  display: none;
}
.stage.open .body { display: block; }
.stage .body .row { margin-bottom: 6px; }
.stage .body .row .lbl { color: var(--text-3); font-size: 12px; margin-bottom: 2px; }

.stage-files {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
}
.stage-files-head,
.stage-file-row,
.stage-file-link,
.stage-file-meta,
.file-access,
.file-audience-option {
  display: flex;
  align-items: center;
}
.stage-files-head { justify-content: space-between; margin-bottom: 8px; }
.stage-files-title { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.file-count {
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; font-size: 11px; color: var(--text-3);
}
.stage-file-list { display: grid; gap: 6px; }
.stage-file-row {
  position: relative; min-height: 42px; gap: 8px; padding: 7px 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); transition: box-shadow .18s, border-color .18s;
}
.stage-file-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-1); }
.stage-file-link { flex: 1; min-width: 0; gap: 8px; color: var(--text); font-weight: 500; }
.stage-file-icon {
  flex: 0 0 30px; width: 30px; height: 30px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--accent);
  background: var(--accent-soft); border-radius: 8px;
}
.stage-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-file-meta { gap: 7px; flex-shrink: 0; }
.file-access { gap: 5px; color: var(--text-3); }
.file-private {
  padding: 3px 7px; border-radius: 999px; font-size: 11px;
  color: var(--text-3); background: var(--bg-2);
}
.file-settings { position: relative; flex-shrink: 0; }
.file-settings > summary { list-style: none; }
.file-settings > summary::-webkit-details-marker { display: none; }
.file-settings-popover {
  position: absolute; z-index: 30; right: 0; top: 34px; width: 300px;
  padding: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-3);
}
.stage-file-upload { margin-top: 8px; }
.stage-file-upload > summary { list-style: none; display: inline-flex; cursor: pointer; }
.stage-file-upload > summary::-webkit-details-marker { display: none; }
.stage-file-form {
  display: grid; gap: 10px; margin-top: 8px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.file-audience-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
  max-height: 180px; overflow-y: auto;
}
.file-audience-option {
  gap: 7px; min-width: 0; padding: 6px 8px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 9px; background: var(--bg);
}
.file-audience-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.file-audience-option input { accent-color: var(--accent); }
.file-audience-option span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 620px) {
  .stage-file-row { align-items: flex-start; flex-wrap: wrap; }
  .stage-file-link { flex-basis: calc(100% - 40px); }
  .stage-file-meta { padding-left: 38px; }
  .file-settings-popover { position: fixed; left: 12px; right: 12px; top: auto; bottom: 78px; width: auto; }
  .file-audience-list { grid-template-columns: 1fr; }
}


/* ---------- COMMENTS / HISTORY ---------- */

.comment {
  display: flex; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: 0; }
.comment .body { flex: 1; }
.comment .meta {
  font-size: 12px; color: var(--text-3); margin-bottom: 4px;
}
.comment .meta .name { color: var(--text); font-weight: 600; }
.comment .text { font-size: 13px; color: var(--text); white-space: pre-wrap; }

.history-list { list-style: none; padding: 0; margin: 0; }
.history-item {
  display: flex; gap: 10px;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text-2);
}
.history-item .when { color: var(--text-3); min-width: 100px; }
.history-item .who { color: var(--text); font-weight: 600; }


/* ---------- FILTERS BAR ---------- */

.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center;
}
.filters .field { margin: 0; flex: 1; min-width: 130px; }
.filters .field label { display: none; }
.filters .reset {
  margin-left: auto;
}


/* ---------- EMPTY STATES ---------- */

.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-3);
}
.empty-state .ico {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  background: var(--bg-2);
  border-radius: 14px;
  display: grid; place-items: center;
  color: var(--text-4);
}
.empty-state .ico svg { width: 28px; height: 28px; }
.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 13px; margin-bottom: 16px; }


/* ---------- SIDE PANEL (quick task) ---------- */

.side-panel-overlay {
  position: fixed; inset: 0;
  background: rgba(28,31,38,0.36);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.side-panel-overlay.open { opacity: 1; pointer-events: auto; }
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-3);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.22s ease-out;
  display: flex; flex-direction: column;
}
.side-panel-overlay.open + .side-panel,
.side-panel-overlay.open ~ .side-panel { transform: translateX(0); }
.side-panel header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.side-panel header h2 { font-size: 17px; }
.side-panel .body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}
.side-panel footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}


/* ---------- PWA ---------- */

.pwa-action.is-on {
  color: #067A57;
  background: var(--soft-ok);
  box-shadow: inset 0 0 0 1px var(--soft-ok-border);
}
.install-sheet {
  position: fixed; inset: 0; z-index: 180;
  display: grid; align-items: end;
  visibility: hidden; pointer-events: none;
}
.install-sheet.open { visibility: visible; pointer-events: auto; }
.install-sheet-backdrop {
  position: absolute; inset: 0; border: 0;
  background: rgba(28,31,38,.44); opacity: 0;
  transition: opacity .18s;
}
.install-sheet.open .install-sheet-backdrop { opacity: 1; }
.install-sheet-card {
  position: relative; z-index: 1; width: min(100%, 520px); margin: 0 auto;
  padding: 12px 22px calc(22px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0; background: var(--surface);
  box-shadow: var(--shadow-3); text-align: center;
  transform: translateY(100%); transition: transform .22s ease-out;
}
.install-sheet.open .install-sheet-card { transform: translateY(0); }
.install-sheet-handle { width: 42px; height: 4px; margin: 0 auto 15px; border-radius: 9px; background: var(--border-strong); }
.install-sheet-close {
  position: absolute; top: 12px; right: 14px; width: 38px; height: 38px;
  border: 0; border-radius: 50%; background: var(--bg-2); color: var(--text-2); font-size: 24px;
}
.install-sheet-icon { width: 70px; height: 70px; border-radius: 18px; margin-bottom: 10px; }
.install-sheet-card h2 { margin-bottom: 18px; }
.install-step {
  display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center;
  padding: 12px 14px; margin: 8px 0; border: 1px solid var(--border);
  border-radius: 12px; background: var(--bg); text-align: left;
}
.install-step span { color: var(--text-2); }
.install-sheet-card p { margin: 16px 0; color: var(--text-3); font-size: 13px; }
.install-sheet-done { width: 100%; min-height: 46px; justify-content: center; }
.pwa-toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 220;
  max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 12px;
  background: #1C1F26; color: white; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-3); opacity: 0; pointer-events: none;
  transform: translate(-50%, 16px); transition: opacity .18s, transform .18s;
}
.pwa-toast.show { opacity: 1; transform: translate(-50%, 0); }
.pwa-toast.error { background: #991B1B; }
@media (display-mode: standalone) { #install-app { display: none !important; } }


/* ---------- MOBILE ---------- */

.mobile-bar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  z-index: 80;
  justify-content: space-around;
}
.mobile-bar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: var(--text-3);
  padding: 6px 8px;
}
.mobile-bar a.active { color: var(--accent); }
.mobile-bar a svg { width: 22px; height: 22px; }
.mobile-fab {
  display: none;
  position: fixed; bottom: 70px; right: 16px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: 0;
  z-index: 90;
  box-shadow: 0 6px 18px rgba(91,103,241,0.4);
  align-items: center; justify-content: center;
}
.mobile-fab svg { width: 22px; height: 22px; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .search { display: none; }
  .topbar .right { gap: 6px; }
  .topbar .right > .btn-primary { display: none; }
  .pwa-action { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .pwa-action .action-label { display: none; }
  .content { padding: 18px 16px 90px; }
  .mobile-bar { display: flex; }
  .mobile-fab { display: flex; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
  .task-row .project-chip { display: none; }
  .task-row .actions { display: none; }
}


/* ---------- MISC ---------- */

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.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; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.center { text-align: center; }
.bold { font-weight: 600; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.col { display: flex; flex-direction: column; }

.alert {
  background: var(--soft-danger);
  border: 1px solid var(--soft-danger-border);
  color: #991B1B;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}
.alert.ok {
  background: var(--soft-ok);
  color: #065F46;
  border-color: var(--soft-ok-border);
}


/* ==== доработки карточки проекта (Pulse) ==== */
.project-avatar-wrap{display:flex;flex-direction:column;align-items:center;width:80px;flex-shrink:0;}
.project-avatar{width:80px;height:80px;border-radius:18px;object-fit:cover;background:#eef0fa;border:1px solid #e7e9f2;}
.project-links{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0 4px;}
.project-link{display:inline-flex;align-items:center;gap:6px;padding:7px 13px;border-radius:10px;background:#ececf6;color:#5B67F1;font-size:13px;font-weight:600;text-decoration:none;transition:.15s;}
.project-link:hover{background:#dfe1f5;}
.stage .top .num{display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:22px;padding:0 5px;border-radius:7px;background:#ececf6;color:#5B67F1;font-size:12px;font-weight:700;flex-shrink:0;}
.stage .top{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.material{font-size:14px;}
.material-title{font-weight:600;display:inline-flex;align-items:center;gap:6px;color:var(--link,#5B67F1);text-decoration:none;}
.participant-row .pill{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;background:#fdf1e0;color:#c77700;font-size:11px;font-weight:600;}
.mt-4{margin-top:4px;} .mb-4{margin-bottom:4px;}
.mt-8{margin-top:8px;} .mb-8{margin-bottom:8px;}


/* ==== аватар-фото пользователя ==== */
.avatar-img{display:inline-block;width:30px;height:30px;border-radius:50%;object-fit:cover;flex-shrink:0;background:#eef0fa;}
.avatar-img.sm{width:24px;height:24px;}
.avatar-img.lg{width:42px;height:42px;}
.avatar-row .avatar-img{margin-left:-8px;border:2px solid var(--surface,#fff);}
.avatar-row .avatar-img:first-child{margin-left:0;}
.sidebar-user-link{display:flex;align-items:center;gap:10px;flex:1;min-width:0;text-decoration:none;color:inherit;}


/* ==== Финансы проекта ==== */
.finance-mini{display:flex;gap:22px;flex-wrap:wrap;margin-top:12px;font-size:13px;}
.finance-mini>div{display:flex;flex-direction:column;gap:2px;}
.finance-summary{display:flex;gap:28px;flex-wrap:wrap;padding:6px 0 14px;align-items:flex-end;}
.fi{display:flex;flex-direction:column;gap:3px;}
.fi .big{font-size:16px;font-weight:600;}
.payment-row{padding:10px 0;border-bottom:1px solid var(--border,#e7e9ee);}
.payment-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}

/* ==== Страница установки ==== */
.install-page{min-height:100vh;display:flex;align-items:flex-start;justify-content:center;
  padding:calc(32px + env(safe-area-inset-top)) 18px calc(40px + env(safe-area-inset-bottom));
  background:var(--bg);box-sizing:border-box;}
.install-card{width:100%;max-width:440px;background:var(--surface);border:1px solid var(--border);
  border-radius:18px;padding:30px 26px;text-align:center;box-shadow:var(--shadow-2);}
.install-logo{border-radius:18px;margin-bottom:14px;}
.install-card h1{margin:0 0 6px;font-size:22px;}
.install-sub{color:var(--text-3);font-size:14px;margin:0 0 22px;}
.install-tabs{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;margin:0 0 18px;}
.install-tab{flex:1 1 auto;min-width:78px;padding:9px 10px;border:1px solid var(--border);border-radius:10px;
  background:var(--surface);color:var(--text-2);font-weight:600;font-size:13px;cursor:pointer;}
.install-tab:hover{border-color:var(--accent);color:var(--accent);}
.install-tab.active{background:var(--accent);border-color:var(--accent);color:#fff;}
.install-panel{text-align:left;margin-bottom:6px;}
.install-platform{text-align:left;margin-bottom:8px;}
.install-platform h2{font-size:16px;margin:0 0 6px;}
.install-desc{color:var(--text-2);font-size:14px;margin:0 0 14px;}
.btn-block{width:100%;min-height:46px;justify-content:center;margin-bottom:10px;}
.install-hint{color:var(--text-3);font-size:12.5px;margin:6px 0 0;}
.install-steps{list-style:none;margin:0 0 6px;padding:0;}
.install-steps li{display:flex;align-items:center;gap:12px;padding:11px 12px;margin:8px 0;
  border:1px solid var(--border);border-radius:12px;background:var(--bg);font-size:14px;color:var(--text-2);}
.install-steps li span{flex:0 0 26px;height:26px;display:inline-flex;align-items:center;justify-content:center;
  border-radius:50%;background:var(--accent);color:#fff;font-weight:700;font-size:13px;}
.install-back{display:inline-block;margin-top:16px;color:var(--accent);font-weight:600;font-size:14px;text-decoration:none;}
.install-back:hover{text-decoration:underline;}

/* ==== safe-area (iPhone вырез / индикатор) ==== */
.mobile-bar{padding-bottom:calc(8px + env(safe-area-inset-bottom, 0px));}
.mobile-fab{bottom:calc(70px + env(safe-area-inset-bottom, 0px));}
