/* ============================================================
   Зеркала — дизайн-система прототипа
   ============================================================ */

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --sidebar: #0f172a;
  --sidebar-hover: #1e293b;
  --text: #0f172a;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --border: #e6eaf1;
  --border-strong: #d6dce7;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --muted-soft: #f1f5f9;

  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px rgba(15, 23, 42, .035);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.icon { width: 18px; height: 18px; display: inline-block; flex: none; vertical-align: middle; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ----------卡拉ка ---------- */
.app-shell { display: grid; grid-template-columns: 258px 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--sidebar);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 22px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: linear-gradient(145deg, #6366f1, #4338ca);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}
.brand-name { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -.2px; line-height: 1.15; }
.brand-sub { color: #64748b; font-size: 11px; margin-top: 2px; }

.side-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .9px;
  color: #64748b; font-weight: 700; padding: 0 12px; margin: 14px 0 8px;
}

.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: #cbd5e1; text-align: left;
  font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: rgba(99, 102, 241, .18); color: #fff; }
.nav-item.active .icon { color: #a5b4fc; }
.nav-item .badge {
  margin-left: auto; background: #334155; color: #cbd5e1;
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 20px;
}
.nav-item.active .badge { background: rgba(99,102,241,.35); color: #e0e7ff; }

.project-switch { margin-top: 4px; }
.project-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: #94a3b8; text-align: left; font-size: 13px;
  transition: background .15s, color .15s;
}
.project-link:hover { background: var(--sidebar-hover); color: #fff; }
.project-link.active { color: #fff; background: rgba(255,255,255,.06); }
.project-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.project-dot.ok { background: #4ade80; }
.project-dot.warn { background: #fbbf24; }
.project-dot.danger { background: #f87171; }
.project-link .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-link .pcount { margin-left: auto; font-size: 11px; color: #64748b; }

.sidebar-bottom { margin-top: auto; padding-top: 16px; }
.btn-create-side {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 12px; border: 1px dashed #475569; background: rgba(255,255,255,.03);
  color: #e2e8f0; border-radius: var(--r-sm); font-weight: 600; font-size: 13px;
  transition: background .15s, border-color .15s;
}
.btn-create-side:hover { background: rgba(99,102,241,.16); border-color: #6366f1; color: #fff; }

.side-user {
  display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; margin-top: 12px;
  border-top: 1px solid #1e293b;
}
.side-avatar {
  width: 32px; height: 32px; border-radius: 9px; background: #334155; color: #e2e8f0;
  display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none;
}
.side-user .u-name { color: #e2e8f0; font-size: 12.5px; font-weight: 600; }
.side-user .u-role { color: #64748b; font-size: 11px; }

/* ---------- Main / topbar ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px; background: rgba(255,255,255,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  gap: 16px; padding: 0 28px; position: sticky; top: 0; z-index: 20;
}
.breadcrumbs { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; min-width: 0; }
.breadcrumbs b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs .sep { color: #cbd5e1; }

.live-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px;
  border-radius: 20px; background: var(--success-soft); color: #15803d;
  font-size: 11.5px; font-weight: 700; letter-spacing: .2px;
}
.live-pill .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,.5); animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.45); }
  70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.live-pill.offline { background: var(--muted-soft); color: var(--text-2); }
.live-pill.offline .pulse { background: #94a3b8; animation: none; box-shadow: none; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search-box {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 11px;
  color: var(--text-3); min-width: 210px;
}
.search-box input { border: 0; outline: 0; background: transparent; font-size: 13px; width: 100%; }
.search-box input::placeholder { color: var(--text-3); }

.icon-btn {
  width: 36px; height: 36px; border: 1px solid var(--border); background: #fff;
  border-radius: var(--r-sm); display: grid; place-items: center; color: var(--text-2);
  position: relative; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn .notif-dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 2px solid #fff;
}
.top-avatar {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px;
}

.notif-dropdown {
  position: absolute; top: 58px; right: 90px; width: 380px; max-height: 480px;
  background: #fff; border: 1px solid var(--border); border-radius: 13px;
  box-shadow: 0 18px 50px rgba(15,23,42,.16); z-index: 60; overflow: hidden;
  animation: rise .15s ease-out; display: flex; flex-direction: column;
}
.notif-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.notif-head .btn { margin-left: auto; }
.notif-list { overflow-y: auto; padding: 6px; }
.notif-item {
  display: flex; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 9px;
  background: transparent; text-align: left; transition: background .12s;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item > span { display: flex; flex-direction: column; gap: 3px; }
.notif-title { font-size: 12.5px; font-weight: 650; line-height: 1.3; }
.notif-detail { font-size: 11.5px; color: var(--text-2); line-height: 1.3; }
.notif-time { font-size: 10.5px; color: var(--text-3); }
.notif-all {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 11px; border: 0; border-top: 1px solid var(--border);
  background: var(--surface-2); color: var(--accent); font-size: 12px; font-weight: 650;
}

.content { padding: 28px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 24px; }
.page-head .grow { flex: 1; min-width: 0; }
.page-title { font-size: 24px; font-weight: 750; letter-spacing: -.5px; margin: 0 0 5px; }
.page-sub { color: var(--text-2); font-size: 13.5px; margin: 0; line-height: 1.5; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: 13px; font-weight: 600; transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.2); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #fff; border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--muted-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Cards & grids ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 17px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14.5px; font-weight: 700; margin: 0; }
.card-head .sub { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.card-head .right { margin-left: auto; }
.card-body { padding: 20px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ---------- Stat cards ---------- */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 17px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-top { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.stat-ico {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
}
.stat-ico.accent { background: var(--accent-soft); color: var(--accent); }
.stat-ico.success { background: var(--success-soft); color: var(--success); }
.stat-ico.danger { background: var(--danger-soft); color: var(--danger); }
.stat-ico.warn { background: var(--warn-soft); color: var(--warn); }
.stat-val { font-size: 27px; font-weight: 750; letter-spacing: -.8px; margin: 13px 0 3px; line-height: 1; }
.stat-foot { font-size: 11.5px; color: var(--text-3); }
.stat-foot b { color: var(--text-2); font-weight: 600; }

/* ---------- Status chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px;
  border-radius: 20px; font-size: 11.5px; font-weight: 650; white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.success { background: var(--success-soft); color: #15803d; }
.chip.danger  { background: var(--danger-soft);  color: #b91c1c; }
.chip.warn    { background: var(--warn-soft);    color: #b45309; }
.chip.muted   { background: var(--muted-soft);   color: var(--text-2); }
.chip.accent  { background: var(--accent-soft);  color: var(--accent); }

.tone-success { color: var(--success); }
.tone-danger { color: var(--danger); }
.tone-warn { color: var(--warn); }
.tone-accent { color: var(--accent); }
.tone-muted { color: var(--text-2); }

/* ---------- Project cards ---------- */
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 19px; cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s; position: relative;
}
.project-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15,23,42,.08); border-color: #c7d2fe; }
.pc-top { display: flex; align-items: flex-start; gap: 12px; }
.pc-icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); flex: none;
}
.pc-title { font-size: 15px; font-weight: 700; margin: 1px 0 3px; }
.pc-desc { color: var(--text-2); font-size: 12px; line-height: 1.4; }
.pc-arrow { margin-left: auto; color: var(--text-3); }
.pc-stats { display: flex; gap: 18px; padding: 16px 0 14px; border-bottom: 1px solid var(--border); margin-top: 14px; }
.pc-stat .v { font-size: 17px; font-weight: 700; }
.pc-stat .l { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.pc-health { display: flex; height: 6px; border-radius: 6px; overflow: hidden; margin: 14px 0 10px; gap: 2px; }
.pc-health span { height: 100%; }
.pc-foot { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 11.5px; }
.pc-foot .chip { margin-left: auto; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 11px 20px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-3); font-weight: 700;
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 13px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: #fafbfe; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--text-3); font-size: 11.5px; margin-top: 3px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.row-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }

.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 20px; flex-wrap: wrap; }
.filter-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 9px; }
.filter-tabs button {
  border: 0; background: transparent; padding: 6px 11px; border-radius: 7px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.filter-tabs button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.toolbar .spacer { flex: 1; }
.mini-search {
  display: flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; color: var(--text-3); min-width: 190px;
}
.mini-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 12.5px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 22px; overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 14px;
  border: 0; background: transparent; color: var(--text-2); font-size: 13px;
  font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .cnt {
  background: var(--muted-soft); color: var(--text-2); border-radius: 20px;
  padding: 1px 6px; font-size: 10.5px;
}
.tab.active .cnt { background: var(--accent-soft); color: var(--accent); }

/* ---------- Status matrix ---------- */
.matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.matrix-cell {
  border: 1px solid var(--border); border-radius: 9px; padding: 10px 11px;
  background: #fff; display: flex; align-items: center; gap: 8px; min-width: 0;
}
.matrix-cell .mname { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matrix-cell .mdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mdot.ok { background: #22c55e; }
.mdot.banned { background: #ef4444; }
.mdot.down { background: #f59e0b; }
.mdot.checking { background: #cbd5e1; }
.mdot.switching { background: #818cf8; animation: pulse-dot 1s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.matrix-cell .mtime { margin-left: auto; color: var(--text-3); font-size: 10px; flex: none; }

/* ---------- Timeline ---------- */
.timeline { position: relative; }
.tl-item { display: flex; gap: 13px; padding: 0 0 18px; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: 15px; top: 30px; bottom: 0; width: 1px; background: var(--border);
}
.tl-item:last-child::before { display: none; }
.tl-ico {
  width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center;
  flex: none; z-index: 1;
}
.tl-ico.danger  { background: var(--danger-soft); color: var(--danger); }
.tl-ico.warn    { background: var(--warn-soft); color: var(--warn); }
.tl-ico.accent  { background: var(--accent-soft); color: var(--accent); }
.tl-ico.success { background: var(--success-soft); color: var(--success); }
.tl-ico.muted   { background: var(--muted-soft); color: var(--text-2); }
.tl-body { padding-top: 2px; min-width: 0; }
.tl-title { font-size: 13px; font-weight: 600; line-height: 1.35; }
.tl-detail { color: var(--text-2); font-size: 12px; margin-top: 3px; line-height: 1.4; }
.tl-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--text-3); font-size: 11px; }
.tl-time { margin-left: auto; }

/* ---------- VPS cards ---------- */
.vps-card { padding: 17px; }
.vps-top { display: flex; align-items: center; gap: 11px; }
.vps-ico {
  width: 38px; height: 38px; border-radius: 10px; background: #eef2ff; color: var(--accent);
  display: grid; place-items: center; flex: none;
}
.vps-name { font-weight: 700; font-size: 13.5px; }
.vps-ip { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.vps-top .chip { margin-left: auto; }
.vps-meta { display: flex; gap: 14px; margin: 16px 0 12px; color: var(--text-2); font-size: 11.5px; }
.vps-meta span { display: flex; align-items: center; gap: 5px; }
.bar { height: 6px; border-radius: 6px; background: var(--muted-soft); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.bar.warn > i { background: var(--warn); }
.bar.danger > i { background: var(--danger); }
.load-row { display: flex; align-items: center; gap: 9px; margin-top: 8px; font-size: 11.5px; color: var(--text-2); }
.load-row .lbl { width: 26px; flex: none; }
.load-row .bar { flex: 1; }
.load-row .val { width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Mirror cards ---------- */
.mirror-card { padding: 15px 17px; display: flex; align-items: center; gap: 13px; }
.mirror-card .m-ico {
  width: 36px; height: 36px; border-radius: 10px; background: var(--muted-soft);
  color: var(--text-2); display: grid; place-items: center; flex: none;
}
.mirror-card.spare .m-ico { background: var(--accent-soft); color: var(--accent); }
.mirror-card .m-name { font-weight: 650; font-size: 13px; }
.mirror-card .m-path { color: var(--text-2); font-size: 11.5px; margin-top: 3px; }
.mirror-card .m-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }

/* ---------- Settings / forms ---------- */
.setting-row {
  display: flex; align-items: center; gap: 16px; padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: 0; }
.setting-info { flex: 1; min-width: 0; }
.setting-info .s-title { font-weight: 650; font-size: 13px; }
.setting-info .s-desc { color: var(--text-2); font-size: 12px; margin-top: 3px; line-height: 1.45; }
.setting-control { flex: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field label { font-size: 12px; font-weight: 650; color: var(--text-2); }
.field input, .field select, .field textarea {
  border: 1px solid var(--border-strong); border-radius: 9px; padding: 10px 12px;
  outline: none; background: #fff; font-size: 13px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.field .hint { font-size: 11px; color: var(--text-3); }

.segmented { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); padding: 4px; border-radius: 10px; }
.segmented button {
  flex: 1; border: 0; background: transparent; padding: 9px 10px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); text-align: center;
}
.segmented button.active { background: #fff; color: var(--accent); box-shadow: 0 1px 4px rgba(15,23,42,.08); }

.toggle { width: 40px; height: 23px; border-radius: 20px; background: #cbd5e1; border: 0; position: relative; transition: background .18s; flex: none; }
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px;
  background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(17px); }
.toggle.danger.on { background: var(--danger); }

.callout {
  display: flex; gap: 12px; padding: 13px 15px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid #dfe3ff; color: #3730a3; font-size: 12.5px; line-height: 1.5;
}
.callout .ico { flex: none; margin-top: 1px; }
.callout.warn { background: var(--warn-soft); border-color: #fde68a; color: #92400e; }
.callout.danger { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }

.provider-row {
  display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--border);
  border-radius: 11px; margin-bottom: 10px;
}
.provider-logo {
  width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 800; font-size: 11px; flex: none; background: var(--muted-soft); color: var(--text-2);
}
.provider-logo.cf { background: #fff3e6; color: #f38020; }
.provider-logo.ns { background: #eef2ff; color: #4338ca; }
.provider-logo.ht { background: #ecfeff; color: #0891b2; }
.provider-row .p-title { font-weight: 650; font-size: 13px; }
.provider-row .p-desc { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.provider-row .p-status { margin-left: auto; }

/* ---------- Wizard / modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 540px; box-shadow: 0 24px 70px rgba(15,23,42,.25); overflow: hidden; animation: rise .2s ease-out; }
.modal.wide { max-width: 720px; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; font-weight: 700; margin: 0; }
.modal-head .sub { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 22px; max-height: 65vh; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 9px; padding: 16px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-foot .spacer { flex: 1; }

.stepper { display: flex; align-items: center; gap: 6px; margin-bottom: 22px; }
.step-dot {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--muted-soft); color: var(--text-3); font-size: 11px; font-weight: 700; flex: none;
}
.step-dot.active { background: var(--accent); color: #fff; }
.step-dot.done { background: var(--success-soft); color: var(--success); }
.step-line { height: 2px; background: var(--border); flex: 1; }
.step-line.done { background: #86efac; }

.option-list { display: flex; flex-direction: column; gap: 9px; }
.option {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s;
}
.option:hover { border-color: #c7d2fe; background: #fafaff; }
.option.selected { border-color: var(--accent); background: var(--accent-soft); }
.option .radio {
  width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--border-strong);
  flex: none; margin-top: 1px; display: grid; place-items: center;
}
.option.selected .radio { border-color: var(--accent); }
.option.selected .radio::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.option .o-title { font-weight: 650; font-size: 13px; }
.option .o-desc { font-size: 11.5px; color: var(--text-2); margin-top: 3px; line-height: 1.4; }
.tag-rec { background: var(--success-soft); color: #15803d; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; margin-left: 7px; }

.chosen-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chosen {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent);
  padding: 5px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
}
.chosen button { border: 0; background: transparent; color: inherit; padding: 0; display: grid; place-items: center; }

/* ---------- Change confirm ---------- */
.change-route { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--surface-2); border-radius: 11px; border: 1px solid var(--border); }
.change-route .cr-side { flex: 1; min-width: 0; }
.change-route .cr-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); font-weight: 700; }
.change-route .cr-val { font-size: 13px; font-weight: 650; margin-top: 5px; overflow-wrap: anywhere; }
.change-route .cr-sub { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: var(--text-3); margin-top: 3px; }
.change-route .cr-arrow { color: var(--accent); flex: none; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #0f172a; color: #fff; border-radius: 11px; padding: 13px 15px;
  display: flex; align-items: center; gap: 11px; min-width: 280px; max-width: 380px;
  box-shadow: 0 12px 32px rgba(15,23,42,.28); animation: slidein .22s ease-out;
}
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast .t-ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.toast .t-ico.success { background: rgba(34,197,94,.2); color: #4ade80; }
.toast .t-ico.danger { background: rgba(248,113,113,.2); color: #fca5a5; }
.toast .t-ico.accent { background: rgba(129,140,248,.2); color: #a5b4fc; }
.toast .t-text { font-size: 12.5px; line-height: 1.4; }
.toast .t-text b { display: block; font-size: 13px; margin-bottom: 1px; }

/* ---------- Empty state & misc ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty .e-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--muted-soft); color: var(--text-3); display: grid; place-items: center; margin: 0 auto 14px; }
.empty h4 { margin: 0 0 6px; color: var(--text); font-size: 14px; }
.empty p { margin: 0 0 16px; font-size: 12.5px; }

.kbd { background: var(--muted-soft); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; font-size: 10.5px; color: var(--text-2); }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.small { font-size: 12px; }
.flex { display: flex; align-items: center; gap: 8px; }
.hidden { display: none !important; }

/* ---------- Вход ---------- */
.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 30% 20%, #eef2ff 0%, var(--bg) 55%);
}
.login-card { width: 100%; max-width: 380px; padding: 30px; box-shadow: 0 24px 60px rgba(15,23,42,.12); }
.login-card .brand { padding: 0 0 20px; }
.login-card h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: -.4px; }
.login-card > p { color: var(--text-2); font-size: 12.5px; margin: 0 0 22px; }
.login-card form .btn { width: 100%; margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px; }
  .search-box { display: none; }
  .grid-3, .grid-2, .project-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
}
