:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #111622;
  --panel-2: #171e2d;
  --border: #293247;
  --text: #eef2ff;
  --muted: #99a4bb;
  --accent: #7c5cff;
  --accent-2: #9c86ff;
  --good: #35c987;
  --warn: #f0a54a;
  --bad: #f26978;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% 0%, #1b1742 0, transparent 34%), var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input { font: inherit; }
.hidden { display: none !important; }
.topbar { height: 72px; padding: 0 6vw; border-bottom: 1px solid var(--border); background: rgba(8, 11, 18, .92); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; backdrop-filter: blur(16px); }
.brand { color: var(--text); text-decoration: none; font-size: 20px; font-weight: 750; }
.brand span { margin-left: 8px; color: var(--accent-2); font-size: 12px; border: 1px solid #5d4ab1; padding: 4px 8px; border-radius: 99px; vertical-align: 2px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.owner-name { color: var(--muted); margin-right: 8px; }
main { width: min(1180px, 92vw); margin: 0 auto; }
.login-wrap { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 44px 0; }
.panel { background: linear-gradient(145deg, rgba(23,30,45,.98), rgba(14,18,29,.98)); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 20px 70px rgba(0,0,0,.28); }
.login-card { width: min(460px, 100%); padding: 36px; }
h1 { font-size: clamp(30px, 5vw, 48px); margin: 8px 0 10px; letter-spacing: -.035em; }
h2 { margin: 4px 0 10px; }
.eyebrow { color: var(--accent-2); font-size: 12px; letter-spacing: .16em; font-weight: 800; margin: 0; }
.muted { color: var(--muted); line-height: 1.55; }
label { display: block; margin: 18px 0 7px; color: #c8d0e2; font-size: 13px; font-weight: 650; }
input { width: 100%; border: 1px solid var(--border); background: #0d121d; color: var(--text); border-radius: 10px; padding: 12px 14px; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.18); }
.button { border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; cursor: pointer; color: var(--text); background: var(--panel-2); font-weight: 700; }
.button:disabled { opacity: .48; cursor: not-allowed; }
.button.primary { background: var(--accent); }
.button.primary:hover:not(:disabled) { background: #6d4ff1; }
.button.ghost { border-color: var(--border); background: transparent; }
.button.danger { color: #ffd9de; border-color: #7b3440; background: #2a151b; }
.button.full { width: 100%; margin-top: 24px; }
.error { color: var(--bad); min-height: 20px; }
.content { padding: 56px 0 90px; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.project-card { padding: 22px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; display: flex; flex-direction: column; gap: 16px; min-height: 260px; }
.project-card h2 { margin: 0; font-size: 21px; }
.project-meta { color: var(--muted); font-size: 13px; min-height: 20px; }
.badges { display: flex; flex-wrap: wrap; gap: 7px; }
.badge { border-radius: 99px; padding: 4px 9px; border: 1px solid var(--border); color: #c7d0e2; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.badge.good { border-color: #216b50; color: #72e1ad; }
.badge.warn { border-color: #725021; color: #efbd74; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metric { padding: 10px; background: #0d121d; border-radius: 10px; }
.metric strong { display: block; font-size: 18px; }
.metric span { color: var(--muted); font-size: 11px; }
.card-actions { display: flex; gap: 8px; margin-top: auto; }
.card-actions .button { flex: 1; }
.notice, .empty { padding: 18px; margin: 16px 0; }
.credential-list, .audit-list { display: grid; gap: 12px; }
.credential, .audit-event { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px; display: grid; gap: 10px; }
.credential-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.credential-mask { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #cbd5e8; }
.credential-details { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 12px; }
.credential-actions { display: flex; gap: 8px; }
.back-link { border: 0; color: var(--accent-2); background: transparent; padding: 0; cursor: pointer; margin-bottom: 18px; }
.dialog { color: var(--text); width: min(520px, 92vw); background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 26px; }
.dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.secret { display: block; margin: 18px 0; padding: 16px; border: 1px solid #5b4aa1; background: #0c1020; border-radius: 10px; word-break: break-all; line-height: 1.5; }
.audit-event { grid-template-columns: 160px 1fr; }
.audit-event time { color: var(--muted); font-size: 12px; }

@media (max-width: 700px) {
  .topbar { padding: 0 4vw; }
  .owner-name { display: none; }
  .hero-row { align-items: flex-start; flex-direction: column; }
  .hero-row > .button { width: 100%; }
  .content { padding-top: 35px; }
  .metrics { grid-template-columns: 1fr; }
  .audit-event { grid-template-columns: 1fr; }
}

/* ALITA #2521: самообслуживание */
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#limitChip { font-size: 13px; padding: 6px 12px; }
#limitChip.warn { background: rgba(250, 200, 80, .12); color: #f5c563; border-color: rgba(250, 200, 80, .35); }
.secret.small { font-size: 12px; }
.dialog label { display: block; margin: 12px 0 6px; }
.dialog select { width: 100%; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.04); color: inherit; border: 1px solid rgba(255,255,255,.12); }
.notice:not(.error):not(.hidden) { border-color: rgba(80, 200, 120, .35); background: rgba(80, 200, 120, .08); }
