:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #1b2436;
  background: #f4f6fa;
  --ink: #1b2436;
  --muted: #5c687d;
  --line: #e0e5ee;
  --accent: #4d39c7;
  --accent-hover: #3d2ba9;
  --soft-accent: #eeeaff;
  --white: #fff;
  --radius: 16px;
  --danger: #ac2348;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #7158f1; outline-offset: 3px; }
p { color: var(--muted); line-height: 1.55; margin: 0; }
h1, h2, h3 { color: var(--ink); margin: 0; line-height: 1.22; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.85rem, 3.2vw, 2.35rem); letter-spacing: -.055em; }
h2 { font-size: 1.16rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
small { color: var(--muted); }
.skip { position: fixed; left: 12px; top: -180px; z-index: 10; padding: 12px; background: var(--white); border-radius: 8px; }
.skip:focus { top: 12px; }

.layout { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: var(--white);
  border-right: 1px solid var(--line); padding: 26px 16px 20px;
  display: flex; flex-direction: column; gap: 46px;
}
.brand { display: inline-flex; gap: 12px; align-items: center; font-size: 1.18rem; font-weight: 750; letter-spacing: -.045em; width: fit-content; }
.sidebar > .brand { margin-left: 10px; }
.brand small { display: block; font-weight: 500; font-size: .72rem; letter-spacing: .005em; margin-top: 1px; }
.brand-icon {
  width: 40px; height: 40px; flex: 0 0 40px; display: flex; align-items: end; justify-content: center; gap: 3px;
  padding: 11px; border-radius: 12px; background: #5842d5; box-shadow: 0 5px 14px #4d39c729;
}
.brand-icon i { width: 5px; height: 8px; background: #fff; border-radius: 3px; }
.brand-icon i:nth-child(2) { height: 13px; }
.brand-icon i:nth-child(3) { height: 18px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a, .quiet {
  display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 9px 12px;
  color: #485369; border-radius: 10px; font-weight: 640; font-size: .9rem;
}
.sidebar nav a:hover, .quiet:hover { background: #f3f1fa; color: var(--accent); }
.sidebar nav a[aria-current="page"] { color: #4230b8; background: var(--soft-accent); }
.nav-icon { text-align: center; font-size: 1.18rem; width: 23px; flex: 0 0 23px; }
.sign-out { margin-top: auto; }
.quiet { background: none; border: none; cursor: pointer; width: 100%; }

.workspace { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 72px; padding: 12px clamp(20px, 4vw, 52px);
  background: var(--white); border-bottom: 1px solid var(--line); color: var(--muted); font-size: .88rem; font-weight: 650;
}
.account { display: flex; gap: 9px; align-items: center; color: #45376f; min-width: 0; }
.account > span {
  width: 33px; height: 33px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 50%; background: #ece9fa; color: #432ab2;
}
.account strong { max-width: min(22vw, 220px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { max-width: 1420px; padding: 35px clamp(20px, 4vw, 52px) 52px; margin-inline: auto; }
.heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 18px; margin-bottom: 26px; }
.heading p { margin-top: 7px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 7px;
  min-height: 43px; padding: 9px 15px; border: 1px solid #d9deea; border-radius: 10px;
  color: #334159; background: var(--white); font-size: .88rem; font-weight: 700; line-height: 1.35; cursor: pointer;
}
.button:hover { background: #f3f4fb; border-color: #cbd0df; }
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: var(--accent-hover); }
.button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.button.danger:hover { background: #881b39; }
.button.danger-outline { color: var(--danger); border-color: #e8c5d0; }
.button.danger-outline:hover { background: #fcf0f4; }
.button:disabled { opacity: .7; cursor: default; }
.wide { width: 100%; }
.text-link, .back { color: #4530ba; font-weight: 700; font-size: .9rem; }
.text-link:hover, .back:hover { text-decoration: underline; }
.back { display: inline-block; margin-bottom: 14px; }
.card { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 12px #283d6608; }
.overview { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(235px, 1fr); gap: 18px; }
.hero {
  color: #fff; padding: 29px; border-radius: var(--radius); overflow: hidden;
  background:
    radial-gradient(circle at 98% -6%, #a594fb50 0 17%, transparent 17.5%),
    radial-gradient(circle at 98% -6%, transparent 0 29%, #a594fb44 29.2% 29.6%, transparent 29.9%),
    linear-gradient(114deg, #322283, #523abe 70%, #5941c4);
}
.hero h2 { color: #fff; font-size: clamp(1.55rem, 3vw, 2.55rem); letter-spacing: -.055em; margin: 16px 0 5px; }
.hero p { color: #e6e0ff; }
.hero a { display: inline-block; color: #fff; font-weight: 700; margin-top: 14px; font-size: .88rem; }
.hero a:hover { text-decoration: underline; }
.signal { display: flex; align-items: center; gap: 8px; color: #eeeaff; font-size: .84rem; font-weight: 700; }
.signal span { width: 8px; height: 8px; background: #96f0c9; border-radius: 50%; }
progress { appearance: none; display: block; margin-top: 19px; width: min(100%, 360px); height: 9px; border: 0; border-radius: 20px; background: #ffffff35; overflow: hidden; }
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: #b3f5d4; border-radius: 20px; }
progress::-moz-progress-bar { background: #b3f5d4; border-radius: 20px; }
.access-summary { display: grid; padding: 23px; gap: 12px; align-content: space-between; }
.access-summary h2 { margin-bottom: 8px; }
.access-summary p + p { margin-top: 7px; font-size: .88rem; }
.pill {
  display: inline-flex; align-items: center; min-height: 25px; width: fit-content;
  border-radius: 20px; padding: 3px 9px; background: #eef0f5; color: #495770;
  font-size: .76rem; font-weight: 730; line-height: 1.3;
}
.pill.positive { color: #176046; background: #e0f6eb; }
.pill.protected { color: #513092; background: #efe7fc; }
.tile-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px;
  color: #5039c5; background: #ece9fd; font-size: 1.15rem; font-weight: 750;
}
.tile-icon.green { background: #e4f6ef; color: #157552; }
.tile-icon.amber { background: #fff1d9; color: #895408; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 18px 0; }
.metric { min-height: 94px; padding: 15px 20px; display: flex; gap: 13px; align-items: center; color: var(--muted); font-size: .88rem; }
.metric:hover { border-color: #aba1ed; }
.metric strong { display: block; color: var(--ink); font-size: 1.55rem; margin-top: 1px; letter-spacing: -.035em; }

.card-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 18px 22px; }
.card-heading p { font-size: .87rem; margin-top: 4px; }
.table-overflow { overflow: auto; max-width: 100%; }
table { width: 100%; min-width: 555px; border-collapse: collapse; font-size: .87rem; text-align: left; }
thead th { padding: 11px 16px; background: #f7f8fc; color: #525f75; font-weight: 690; border-block: 1px solid var(--line); }
tbody td, tbody th { padding: 13px 16px; border-top: 1px solid #eceef5; overflow-wrap: anywhere; vertical-align: top; }
tbody th { font-weight: 650; }
tbody tr:hover { background: #f9f8fd; }
td:last-child, th:last-child { min-width: 115px; }
.empty { padding: 29px 20px 32px; text-align: center; border-top: 1px solid #edf0f6; }
.empty .tile-icon { margin: 0 auto 12px; }
.empty p { margin: 6px auto 0; max-width: 35rem; font-size: .88rem; }
.empty .button { margin-top: 12px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 11px; flex-wrap: wrap; padding: 15px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .87rem; }
.tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; }
.tabs a { padding: 10px 13px; border-radius: 9px; color: #485369; font-weight: 650; font-size: .88rem; }
.tabs a:hover { background: #edf0f9; }
.tabs a[aria-current="page"] { background: var(--soft-accent); color: #4230b8; }

.editor { max-width: 780px; padding: clamp(17px, 3vw, 27px); }
.editor:not(.card) { padding: 0; }
.editor > .actions { margin-top: 19px; }
.access-lookup { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; max-width: none; margin-bottom: 15px; }
.access-lookup .field { flex: 0 1 245px; margin: 0; }
.access-lookup > .actions { margin-top: 0; }
.report-table { min-width: 820px; }
.report-table td { min-width: 80px; }
.editor > p, .editor-card > p { margin-bottom: 15px; }
.editor-card { padding: clamp(17px, 3vw, 27px); }
.editor-card > h2 { margin-bottom: 10px; }
.form-flow { display: grid; gap: 13px; }
.form-flow > .actions { margin-top: 0; }
.field { margin: 12px 0; min-width: 0; }
.field label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 6px; color: #344057; }
input:not([type=checkbox]), textarea, .field select {
  width: 100%; min-height: 43px; padding: 9px 12px; border: 1px solid #cbd2e1;
  background: #fff; border-radius: 9px; color: var(--ink);
}
input[type=file] { padding-block: 6px; }
textarea { resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; margin: 0 5px 0 0; accent-color: var(--accent); vertical-align: middle; }
input:disabled { background: #edf0f6; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.check-field label { display: flex; align-items: center; min-height: 37px; }
.errorlist { color: #a01f42; margin: 7px 0; padding-left: 20px; font-size: .86rem; }
.errorlist.nonfield { padding: 12px 25px; border-radius: 8px; background: #fdf0f4; }
.option-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 14px; border-top: 1px solid var(--line); }
.option-check { font-size: .84rem; white-space: nowrap; display: flex; align-items: center; min-height: 35px; }
.option-row .field { margin: 10px 0; }
#option-status { font-size: .85rem; color: var(--muted); }
.confirmation-phrase { padding: 2px 5px; background: #fff0ea; color: #84213e; border-radius: 5px; }
.feedback { padding: 12px 15px; margin-bottom: 17px; background: #e5f6ee; border: 1px solid #c8ead8; border-radius: 10px; color: #136044; }
.feedback.error { background: #fff0f4; border-color: #efcfda; color: #8d2040; }
.maintenance h2 { margin: 12px 0 8px; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 0; border-top: 1px solid var(--line); }
.action-row p { font-size: .86rem; margin-top: 4px; }
.public-layout { min-height: 100vh; background: radial-gradient(ellipse at 75% 0%, #eae5ff, transparent 45%), #f4f6fa; }
.public-header { padding: 24px clamp(18px, 5vw, 48px); }
.public-layout .main { display: grid; justify-items: center; }
.login-card { width: min(100%, 430px); padding: clamp(21px, 4vw, 34px); }
.login-card h1 { margin: 13px 0 8px; font-size: 1.9rem; }
.login-card p { margin-bottom: 20px; }
.login-card .button { margin-top: 8px; }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 194px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .main, .topbar { padding-inline: 24px; }
}
@media (max-width: 760px) {
  .layout { display: block; }
  .sidebar { height: auto; position: static; padding: 13px 15px 7px; border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 10px; }
  .sidebar nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar nav a { padding-inline: 8px; gap: 5px; min-height: 42px; }
  .sidebar > .brand { margin: 0; }
  .sign-out { margin: 0; }
  .topbar { display: none; }
  .main { padding: 23px 15px 35px; }
}
@media (max-width: 510px) {
  .overview { grid-template-columns: 1fr; gap: 12px; }
  .hero { padding: 22px; }
  .metrics { grid-template-columns: 1fr; gap: 9px; margin: 12px 0; }
  .metric { min-height: 69px; }
  .metric strong { font-size: 1.35rem; }
  .option-row { grid-template-columns: 1fr 1fr; gap: 0 8px; }
  .option-row .field { grid-column: 1 / -1; margin-bottom: 0; }
}

.telegram-chats { margin-top: 1rem; }
.telegram-chats th small { font-weight: normal; }
.telegram-chats th { overflow-wrap: anywhere; }
