/* ===================== Тема: светлая (по умолчанию) ===================== */
:root {
  --bg: #eef2f9;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #e7edfb 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 110%, #eaf3f1 0%, transparent 55%);
  --panel: #ffffff;
  --panel-2: #f5f8fc;
  --panel-3: #eef3fa;
  --ink: #14202e;
  --muted: #66758c;
  --line: #e2e8f1;
  --line-soft: #edf1f7;
  --brand: #16314c;
  --brand-grad: linear-gradient(135deg, #1f4068 0%, #2f6db0 100%);
  --accent: #3b6fe0;
  --accent-2: #6366f1;
  --accent-grad: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --accent-soft: #eaf1fe;
  --green: #1f9d57;
  --semi: #b8791f;
  --danger: #d6453a;
  --yellow: #ffe08a;
  --yellow-line: #e6b94c;
  --yellow-ink: #4a3a08;
  --topbar-grad: linear-gradient(100deg, #16314c 0%, #1f4068 55%, #2a5488 100%);
  --shadow: 0 1px 2px rgba(20,32,46,.06), 0 6px 18px rgba(20,32,46,.07);
  --shadow-lg: 0 10px 30px rgba(20,32,46,.14);
  --shadow-pop: 0 18px 50px rgba(16,26,40,.28);
  --radius: 12px;
  --radius-sm: 8px;
  --overlay-bg: rgba(255,255,255,.86);
  --scheme: light;
}

/* ===================== Тема: тёмная ===================== */
html[data-theme="dark"] {
  --bg: #0d1118;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #16233a 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 110%, #122027 0%, transparent 55%);
  --panel: #161d27;
  --panel-2: #1b2531;
  --panel-3: #212d3b;
  --ink: #e6edf6;
  --muted: #8b99ab;
  --line: #2a3543;
  --line-soft: #232e3b;
  --brand: #0e1620;
  --brand-grad: linear-gradient(135deg, #1b2940 0%, #2c4f86 100%);
  --accent: #5a8cf5;
  --accent-2: #818cf8;
  --accent-grad: linear-gradient(135deg, #4f86f7 0%, #818cf8 100%);
  --accent-soft: #1a2740;
  --green: #34c574;
  --semi: #d6a24a;
  --danger: #f0685c;
  --yellow: #d8b24a;
  --yellow-line: #b9933a;
  --yellow-ink: #1c160a;
  --topbar-grad: linear-gradient(100deg, #0e1620 0%, #16243a 60%, #1d3357 100%);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 34px rgba(0,0,0,.5);
  --shadow-pop: 0 20px 56px rgba(0,0,0,.6);
  --overlay-bg: rgba(13,17,24,.86);
  --scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-grad);
  color: var(--ink);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  transition: background-color .3s ease, color .3s ease;
}
.hidden { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---------- Topbar ---------- */
.topbar {
  height: 60px;
  background: var(--topbar-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex: 0 0 auto;
  box-shadow: 0 4px 20px rgba(10,20,35,.18);
  position: relative;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #4f9be0, #6366f1);
  display: grid; place-items: center;
  font-weight: 800; font-size: 19px; color: #fff;
  box-shadow: 0 4px 14px rgba(79,155,224,.45), inset 0 1px 0 rgba(255,255,255,.3);
}
.brand-title { font-weight: 700; font-size: 15px; line-height: 1.1; letter-spacing: .2px; }
.brand-sub { font-size: 11.5px; opacity: .78; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-box { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 12.5px; }
#user-name { font-weight: 600; opacity: .92; }

/* ---------- Settings ---------- */
.settings {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.settings label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.settings input, .settings select {
  font-size: 13px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--ink); background: var(--panel-2);
  transition: border-color .15s, box-shadow .15s;
}
.settings input:focus, .settings select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* ---------- Layout ---------- */
.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 330px;
  gap: 16px;
  padding: 16px;
  min-height: 0;
}
.col {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.col-head { padding: 15px 16px 9px; border-bottom: 1px solid var(--line); }
.col-head h2 { margin: 0; font-size: 14px; letter-spacing: .2px; }
.hint { margin: 5px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ---------- Left: Checko card ---------- */
.checko-card {
  margin: 13px 14px 0; padding: 12px 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  background: linear-gradient(180deg, var(--accent-soft), var(--panel));
  border-radius: 11px;
}
.checko-title { font-weight: 700; font-size: 12.5px; color: var(--accent); margin-bottom: 4px; }
.checko-input { display: flex; gap: 7px; margin-top: 8px; }
.checko-input input {
  flex: 1 1 auto; font-size: 12.5px; padding: 7px 9px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--ink);
}
.checko-input input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.checko-input .btn { padding: 7px 11px; font-size: 12px; white-space: nowrap; }
.checko-result { margin-top: 8px; font-size: 11.5px; }
.checko-found {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 9px; margin-top: 5px; line-height: 1.45; color: var(--ink);
}
.checko-found b { color: var(--accent); }
.checko-found .ok { color: var(--green); font-weight: 700; }
.checko-found.err { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); }

/* ---------- Left: folders ---------- */
.folders { overflow-y: auto; padding: 13px 14px; flex: 1 1 auto; }
.folder {
  border: 1.5px dashed var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 10px;
  transition: border-color .15s, background .15s, transform .12s;
}
.folder:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.folder.drag { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.folder-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.folder-name { font-weight: 600; font-size: 12.5px; display: flex; align-items: center; }
.folder-code {
  display: inline-grid; place-items: center; min-width: 24px; height: 20px;
  background: var(--brand-grad); color: #fff; border-radius: 6px;
  font-size: 11px; padding: 0 6px; margin-right: 8px; font-weight: 700;
}
.folder-count { font-size: 11px; color: var(--accent); font-weight: 600; }
.folder-files { list-style: none; margin: 8px 0 0; padding: 0; }
.folder-files li { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; padding: 3px 0; gap: 6px; }
.folder-files .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-files .fx { color: var(--danger); cursor: pointer; font-weight: 700; padding: 0 3px; }
.folder-hint { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Left: единое окно загрузки ---------- */
.upload { padding: 13px 14px; flex: 1 1 auto; overflow-y: auto; }
.dropzone {
  border: 2px dashed var(--line); border-radius: 12px;
  padding: 22px 14px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
  background: var(--panel-2);
}
.dropzone:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: var(--accent-soft); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.dz-icon { font-size: 30px; opacity: .8; }
.dz-text { font-size: 13px; font-weight: 600; margin-top: 6px; color: var(--ink); line-height: 1.4; }
.dz-hint { font-size: 11px; color: var(--muted); margin-top: 6px; }
.file-list { list-style: none; margin: 12px 0 0; padding: 0; }
.file-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; padding: 7px 9px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
}
.file-list .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fx { color: var(--danger); cursor: pointer; font-weight: 700; padding: 0 4px; flex: 0 0 auto; }

.left-footer { padding: 13px 14px; border-top: 1px solid var(--line); background: var(--panel-2); }
.upload-summary { font-size: 12px; color: var(--muted); margin-bottom: 9px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 8px 14px; cursor: pointer; transition: .16s ease;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; margin-bottom: 8px; }
.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:not(:disabled):hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 7px 20px color-mix(in srgb, var(--accent) 42%, transparent); }
.btn-outline { background: var(--panel); border-color: var(--line); color: var(--accent); }
.btn-outline:not(:disabled):hover { border-color: var(--accent); background: var(--accent-soft); }
.btn-ghost { background: transparent; color: inherit; border-color: transparent; }
.btn-ghost:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.topbar .btn-ghost { color: #fff; }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.16); }

/* ---------- Center: result ---------- */
.result-head {
  padding: 15px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.result-head h2 { margin: 0; font-size: 15px; }
.result-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.legend {
  display: flex; gap: 16px; padding: 9px 18px; border-bottom: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted); flex-wrap: wrap; background: var(--panel-2);
}
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-auto { background: var(--green); }
.dot-semi { background: var(--semi); }
.dot-yellow { background: var(--yellow); border: 1px solid var(--yellow-line); }
.dot-empty { background: var(--muted); opacity: .5; }

.result { position: relative; overflow-y: auto; flex: 1 1 auto; padding: 20px 24px; }
.placeholder { text-align: center; color: var(--muted); padding-top: 64px; }
.ph-icon { font-size: 50px; opacity: .45; }
.placeholder p { line-height: 1.6; font-size: 13px; }

.overlay {
  position: absolute; inset: 0; background: var(--overlay-bg); backdrop-filter: blur(2px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 13px; z-index: 5; text-align: center; padding: 20px;
}
.overlay-sub { font-size: 12px; color: var(--muted); max-width: 320px; }
.spinner {
  width: 40px; height: 40px; border: 4px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Resume blocks ---------- */
.r-title { text-align: center; margin: 0 0 3px; font-size: 20px; letter-spacing: .5px; }
.r-subtitle { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 20px; font-style: italic; }
.block { margin-bottom: 22px; }
.block-h {
  font-size: 13.5px; font-weight: 700; color: var(--ink);
  padding-left: 10px; margin-bottom: 9px;
  display: flex; align-items: center; gap: 9px;
  border-left: 3px solid transparent; border-image: var(--accent-grad) 1;
}
.block-num {
  background: var(--accent-grad); color: #fff; border-radius: 6px;
  font-size: 11px; padding: 2px 8px; font-weight: 700; min-width: 20px; text-align: center;
}
table.kv, table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.kv td, table.tbl td, table.tbl th {
  border: 1px solid var(--line); padding: 6px 9px; vertical-align: top; color: var(--ink);
}
table.kv td.k { width: 38%; font-weight: 600; background: var(--panel-2); color: var(--ink); }
table.tbl th { background: var(--panel-3); font-weight: 700; font-size: 11.5px; text-align: left; }

.cell { min-height: 18px; outline: none; border-radius: 4px; transition: background .12s; }
.cell:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.cell[contenteditable="true"]:hover { background: var(--accent-soft); }
td.yellow, .cell.yellow { background: var(--yellow) !important; }
td.yellow .cell, .cell.yellow { color: var(--yellow-ink); }
td.yellow .cell { background: transparent !important; }
.cell.dash { color: var(--muted); opacity: .7; }

.src {
  display: inline-block; margin-left: 5px; font-size: 9px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; cursor: help;
  vertical-align: middle; user-select: none; background: var(--panel-2);
}
.src.low { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

.note {
  font-size: 11.5px; color: var(--muted); font-style: italic; margin: 7px 0 0;
  background: var(--panel-2); border-left: 2px solid var(--line); padding: 6px 10px; border-radius: 0 6px 6px 0;
}
.note.warn { background: color-mix(in srgb, var(--yellow) 22%, var(--panel)); border-left-color: var(--yellow-line); color: var(--semi); }
.note b { color: var(--ink); }
textarea.narrative {
  width: 100%; min-height: 92px; font: inherit; font-size: 12.5px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px; resize: vertical;
  background: var(--panel-2);
}
textarea.narrative:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea.narrative.yellow { background: color-mix(in srgb, var(--yellow) 18%, var(--panel)); }

/* ---------- Right: recon ---------- */
.recon { overflow-y: auto; padding: 13px 14px; flex: 1 1 auto; }
.usage-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; font-size: 11.5px; color: var(--muted); }
.usage-card b { color: var(--ink); }
.recon-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; margin-bottom: 9px; font-size: 12px; line-height: 1.5; background: var(--panel); }
.recon-item .rt { font-weight: 700; color: var(--accent); display: block; margin-bottom: 2px; font-size: 11.5px; }
.recon-item.warn { border-color: var(--yellow-line); background: color-mix(in srgb, var(--yellow) 14%, var(--panel)); }
.recon-empty { color: var(--muted); font-size: 12px; }
.warn-tag { color: var(--danger); font-weight: 700; }

/* ---------- Auth: login ---------- */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(99,102,241,.55), transparent 60%),
    radial-gradient(700px 500px at 10% 110%, rgba(47,109,176,.5), transparent 60%),
    linear-gradient(135deg, #14233a, #1f4068);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: var(--panel); border-radius: 16px; padding: 32px 30px; width: 350px;
  box-shadow: var(--shadow-pop); text-align: center; border: 1px solid var(--line-soft);
}
.login-brand { display: flex; justify-content: center; margin-bottom: 14px; }
.login-brand .brand-mark { width: 50px; height: 50px; font-size: 26px; border-radius: 13px; }
.login-card h1 { margin: 0; font-size: 20px; color: var(--ink); }
.login-sub { color: var(--muted); font-size: 12.5px; margin: 5px 0 22px; }
.login-card label { display: block; text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 13px; }
.login-card input {
  width: 100%; margin-top: 5px; padding: 10px 12px; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
}
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.login-error { background: color-mix(in srgb, var(--danger) 14%, var(--panel)); color: var(--danger); font-size: 12.5px; padding: 9px 11px; border-radius: var(--radius-sm); margin-bottom: 13px; }

/* ---------- Modal: admin ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(10,16,26,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: var(--panel); border-radius: 14px; width: min(840px, 96vw); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-pop); border: 1px solid var(--line-soft); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-tabs { display: flex; gap: 4px; padding: 8px 14px 0; border-bottom: 1px solid var(--line); }
.modal-tabs .tab { border: none; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); padding: 9px 14px; cursor: pointer; border-bottom: 2px solid transparent; }
.modal-tabs .tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-body label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin: 11px 0; }
.modal-body input { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font-size: 13px; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.modal-body input:focus { outline: none; border-color: var(--accent); }
.create-user { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.create-user input { flex: 1 1 200px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; background: var(--panel-2); color: var(--ink); }
.create-user select { padding: 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; background: var(--panel-2); color: var(--ink); }
.new-cred { background: color-mix(in srgb, var(--green) 14%, var(--panel)); border: 1px solid color-mix(in srgb, var(--green) 40%, var(--line)); color: var(--green); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; font-size: 13px; font-weight: 600; user-select: all; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; color: var(--ink); }
.admin-table th { color: var(--muted); font-size: 11.5px; }
.btn.mini { padding: 3px 9px; font-size: 11.5px; }
.btn.mini.danger { color: var(--danger); }
.keys-status { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; margin: 10px 0; color: var(--muted); }
.keys-status b { color: var(--ink); }

/* ---------- Онлайн-прогресс (правая панель) ---------- */
.progress-head { margin-bottom: 12px; }
.progress-label { font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.progress-bar { height: 9px; background: var(--panel-3); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.progress-fill {
  height: 100%; width: 0; border-radius: 6px;
  background: var(--accent-grad); transition: width .4s ease;
}
.progress-fill.done { background: linear-gradient(135deg, #1f9d57, #2ec46f); }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  display: flex; align-items: center; gap: 9px; font-size: 12.5px;
  padding: 7px 0; color: var(--muted); border-bottom: 1px dashed var(--line-soft);
}
.steps li:last-child { border-bottom: none; }
.steps li .st-mark { width: 18px; text-align: center; font-size: 13px; flex: 0 0 auto; }
.steps li.done { color: var(--ink); }
.steps li.done .st-mark { color: var(--green); }
.steps li.active { color: var(--accent); font-weight: 700; }
.steps li.active .st-mark { color: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }
.progress-time { margin-top: 10px; font-size: 11.5px; color: var(--muted); }

.recon-block .block-h .block-num { background: linear-gradient(135deg,#7a8aa0,#9aa7bb); }

/* ---------- История ---------- */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
  cursor: pointer; transition: .14s; background: var(--panel);
}
.history-item:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.history-item .hi-title { font-weight: 700; font-size: 13px; color: var(--ink); }
.history-item .hi-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 11px 18px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-lg); z-index: 120; max-width: 80vw; }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--green); color: #fff; }

/* ---------- Theme toggle (внизу) ---------- */
.theme-bar { position: fixed; right: 18px; bottom: 18px; z-index: 80; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 22px; padding: 7px 13px; font-size: 12.5px; font-weight: 600;
  box-shadow: var(--shadow-lg); transition: .16s ease; user-select: none;
}
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--accent); }
.theme-toggle .ic { font-size: 14px; }

/* ---------- Планшет / узкий экран: столбцы в одну колонку ---------- */
@media (max-width: 1100px) {
  body { overflow: auto; }
  .layout {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    height: auto;
    padding: 12px;
    gap: 12px;
  }
  .col { overflow: visible; }
  .folders, .recon { overflow: visible; }
  .result { overflow: visible; height: auto; }
  .col-center { min-height: 55vh; }
  .theme-bar { bottom: 12px; right: 12px; }
}

/* ---------- Телефон ---------- */
@media (max-width: 720px) {
  body { font-size: 13.5px; }

  .topbar {
    height: auto; min-height: 52px; flex-wrap: wrap;
    padding: 8px 12px; row-gap: 6px; gap: 8px;
  }
  .brand { gap: 10px; }
  .brand-mark { width: 32px; height: 32px; font-size: 17px; border-radius: 9px; }
  .brand-title { font-size: 14px; }
  .brand-sub { display: none; }
  .top-actions { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .top-actions .btn { padding: 6px 9px; font-size: 12px; }
  #user-name { max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .layout { padding: 10px; gap: 12px; }
  .col-head { padding: 12px 13px 8px; }
  .result { padding: 15px 13px; }
  .result-head { flex-direction: column; align-items: stretch; gap: 9px; }
  .result-actions { width: 100%; }
  .result-actions .btn { flex: 1; }
  .legend { gap: 12px 14px; }

  /* широкие таблицы резюме — горизонтальный скролл внутри блока */
  .block { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.tbl { min-width: 540px; }
  .r-title { font-size: 17px; }
  .r-subtitle { font-size: 11px; margin-bottom: 16px; }

  .settings-grid { grid-template-columns: 1fr; }

  /* модалки и форма входа — на всю ширину */
  .modal { width: 96vw; max-height: 92vh; }
  .modal-head { padding: 13px 14px; }
  .modal-body { padding: 14px; }
  .modal-tabs { overflow-x: auto; }
  .tab-pane { overflow-x: auto; }
  .admin-table { min-width: 460px; }
  .create-user { flex-direction: column; }
  .create-user input, .create-user select, .create-user .btn { width: 100%; }
  .login-card { width: 92vw; max-width: 360px; padding: 26px 22px; }

  /* переключатель темы — компактный круглый значок */
  .theme-bar { bottom: 10px; right: 10px; }
  .theme-toggle { padding: 10px; border-radius: 50%; }
  .theme-toggle #theme-label { display: none; }
  .theme-toggle .ic { font-size: 17px; }
}
