/* ==========================================================================
   Doro Moliya — POS-кредитование
   Дизайн-система на основе цветовой палитры заказчика (см. Colors reference)
   ========================================================================== */

:root {
  /* --- Базовая палитра (из референса Colors) --- */
  --c-ink:        #070e12;  /* тёмный — сайдбар, основной текст */
  --c-white:      #ffffff;
  --c-blue-600:   #0677e8;  /* основной акцент — кнопки, ссылки, активные состояния */
  --c-blue-500:   #51a0ef;
  --c-blue-400:   #83bbf3;
  --c-blue-300:   #9bc9f6;
  --c-blue-100:   #cde4fa;
  --c-blue-50:    #e1effc;
  --c-teal-200:   #a7d7e7;  /* дополнительный акцент (андеррайтер/инфо-блоки) */
  --c-gray-300:   #c8c9cd;
  --c-gray-200:   #dadada;
  --c-gray-100:   #f3f3f5;
  --c-gray-50:    #f8f8fa;

  /* --- Функциональные цвета статусов (раздел 6 ТЗ: зелёный/красный/жёлтый) --- */
  --c-success:      #1a9b5c;
  --c-success-bg:   #e3f6ec;
  --c-danger:       #d23b3b;
  --c-danger-bg:    #fbe9e9;
  --c-warning:      #c78a12;
  --c-warning-bg:   #fbf1dd;
  --c-info-bg:      var(--c-blue-50);

  /* --- Семантика --- */
  --bg-app:       var(--c-gray-100);
  --bg-card:      var(--c-white);
  --bg-sidebar:   var(--c-ink);
  --text-main:    #14202b;
  --text-muted:   #6b7784;
  --text-inverse: var(--c-white);
  --border-color: var(--c-gray-200);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-card: 0 1px 2px rgba(7,14,18,0.04), 0 4px 16px rgba(7,14,18,0.06);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--c-blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 4px 0; font-weight: 700; color: var(--c-ink); }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 8px 0; }
.text-muted { color: var(--text-muted); }
.small { font-size: 13px; }

