/* ============================================================================
   GALLERY CRM — DESIGN SYSTEM v1.0
   Сеть салонов «Галерея красоты» · Омск
   Все будущие страницы строятся из этих блоков.
   Источник: прототип gallery-crm-bx0p.zai-ai.site
   ========================================================================== */

/* ============ 1. TOKENS ============ */

:root {
  /* --- Цвета бренда --- */
  --purple:        #a159b3;
  --purple-d:      #8a44a0;
  --purple-bg:     #f3e8f6;
  --purple-grad:   linear-gradient(135deg, #a159b3, #8a44a0);

  /* --- Нейтральные --- */
  --ink:           #1e2323;
  --bg:            #f7f5f9;
  --card:          #ffffff;
  --lav:           #e5d8e9;
  --line:          #e9e2ee;
  --muted:         #7d7686;

  /* --- Семантические --- */
  --green:         #2e7d4f;  --green-bg:  #e3f3ea;
  --amber:         #b97f1f;  --amber-bg:  #fdf3e0;
  --red:           #b3413f;  --red-bg:    #fbe9e8;
  --blue:          #3f6fb3;  --blue-bg:   #e8effa;
  --pink:          #c2447f;  --pink-bg:   #fbe7f1;
  --grey:          #5f6a68;  --grey-bg:   #eceff0;

  /* --- Стекло (glassmorphism) --- */
  --glass-bg:      rgba(255,255,255,.82);
  --glass-border:  rgba(161,89,179,.12);
  --glass-blur:    blur(24px);

  /* --- Типографика --- */
  --font-serif:    'Playfair Display', Georgia, serif;
  --font-sans:     'Inter', -apple-system, sans-serif;

  /* --- Размеры --- */
  --text-xs:       11px;
  --text-sm:       12.5px;
  --text-base:     14px;
  --text-md:       15px;
  --text-lg:       17px;
  --text-xl:       20px;
  --text-2xl:      24px;
  --text-kpi:      28px;

  /* --- Отступы (spacing scale) --- */
  --sp-xs:         4px;
  --sp-sm:         8px;
  --sp-md:         12px;
  --sp-lg:         16px;
  --sp-xl:         24px;
  --sp-2xl:        32px;
  --sp-3xl:        48px;

  /* --- Скругления --- */
  --r-sm:          6px;
  --r-md:          10px;
  --r-lg:          12px;
  --r-xl:          16px;
  --r-full:        999px;

  /* --- Тени --- */
  --shadow-xs:     0 1px 3px rgba(30,35,35,.06);
  --shadow-sm:     0 2px 8px rgba(161,89,179,.05);
  --shadow-md:     0 4px 14px rgba(161,89,179,.1);
  --shadow-lg:     0 8px 32px rgba(161,89,179,.12);
  --shadow-glow:   0 0 0 3px rgba(161,89,179,.15);
  --shadow-btn:    0 4px 14px rgba(161,89,179,.25);

  /* --- Переходы --- */
  --ease:          cubic-bezier(.22,.61,.36,1);
  --ease-bounce:   cubic-bezier(.34,1.56,.64,1);
  --dur-fast:      .15s;
  --dur:           .25s;
  --dur-slow:      .4s;

  /* --- Layout --- */
  --sidebar-w:     270px;
  --sidebar-w-min: 74px;
  --topbar-h:      64px;
  --content-max:   1600px;
}

/* ============ 2. RESET ============ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: linear-gradient(160deg, #f7f5f9 0%, #f0e8f4 40%, #ece0f0 100%);
  background-attachment: fixed;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--purple-d); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ 3. LAYOUT ============ */

.container {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: var(--sp-xl);
}

.grid { display: grid; gap: var(--sp-lg); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }
.gap-lg { gap: var(--sp-lg); }

/* ============ 4. TYPOGRAPHY ============ */

.h1 { font-family: var(--font-serif); font-size: var(--text-xl); font-weight: 700; color: var(--ink); }
.h2 { font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600; color: var(--ink); }
.h3 { font-family: var(--font-serif); font-size: var(--text-base); font-weight: 600; color: var(--ink); }
.text-muted { color: var(--muted); font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.num { font-variant-numeric: tabular-nums; }

.brand-gradient {
  background: linear-gradient(90deg, var(--ink), var(--purple), var(--ink));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 7s linear infinite;
}

/* ============ 5. BUTTONS ============ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 12px 24px;
  border: 0;
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-decoration: none !important;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--purple-grad);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(161,89,179,.35);
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  color: var(--purple-d);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover { background: var(--purple-bg); border-color: var(--purple); }

.btn-danger {
  background: rgba(179,65,63,.05);
  color: var(--red);
  border: 1.5px solid rgba(179,65,63,.2);
}
.btn-danger:hover { background: var(--red-bg); border-color: rgba(179,65,63,.4); }

.btn-sm { padding: 8px 16px; font-size: var(--text-sm); border-radius: var(--r-sm); }
.btn-xs { padding: 5px 12px; font-size: var(--text-xs); border-radius: var(--r-sm); }
.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  width: 40px; height: 40px;
  padding: 0;
  justify-content: center;
  border-radius: var(--r-md);
}
.btn-icon svg { width: 20px; height: 20px; }

/* ============ 6. CARDS ============ */

.card {
  background: var(--card);
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  padding: var(--sp-xl);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  box-shadow: var(--shadow-sm);
}
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.card-static { transition: none; }
.card-static:hover { transform: none; box-shadow: var(--shadow-sm); }

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  padding: var(--sp-xl);
}

.card-flush { padding: 0; overflow: hidden; }

/* ============ 7. KPI TILES ============ */

.kpi {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}
.kpi .kpi-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  font-weight: 600;
}
.kpi .kpi-value {
  font-size: var(--text-kpi);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.kpi .kpi-value.purple { color: var(--purple); }
.kpi .kpi-value.green  { color: var(--green); }
.kpi .kpi-value.red    { color: var(--red); }
.kpi .kpi-value.amber  { color: var(--amber); }
.kpi .kpi-sub {
  font-size: var(--text-sm);
  color: var(--muted);
}

/* ============ 8. PROGRESS BARS ============ */

.pf-track {
  position: relative;
  height: 9px;
  border-radius: var(--r-full);
  background: var(--lav);
  overflow: hidden;
  flex: 1;
}
.pf-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, #8a44a0, #a159b3, #c98ad6);
  animation: growBar .9s var(--ease) both;
  overflow: hidden;
}
.pf-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 34%, rgba(255,255,255,.5) 50%, transparent 66%);
  background-size: 200% 100%;
  animation: sheen 4.2s var(--ease) infinite;
}
.pf-row {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  margin-top: var(--sp-xs);
}
.pf-row .pf-fact {
  min-width: 60px;
  text-align: right;
  font-weight: 700;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.pf-row .pf-plan {
  min-width: 60px;
  font-size: var(--text-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pf-pct { min-width: 36px; text-align: right; font-weight: 700; font-size: var(--text-sm); }

.pct-ok   { color: #1d9a6c; }
.pct-mid  { color: #c07f10; }
.pct-low  { color: var(--red); }
.pct-month{ color: var(--purple); }

/* ============ 9. STATUS BADGES ============ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red   { background: var(--red-bg);   color: var(--red); }
.badge-blue  { background: var(--blue-bg);  color: var(--blue); }
.badge-pink  { background: var(--pink-bg);  color: var(--pink); }
.badge-grey  { background: var(--grey-bg);  color: var(--grey); }
.badge-purple{ background: var(--purple-bg);color: var(--purple-d); }

/* ============ 10. CHIPS (фильтры, метаданные) ============ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.chip:hover { border-color: var(--purple); color: var(--purple-d); }
.chip.active {
  background: var(--purple-bg);
  border-color: var(--purple);
  color: var(--purple-d);
  font-weight: 600;
}
.chip .count {
  background: var(--purple);
  color: #fff;
  border-radius: var(--r-full);
  padding: 1px 7px;
  font-size: var(--text-xs);
  font-weight: 700;
}

/* ============ 11. TASK ITEMS ============ */

.task {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: 14px var(--sp-lg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: all var(--dur) var(--ease);
  position: relative;
}
.task:hover {
  border-color: var(--purple);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.task.hot {
  animation: glowPulse 2.6s ease-in-out infinite;
}
.task.done {
  opacity: .5;
  border-style: dashed;
}
.task .task-chip {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.task .task-name {
  font-weight: 600;
  font-size: var(--text-base);
}
.task .task-meta {
  font-size: var(--text-xs);
  color: var(--muted);
}

/* ============ 12. FORMS ============ */

.form-group { margin-bottom: var(--sp-lg); }
.form-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background: var(--card);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.form-control:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: var(--shadow-glow);
}
.form-control::placeholder { color: var(--muted); opacity: .7; }
.form-control:disabled { background: var(--bg); cursor: not-allowed; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d7686' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
  cursor: pointer;
}

textarea.form-control { resize: vertical; min-height: 80px; }

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

/* ============ 13. TABLES ============ */

.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}
table.data th {
  text-align: left;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  font-weight: 600;
  padding: 12px var(--sp-lg);
  border-bottom: 2px solid var(--purple);
  white-space: nowrap;
}
table.data td {
  padding: 13px var(--sp-lg);
  border-bottom: 1px solid var(--line);
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--purple-bg); }
table.data .num { font-variant-numeric: tabular-nums; text-align: right; }

/* ============ 14. MODAL ============ */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(30,35,35,.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  overflow-y: auto;
  padding: 36px 18px;
  animation: fadeIn .2s ease;
}

.modal {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--r-xl);
  padding: var(--sp-xl);
  position: relative;
  animation: modalIn .35s var(--ease);
  box-shadow: 0 24px 64px rgba(0,0,0,.15);
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  transform: rotate(90deg);
}

/* ============ 15. TOAST ============ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--r-md);
  font-size: var(--text-base);
  opacity: 0;
  pointer-events: none;
  transition: all var(--dur) var(--ease);
  z-index: 300;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 16. ANIMATIONS ============ */

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(26px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.14); } 100% { transform: scale(1); opacity: 1; } }
@keyframes glowPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(161,89,179,.3); } 50% { box-shadow: 0 0 0 7px rgba(161,89,179,0); } }
@keyframes shimmer { to { background-position: 200% 50%; } }
@keyframes growBar { from { width: 0; } }
@keyframes sheen { 0% { background-position: 200% 0; } 55%,100% { background-position: -200% 0; } }
@keyframes pulseDot { 0%,100% { box-shadow: 0 0 0 0 rgba(29,154,108,.45); } 50% { box-shadow: 0 0 0 5px rgba(29,154,108,0); } }

.anim-in { animation: fadeUp .5s var(--ease) both; }
.anim-pop { animation: popIn .5s var(--ease-bounce) both; }
.anim-slide { animation: slideIn .4s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============ 17. UTILITIES ============ */

.mt-xs { margin-top: var(--sp-xs); }
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.mt-xl { margin-top: var(--sp-xl); }
.mb-sm { margin-bottom: var(--sp-sm); }
.mb-md { margin-bottom: var(--sp-md); }
.mb-lg { margin-bottom: var(--sp-lg); }
.mb-xl { margin-bottom: var(--sp-xl); }
.p-md { padding: var(--sp-md); }
.p-lg { padding: var(--sp-lg); }
.p-xl { padding: var(--sp-xl); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.visible { display: block; }

.w-full { width: 100%; }
.rounded-full { border-radius: var(--r-full); }

/* ============ 18. RESPONSIVE ============ */

@media (max-width: 768px) {
  .container { padding: var(--sp-lg); }
  .kpi .kpi-value { font-size: var(--text-xl); }
  .grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .btn { width: 100%; justify-content: center; }
  .btn-sm, .btn-xs { width: auto; }
  .modal { padding: var(--sp-lg); margin: var(--sp-sm); }
}
