:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --focus-ring: rgba(37, 99, 235, 0.25);
  --nav-active-bg: #eff6ff;

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --success: #15803d;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.03);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 600;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

p {
  margin: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

code,
pre {
  font-family: var(--font-mono);
}

/* Шапка и навигация */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background-color: var(--primary);
  flex-shrink: 0;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-link:hover {
  background-color: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

.nav-link[aria-current="page"] {
  background-color: var(--nav-active-bg);
  color: var(--primary);
  font-weight: 600;
}

@media (max-width: 639px) {
  .header-inner {
    padding: 10px 16px;
    min-height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .nav-list {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }
}

/* Контейнер и сетка */

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  flex: 1 0 auto;
}

.container-narrow {
  max-width: 420px;
}

@media (max-width: 639px) {
  .container {
    padding: 20px 16px 36px;
  }
}

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

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-md {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 639px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
}

.page-subtitle {
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-muted);
}

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

.text-sm {
  font-size: 14px;
}

.text-xs {
  font-size: 13px;
}

/* Карточки */

.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

@media (max-width: 639px) {
  .card {
    padding: 18px 20px;
  }
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-highlight {
  background-color: var(--primary-soft);
  border-color: #bfdbfe;
  border-left: 3px solid var(--primary);
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.tile-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.tile-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

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

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

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

.btn-secondary:hover {
  background-color: var(--surface-muted);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--surface-muted);
  color: var(--text);
}

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

.btn-danger:hover {
  background-color: #fee2e2;
  border-color: #fca5a5;
  color: var(--danger-hover);
}

.btn-sm {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* Формы и поля ввода */

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.input,
.select,
.textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
}

.input,
.select {
  height: 38px;
  padding: 8px 12px;
}

.textarea {
  padding: 10px 12px;
  resize: vertical;
}

.textarea-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 8px;
}

.auth-divider {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}

/* Уведомления */

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 16px;
}

.alert.error {
  background-color: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.alert.success {
  background-color: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

/* Списки резюме и промптов */

.item-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.item-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.item-description {
  font-size: 14px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.item-pre {
  margin: 4px 0 0;
  padding: 12px 14px;
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}

.item-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.item-actions form {
  margin: 0;
}

@media (max-width: 639px) {
  .item-card {
    flex-direction: column;
    align-items: stretch;
    padding: 18px 20px;
    gap: 14px;
  }

  .item-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* Пустые состояния */

.empty-state {
  text-align: center;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.empty-state-text {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 420px;
}

/* Метаданные профиля */

.meta-list {
  margin: 0;
  border-top: 1px solid var(--border);
}

.meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.meta-label {
  color: var(--text-muted);
  font-weight: 500;
}

.meta-value {
  color: var(--text);
  font-weight: 500;
  overflow-wrap: anywhere;
  text-align: right;
}

/* Генератор */

.generator-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.copy-status {
  font-size: 13px;
  color: var(--text-muted);
}

/* 404 */

.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
  gap: 12px;
}

.error-code {
  font-size: 64px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-muted);
}

/* Подвал */

.site-footer {
  border-top: 1px solid var(--border);
  background-color: var(--surface);
  padding: 16px 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
