/* dev.multi-tool.su — минимальная лицензионная панель (Фаза 3, черновая
   версия). Визуальный язык — в духе TailAdmin (тёмный сайдбар, светлые
   карточки), но без самого фреймворка: чистый CSS, без сборки, ноль
   зависимостей — соответствует минимальному масштабу этого этапа. */

:root {
  --ink: #1a2233;
  --ink-soft: #64748b;
  --paper: #f3f5f9;
  --surface: #ffffff;
  --line: #e2e7f0;
  --accent: #3457d5;
  --accent-soft: #ecf0ff;
  --sidebar: #101728;
  --sidebar-ink: #cbd5e8;
  --sidebar-active: #1c2740;
  --pending: #b4650f;
  --pending-soft: #fbf0de;
  --approved: #1f8a5f;
  --approved-soft: #e5f5ee;
  --rejected: #c23b3b;
  --rejected-soft: #fbe9e9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---------- вход / первичная настройка ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.auth-card h1 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 .3rem;
}
.auth-card .sub {
  color: var(--ink-soft);
  font-size: .85rem;
  margin: 0 0 1.4rem;
}
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .35rem; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55rem .7rem;
  font-size: .9rem;
  background: var(--surface);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: .55rem 1rem; font-size: .86rem; font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--paper); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { background: #2c49b8; }
.btn-sm { padding: .35rem .65rem; font-size: .78rem; }
.btn-danger { color: var(--rejected); border-color: var(--rejected); }
.btn-approve { color: var(--approved); border-color: var(--approved); }
.error-msg { background: var(--rejected-soft); color: var(--rejected); border-radius: 8px; padding: .6rem .8rem; font-size: .84rem; margin-bottom: 1rem; }

/* ---------- рабочий layout ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
@media (max-width: 780px) { .shell { grid-template-columns: 1fr; } .sidebar { display: none; } }

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.sidebar .brand {
  font-weight: 700; color: #fff; font-size: .95rem;
  padding: .4rem .6rem 1.2rem;
}
.sidebar .brand small { display: block; font-weight: 500; color: var(--sidebar-ink); font-size: .72rem; margin-top: .15rem; }
.sidebar-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .6rem; border-radius: 8px; color: var(--sidebar-ink);
  font-size: .86rem; font-weight: 500; cursor: pointer; border: none; background: none; text-align: left;
}
.sidebar-link:hover { background: var(--sidebar-active); color: #fff; }
.sidebar-link.is-active { background: var(--sidebar-active); color: #fff; }
.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot .email { font-size: .78rem; color: var(--sidebar-ink); padding: 0 .6rem .5rem; word-break: break-all; }

.main { padding: 1.6rem 2rem 3rem; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.4rem; gap: 1rem; flex-wrap: wrap; }
.topbar h1 { font-size: 1.2rem; margin: 0; }
.topbar .sub { color: var(--ink-soft); font-size: .85rem; margin: .15rem 0 0; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.stat-tile .n { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-tile .l { color: var(--ink-soft); font-size: .78rem; margin-top: .15rem; }
.stat-tile.pending .n { color: var(--pending); }
.stat-tile.approved .n { color: var(--approved); }
.stat-tile.rejected .n { color: var(--rejected); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); gap: 1rem; flex-wrap: wrap; }
.panel-head h2 { font-size: .95rem; margin: 0; }

table.installs { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.installs th, table.installs td { text-align: left; padding: .7rem 1.2rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.installs th { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-soft); font-weight: 600; }
table.installs tr:last-child td { border-bottom: none; }
table.installs tr:hover td { background: var(--paper); }
.label-cell strong { display: block; }
.label-cell .company { color: var(--ink-soft); font-size: .78rem; }
.meta-cell { color: var(--ink-soft); font-size: .8rem; }
.meta-cell div + div { margin-top: .1rem; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.badge.pending { background: var(--pending-soft); color: var(--pending); }
.badge.approved { background: var(--approved-soft); color: var(--approved); }
.badge.rejected { background: var(--rejected-soft); color: var(--rejected); }

.actions-cell { display: flex; gap: .4rem; flex-wrap: wrap; }
.empty-state { padding: 2.5rem 1.2rem; text-align: center; color: var(--ink-soft); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 1.5rem; z-index: 20; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin: 0 0 .2rem; font-size: 1.05rem; }
.modal .sub { color: var(--ink-soft); font-size: .82rem; margin: 0 0 1.2rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }

.events-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; font-size: .82rem; }
.events-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px dashed var(--line); }
.events-list li:last-child { border-bottom: none; }
.events-list .t { color: var(--ink-soft); white-space: nowrap; }
