:root {
  --bg: #050816;
  --bg-elevated: #0f172a;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-strong: rgba(56, 189, 248, 0.3);
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --border-subtle: #1f2937;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --primary: #16a34a;
  --primary-hover: #15803d;
  --primary-soft: rgba(34, 197, 94, 0.15);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, 0.9);
  --btn-font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background: radial-gradient(circle at top left, #1f2937 0, #020617 45%, #000 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(20px);
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.1), rgba(15, 23, 42, 0.92));
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.header__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header__title {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.03em;
}

.main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 32px;
}

.card {
  position: relative;
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.06), rgba(15, 23, 42, 0.96));
  border-radius: 28px;
  padding: 24px 22px 22px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -120px;
  background:
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.06) 0, transparent 50%),
    radial-gradient(circle at 80% 10%, rgba(129, 140, 248, 0.08) 0, transparent 55%),
    radial-gradient(circle at 10% 90%, rgba(52, 211, 153, 0.05) 0, transparent 60%);
  opacity: 0.85;
  pointer-events: none;
}

.card__header {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
}

.card__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.card__subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Базовый стиль кнопок: без фона, только окантовка */
.button {
  border: 1px solid rgba(148, 163, 184, 0.45);
  cursor: pointer;
  font-family: var(--btn-font);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  min-height: 38px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  transition:
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

/* Кнопки в шапке — одинаковый размер (Обновить и К проекту) */
.button--header {
  min-width: 120px;
  padding: 8px 18px;
}

/* Обычные кнопки — зелёная окантовка */
.button--primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.button--secondary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
  padding-inline: 16px 18px;
  white-space: nowrap;
}

.button:disabled {
  opacity: 0.65;
  cursor: default;
}

.button--primary:not(:disabled):hover,
.button--secondary:not(:disabled):hover {
  color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.state {
  position: relative;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.state--info {
  background: var(--accent-soft);
  border: 1px solid var(--accent-strong);
}

.state--error {
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.state--muted {
  background: rgba(15, 23, 42, 0.7);
  border: 1px dashed rgba(148, 163, 184, 0.4);
  color: var(--text-muted);
}

.projects {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.project {
  position: relative;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 12px 13px 11px;
  display: grid;
  grid-template-columns: minmax(0, 230px) minmax(0, 1fr);
  gap: 10px 14px;
}

.project::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: conic-gradient(
    from 190deg,
    rgba(56, 189, 248, 0.7),
    rgba(129, 140, 248, 0.5),
    rgba(45, 212, 191, 0.8),
    rgba(56, 189, 248, 0.7)
  );
  opacity: 0;
  z-index: -1;
  transition: opacity 0.25s ease;
}

.project:hover::before {
  opacity: 0.35;
}

.project__header {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.project__header--clickable {
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.45);
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.project__header--clickable:hover {
  transform: translateY(-1px);
  background: rgba(15, 23, 42, 1);
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.85);
}

.project__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project__id {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.project__name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.project__delete-wrap {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

/* Критичные кнопки (удаление): только красная окантовка */
.button-delete-project {
  font-family: var(--btn-font);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  min-height: 38px;
  border-radius: var(--radius-pill);
  color: var(--danger);
  background: transparent;
  border: 1px solid var(--danger);
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.button-delete-project:hover {
  color: var(--danger-hover);
  border-color: var(--danger-hover);
  transform: translateY(-1px);
}

.button-delete-project:focus-visible {
  outline: 2px solid rgba(248, 113, 113, 0.8);
  outline-offset: 2px;
}

.button-delete-project:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.project__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project__files {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.project__files-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

.project__files-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.project__files-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
}

/* Обычные действия — только зелёная окантовка */
.button-add-file {
  font-family: var(--btn-font);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  min-height: 38px;
  border-radius: var(--radius-pill);
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.button-add-file:hover {
  color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.button-add-file:focus-visible {
  outline: 2px solid rgba(34, 197, 94, 0.5);
  outline-offset: 2px;
}

.button-match-pd-bim {
  font-family: var(--btn-font);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  min-height: 38px;
  border-radius: var(--radius-pill);
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.button-match-pd-bim:hover {
  color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.button-match-pd-bim:focus-visible {
  outline: 2px solid rgba(34, 197, 94, 0.5);
  outline-offset: 2px;
}

.button-match-pd-bim:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.45);
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  transition:
    background 0.16s ease,
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease;
}

.file-pill--button {
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.file-pill:hover {
  transform: translateY(-1px);
  background: rgba(15, 23, 42, 1);
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.85);
  color: #f9fafb;
}

.file-pill__name {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-pill__status {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--text-muted);
}

.file-pill__status--done {
  border-color: rgba(52, 211, 153, 0.75);
  color: #bbf7d0;
}

.file-pill__status--processing {
  border-color: rgba(56, 189, 248, 0.8);
  color: #bae6fd;
}

.file-pill__status--error {
  border-color: rgba(248, 113, 113, 0.8);
  color: #fecaca;
}

/* Кнопка «Новый проект» — только зелёная окантовка */
.new-project-wrap {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.button--new-project {
  font-family: var(--btn-font);
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  max-width: 480px;
  padding: 14px 24px;
  min-height: 38px;
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.button--new-project:hover {
  color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.button--new-project:focus-visible {
  outline: 2px solid rgba(34, 197, 94, 0.5);
  outline-offset: 2px;
}

/* Модальное окно */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(8px);
}

.modal__box {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.08), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-soft);
}

.modal__title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}

.modal__hint {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.modal__error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.modal__loading {
  margin-top: 12px;
  font-size: 13px;
  color: var(--accent);
}

.modal__file-name {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
}

.modal__file-status {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.file-card-jobs {
  margin: 16px 0;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.file-card-jobs__title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.file-card-jobs__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-card-job {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px 12px;
  font-size: 12px;
  color: var(--text);
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.file-card-job__id {
  font-weight: 600;
  color: var(--accent);
}

.file-card-job__type {
  color: var(--text-muted);
}

.file-card-job__status {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.file-card-job__date {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--text-muted);
}

.file-card-job__date + .file-card-job__date {
  margin-top: -4px;
}

.modal__actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Кнопка удаления в модалке — только красная окантовка */
.button--danger-outline {
  font-family: var(--btn-font);
  font-size: 14px;
  font-weight: 500;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.button--danger-outline:hover:not(:disabled) {
  color: var(--danger-hover);
  border-color: var(--danger-hover);
}

/* Dropzone */
.dropzone {
  position: relative;
  min-height: 140px;
  padding: 20px;
  border: 2px dashed rgba(148, 163, 184, 0.4);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.6);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(15, 23, 42, 0.8);
}

.dropzone.dropzone--active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone__input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.dropzone__text {
  display: block;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 8px;
}

.dropzone__files {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.dropzone__files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  padding: 4px 8px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.dropzone__files li {
  overflow: hidden;
}

.dropzone__files li span,
.dropzone__files li .dropzone__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone__remove {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--danger);
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.dropzone__remove:hover {
  color: var(--danger-hover);
  border-color: var(--danger-hover);
}

@media (max-width: 720px) {
  .project {
    grid-template-columns: minmax(0, 1fr);
  }
}

