:root {
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --text: #15181D;
  --text-2: #3B4149;
  --muted: #5A616B;
  --line: #E1E4E8;
  --line-2: #EEF0F2;
  --input: #C9CDD3;
  --accent: #0B5F50;
  --accent-dark: #073F35;
  --accent-soft: #E3F4EE;
  --accent-bg: #F2FAF7;
  --side: #15181D;
  --side-2: #262B33;
  --side-line: #2E343D;
  --side-text: #B9BEC6;
  --brand: #3FD1B0;
  --warn-bg: #FFF1DC; --warn: #8A4B00;
  --err-bg: #FBE4E2; --err: #A1281D;
  --info-bg: #E6ECF8; --info: #2D3E66;
  --gray-bg: #F1F2F4; --gray: #4A5059;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.4; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
.h, .h2 { font-size: 22px; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.boot { padding: 40px; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---- Кнопки и поля ---- */
.btn { font: inherit; font-size: 15px; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--input); background: var(--card); color: var(--text);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #9AA1AB; color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #FFF; font-weight: 500; }
.btn.primary:hover { background: var(--accent-dark); color: #FFF; }
.btn.danger { color: var(--err); border-color: #E8B4AE; }
.btn.small { min-height: 36px; font-size: 14px; padding: 0 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { font: inherit; font-size: 14px; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; min-height: 36px; }
.icon-btn { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], select, textarea {
  font: inherit; height: 44px; padding: 0 12px; border: 1px solid var(--input); border-radius: 8px; background: var(--card); color: var(--text); width: 100%; min-width: 0; }
textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .chip:focus-visible, .row-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.error { color: var(--err); font-size: 14px; }

/* ---- Значки ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.b-ok { background: var(--accent-soft); color: var(--accent); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-err { background: var(--err-bg); color: var(--err); }
.b-gray { background: var(--gray-bg); color: var(--gray); }
.b-dark { background: var(--text); color: #FFF; }
.t-hot { color: var(--err); font-weight: 500; }
.t-warn { color: var(--warn); font-weight: 500; }

/* ---- Каркас ---- */
.app { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 220px; max-width: 240px; background: var(--side); color: #E8EAED; padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; min-height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; }
.brand b { font-size: 17px; font-weight: 600; }
.brand span { font-size: 12px; color: #9AA1AB; display: block; }
.nav { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 8px; color: var(--side-text); text-decoration: none; }
.nav:hover { color: #FFF; background: #1E232A; }
.nav[aria-current=page] { background: var(--side-2); color: #FFF; font-weight: 500; }
.nav .count { margin-left: auto; background: var(--brand); color: var(--side); font-size: 12px; font-weight: 600; border-radius: 99px; padding: 1px 8px; }
.side .foot { margin-top: auto; padding: 16px 0 0 8px; border-top: 1px solid var(--side-line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side .foot .who { min-width: 0; font-size: 13px; line-height: 1.35; }
.side .foot .who div:last-child { color: #9AA1AB; overflow: hidden; text-overflow: ellipsis; }
.side .foot .icon-btn { background: transparent; border-color: var(--side-line); color: var(--side-text); }
.main { flex: 999 1 560px; min-width: 0; padding: 32px 40px; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 860px) {
  .app { align-content: flex-start; }
  .side { flex: 1 1 100%; max-width: none; min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  .brand { flex: 1 1 100%; padding: 0 0 8px; }
  .side .foot { flex: 1 1 100%; margin: 8px 0 0; padding: 8px 0 0; }
  .main { padding: 20px 16px; }
}

/* ---- Карточки, таблицы ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.tile .k { font-size: 13px; color: var(--muted); }
.tile .v { font-size: 30px; font-weight: 600; margin-top: 4px; }
.tile .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 14px; height: 40px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--input); background: var(--card); color: var(--text); cursor: pointer; }
.chip[aria-pressed=true] { background: var(--text); border-color: var(--text); color: #FFF; }
.toolbar input[type=search] { max-width: 300px; }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.table-box { flex: 3 1 560px; min-width: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.table-box table { min-width: 720px; }
th { text-align: left; color: var(--muted); font-size: 13px; font-weight: 500; padding: 14px 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th:first-child, td:first-child { padding-left: 20px; }
tr:last-child td { border-bottom: 0; }
tr.sel td { background: var(--accent-bg); }
.row-btn { font: inherit; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; color: var(--text); display: flex; flex-direction: column; gap: 2px; min-height: 40px; }
.row-btn b { font-weight: 500; }
.row-btn span, .sub { font-size: 13px; color: var(--muted); }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }
.aside { flex: 1 1 320px; min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.aside .where { font-size: 13px; color: var(--muted); }
.aside .box { background: var(--bg); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.aside .stack { display: flex; flex-direction: column; gap: 8px; }
dl.props { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; overflow-wrap: anywhere; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.history li { display: grid; grid-template-columns: 92px 1fr; gap: 8px; }
.history li span:first-child { color: var(--muted); font-family: 'IBM Plex Mono', monospace; font-size: 13px; }

/* ---- Окна ---- */
.overlay { position: fixed; inset: 0; background: rgba(21, 24, 29, .62); display: flex; justify-content: center; align-items: flex-start; padding: 32px 16px; overflow-y: auto; z-index: 20; }
.dialog { width: 100%; max-width: 600px; background: var(--card); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.dialog > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dialog > header p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.dialog fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.dialog legend { font-size: 15px; font-weight: 600; margin-bottom: 10px; padding: 0; }
.dialog .foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line-2); padding-top: 16px; }
.radios { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.radio { font: inherit; text-align: left; min-height: 64px; padding: 10px 12px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
  color: var(--text); border: 1px solid var(--input); background: var(--card); }
.radio b { font-weight: 600; font-size: 15px; }
.radio span { font-size: 12px; color: var(--muted); }
.radio[aria-checked=true] { border: 2px solid var(--accent); background: var(--accent-bg); padding: 9px 11px; }
.summary { background: var(--bg); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.summary div { color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.secret { background: var(--bg); border: 1px dashed var(--input); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.secret code { font-family: 'IBM Plex Mono', monospace; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.secret code.cmd { font-size: 13px; font-weight: 500; }
.notice { border-radius: 10px; padding: 12px 14px; font-size: 14px; background: var(--warn-bg); color: #5C3300; }
.notice.ok { background: var(--accent-bg); color: var(--accent-dark); }

/* ---- Вход ---- */
.login { min-height: 100vh; background: var(--side); display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login .wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; }
.login .logo { display: flex; align-items: center; justify-content: center; gap: 10px; color: #FFF; font-weight: 600; font-size: 22px; }
.login .logo small { display: block; font-size: 13px; font-weight: 400; color: #9AA1AB; }
.login form { background: var(--card); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.login form p { margin: 0; font-size: 14px; color: var(--muted); }
.login .step { margin: 0; text-align: center; font-size: 13px; color: #9AA1AB; }
.code-input { font-family: 'IBM Plex Mono', monospace !important; font-size: 28px !important; letter-spacing: 6px; text-align: center; height: 60px !important; }
.meter { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 6px; background: var(--accent); border-radius: 99px; }
.meter i.w0 { width: 0; } .meter i.w1 { width: 25%; background: var(--err); } .meter i.w2 { width: 50%; background: #B45309; }
.meter i.w3 { width: 75%; } .meter i.w4 { width: 100%; }
.qr { display: flex; justify-content: center; }
.qr svg { width: 200px; height: 200px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; font-family: 'IBM Plex Mono', monospace; font-size: 16px; background: var(--bg); border-radius: 10px; padding: 14px; }

/* ---- Уведомление ---- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--text); color: #FFF;
  padding: 12px 18px; border-radius: 10px; font-size: 15px; z-index: 30; display: none; }
#toast.show { display: block; }
#toast.err { background: var(--err); }

.section { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.section + .section { border-top: 1px solid var(--line-2); }
.req { padding: 16px 20px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-start; border-bottom: 1px solid var(--line-2); }
.req:last-child { border-bottom: 0; }
.req .info { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.drop { border: 2px dashed #B8BEC6; border-radius: 12px; padding: 20px; background: #FAFBFC; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.narrow { max-width: 720px; }
