/* === IPG Design System v1 === */
:root {
  --ink: #0f172a;
  --ink-soft: #64748b;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #059669;
  --red: #dc2626;
  --violet: #7c3aed;
  --amber: #d97706;

  --card-bg: rgba(255,255,255,0.92);
  --border: rgba(15,23,42,0.08);

  --radius-card: 20px;
  --radius-btn: 12px;
  --radius-input: 12px;
  --radius-modal: 18px;

  --shadow-card: 0 10px 30px rgba(15,23,42,0.06);
  --shadow-btn: 0 6px 14px -6px rgba(37,99,235,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100vh; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 0% 0%, #dbeafe 0%, transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, #ede9fe 0%, transparent 55%),
    radial-gradient(900px 700px at 50% 100%, #cffafe 0%, transparent 60%),
    linear-gradient(180deg, #eef2ff 0%, #f5f3ff 50%, #ecfeff 100%);
  background-attachment: fixed;
  padding: 24px 18px;
}

.container { max-width: 1280px; margin: 0 auto; }

/* === Шапка === */
.ipg-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 14px;
  padding: 16px 22px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 18px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset, 0 12px 40px rgba(30,64,175,0.08);
  margin-bottom: 18px;
}
.ipg-header .brand { display: flex; align-items: center; gap: 12px; }
.ipg-header .brand-logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 8px 20px rgba(37,99,235,0.35);
  flex-shrink: 0;
}
.ipg-header .brand-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.ipg-header .brand-sub { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
.ipg-header .user-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.ipg-header .uname { color: var(--ink-soft); padding-right: 10px; border-right: 1px solid var(--border); }
.ipg-header .uname b { color: var(--ink); }
.ipg-header .user-nav a {
  text-decoration: none; padding: 7px 13px; border-radius: 9px;
  font-weight: 600; font-size: 12.5px; transition: all 0.18s;
}
.ipg-header .user-nav a.profile { color: #1d4ed8; background: rgba(219,234,254,0.9); }
.ipg-header .user-nav a.profile:hover { background: #bfdbfe; }
.ipg-header .user-nav a.admin { color: #b91c1c; background: rgba(254,226,226,0.9); }
.ipg-header .user-nav a.admin:hover { background: #fecaca; }
.ipg-header .user-nav a.logout { color: #475569; background: rgba(241,245,249,0.9); }
.ipg-header .user-nav a.logout:hover { background: #e2e8f0; }
.ipg-header .user-nav a.back { color: #1d4ed8; background: transparent; border: 1.5px solid #bfdbfe; }
.ipg-header .user-nav a.back:hover { background: #eff6ff; border-color: var(--blue); }

/* === Карточки === */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: var(--radius-card);
  padding: 22px 26px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}

/* === Заголовки === */
h1, .h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 10px; }
h2, .h2 { font-size: 16px; font-weight: 700; color: #1e3a8a; margin-bottom: 12px; letter-spacing: -0.01em; }
h3, .h3 { font-size: 14px; font-weight: 700; color: #1e3a8a; margin-bottom: 10px; }

/* === Кнопки === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  font-family: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer; border: none;
  transition: all 0.2s; white-space: nowrap; line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -8px rgba(15,23,42,0.3); }
.btn:active { transform: translateY(0); }

.btn-primary { background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; box-shadow: var(--shadow-btn); }
.btn-secondary { background: rgba(255,255,255,0.9); color: #1d4ed8; border: 1.5px solid #bfdbfe; }
.btn-secondary:hover { border-color: var(--blue); background: #eff6ff; }
.btn-green { background: linear-gradient(135deg, #059669, #10b981); color: #fff; box-shadow: 0 6px 14px -6px rgba(5,150,105,0.5); }
.btn-red { background: linear-gradient(135deg, #dc2626, #ef4444); color: #fff; box-shadow: 0 6px 14px -6px rgba(220,38,38,0.5); }
.btn-ai { background: linear-gradient(135deg, #7c3aed, #c026d3); color: #fff; box-shadow: 0 6px 14px -6px rgba(124,58,237,0.5); }
.btn-small { padding: 7px 13px; font-size: 13px; }

.btn:disabled, .btn-ai:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* === Поля === */
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-input);
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: #fff; transition: all 0.15s; outline: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }

.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; letter-spacing: 0.01em; }

/* === Бейджи === */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-violet { background: #ede9fe; color: #5b21b6; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* === Модалка === */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-overlay.active { display: flex; animation: ipgFade 0.2s ease-out; }
@keyframes ipgFade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: #fff; border-radius: var(--radius-modal);
  padding: 26px; max-width: 720px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 30px 80px -20px rgba(15,23,42,0.4);
  animation: ipgSlide 0.25s cubic-bezier(0.16,1,0.3,1);
}
@keyframes ipgSlide {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* === Flash === */
.flash { padding: 12px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; border-left: 4px solid; }
.flash-success { background: #ecfdf5; color: #065f46; border-color: #10b981; }
.flash-error { background: #fef2f2; color: #991b1b; border-color: #ef4444; }
.flash-info { background: #eff6ff; color: #1e40af; border-color: #3b82f6; }

/* === Утилиты === */
.row-flex { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.text-soft { color: var(--ink-soft); font-size: 13px; }

/* === Мобильные === */
@media (max-width: 640px) {
  body { padding: 14px 12px; }
  .card { padding: 16px 18px; border-radius: 16px; }
  .ipg-header { padding: 14px 18px; border-radius: 16px; }
  .ipg-header .brand-logo { width: 38px; height: 38px; font-size: 18px; }
  .ipg-header .brand-title { font-size: 15px; }
  .ipg-header .user-nav .uname { display: none; }
  .btn { padding: 9px 14px; font-size: 13px; }
}
