/* «DayZ Сибиряк» — палитра и шрифты фирменного стиля */
@font-face { font-family: 'Russo One'; font-weight: 400; font-display: swap; src: url(fonts/russo-one-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Russo One'; font-weight: 400; font-display: swap; src: url(fonts/russo-one-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: 'Oswald'; font-weight: 700; font-display: swap; src: url(fonts/oswald-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Oswald'; font-weight: 700; font-display: swap; src: url(fonts/oswald-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto Condensed'; font-weight: 400; font-display: swap; src: url(fonts/roboto-condensed-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Roboto Condensed'; font-weight: 400; font-display: swap; src: url(fonts/roboto-condensed-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto Condensed'; font-weight: 700; font-display: swap; src: url(fonts/roboto-condensed-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Roboto Condensed'; font-weight: 700; font-display: swap; src: url(fonts/roboto-condensed-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }

:root {
  --bg: #171717; --bg2: #302820; --bg3: #221d18; --line: #3d3329; --line2: #4c4034;
  --text: #E2D2B6; --muted: #a8997f; --faint: #7a6e5d;
  --accent: #A68B60; --accent-hi: #c0a374; --warn: #8C3023; --warn-hi: #b2402f; --green: #576044; --green-hi: #7d8a60;
  --amber: #b8862f;
  --r: 6px;
  --f-text: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
  --f-head: 'Oswald', 'Roboto Condensed', sans-serif;
  --f-logo: 'Russo One', 'Oswald', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 var(--f-text); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-hi); }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-head); font-weight: 700; letter-spacing: .02em; margin: 0 0 .6em; }
h2 { font-size: 20px; } h3 { font-size: 16px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; }

/* кнопки и поля */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--r); border: 1px solid var(--line2); background: var(--bg2); cursor: pointer; white-space: nowrap; min-height: 34px; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; border-color: var(--line2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1b1612; font-weight: 700; }
.btn.primary:hover { background: var(--accent-hi); }
.btn.danger { background: var(--warn); border-color: var(--warn); color: #f3e3d0; font-weight: 700; }
.btn.danger:hover { background: var(--warn-hi); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg2); border-color: var(--line2); }
.btn.sm { padding: 4px 10px; min-height: 28px; font-size: 13px; }
.btn.on { background: var(--green); border-color: var(--green-hi); }
input[type=text], input[type=password], input[type=search], input:not([type]), select, textarea {
  background: var(--bg3); border: 1px solid var(--line2); border-radius: var(--r); padding: 8px 10px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label.field { display: block; margin: 0 0 12px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* каркас */
#app { display: flex; flex-direction: column; height: 100%; }
#app > .main { flex: 1; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: var(--bg3); border-bottom: 1px solid var(--line); min-height: 48px; }
.logo { font-family: var(--f-logo); font-size: 20px; letter-spacing: .06em; color: var(--accent); white-space: nowrap; }
.logo small { font-family: var(--f-head); font-size: 13px; color: var(--muted); letter-spacing: .04em; margin-left: 8px; }
.tabsbar { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: thin; }
.tab { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--r) var(--r) 0 0; background: transparent; border: 1px solid transparent; cursor: pointer; white-space: nowrap; max-width: 220px; }
.tab .t { overflow: hidden; text-overflow: ellipsis; }
.tab.active { background: var(--bg); border-color: var(--line); border-bottom-color: var(--bg); color: var(--accent-hi); }
.tab .x { opacity: .6; padding: 0 2px; border: 0; background: none; cursor: pointer; }
.tab .x:hover { opacity: 1; color: var(--warn-hi); }
.sessions-btn { display: none; }
.corebar { padding: 6px 14px; font-size: 14px; background: var(--warn); color: #f6e7d3; display: flex; gap: 10px; align-items: center; }
.corebar.amber { background: #5a4520; }
.main { display: grid; grid-template-columns: 250px 1fr; min-height: 0; }
.side { border-right: 1px solid var(--line); overflow-y: auto; padding: 8px; background: #1b1916; }
.side .s-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r); cursor: pointer; }
.side .s-item:hover { background: var(--bg2); }
.side .s-item.open { color: var(--accent-hi); }
.side .s-grp { font-family: var(--f-head); font-size: 12px; color: var(--faint); text-transform: uppercase; margin: 10px 8px 4px; letter-spacing: .08em; }
.content { min-width: 0; min-height: 0; position: relative; overflow: hidden; }
.page { position: absolute; inset: 0; overflow-y: auto; padding: 16px; }
.page.rdp-page { padding: 0; overflow: hidden; display: grid; grid-template-rows: auto 1fr auto; }

/* точки состояния */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--faint); }
.dot.online, .dot.ready, .dot.on, .dot.connected { background: #8fae5a; box-shadow: 0 0 6px #8fae5a88; }
.dot.offline, .dot.lost, .dot.error, .dot.off { background: var(--warn-hi); }
.dot.pending, .dot.connecting, .dot.unknown { background: var(--amber); }
.dot.revoked { background: #555; }

/* каталог */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { max-width: 320px; }
.chip { padding: 5px 12px; border-radius: 16px; border: 1px solid var(--line2); background: transparent; cursor: pointer; }
.chip.on { background: var(--bg2); border-color: var(--accent); color: var(--accent-hi); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.card .head { display: flex; align-items: flex-start; gap: 8px; }
.card .name { font-family: var(--f-head); font-size: 17px; font-weight: 700; cursor: pointer; flex: 1; overflow-wrap: anywhere; }
.card .name:hover { color: var(--accent-hi); }
.star { background: none; border: 0; cursor: pointer; font-size: 18px; color: var(--faint); padding: 0 2px; line-height: 1; }
.star.on { color: var(--accent-hi); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 8px; border-radius: 4px; background: var(--bg3); border: 1px solid var(--line); }
.tag { font-size: 12px; padding: 1px 7px; border-radius: 10px; background: #3a3026; color: var(--muted); }
.meta { font-size: 13px; color: var(--muted); }
.card .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.op { font-size: 13px; padding: 6px 8px; border-radius: 4px; background: var(--bg3); border-left: 3px solid var(--amber); }
.op.ok { border-left-color: var(--green-hi); } .op.fail { border-left-color: var(--warn-hi); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* меню */
.menu { position: fixed; z-index: 60; background: var(--bg3); border: 1px solid var(--line2); border-radius: var(--r); padding: 4px; min-width: 220px; box-shadow: 0 8px 24px #000a; }
.menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; background: none; border: 0; border-radius: 4px; cursor: pointer; }
.menu button:hover:not(:disabled) { background: var(--bg2); }
.menu button:disabled { opacity: .4; cursor: not-allowed; }
.menu button.danger { color: #e07a68; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* окна */
.modal-bg { position: fixed; inset: 0; background: #000b; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--bg3); border: 1px solid var(--line2); border-radius: 10px; width: min(520px, 100%); max-height: 92vh; overflow-y: auto; padding: 18px; }
.modal.wide { width: min(980px, 100%); }
.modal .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.warnbox { background: #3b1d17; border: 1px solid var(--warn); border-radius: var(--r); padding: 10px; margin: 10px 0; }
.infobox { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin: 10px 0; }
.err { color: #e98c7a; margin-top: 8px; min-height: 1em; }
.code-big { font-family: ui-monospace, Consolas, monospace; font-size: 28px; letter-spacing: .12em; text-align: center; padding: 14px; background: var(--bg); border: 1px dashed var(--accent); border-radius: 8px; user-select: all; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg3); border-left: 1px solid var(--line2); z-index: 40; overflow-y: auto; padding: 18px; box-shadow: -10px 0 30px #0009; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 10px; font-size: 14px; margin-bottom: 12px; }
.kv > div:nth-child(odd) { color: var(--muted); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { font-family: var(--f-head); font-weight: 700; color: var(--muted); font-size: 13px; position: sticky; top: 0; background: var(--bg); }
tr.bad td { background: #2e1915; } tr.dup td { background: #2b2717; }
.res-ok { color: #9fbf6a; } .res-fail { color: #e98c7a; } .res-info { color: var(--muted); }
.section { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 14px; max-width: 900px; }
.qr { background: #fff; padding: 10px; border-radius: 6px; width: 220px; margin: 8px auto; }
.qr svg { display: block; width: 100%; height: auto; }

/* вход */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .box { width: min(400px, 100%); background: var(--bg3); border: 1px solid var(--line2); border-radius: 12px; padding: 26px; }
.login .logo { font-size: 30px; text-align: center; margin-bottom: 2px; }
.login .sub { text-align: center; color: var(--muted); margin-bottom: 20px; font-family: var(--f-head); }

/* рабочий стол */
.rdp-bar { display: flex; align-items: center; gap: 6px; padding: 5px 8px; background: var(--bg3); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rdp-bar .title { font-family: var(--f-head); font-weight: 700; margin-right: 6px; }
.rdp-holder { position: relative; min-height: 0; background: #0d0c0b; }
.rdp { position: absolute; inset: 0; }
.rdp-viewport { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; outline: none; touch-action: none; }
.rdp-viewport.scroll { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.rdp-stage { transform-origin: 0 0; }
.rdp-canvas { display: block; image-rendering: auto; }
.rdp[data-state=idle] .rdp-canvas, .rdp[data-state=error] .rdp-canvas { visibility: hidden; }
.osk-input { position: absolute; left: -2000px; top: 0; width: 10px; height: 10px; opacity: 0; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #0d0c0bd9; z-index: 5; padding: 16px; }
.overlay .box { max-width: 560px; width: 100%; background: var(--bg3); border: 1px solid var(--line2); border-radius: 10px; padding: 20px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.keysbar { display: none; gap: 4px; padding: 4px; background: var(--bg3); border-top: 1px solid var(--line); overflow-x: auto; }
.keysbar .btn { min-width: 42px; justify-content: center; padding: 6px 8px; }
.touch .keysbar { display: flex; }
.pseudo-full .topbar, .pseudo-full .side, .pseudo-full .corebar { display: none !important; }
.pseudo-full .main { grid-template-columns: 1fr; }

/* узкие экраны и телефон */
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; }
  .side { display: none; }
  .side.show { display: block; position: fixed; z-index: 45; top: 48px; bottom: 0; left: 0; width: 280px; }
  .tabsbar { display: none; }
  .sessions-btn { display: inline-flex; }
  .logo small { display: none; }
  .grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 120px 1fr; }
  .rdp-bar .wide-only { display: none; }
}
@media (min-width: 901px) { .narrow-only { display: none !important; } }
