:root {
  --bg: #080d0d;
  --surface: #101817;
  --surface-2: #14201e;
  --line: #24302e;
  --text: #f0f6f4;
  --muted: #82908d;
  --accent: #c8ff4d;
  --accent-soft: rgba(200, 255, 77, .11);
  --danger: #ff6d70;
  --danger-soft: rgba(255, 109, 112, .11);
  --success: #67e6a0;
  font-family: Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; color: var(--text); background: radial-gradient(circle at 75% -10%, rgba(112, 154, 73, .12), transparent 28rem), var(--bg); }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 30px 18px 22px; border-left: 1px solid var(--line); background: rgba(10, 16, 15, .94); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 30px; }
.brand-mark { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid var(--accent); color: var(--accent); font-weight: 800; font-size: 21px; transform: rotate(45deg); border-radius: 12px; box-shadow: 0 0 24px rgba(200, 255, 77, .13); }
.brand-mark::first-letter { transform: rotate(-45deg); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; }
.brand small { color: var(--muted); direction: ltr; font-size: 10px; letter-spacing: .13em; margin-top: 3px; }
nav { display: grid; gap: 7px; }
.nav-link { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 9px; color: #aeb9b6; font-size: 14px; border: 1px solid transparent; }
.nav-link span { font-size: 20px; color: #66736f; width: 19px; text-align: center; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { color: var(--accent); background: var(--accent-soft); border-color: rgba(200, 255, 77, .16); }
.nav-link.active span { color: var(--accent); }
.sidebar-foot { margin-top: auto; display: grid; gap: 14px; }
.identity { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; direction: ltr; text-align: left; }
.identity small, .identity b { display: block; }
.identity small { color: var(--muted); font-size: 10px; }
.identity b { font-size: 12px; margin-top: 3px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); flex: none; display: inline-block; }
main { width: 100%; max-width: 1600px; margin: 0 auto; padding: 32px clamp(24px, 4vw, 64px); overflow: hidden; }
.topbar { min-height: 76px; display: flex; justify-content: space-between; gap: 30px; align-items: flex-start; margin-bottom: 28px; }
.eyebrow { color: var(--accent); font-size: 9px; letter-spacing: .18em; direction: ltr; margin: 0 0 8px; font-weight: 700; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(24px, 3vw, 34px); margin-bottom: 0; letter-spacing: -.04em; }
h2 { font-size: 17px; margin-bottom: 0; }
.chat-picker label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 7px; }
.select-row, .add-form, .search-form, .add-access-form > div { display: flex; gap: 8px; }
select, input { color: var(--text); background: #0b1211; border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; min-height: 39px; outline: none; }
select:focus, input:focus { border-color: rgba(200, 255, 77, .55); box-shadow: 0 0 0 3px rgba(200, 255, 77, .07); }
.compact-button, .telegram-button { border: 1px solid var(--accent); color: #10150b; background: var(--accent); font-weight: 700; border-radius: 7px; padding: 9px 14px; cursor: pointer; white-space: nowrap; }
.compact-button:hover, .telegram-button:hover { filter: brightness(1.08); }
.ghost-button { color: #aeb9b6; background: transparent; border: 1px solid var(--line); border-radius: 7px; padding: 9px 12px; cursor: pointer; }
.ghost-button:hover { color: var(--text); border-color: #53605d; }
.full { width: 100%; }
.notice { border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; margin: -8px 0 20px; font-size: 13px; }
.notice.success { color: var(--success); background: rgba(103, 230, 160, .08); border-color: rgba(103, 230, 160, .25); }
.notice.error { color: #ff9698; background: var(--danger-soft); border-color: rgba(255, 109, 112, .25); }
.notice.info { color: #cbd5d2; background: var(--surface); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 13px; }
.metric-card, .panel { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(19, 29, 28, .96), rgba(13, 20, 19, .96)); border-radius: 11px; }
.metric-card { padding: 21px 22px; position: relative; overflow: hidden; }
.metric-card.accent::after { content: ""; position: absolute; width: 90px; height: 90px; border: 1px solid rgba(200, 255, 77, .13); border-radius: 24px; transform: rotate(30deg); left: -43px; top: -41px; }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card span { font-size: 11px; }
.metric-card strong { display: block; font-size: 31px; margin: 11px 0 8px; direction: ltr; text-align: right; }
.metric-card small { font-size: 10px; }
.split-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 13px; margin-bottom: 13px; }
.panel { padding: 22px; }
.panel-title { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 20px; }
.panel-title a { color: var(--accent); font-size: 11px; }
.live-pill, .shield-badge, .count-pill { border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; font-size: 9px; color: #b7c2bf; }
.live-pill i { width: 5px; height: 5px; background: var(--accent); display: inline-block; border-radius: 50%; box-shadow: 0 0 8px var(--accent); margin-left: 4px; }
.shield-badge { color: var(--accent); border-color: rgba(200, 255, 77, .25); background: var(--accent-soft); }
.category-bars { display: grid; gap: 13px; }
.category-row { display: grid; grid-template-columns: 105px 1fr 25px; align-items: center; gap: 10px; font-size: 11px; }
.category-row b { direction: ltr; color: var(--accent); }
progress { width: 100%; height: 7px; border: 0; background: #27312f; border-radius: 10px; overflow: hidden; }
progress::-webkit-progress-bar { background: #27312f; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #819e45, var(--accent)); }
progress::-moz-progress-bar { background: var(--accent); }
.policy-list { margin: 0; display: grid; gap: 0; }
.policy-list div { display: flex; justify-content: space-between; gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.policy-list div:last-child { border: 0; padding-bottom: 0; }
.policy-list dt { color: var(--muted); }
.policy-list dd { margin: 0; text-align: left; }
.policy-list .on { color: var(--accent); }
.table-panel { margin-bottom: 15px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th { color: #6e7c79; font-size: 9px; text-align: right; letter-spacing: .04em; padding: 10px 8px; border-bottom: 1px solid var(--line); }
td { padding: 12px 8px; border-bottom: 1px solid rgba(36, 48, 46, .65); font-size: 11px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.015); }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 165px; }
.user-cell b, .user-cell small { display: block; }
.user-cell small { color: var(--muted); direction: ltr; text-align: right; margin-top: 3px; font-size: 9px; }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; background: #26322f; color: #cad4d1; font-weight: 700; flex: none; }
.avatar.owner { color: var(--accent); background: var(--accent-soft); }
.tag { display: inline-flex; border-radius: 999px; border: 1px solid var(--line); padding: 4px 8px; font-size: 9px; white-space: nowrap; }
.tag.danger { color: #ff9b9d; border-color: rgba(255,109,112,.25); background: var(--danger-soft); }
.tag.success { color: var(--success); border-color: rgba(103,230,160,.25); background: rgba(103,230,160,.08); }
.tag.neutral { color: #a7b1af; }
.muted { color: var(--muted); white-space: nowrap; }
.warning-count { display: inline-grid; min-width: 27px; height: 27px; place-items: center; border-radius: 50%; background: #212a28; direction: ltr; }
.warning-count.hot { color: #ff9698; background: var(--danger-soft); }
.empty-state { color: var(--muted); text-align: center; padding: 30px 12px; font-size: 12px; }
.empty-state.large { padding: 80px 25px; }
.empty-state.large h2 { color: var(--text); margin-bottom: 10px; }
.search-form input { width: 220px; }
.action-form { display: flex; gap: 5px; direction: rtl; }
.action-form select { min-width: 100px; max-width: 125px; font-size: 10px; }
.action-form .compact-button { padding-inline: 10px; font-size: 10px; }
.minutes-input { width: 59px; direction: ltr; font-size: 10px; }
.rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.rule-panel:last-child { grid-column: 1 / -1; }
.count-pill { color: var(--accent); min-width: 28px; text-align: center; }
.add-form input { flex: 1; min-width: 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.chip-list form { display: inline-flex; align-items: center; gap: 8px; background: #1b2523; border: 1px solid #2d3936; border-radius: 999px; padding: 6px 10px; font-size: 10px; }
.chip-list button { border: 0; color: #8e9b98; background: transparent; font-size: 15px; cursor: pointer; padding: 0; line-height: 1; }
.chip-list button:hover { color: var(--danger); }
.chip-list .empty-state { width: 100%; }
.panel-help { color: var(--muted); font-size: 10px; margin: -10px 0 15px; }
.access-grid { align-items: start; }
.owner-row { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.owner-row b, .owner-row small { display: block; }
.owner-row b { font-size: 12px; direction: ltr; text-align: right; }
.owner-row small { color: var(--muted); font-size: 9px; margin-top: 4px; }
.danger-button { color: #ff9698; border: 1px solid rgba(255,109,112,.25); background: var(--danger-soft); border-radius: 6px; padding: 7px 9px; cursor: pointer; font-size: 10px; }
.add-access-form { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 8px; }
.add-access-form label { display: block; font-size: 10px; color: var(--muted); margin-bottom: 8px; }
.add-access-form input { flex: 1; }
.add-access-form small { display: block; color: var(--muted); font-size: 9px; margin-top: 8px; line-height: 1.8; }
.audit-list > div { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.audit-list > div:last-child { border: 0; }
.audit-list b, .audit-list small { display: block; }
.audit-list b { font-size: 11px; }
.audit-list small, .audit-list time { color: var(--muted); font-size: 8px; margin-top: 4px; }
.audit-icon { color: var(--accent); width: 26px; height: 26px; border: 1px solid rgba(200,255,77,.2); border-radius: 7px; display: grid; place-items: center; }
footer { color: #4f5c59; font-size: 9px; text-align: center; padding: 22px 0 0; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; overflow: hidden; }
.login-body::before { content: ""; position: fixed; width: 420px; height: 420px; border: 1px solid rgba(200,255,77,.05); border-radius: 95px; transform: rotate(45deg); left: -210px; bottom: -220px; }
.login-card { width: min(100%, 410px); padding: 42px; border: 1px solid var(--line); background: rgba(15,23,22,.94); border-radius: 14px; box-shadow: 0 35px 100px rgba(0,0,0,.45); text-align: center; }
.login-emblem { width: 65px; height: 65px; display: grid; place-items: center; border: 1px solid var(--accent); border-radius: 17px; margin: 0 auto 26px; transform: rotate(45deg); box-shadow: 0 0 40px rgba(200,255,77,.09); }
.login-emblem span { transform: rotate(-45deg); color: var(--accent); font-weight: 800; font-size: 26px; }
.login-card h1 { font-size: 29px; margin-bottom: 12px; }
.login-copy { color: #9aa6a3; font-size: 12px; line-height: 2; margin-bottom: 24px; }
.telegram-button { display: block; padding: 12px 16px; }
.login-steps { list-style: none; padding: 20px 0 0; margin: 0; display: grid; gap: 9px; text-align: right; }
.login-steps li { color: #a8b3b0; font-size: 11px; }
.login-steps span { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 50%; background: #202a28; color: var(--accent); margin-left: 8px; }
.security-note { color: #66736f; font-size: 9px; border-top: 1px solid var(--line); padding-top: 18px; margin: 20px 0 0; direction: ltr; }
.security-note .status-dot { margin-right: 6px; width: 5px; height: 5px; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px; border: 0; border-bottom: 1px solid var(--line); display: block; }
  .brand { padding: 0 4px 13px; }
  .brand-mark { width: 35px; height: 35px; font-size: 17px; }
  nav { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .nav-link { flex: none; padding: 9px 11px; }
  .nav-link span { display: none; }
  .sidebar-foot { display: none; }
  main { padding: 22px 14px; }
  .topbar { display: block; margin-bottom: 20px; }
  .chat-picker { margin-top: 18px; }
  .chat-picker select { flex: 1; min-width: 0; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 16px; }
  .metric-card strong { font-size: 25px; }
  .rule-grid { grid-template-columns: 1fr; }
  .rule-panel:last-child { grid-column: auto; }
  .responsive-title { display: block; }
  .search-form { margin-top: 15px; }
  .search-form input { width: auto; flex: 1; min-width: 0; }
  .panel { padding: 17px; }
}

@media (max-width: 430px) {
  .metric-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 22px; }
  .category-row { grid-template-columns: 92px 1fr 20px; }
}
