/* ФОП Монітор — світла тема: білий, сірий, синій, зелений */
:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #eff6ff;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --red: #dc2626;
  --orange: #ea580c;
  --yellow: #ca8a04;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  font-size: 14.5px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.lucide { width: 18px; height: 18px; vertical-align: -3px; }

/* ---------- Розмітка ---------- */
.layout { display: flex; min-height: 100vh; }
.content { flex: 1; padding: 28px 32px; max-width: 1280px; }

/* ---------- Сайдбар ---------- */
.sidebar {
  width: 240px; min-height: 100vh; background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px; font-weight: 700; font-size: 17px; color: var(--blue);
  border-bottom: 1px solid var(--gray-100);
}
.logo svg { width: 26px; height: 26px; }
.sidebar nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: var(--gray-700); font-weight: 500;
}
.sidebar nav a:hover { background: var(--gray-50); text-decoration: none; }
.sidebar nav a.active { background: var(--blue-light); color: var(--blue); }
.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip svg { width: 30px; height: 30px; color: var(--gray-400); }
.user-name { font-weight: 600; font-size: 13.5px; }
.user-role { font-size: 12px; color: var(--gray-500); }
.logout { color: var(--gray-400); padding: 6px; border-radius: 8px; }
.logout:hover { color: var(--red); background: var(--gray-50); }

/* ---------- Заголовок сторінки ---------- */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h1 {
  margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px;
}
.page-head h1 svg { width: 24px; height: 24px; color: var(--blue); }
.page-head .subtitle { font-size: 15px; color: var(--gray-500); font-weight: 400; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Пошук ---------- */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--gray-200); border-radius: 10px;
  padding: 9px 14px; min-width: 340px; box-shadow: var(--shadow);
}
.search-box svg { width: 17px; height: 17px; color: var(--gray-400); flex-shrink: 0; }
.search-box input { border: 0; outline: 0; flex: 1; font-size: 14px; background: transparent; }

/* ---------- Статистика ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 22px;
}
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 18px 20px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue   { background: var(--blue-light); color: var(--blue); }
.stat-icon.green  { background: var(--green-light); color: var(--green); }
.stat-icon.orange { background: #fff7ed; color: var(--orange); }
.stat-icon.red    { background: #fef2f2; color: var(--red); }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--gray-500); }

/* ---------- Картки ---------- */
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 24px; margin-bottom: 20px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.card-head h2 {
  margin: 0; font-size: 16px; display: flex; align-items: center; gap: 9px;
}
.card-head h2 svg { width: 19px; height: 19px; color: var(--blue); }
.prro-card.inactive { opacity: .65; }
.empty { color: var(--gray-500); text-align: center; padding: 24px 0; margin: 0; }

