:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  
  /* Цветовая палитра: белый, синий и голубой */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --primary-border: #bae6fd;
  
  --accent-cyan: #06b6d4;
  --accent-cyan-light: #ecfeff;
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  
  /* Цвета статусов */
  --status-ok-bg: #f0fdf4;
  --status-ok-text: #15803d;
  --status-ok-border: #bbf7d0;

  --status-info-bg: #eff6ff;
  --status-info-text: #1d4ed8;
  --status-info-border: #bfdbfe;

  --status-warn-bg: #fffbeb;
  --status-warn-text: #b45309;
  --status-warn-border: #fde68a;

  --status-error-bg: #fef2f2;
  --status-error-text: #b91c1c;
  --status-error-border: #fecaca;
  
  /* Размеры, скругления и тени */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* Компоновка */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 28px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  display: block;
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Основное содержимое */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 28px 48px;
  flex: 1;
}

/* Карточки показателей */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Сетка списка и подробностей */
.dashboard-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Карточки и панели */
.panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #ffffff;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Список проектов */
.project-list {
  list-style: none;
  max-height: 680px;
  overflow-y: auto;
}

.project-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-item:last-child {
  border-bottom: none;
}

.project-item:hover {
  background-color: var(--bg-surface-hover);
}

.project-item.active {
  background-color: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding-left: 16px;
}

.project-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.project-item-repo {
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: 4px;
}

.project-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 4px;
}

/* Вкладки панели подробностей */
.tabs-header {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background-color: #ffffff;
  padding: 0 16px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
  padding: 24px;
}

.tab-content.active {
  display: block;
}

/* Панель инструментов в заголовке подробностей */
.detail-toolbar {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.detail-info h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.detail-info p {
  font-size: 13px;
  color: var(--text-muted);
}

.detail-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  flex-wrap: wrap;
}

.detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.detail-meta-sep {
  color: var(--border-strong);
  font-size: 10px;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-surface-hover);
}

.btn-danger {
  background-color: var(--status-error-bg);
  border-color: var(--status-error-border);
  color: var(--status-error-text);
}

.btn-danger:hover:not(:disabled) {
  background-color: #fee2e2;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Таблицы */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #fafbfc;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

code {
  font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  background-color: #f1f5f9;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.table-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.table-link:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

.inline-icon {
  vertical-align: middle;
  flex-shrink: 0;
}

/* Метки статусов */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.4;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  display: inline-block;
  flex-shrink: 0;
}

.pill-success {
  background-color: var(--status-ok-bg);
  color: var(--status-ok-text);
  border-color: var(--status-ok-border);
}

.pill-info {
  background-color: var(--status-info-bg);
  color: var(--status-info-text);
  border-color: var(--status-info-border);
}

.pill-warn {
  background-color: var(--status-warn-bg);
  color: var(--status-warn-text);
  border-color: var(--status-warn-border);
}

.pill-danger {
  background-color: var(--status-error-bg);
  color: var(--status-error-text);
  border-color: var(--status-error-border);
}

.pill-neutral {
  background-color: #f1f5f9;
  color: var(--text-muted);
  border-color: var(--border-subtle);
}

/* Модальные окна */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalFadeIn 200ms ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background-color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Формы */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-main);
  background-color: #ffffff;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Состояния без данных */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
  color: var(--text-subtle);
}

.empty-state-icon svg {
  stroke-width: 1.6;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.empty-state-sub {
  font-size: 13px;
  max-width: 380px;
  margin: 0 auto;
}

/* Всплывающие уведомления */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  animation: toastSlideIn 200ms ease;
}

.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast.toast-error {
  border-left-color: var(--status-error-text);
}

.toast.toast-success {
  border-left-color: var(--status-ok-text);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Индикатор загрузки */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Постоянная карточка фоновой работы */
[hidden] { display: none !important; }
.workflow-panel { margin: 0 24px 16px; padding: 20px; border: 1px solid var(--primary-border); border-radius: 12px; background: #f5fbff; }
.workflow-panel[data-tone="success"] { border-color: var(--status-ok-border); background: #f7fcf8; }
.workflow-panel[data-tone="danger"] { border-color: var(--status-error-border); background: #fffafa; }
.workflow-panel[data-tone="warn"] { border-color: var(--status-warn-border); background: #fffdf7; }
.workflow-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.workflow-heading h3 { margin: 4px 0 0; font-size: 19px; }
.workflow-eyebrow { color: var(--text-muted); font-size: 12px; }
#workflowMessage { line-height: 1.6; margin: 14px 0 8px; overflow-wrap: anywhere; }
.workflow-dependency { font-family: monospace; overflow-wrap: anywhere; color: var(--primary-hover); }
.workflow-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 18px 0; }
.workflow-steps li { padding: 6px 10px; border-radius: 6px; font-size: 12px; color: var(--text-muted); background: #fff; border: 1px solid var(--border-subtle); }
.workflow-steps li.current { background: var(--primary); color: white; border-color: var(--primary); }
.workflow-steps li.current::before { content: '● '; }
.workflow-counts { display: flex; flex-wrap: wrap; gap: 12px 24px; font-size: 13px; }
.workflow-counts strong { margin-left: 6px; }
.workflow-footer { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-subtle); font-size: 11px; color: var(--text-muted); }
.workflow-results { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.workflow-result { color: var(--primary-hover); overflow-wrap: anywhere; font-weight: 600; }
.workflow-policy { margin: 0 24px 18px; font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.wrap-code { white-space: normal; overflow-wrap: anywhere; }
.version-change { color: var(--text-muted); margin-top: 5px; font-size: 12px; }
.update-note { min-width: 150px; max-width: 320px; white-space: normal; }
.update-note p { overflow-wrap: anywhere; white-space: pre-wrap; max-height: 240px; overflow-y: auto; }
.update-note summary { cursor: pointer; color: var(--primary-hover); }
.toast-dismiss { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 24px; margin-left: auto; padding: 0 6px; }
.toast-container { max-height: 70vh; overflow-y: auto; }
.toast { flex-shrink: 0; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
@media (max-width: 700px) {
  .workflow-panel { margin: 0 12px 12px; padding: 14px; }
  .workflow-heading { align-items: flex-start; }
  .workflow-heading h3 { font-size: 17px; }
  .workflow-policy { margin: 0 12px 12px; }
  .detail-toolbar, .detail-actions { flex-wrap: wrap; }
}
