/* [2026-03-28][CLX][V8-PROJLIST] Projects list — WorkHub telephony pattern
   Two-panel layout: fixed top (toolbar+stats) + scrollable bottom (filters+table)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Override .content when project list is active ── */
.content:has(.proj-top-panel) {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ═══ TOP PANEL (fixed, never scrolls) ═══ */
.proj-top-panel {
  flex-shrink: 0;
  background: var(--c-surface, var(--c-bg, #fff));
  border-bottom: 1px solid var(--c-border);
  padding: 8px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* ── Toolbar: left (segment + stats) + right (buttons) ── */
.proj-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.proj-toolbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.proj-toolbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Separator */
.proj-toolbar__sep {
  width: 1px;
  height: 20px;
  background: var(--c-border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── Segment toggle (Все / В работе / Завершённые / Архив) ── */
.proj-seg {
  display: inline-flex;
  border: 1px solid var(--c-border);
  border-radius: var(--radius, 6px);
  overflow: hidden;
  font-size: 12px;
}
.proj-seg__btn {
  padding: 6px 14px;
  background: var(--c-surface, #fff);
  color: var(--c-text-secondary, #64748b);
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
  font-size: inherit;
  font-family: inherit;
}
.proj-seg__btn:not(:last-child) {
  border-right: 1px solid var(--c-border);
}
.proj-seg__btn--active {
  background: var(--c-accent, #B87333);
  color: #fff;
  font-weight: 600;
}
.proj-seg__btn:hover:not(.proj-seg__btn--active) {
  background: var(--c-bg);
}

/* ── Inline stats ── */
.proj-inline-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}
.proj-istat {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 12px;
  white-space: nowrap;
}
.proj-istat__label {
  color: var(--c-text-muted);
  font-size: 11px;
}
.proj-istat__val {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
}
.proj-istat__val--warn {
  color: #d97706;
}
.proj-istat__val--danger {
  color: #dc2626;
}
@media (max-width: 1100px) {
  .proj-inline-stats { display: none; }
}

/* ── Icon buttons (Export, Settings, Analytics) ── */
.proj-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius, 6px);
  background: var(--c-surface, #fff);
  color: var(--c-text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
  font-family: inherit;
}
.proj-icon-btn:hover {
  border-color: var(--c-accent, #B87333);
  color: var(--c-accent, #B87333);
  background: rgba(184, 115, 51, .04);
}

/* ── Alert strip (overdue callbacks) ── */
.proj-alert-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  margin-top: 8px;
  border-radius: var(--radius, 6px);
  background: rgba(220, 38, 38, .06);
  border: 1px solid rgba(220, 38, 38, .15);
  color: #dc2626;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.proj-alert-strip:hover {
  background: rgba(220, 38, 38, .1);
}
.proj-alert-strip__text { flex: 1; }
.proj-alert-strip__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #dc2626;
  cursor: pointer;
  border-radius: var(--radius, 6px);
  opacity: .6;
  transition: opacity .15s;
}
.proj-alert-strip__close:hover { opacity: 1; }

/* ── Analytics cards (toggle via button) ── */
.proj-analytics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 8px 0 4px;
}
.proj-analytics--collapsed { display: none; }

.proj-analytics-card {
  background: var(--c-surface, #fff);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 12px;
}
.proj-analytics-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.proj-analytics-card__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.proj-analytics-card__val {
  font-size: 24px;
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.proj-analytics-card__val--danger { color: #dc2626; }
.proj-analytics-card__val--warn { color: #d97706; }
.proj-analytics-card__val--success { color: #16a34a; }
.proj-analytics-card__sub {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-top: 4px;
}

@media (max-width: 1200px) {
  .proj-analytics { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .proj-analytics { grid-template-columns: 1fr; }
}

/* ═══ BOTTOM PANEL (scrollable) ═══ */
.proj-bottom-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 24px;
  overflow: hidden;
}

/* ── Filters row ── */
.proj-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 0 6px;
  flex-shrink: 0;
}
.proj-filters select,
.proj-filters .input {
  width: auto; /* override components.css .select { width: 100% } */
  font-size: 13px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius, 6px);
  background: var(--c-surface, #fff);
  color: var(--c-text);
  font-family: inherit;
}
.proj-filters select {
  min-width: 120px;
  max-width: 200px;
  cursor: pointer;
}
.proj-search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
  max-width: 280px;
}
.proj-search-wrap .input {
  width: 100%;
  padding-right: 30px;
}
.proj-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--c-text-muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
  transition: background .15s, color .15s;
}
.proj-search-clear:hover {
  background: rgba(0,0,0,.04);
  color: var(--c-text);
}
.proj-reset-btn {
  font-size: 12px;
  color: var(--c-text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 4px 8px;
  border-radius: var(--radius, 6px);
  transition: all .15s;
  font-family: inherit;
}
.proj-reset-btn:hover {
  background: rgba(0,0,0,.04);
  color: var(--c-text);
}

/* ═══ TABLE (scrollable zone with sticky header) ═══ */
.proj-table-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* Override the old .proj-table grid with real <table> */
table.proj-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

table.proj-tbl th {
  position: sticky;
  top: 0;
  z-index: 9;
  background: var(--c-surface, var(--c-bg, #fff));
  text-align: left;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  border-bottom: 2px solid var(--c-border);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,.06);
  user-select: none;
}
table.proj-tbl th:hover {
  color: var(--c-text-secondary);
}
table.proj-tbl th .sort-arrow {
  font-size: 10px;
  margin-left: 2px;
  opacity: 0.4;
}
table.proj-tbl th.sort-active .sort-arrow {
  opacity: 1;
  color: var(--c-accent, #B87333);
}

table.proj-tbl td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
table.proj-tbl td.proj-cell--client {
  white-space: normal;
  line-height: 1.3;
  max-width: 220px;
}
table.proj-tbl tbody tr {
  cursor: pointer;
  transition: background .15s;
}
table.proj-tbl tbody tr:hover {
  background: var(--c-bg);
}

/* ── Specific column styles ── */
.proj-cell--studio { color: var(--c-primary); font-weight: 500; }
.proj-cell--rooms { text-align: center; color: var(--c-text-muted); }
.proj-cell--price { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.proj-cell--actions {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
  white-space: nowrap;
}
.proj-cell--actions .btn { padding: 2px 4px; font-size: .7rem; }

/* ── Progress bar (slots filled) ── */
.proj-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
}
.proj-progress__bar {
  width: 40px;
  height: 4px;
  background: var(--c-border);
  border-radius: 2px;
  overflow: hidden;
}
.proj-progress__fill {
  height: 100%;
  border-radius: 2px;
  background: var(--c-accent, #B87333);
  transition: width .3s;
}
.proj-progress__fill--done {
  background: #16a34a;
}

/* ── Callback date indicator ── */
.proj-callback {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.proj-callback__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.proj-callback__dot--overdue { background: #dc2626; }
.proj-callback__dot--today { background: #d97706; }
.proj-callback__dot--upcoming { background: #16a34a; }
.proj-callback__dot--none { background: var(--c-border); }

/* ── B24 sync icon ── */
.proj-b24-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-decoration: none;
  transition: all .15s;
}
.proj-b24-icon--synced {
  background: rgba(22, 163, 74, .1);
  color: #16a34a;
}
.proj-b24-icon--synced:hover {
  background: rgba(22, 163, 74, .2);
}
.proj-b24-icon--none {
  background: rgba(0,0,0,.04);
  color: var(--c-text-muted);
  opacity: .5;
}

/* ── Date column ── */
.proj-cell--date {
  font-size: 12px;
  color: var(--c-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ═══ DEV COLUMNS (1С — not yet synced) ═══ */
.proj-col--dev {
  position: relative;
  cursor: help;
}
table.proj-tbl th.proj-col--dev {
  color: var(--c-text-muted);
  opacity: 0.45;
}
table.proj-tbl td.proj-col--dev {
  opacity: 0.35;
  color: var(--c-text-muted);
  font-style: italic;
  font-size: 11px;
}
table.proj-tbl td.proj-col--dev::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg, transparent, transparent 4px,
    rgba(0,0,0,.015) 4px, rgba(0,0,0,.015) 8px
  );
  pointer-events: none;
}
table.proj-tbl th.proj-col--dev:hover,
table.proj-tbl td.proj-col--dev:hover {
  opacity: 0.7;
}

/* ── Table footer (totals) ── */
.proj-table-footer {
  flex-shrink: 0;
  padding: 8px 0;
  font-size: 12px;
  color: var(--c-text-muted);
  display: flex;
  gap: 16px;
  border-top: 1px solid var(--c-border);
}
.proj-table-footer strong {
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1400px) {
  /* Hide 1C columns on smaller screens */
  .proj-col--1c-status,
  .proj-col--1c-ship,
  .proj-col--1c-total { display: none; }
}
@media (max-width: 1200px) {
  .proj-col--1c-num,
  .proj-col--1c-status,
  .proj-col--1c-ship,
  .proj-col--1c-total { display: none; }
  .proj-col--logistics,
  .proj-col--stage { display: none; }
}
@media (max-width: 900px) {
  .proj-col--production,
  .proj-col--logistics,
  .proj-col--stage,
  .proj-col--b24,
  .proj-col--callback,
  .proj-col--progress { display: none; }
  .proj-top-panel { padding: 8px 16px; }
  .proj-bottom-panel { padding: 0 16px; }
  .proj-toolbar__right .proj-icon-btn span { display: none; }
}