/* ---------- Таблиці ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--gray-500); padding: 8px 12px; border-bottom: 2px solid var(--gray-100);
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--gray-100); }
.table tr:hover td { background: var(--gray-50); }
.nowrap { white-space: nowrap; }
.row-actions { white-space: nowrap; }

/* ---------- Бейджі ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-green  { background: var(--green-light); color: var(--green); }
.badge-blue   { background: var(--blue-light); color: var(--blue); }
.badge-gray   { background: var(--gray-100); color: var(--gray-500); }
.badge-red    { background: #fef2f2; color: var(--red); }
.badge-orange { background: #fff7ed; color: var(--orange); }
.badge-yellow { background: #fefce8; color: var(--yellow); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; border-radius: 10px; padding: 10px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--green); color: #fff; }
.btn-secondary:hover { background: #15803d; }
.btn-ghost { background: var(--gray-100); color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-200); }
.btn-danger { background: #fef2f2; color: var(--red); }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 6px 11px; font-size: 13px; }

/* ---------- Зірочка «Мої ФОП» ---------- */
.star-btn { background: transparent; border: 0; cursor: pointer; padding: 4px; color: var(--gray-400); border-radius: 8px; }
.star-btn:hover { color: var(--yellow); }
.star-btn.on { color: #eab308; }
.star-btn.on svg { fill: #eab308; }
.btn.star-btn { background: var(--gray-100); padding: 10px 16px; }

/* ---------- Деталі картки ---------- */
.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 24px;
}
.detail-grid > div { display: flex; flex-direction: column; gap: 3px; }
.detail-grid span { font-size: 12px; color: var(--gray-500); text-transform: uppercase; letter-spacing: .3px; }
.detail-grid b { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.detail-wide { grid-column: 1 / -1; }
.file-link { display: inline-flex; align-items: center; gap: 6px; }
.pass-hidden { font-family: monospace; letter-spacing: 1px; }
.reveal-btn { padding: 4px 8px; }

/* ---------- Форми ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.wide, .form-actions.wide { grid-column: 1 / -1; }
.form-field label { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.form-field small { color: var(--gray-500); }
.form-field input:not([type=checkbox]), .form-field select, .form-field textarea {
  padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 9px;
  font-size: 14px; font-family: inherit; background: var(--gray-50);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: 2px solid var(--blue-light); border-color: var(--blue); background: #fff;
}
.form-field .checkbox { display: flex; align-items: center; gap: 8px; padding-top: 24px; font-weight: 500; cursor: pointer; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.form-section h3 {
  margin: 14px 0 0; padding-top: 18px; border-top: 1px solid var(--gray-200);
  font-size: 15px; display: flex; align-items: center; gap: 8px;
}
.form-section h3 svg { width: 18px; height: 18px; color: var(--blue); }
.form-section small { color: var(--gray-500); font-weight: 400; }

/* ---------- Вкладки ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; background: #fff;
  color: var(--gray-700); font-weight: 600; box-shadow: var(--shadow);
}
.tabs a:hover { text-decoration: none; background: var(--gray-50); }
.tabs a.active { background: var(--blue); color: #fff; }
.tabs a svg { width: 16px; height: 16px; }

/* ---------- Сповіщення ---------- */
.alert { padding: 12px 18px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; }
.alert-success { background: var(--green-light); color: var(--green); border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }

/* ---------- Пагінація ---------- */
.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager a { padding: 6px 12px; border-radius: 8px; background: var(--gray-100); color: var(--gray-700); font-weight: 600; }
.pager a.active { background: var(--blue); color: #fff; }

/* ---------- TOTP card ---------- */
.totp-card { border: 2px solid var(--blue); }
.totp-card #qrcode { margin: 12px 0; }
.totp-secret code { background: var(--gray-100); padding: 4px 10px; border-radius: 6px; font-size: 15px; }

/* ---------- Логін ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(150deg, var(--blue-light), var(--gray-100) 55%, var(--green-light));
}
.login-card {
  background: #fff; border-radius: 16px; padding: 38px 40px; width: 380px;
  box-shadow: 0 10px 40px rgba(30, 64, 175, .12); text-align: center;
}
.login-logo svg { width: 44px; height: 44px; color: var(--blue); }
.login-card h1 { font-size: 20px; margin: 10px 0 24px; }
.login-card form { text-align: left; }
.login-card label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin: 14px 0 5px; }
.login-card input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--gray-200); border-radius: 9px;
  font-size: 14px; background: var(--gray-50);
}
.login-card input:focus { outline: 2px solid var(--blue-light); border-color: var(--blue); background: #fff; }
.login-card button {
  width: 100%; margin-top: 22px; padding: 12px; background: var(--blue); color: #fff;
  border: 0; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-card button:hover { background: var(--blue-dark); }
.login-err { color: var(--red); font-size: 13.5px; margin-top: 12px; }
.totp-hint { color: var(--gray-500); font-size: 14px; }
.totp-input { text-align: center; font-size: 22px !important; letter-spacing: 8px; font-family: monospace; }
.login-back { display: inline-block; margin-top: 16px; font-size: 13.5px; color: var(--gray-500); }

/* ---------- Адаптивність ---------- */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; min-height: 0; position: static; }
  .sidebar nav { flex-direction: row; overflow-x: auto; }
  .content { padding: 18px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .search-box { min-width: 0; width: 100%; }
}
