:root {
  color-scheme: dark;
  --bg: #07181b;
  --card: #10272a;
  --card-strong: #0b2023;
  --gold: #c8a55f;
  --text: #eef1e9;
  --muted: #a9c1bd;
  --line: rgba(200, 165, 95, .36);
  --danger: #bc6c62;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { border: 1px solid var(--line); border-radius: 8px; background: #183337; color: var(--text); padding: 10px 14px; cursor: pointer; }
button:hover:not(:disabled), button:focus-visible { border-color: var(--gold); filter: brightness(1.08); }
button:disabled { opacity: .42; cursor: not-allowed; }
input, select, textarea, .report-editor { width: 100%; border: 1px solid rgba(200,165,95,.28); border-radius: 8px; background: #081a1d; color: var(--text); padding: 12px; outline: none; }
input:focus, select:focus, textarea:focus, .report-editor:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(200,165,95,.16); }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
label { display: grid; gap: 8px; margin: 15px 0; color: #dce8e5; font-size: 13px; }
p { color: var(--muted); line-height: 1.5; }
h1 { font-size: 30px; margin: 10px 0; }
h2 { font-size: 19px; margin: 0; }

.center-view { min-height: 100%; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 50% 30%, #153236 0, var(--bg) 62%); }
.center-view.starting-server { background-image: linear-gradient(90deg,rgba(3,15,17,.45),rgba(3,15,17,.76) 48%,rgba(3,15,17,.92)),url('/server-startup-bg.webp'); background-position: center; background-size: cover; }
.center-view.starting-server .landing-card { background: rgba(9,31,34,.89); backdrop-filter: blur(12px); }
.card { width: min(440px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 12px; background: rgba(16,39,42,.98); box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.landing-card { width: min(500px, 100%); }
.eyebrow { margin: 0 0 5px; font-size: 10px; letter-spacing: .22em; color: #e0c68d; }
.primary { background: var(--gold); color: #07181b; font-weight: 750; }
.secondary { background: #183337; }
.wide { width: 100%; padding: 13px; }
.text-button { padding: 8px 0; border: 0; background: transparent; color: #e0c68d; }
.danger-text { color: #e9a39a; }
.status { min-height: 20px; margin-top: 10px; color: #ddc896; font-size: 13px; }
.muted { color: var(--muted); }
.small-copy { font-size: 12px; }
.app-version { margin: 14px 0 0; text-align: center; color: #78928f; font-size: 11px; letter-spacing: .05em; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0 14px; }
.auth-tabs button { background: #0b2023; color: var(--muted); }
.auth-tabs button.active { border-color: var(--gold); background: #2a3e36; color: #f2d99f; }
.specialty-choice { margin: 16px 0; padding: 12px 14px; border: 1px solid rgba(200,165,95,.28); border-radius: 8px; }
.specialty-choice legend { padding: 0 6px; color: #e0c68d; font-size: 12px; font-weight: 700; }
.specialty-choice label { display: flex; align-items: center; gap: 9px; margin: 9px 0; }
.specialty-choice input { width: auto; margin: 0; }
.startup-progress { margin-top: 15px; padding: 14px; border: 1px solid rgba(200,165,95,.35); border-radius: 9px; background: rgba(7,24,27,.72); }
.startup-progress-heading { display: flex; justify-content: space-between; gap: 12px; color: #f0dfba; font-size: 13px; }
.startup-progress-track { height: 8px; margin-top: 10px; overflow: hidden; border-radius: 5px; background: rgba(255,255,255,.1); }
.startup-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#9f7e3f,#ebc977); transition: width .35s ease; }
.startup-progress p { margin: 9px 0 0; font-size: 12px; }

#workspace { position: fixed; inset: 0; overflow: hidden; background: #000; }
#rdpFrame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.topbar { position: absolute; z-index: 40; top: 0; left: 50%; transform: translateX(-50%); height: 36px; width: min(650px, calc(100% - 150px)); display: flex; align-items: center; gap: 14px; padding: 3px 6px 3px 14px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; background: rgba(7,24,27,.94); backdrop-filter: blur(10px); transition: opacity .16s, transform .16s; }
.brand { font-weight: 800; letter-spacing: .15em; font-size: 13px; }
.brand span { color: var(--gold); }
.session-name { min-width: 100px; max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 5px; margin-left: auto; }
.top-actions button { padding: 5px 9px; font-size: 12px; }
.top-actions #settingsButton { font-size: 17px; padding-inline: 10px; }
.finish { color: #f3c1bb; }
.topbar[data-position="left"] { left: 8px; transform: none; }
.topbar[data-position="right"] { left: auto; right: 8px; transform: none; }

.edge-tools { position: absolute; z-index: 45; inset: 0; pointer-events: none; }
.edge-button { pointer-events: auto; position: absolute; width: 58px; height: 88px; min-width: 0; min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 7px; padding: 6px 3px; border-radius: 0 7px 7px 0; background: rgba(10,34,37,.88); backdrop-filter: blur(10px); box-shadow: 0 5px 18px rgba(0,0,0,.34); transition: background .16s, border-color .16s, box-shadow .16s; touch-action: none; user-select: none; font-size: 10px; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
.edge-button[data-edge="right"] { border-radius: 7px 0 0 7px; }
.edge-button[data-edge="top"] { width: 88px; height: 58px; flex-direction: row; border-radius: 0 0 7px 7px; }
.edge-button[data-edge="bottom"] { width: 88px; height: 58px; flex-direction: row; border-radius: 7px 7px 0 0; }
.edge-button.record { width: 72px; height: 106px; font-size: 11px; }
.edge-button.record[data-edge="top"], .edge-button.record[data-edge="bottom"] { width: 106px; height: 72px; }
.edge-button.dragging { cursor: grabbing; border-color: #e1bd78; box-shadow: 0 0 0 4px rgba(200,165,95,.18), 0 8px 24px rgba(0,0,0,.55); }
.edge-button.holding::after { content: ""; position: absolute; left: 3px; bottom: 2px; height: 2px; border-radius: 2px; background: #e1bd78; animation: dock-hold 5s linear forwards; }
@keyframes dock-hold { from { width: 0; } to { width: calc(100% - 6px); } }
.edge-button.active { background: #843934; }
.edge-button.delete { color: #f0aaa2; }
.tab-icon, .tab-language { width: 30px; flex: 0 0 30px; text-align: center; font-weight: 800; font-size: 25px; line-height: 1; }
.tab-language { color: #e5c77f; font-size: 17px; }
.record-quick-controls { pointer-events: auto; position: absolute; z-index: 47; width: 158px; min-height: 48px; display: flex; align-items: center; gap: 7px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: rgba(7,25,28,.95); box-shadow: 0 8px 22px rgba(0,0,0,.38); }
.record-quick-controls .quick-mode { display: flex; grid-template-columns: none; align-items: center; gap: 5px; margin: 0; font-size: 11px; white-space: nowrap; }
.record-quick-controls .quick-mode input { width: auto; margin: 0; }
.record-quick-controls select { width: 52px; padding: 7px 5px; font-size: 12px; }
.live-transcript { pointer-events: none; position: absolute; z-index: 47; width: min(280px, calc(100vw - 90px)); min-height: 58px; max-height: 104px; overflow: hidden; padding: 10px 12px; border: 1px solid rgba(225,189,120,.7); border-radius: 8px; background: rgba(7,25,28,.96); color: #fff4d5; font-size: 13px; line-height: 1.35; box-shadow: 0 8px 24px rgba(0,0,0,.46); }
.live-transcript::before { content: "● "; color: #f08d82; }
.badge { position: absolute; top: 4px; right: 5px; min-width: 17px; height: 17px; padding: 1px 4px; border-radius: 9px; background: #b94f46; color: #fff; font-size: 10px; font-style: normal; }
.dock-guide { position: absolute; z-index: 44; pointer-events: none; background: #e1bd78; box-shadow: 0 0 18px rgba(225,189,120,.85); }
.dock-guide[data-edge="left"], .dock-guide[data-edge="right"] { top: 40px; bottom: 0; width: 3px; }
.dock-guide[data-edge="left"] { left: 0; } .dock-guide[data-edge="right"] { right: 0; }
.dock-guide[data-edge="top"], .dock-guide[data-edge="bottom"] { left: 0; right: 0; height: 3px; }
.dock-guide[data-edge="top"] { top: 40px; } .dock-guide[data-edge="bottom"] { bottom: 0; }

.drawer { position: absolute; z-index: 42; top: 46px; width: min(460px, calc(100vw - 90px)); max-height: calc(100vh - 24px); padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: rgba(7,25,28,.94); backdrop-filter: blur(15px); box-shadow: 0 16px 50px rgba(0,0,0,.46); overflow: auto; }
.drawer.expanded { width: min(780px, calc(100vw - 90px)); }
.emergency-windows-login { margin: 12px 0; padding: 0 11px 11px; border: 1px solid rgba(200,165,95,.3); border-radius: 8px; background: rgba(8,29,32,.56); }
.emergency-windows-login summary { padding: 11px 0; cursor: pointer; color: #e4c780; font-weight: 700; }
.emergency-windows-login label { margin-top: 9px; }
.emergency-windows-login .small-copy { margin: 0 0 10px; line-height: 1.4; }
.drawer header { position: sticky; top: -18px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -18px -18px 14px; padding: 17px 18px 12px; background: rgba(7,25,28,.98); }
.heading-actions { display: flex; gap: 4px; }
.heading-actions button { border: 0; background: transparent; padding: 4px 8px; font-size: 20px; }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; }
.field-heading label { margin: 0; }
.mic-button { flex: 0 0 auto; width: 38px; height: 34px; padding: 4px; }
.mic-button.active { background: #843934; animation: pulse 1.1s infinite; }
.tall-text, .report-editor { min-height: 300px; }
.report-editor { margin: 10px 0 14px; overflow: auto; line-height: 1.55; white-space: pre-wrap; }
.button-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.button-row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.text-workflow-panel { scroll-behavior: smooth; }
.text-workflow-nav { position: sticky; z-index: 2; top: 48px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 0 0 12px; padding: 7px; border: 1px solid rgba(200,165,95,.25); border-radius: 9px; background: rgba(7,25,28,.98); }
.text-workflow-nav button { min-height: 38px; padding: 7px 10px; color: #ead49e; }
.workflow-section { margin: 0 0 14px; padding: 15px; border: 1px solid rgba(200,165,95,.24); border-radius: 10px; background: rgba(8,29,32,.82); scroll-margin-top: 112px; }
.workflow-step-heading { display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; gap: 10px; }
.workflow-step-heading strong, .workflow-step-heading small { display: block; }
.workflow-step-heading strong { color: #f0dfba; font-size: 15px; }
.workflow-step-heading small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.workflow-step-number { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; color: #e7c77e; font-weight: 800; }
.workflow-input { min-height: 170px; }
.text-workflow-panel .report-editor { min-height: 190px; max-height: 360px; }
.workflow-create { margin-top: 12px; min-height: 48px; font-size: 15px; }
.workflow-buttons { flex-wrap: wrap; }
.workflow-buttons button { min-height: 42px; flex: 1 1 180px; }
.workflow-status { position: sticky; z-index: 2; bottom: -18px; margin: 0 -18px -18px; padding: 11px 18px; border-top: 1px solid rgba(200,165,95,.28); background: rgba(7,25,28,.98); }
.signing-panel textarea { min-height: 125px; }
.capture-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(92px,1fr)); gap: 8px; margin: 12px 0; }
.capture-item { position: relative; min-height: 64px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #071518; }
.capture-item img, .capture-item video, .capture-item audio { width: 100%; display: block; }
.capture-item video { min-height: 150px; background: #020707; border-radius: 7px; }
.capture-item video:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.media-meta { padding: 7px 38px 2px 2px; color: var(--muted); font-size: 12px; }
.capture-item button { position: absolute; right: 3px; top: 3px; padding: 2px 6px; background: rgba(0,0,0,.75); }
.chat-stream { min-height: 160px; max-height: 310px; overflow: auto; display: grid; gap: 8px; padding: 10px; border: 1px solid rgba(200,165,95,.2); border-radius: 8px; background: #081a1d; }
.chat-message { padding: 9px 11px; border-radius: 8px; background: #173135; }
.chat-message.mine { background: #493e27; }
.chat-message strong { display: block; margin-bottom: 4px; color: #e4c780; }
.chat-message p { margin: 0; color: var(--text); white-space: pre-wrap; }
.approval-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.approval-actions button { min-height: 34px; padding: 6px 12px; }
.approval-actions small { color: #d9c38b; }
.check-row { display: flex; grid-template-columns: none; align-items: flex-start; gap: 9px; }
.check-row input { width: auto; margin-top: 3px; }
.settings-panel { padding-bottom: 74px; }
.settings-domain-title { margin: 18px 2px 6px; color: #e4c780; font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.settings-domain-title.rdp-title { margin-top: 25px; }
.settings-panel details { margin: 0; border: 0; border-bottom: 1px solid rgba(118,145,139,.3); border-radius: 0; background: transparent; }
.settings-panel details:first-of-type { border-top: 1px solid rgba(118,145,139,.3); }
.settings-panel summary { position: relative; min-height: 47px; display: flex; align-items: center; padding: 11px 26px 11px 3px; cursor: pointer; color: var(--text); font-weight: 700; list-style: none; }
.settings-panel summary::-webkit-details-marker { display: none; }
.settings-panel summary::after { content: '›'; position: absolute; right: 4px; color: #cbb16f; font-size: 22px; line-height: 1; transition: transform .15s ease; }
.settings-panel details[open] summary::after { transform: rotate(90deg); }
.settings-panel summary:hover, .settings-panel summary:focus-visible { color: #f1cf87; }
.settings-section-body { padding: 2px 3px 16px; }
.settings-section-body hr { margin: 18px 0; border: 0; border-top: 1px solid rgba(118,145,139,.25); }
.settings-facts { margin: 8px 0 14px; }
.settings-facts div { display: flex; justify-content: space-between; gap: 20px; padding: 8px 0; border-bottom: 1px solid rgba(118,145,139,.18); }
.settings-facts dt { color: var(--muted); font-size: 12px; }
.settings-facts dd { margin: 0; max-width: 62%; color: var(--text); font-size: 12px; text-align: right; overflow-wrap: anywhere; }
.settings-save { position: sticky; z-index: 3; bottom: -1px; margin-top: 20px; box-shadow: 0 -10px 24px rgba(7,25,28,.94); }

.toast { position: absolute; z-index: 70; bottom: 22px; left: 50%; transform: translateX(-50%); max-width: min(720px,calc(100% - 40px)); padding: 12px 18px; border: 1px solid var(--line); border-radius: 9px; background: #10272a; color: #f0dfba; box-shadow: 0 14px 45px #000; }
dialog { border: 0; padding: 0; border-radius: 12px; background: transparent; color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.72); }
.dialog-card { width: min(450px,calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.dialog-card > div:last-child { display: flex; justify-content: flex-end; gap: 10px; }
.danger { background: #843934; }

.capture-overlay { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; background: rgba(4,12,14,.35); cursor: crosshair; overflow: hidden; }
.capture-overlay canvas { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.capture-hint { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 8px; background: rgba(7,24,27,.9); color: #f0dfba; pointer-events: none; }
.capture-actions { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; cursor: default; }
.capture-selection { outline: 2px solid #f0c86c; }

.ui-hidden .edge-tools { display: none; }
.ui-hidden .record-quick-controls, .ui-hidden .live-transcript { display: none; }
.capture-clean .topbar, .capture-clean .edge-tools, .capture-clean .drawer, .capture-clean .toast { display: none !important; }
.video-control { position: fixed; z-index: 1100; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(7,24,27,.96); }
.video-control strong { color: #f0aaa2; }
.video-recording-guide { position: fixed; z-index: 1080; inset: 0; pointer-events: none; }
.video-recording-guide .video-control { pointer-events: auto; white-space: nowrap; box-shadow: 0 12px 38px rgba(0,0,0,.7); }
.video-roi-frame { position: fixed; border: 3px solid #ff665a; outline: 1px solid rgba(255,255,255,.9); outline-offset: 2px; box-shadow: 0 0 0 2px rgba(0,0,0,.75),inset 0 0 0 1px rgba(0,0,0,.8); pointer-events: none; animation: roi-recording-pulse 1.15s ease-in-out infinite; }
.video-roi-frame::before { content: 'REC · записывается только эта область'; position: absolute; left: -3px; top: -31px; padding: 5px 9px; border-radius: 6px 6px 0 0; background: #b53f38; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.video-recording-guide.paused .video-roi-frame { border-color: #f1c96e; animation: none; }
.video-recording-guide.paused .video-roi-frame::before { content: 'ПАУЗА'; background: #756136; }
@keyframes roi-recording-pulse { 50% { box-shadow: 0 0 0 4px rgba(255,102,90,.24),inset 0 0 0 1px rgba(0,0,0,.8); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(188,108,98,.22); } }
@media (max-height: 760px) { .edge-button { width: 52px; height: 68px; font-size: 9px; } .edge-button.record { width: 64px; height: 84px; font-size: 10px; } .edge-button[data-edge="top"], .edge-button[data-edge="bottom"] { width: 68px; height: 52px; } .edge-button.record[data-edge="top"], .edge-button.record[data-edge="bottom"] { width: 84px; height: 64px; } .tab-icon, .tab-language { width: 26px; flex-basis: 26px; font-size: 22px; } .tab-language { font-size: 15px; } }
@media (max-width: 780px) { .drawer, .drawer.expanded { width: calc(100% - 54px); max-width: none; } .topbar { width: calc(100% - 18px); } .session-name { display: none; } .workflow-section { padding: 12px; } .workflow-step-heading { grid-template-columns: 30px minmax(0,1fr) auto; } .workflow-buttons button { flex-basis: 100%; } }