/* ---------------- Layout: сайдбар + контент ---------------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px 8px; }
.sidebar .brand .logo-dot {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--c-blue-600), var(--c-blue-400));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--c-white); font-size: 15px;
}
.sidebar .brand .brand-text { font-weight: 700; font-size: 15px; line-height: 1.15; }
.sidebar .brand .brand-text small { display: block; font-weight: 400; font-size: 11px; color: var(--c-gray-300); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  color: #c7d1da; text-decoration: none;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,0.06); color: var(--c-white); }
.nav a.active { background: var(--c-blue-600); color: var(--c-white); }
.nav .nav-icon { width: 18px; text-align: center; opacity: 0.9; }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 12px; margin-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--c-blue-500); color: var(--c-white);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.user-chip .meta { font-size: 12px; line-height: 1.3; }
.user-chip .meta .name { color: var(--c-white); font-weight: 600; font-size: 13px; }
.logout-link { display: block; margin-top: 8px; font-size: 13px; color: #c7d1da; cursor: pointer; }
.logout-link:hover { color: var(--c-white); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; background: var(--bg-card); border-bottom: 1px solid var(--border-color);
}
.topbar .title-block .eyebrow { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.content { padding: 24px 28px; flex: 1; }
.content.narrow { max-width: 620px; margin: 0 auto; width: 100%; }

/* ---------------- Карточки / панели ---------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 18px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .app-shell { flex-direction: column; } .sidebar { width: 100%; } }

/* ---------------- Формы ---------------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-main); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=tel], input[type=number], input[type=email], select, textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--border-color); border-radius: var(--radius-sm);
  font-size: 14px; background: var(--c-white); color: var(--text-main); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--c-blue-600); box-shadow: 0 0 0 3px var(--c-blue-50); }
.field { margin-bottom: 16px; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.error-text { font-size: 12px; color: var(--c-danger); margin-top: 4px; }

/* ---------------- Кнопки ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm); border: none;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: filter .12s ease, transform .05s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--c-blue-600); color: var(--c-white); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { background: var(--c-gray-300); cursor: not-allowed; }
.btn-secondary { background: var(--c-gray-100); color: var(--text-main); border: 1.5px solid var(--border-color); }
.btn-secondary:hover { background: var(--c-gray-200); }
.btn-danger { background: var(--c-danger); color: var(--c-white); }
.btn-success { background: var(--c-success); color: var(--c-white); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-link { background: none; border: none; color: var(--c-blue-600); cursor: pointer; font-weight: 600; font-size: 14px; padding: 0; }

/* ---------------- Бейджи статусов ---------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; }
.badge-success { background: var(--c-success-bg); color: var(--c-success); }
.badge-success .badge-dot { background: var(--c-success); }
.badge-danger { background: var(--c-danger-bg); color: var(--c-danger); }
.badge-danger .badge-dot { background: var(--c-danger); }
.badge-warning { background: var(--c-warning-bg); color: var(--c-warning); }
.badge-warning .badge-dot { background: var(--c-warning); }
.badge-neutral { background: var(--c-gray-100); color: var(--text-muted); }
.badge-neutral .badge-dot { background: var(--c-gray-300); }
.badge-info { background: var(--c-blue-50); color: var(--c-blue-600); }
.badge-info .badge-dot { background: var(--c-blue-600); }

/* ---------------- Таблицы ---------------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); padding: 10px 12px; border-bottom: 1.5px solid var(--border-color); }
td { padding: 12px; border-bottom: 1px solid var(--border-color); }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--c-gray-50); }

/* ---------------- Stat-карточки (дашборды) ---------------- */
.stat-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 18px 20px; }
.stat-card .value { font-size: 28px; font-weight: 800; color: var(--c-ink); }
.stat-card .label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---------------- Шаги мастера (wizard) ---------------- */
.wizard-steps { display: flex; align-items: center; gap: 4px; margin-bottom: 22px; }
.wizard-steps .step { display: flex; align-items: center; gap: 8px; }
.wizard-steps .step .dot {
  width: 26px; height: 26px; border-radius: 50%; background: var(--c-gray-200); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.wizard-steps .step.done .dot { background: var(--c-blue-600); color: var(--c-white); }
.wizard-steps .step.active .dot { background: var(--c-blue-600); color: var(--c-white); box-shadow: 0 0 0 4px var(--c-blue-50); }
.wizard-steps .step .label { font-size: 12px; color: var(--text-muted); }
.wizard-steps .step.active .label { color: var(--c-ink); font-weight: 600; }
.wizard-steps .sep { flex: 1; height: 2px; background: var(--c-gray-200); }
.wizard-steps .sep.done { background: var(--c-blue-600); }

/* ---------------- OTP ввод ---------------- */
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin: 18px 0; }
.otp-inputs input {
  width: 52px; height: 60px; text-align: center; font-size: 26px; font-weight: 700;
  border: 1.5px solid var(--border-color); border-radius: var(--radius-sm);
}
.otp-inputs input:focus { border-color: var(--c-blue-600); }
.otp-timer { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 4px; }

/* ---------------- Utility ---------------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; gap: 10px; align-items: center; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; }
.text-center { text-align: center; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.divider { height: 1px; background: var(--border-color); margin: 16px 0; }
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 1000;
  background: var(--c-ink); color: var(--c-white); padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 14px; box-shadow: var(--shadow-card); max-width: 360px;
}
.toast.error { background: var(--c-danger); }
.toast.success { background: var(--c-success); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.4); border-top-color: var(--c-white);
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Login screen (01) ---------------- */
.login-shell { min-height: 100vh; display: flex; }
.login-aside {
  flex: 1; background: linear-gradient(160deg, var(--c-ink) 0%, #0c1b26 60%, var(--c-blue-600) 140%);
  color: var(--c-white); display: flex; flex-direction: column; justify-content: center; padding: 60px;
}
.login-aside .ring { width: 74px; height: 74px; border-radius: 50%; border: 3px solid var(--c-blue-400); margin-bottom: 28px; }
.login-aside h1 { color: var(--c-white); font-size: 30px; margin-bottom: 10px; }
.login-aside p { color: #a9c3d8; font-size: 14px; max-width: 320px; }
.login-form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--bg-app); }
.login-card { width: 100%; max-width: 380px; }

/* Печатная форма (акт) — печатается через window.print() */
@media print {
  .no-print { display: none !important; }
  .print-only { display: block !important; }
  body { background: var(--c-white); }
}
.print-only { display: none; }
