*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:     #1B2A45;
  --navy-lt:  #24365A;
  --blue:     #0066CC;
  --blue-lt:  #E8F1FB;
  --bg:       #F2F5FA;
  --surface:  #FFFFFF;
  --border:   #DDE3ED;
  --border2:  #EBEFF6;
  --text:     #1B2A45;
  --muted:    #6B7A96;
  --muted2:   #9BA6BB;
  --ai-red:   #C93535;
  --hu-grn:   #2A8C4A;
  --ed-blu:   #3B6EB5;
  --un-gry:   #9BA0AC;
  --amber:    #A07000;
  --amber-bg: #FFF8E6;
  --mono:     'DM Mono', 'Courier New', monospace;
  --ui:       'Inter', system-ui, -apple-system, sans-serif;
  --r:        8px;
  --r2:       12px;
  --sh:       0 1px 2px rgba(27,42,69,.06), 0 0 0 1px rgba(27,42,69,.05);
  --sh2:      0 8px 24px rgba(27,42,69,.14), 0 0 0 1px rgba(27,42,69,.06);
}

html, body { height: 100%; }
body {
  font-family: var(--ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--blue); }

.topbar { background: var(--navy); padding: 10px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-name { font-family: var(--mono); font-weight: 500; font-size: 16px; color: #fff; }
.brand-name em { color: #5B9BFF; font-style: normal; }
.brand-v { font-family: var(--mono); font-size: 10px; color: rgba(255,255,255,.35); }

.mode-toggle { display: flex; background: rgba(255,255,255,.07); border-radius: 18px; padding: 3px; margin-left: 8px; }
.mode-btn { font-family: var(--ui); font-weight: 500; font-size: 12.5px; padding: 6px 16px; border-radius: 15px; border: none; cursor: pointer; background: transparent; color: rgba(255,255,255,.55); transition: background .2s, color .2s; }
.mode-btn.active { background: var(--blue); color: #fff; }

.key-chip { margin-left: auto; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 20px; padding: 5px 6px 5px 12px; flex: 1 1 260px; min-width: 0; }
.key-chip input { background: none; border: none; outline: none; color: #fff; font-family: var(--mono); font-size: 11.5px; width: 100%; min-width: 0; flex: 1; }
.key-chip input::placeholder { color: rgba(255,255,255,.3); }
.key-field-label { font-family: var(--mono); font-size: 10px; color: rgba(255,255,255,.4); letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; }
.key-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted2); flex-shrink: 0; transition: background .2s; }
.key-dot.active { background: #4ADE80; }
.key-eye { background: none; border: none; cursor: pointer; color: rgba(255,255,255,.4); font-size: 12px; padding: 2px; }

.icon-btn { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.07); border: none; color: rgba(255,255,255,.6); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 15px; transition: background .15s, color .15s; flex-shrink: 0; }
.icon-btn:hover { background: rgba(255,255,255,.14); color: #fff; }

.substrip { background: var(--navy-lt); padding: 6px 20px; display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 10.5px; color: rgba(255,255,255,.35); }
.substrip a { color: rgba(255,255,255,.5); text-underline-offset: 2px; }
.risk-pill { margin-left: auto; display: flex; align-items: center; gap: 6px; color: #F0C550; cursor: pointer; font-family: var(--ui); font-size: 11.5px; }

/* ══════════ REMEMBER-KEY BAR ══════════ */
.remember-bar {
  background: var(--blue-lt); border-bottom: 1px solid rgba(0,102,204,.15);
  padding: 9px 20px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; font-size: 12.5px; color: var(--text); flex-wrap: wrap;
}
.remember-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-ghost.sm { padding: 5px 12px; font-size: 11.5px; }
.btn-primary.sm { width: auto; margin-top: 0; padding: 6px 14px; font-size: 12px; }

/* ══════════ STATUS BAR (persistent, bottom of screen) ══════════ */
.status-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
  background: var(--navy); color: #fff;
  padding: 10px 20px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; box-shadow: 0 -4px 16px rgba(0,0,0,.15);
  font-size: 12.5px;
}
.status-bar-msg { line-height: 1.5; color: rgba(255,255,255,.85); flex: 1; min-width: 200px; }
.status-bar-msg .ok { color: #4ADE80; }
.status-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.status-bar .btn-ghost.sm { background: transparent; border-color: rgba(255,255,255,.25); color: rgba(255,255,255,.8); }
.status-bar .btn-ghost.sm:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.4); color: #fff; }

/* ══════════ LAYOUT ══════════ */
.shell { flex: 1; max-width: 1320px; width: 100%; margin: 0 auto; padding: 18px 20px; display: grid; grid-template-columns: 400px 1fr; gap: 16px; align-items: start; }
@media (max-width: 920px) { .shell { grid-template-columns: 1fr; } }

.card { background: var(--surface); border-radius: var(--r2); box-shadow: var(--sh); overflow: hidden; }
.card + .card { margin-top: 14px; }
.card-hd { padding: 12px 16px; border-bottom: 1px solid var(--border2); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-weight: 600; font-size: 12.5px; color: var(--text); }
.card-bd { padding: 16px; }

/* ══════════ INPUT TABS ══════════ */
.input-tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: var(--r); margin-bottom: 12px; }
.input-tab { flex: 1; padding: 7px 10px; font-size: 12.5px; font-weight: 500; border-radius: 6px; border: none; background: none; cursor: pointer; color: var(--muted); transition: background .15s, color .15s; }
.input-tab.active { background: var(--surface); color: var(--blue); box-shadow: var(--sh); }
.input-pane { display: none; }
.input-pane.active { display: block; }

textarea { width: 100%; height: 250px; font-family: var(--ui); font-size: 13.5px; line-height: 1.6; padding: 12px; border: 1px solid var(--border); border-radius: var(--r); resize: vertical; outline: none; color: var(--text); background: var(--bg); transition: border-color .15s, background .15s; }
textarea:focus { border-color: var(--blue); background: #fff; }
textarea::placeholder { color: var(--muted2); }

.url-input { width: 100%; padding: 11px 12px; font-family: var(--ui); font-size: 13.5px; border: 1px solid var(--border); border-radius: var(--r); outline: none; background: var(--bg); color: var(--text); }
.url-input:focus { border-color: var(--blue); background: #fff; }

.upload-zone { border: 1.5px dashed var(--border); border-radius: var(--r); padding: 40px 20px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; background: var(--bg); }
.upload-zone:hover, .upload-zone.drag { border-color: var(--blue); background: var(--blue-lt); }
.uz-icon { font-size: 26px; opacity: .4; display: block; margin-bottom: 8px; }
.uz-main { font-size: 13.5px; margin-bottom: 3px; }
.uz-main b { color: var(--blue); font-weight: 600; }
.uz-sub { font-size: 11.5px; color: var(--muted); }
.uploaded-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 10px; background: var(--bg); border-radius: var(--r); font-size: 12.5px; }
.uploaded-file .uf-name { flex: 1; font-weight: 500; }
.uploaded-file .uf-size { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.uploaded-file .uf-rm { background: none; border: none; color: var(--muted2); cursor: pointer; font-size: 15px; }

.char-count { text-align: right; font-family: var(--mono); font-size: 10.5px; color: var(--muted2); margin-top: 6px; }

/* ══════════ OPTIONS ══════════ */
.opt-block { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border2); }
.opt-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.opt-row:last-child { margin-bottom: 0; }
.opt-label { font-size: 12px; font-weight: 500; color: var(--muted); min-width: 66px; }
select { font-family: var(--ui); font-size: 12.5px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); outline: none; cursor: pointer; flex: 1; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.switch-label { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.switch-label .sub { font-size: 11px; color: var(--muted2); }

.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 20px; transition: background .2s; }
.slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
input:checked + .slider { background: var(--blue); }
input:checked + .slider::before { transform: translateX(16px); }

.service-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; margin-bottom: 10px; }
.chip { padding: 5px 11px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); font-family: var(--mono); font-size: 11px; cursor: pointer; color: var(--muted); transition: all .15s; user-select: none; }
.chip.on { background: var(--blue-lt); border-color: rgba(0,102,204,.3); color: var(--blue); }
.chip.locked { opacity: .4; cursor: not-allowed; }

.cost-preview { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 10px 12px; background: var(--bg); border-radius: var(--r); font-size: 12px; }
.cost-preview .cp-label { color: var(--muted); }
.cost-preview .cp-val { font-family: var(--mono); font-weight: 500; color: var(--text); }

/* ══════════ BUTTONS ══════════ */
.btn-primary { width: 100%; margin-top: 14px; padding: 12px 16px; background: var(--blue); color: #fff; border: none; border-radius: var(--r); font-family: var(--ui); font-weight: 600; font-size: 14px; cursor: pointer; transition: background .15s, transform .1s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary:hover { background: #0055AA; }
.btn-primary:active { transform: scale(.99); }
.btn-primary.cancel { background: var(--surface); color: var(--ai-red); border: 1px solid rgba(201,53,53,.3); }
.btn-primary.cancel:hover { background: #FFF5F5; }
.btn-primary:disabled { background: var(--muted2); cursor: not-allowed; }

.btn-ghost { padding: 9px 14px; font-family: var(--ui); font-weight: 500; font-size: 12.5px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text); cursor: pointer; transition: background .15s, border-color .15s, color .15s; text-decoration: none; display: inline-block; }
.btn-ghost:hover { background: var(--bg); border-color: var(--blue); color: var(--blue); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

.notice { display: flex; gap: 8px; align-items: flex-start; background: var(--amber-bg); border: 1px solid #EAD07A; border-radius: var(--r); padding: 10px 12px; font-size: 11.5px; color: #7A5800; margin-top: 14px; line-height: 1.5; }
.notice a { color: #5A4000; font-weight: 500; }
html[data-theme="dark"] .notice { color: #F0C878; border-color: #6B5420; }
html[data-theme="dark"] .notice a { color: #FFDFA0; }

/* ══════════ SCORE BAR ══════════ */
.score-panel { padding: 18px 16px 6px; }
.score-track { display: flex; height: 34px; border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.score-seg { position: relative; transition: width .8s cubic-bezier(.2,.8,.2,1); display: flex; align-items: center; justify-content: center; }
.score-seg.ai { background: var(--ai-red); }
.score-seg.hu { background: var(--hu-grn); }
.score-seg.ed { background: var(--ed-blu); }
.score-seg.un { background: var(--un-gry); }
.score-seg .sv { font-family: var(--mono); font-size: 11px; font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; }

.score-legend { display: flex; gap: 18px; flex-wrap: wrap; padding-bottom: 14px; }
.leg-item { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.leg-dot { width: 9px; height: 9px; border-radius: 3px; }
.leg-dot.ai { background: var(--ai-red); } .leg-dot.hu { background: var(--hu-grn); }
.leg-dot.ed { background: var(--ed-blu); } .leg-dot.un { background: var(--un-gry); }
.leg-name { color: var(--muted); }
.leg-val { font-family: var(--mono); font-weight: 500; }

.conf-inline { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bg); border-top: 1px solid var(--border2); border-bottom: 1px solid var(--border2); }
.conf-inline .ci-label { font-size: 11.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.conf-inline .ci-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.conf-inline .ci-fill { height: 100%; background: var(--hu-grn); border-radius: 3px; transition: width .8s ease; }
.conf-inline .ci-pct { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--hu-grn); }

/* ══════════ SKELETON ══════════ */
@keyframes shimmer { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
.skel { background: linear-gradient(90deg, var(--border2) 25%, var(--border) 37%, var(--border2) 63%); background-size: 300px 100%; animation: shimmer 1.4s linear infinite; border-radius: 6px; }
.skel-track { height: 34px; margin: 18px 16px 12px; }
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-line.w60 { width: 60%; } .skel-line.w80 { width: 80%; } .skel-line.w40 { width: 40%; }

/* ══════════ TABS ══════════ */
.tab-bar { display: flex; padding: 0 16px; border-bottom: 1px solid var(--border2); gap: 4px; }
.tab-btn { font-family: var(--ui); font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 10px 4px; margin-right: 18px; border: none; background: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-pane { display: none; padding: 16px; }
.tab-pane.active { display: block; }

.sig-list { display: flex; flex-direction: column; gap: 2px; }
.sig-item { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; padding: 8px 10px; border-left: 3px solid transparent; border-radius: 0 6px 6px 0; transition: background .15s; }
.sig-item:hover { background: var(--bg); }
.sig-item.sig-ai { border-left-color: var(--ai-red); }
.sig-item.sig-ai-mod { border-left-color: var(--ai-red); opacity: .7; }
.sig-item.sig-human { border-left-color: var(--hu-grn); }
.sig-item.sig-edited { border-left-color: var(--ed-blu); }
.sig-item.sig-weak { border-left-color: var(--un-gry); }
.sig-tag { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; color: var(--muted2); flex-shrink: 0; width: 52px; padding-top: 1px; letter-spacing: .4px; }

.cit-list { display: flex; flex-direction: column; gap: 8px; }
.cit-item { padding: 10px 12px; border-radius: var(--r); border-left: 3px solid var(--border); background: var(--bg); font-size: 12.5px; line-height: 1.5; }
.cit-item.v { border-left-color: var(--hu-grn); }
.cit-item.s { border-left-color: var(--amber); }
.cit-item.i { border-left-color: var(--ai-red); }
.cit-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-family: var(--mono); font-size: 9px; padding: 2px 6px; border-radius: 4px; background: var(--blue-lt); color: var(--blue); }
.tag.am { background: var(--amber-bg); color: var(--amber); }
.cit-note { font-size: 11px; color: var(--muted); margin-top: 4px; font-style: italic; }
.cit-key { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border2); display: flex; flex-direction: column; gap: 4px; }
.ck-row { display: flex; gap: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.ck-tag { color: var(--blue); font-weight: 500; }

.summary { font-size: 14px; line-height: 1.75; }
.summary strong { color: var(--navy); }

.cost-foot { display: flex; justify-content: space-between; align-items: center; padding: 9px 16px; background: var(--bg); border-top: 1px solid var(--border2); font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.result-actions { display: flex; gap: 8px; margin-top: 14px; }
.result-actions .btn-ghost { flex: 1; text-align: center; }

/* ══════════ TOAST ══════════ */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 999; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: var(--r); font-size: 13px; font-weight: 500; box-shadow: var(--sh2); display: flex; align-items: center; gap: 8px; animation: toast-in .25s ease; }
@keyframes toast-in { from { opacity:0; transform: translateY(8px);} to { opacity:1; transform:none; } }
.toast.err { background: var(--ai-red); }
.toast .tk { color: #4ADE80; }
.toast-close { background: none; border: none; color: rgba(255,255,255,.8); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 0 0 6px; flex-shrink: 0; }
.toast-close:hover { color: #fff; }

/* ══════════ DRAWERS ══════════ */
.overlay { position: fixed; inset: 0; background: rgba(27,42,69,.4); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 100; }
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 92vw; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -8px 0 32px rgba(27,42,69,.2); transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); z-index: 101; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-hd { padding: 18px 20px; border-bottom: 1px solid var(--border2); display: flex; align-items: center; justify-content: space-between; }
.drawer-title { font-weight: 600; font-size: 15px; }
.drawer-close { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-section { margin-bottom: 22px; }
.ds-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 10px; }
.ds-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border2); }
.ds-row:last-child { border-bottom: none; }
.ds-name { font-size: 13px; }
.ds-note { font-size: 11px; color: var(--muted2); margin-top: 2px; }
.field-input { width: 100%; padding: 7px 10px; margin-top: 8px; border: 1px solid var(--border); border-radius: 6px; font-family: var(--mono); font-size: 12px; outline: none; }
.field-input:focus { border-color: var(--blue); }
.spend-limit-row { display: flex; align-items: center; gap: 8px; }
.spend-limit-row input[type=number] { width: 80px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 6px; font-family: var(--mono); font-size: 13px; outline: none; }

.help-item { margin-bottom: 14px; }
.help-item:last-child { margin-bottom: 0; }
.help-q { font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.help-a { font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.help-a a { color: var(--blue); }
.help-a b { color: var(--text); font-weight: 600; }

/* ══════════ HISTORY ══════════ */
.history-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); cursor: pointer; transition: background .15s; }
.history-item:hover { background: var(--bg); }
.hist-badge { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; font-weight: 500; color: #fff; flex-shrink: 0; }
.hist-badge.ai { background: var(--ai-red); } .hist-badge.hu { background: var(--hu-grn); } .hist-badge.ed { background: var(--ed-blu); } .hist-badge.un { background: var(--un-gry); }
.hist-meta { flex: 1; min-width: 0; }
.hist-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-time { font-size: 10.5px; color: var(--muted2); font-family: var(--mono); }

/* ══════════ BATCH MODE ══════════ */
.drop-zone { border: 1.5px dashed var(--border); border-radius: var(--r); padding: 34px 18px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; background: var(--bg); }
.drop-zone:hover, .drop-zone.drag { border-color: var(--blue); background: var(--blue-lt); }
.dz-icon { font-size: 26px; opacity: .4; display: block; margin-bottom: 8px; }
.dz-main { font-size: 13.5px; margin-bottom: 3px; }
.dz-main b { color: var(--blue); font-weight: 600; }
.dz-sub { font-size: 11.5px; color: var(--muted); }

.file-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; margin-top: 12px; }
.file-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg); border-radius: 6px; font-size: 12px; }
.file-item .fi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fi-size { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.file-item .fi-rm { color: var(--muted2); cursor: pointer; background: none; border: none; font-size: 14px; }
.file-item .fi-rm:hover { color: var(--ai-red); }

.file-summary { display: flex; justify-content: space-between; padding: 10px 0 0; font-size: 12px; color: var(--muted); }
.file-summary strong { color: var(--text); }
.chk-label { display: flex; align-items: center; gap: 6px; margin: 20px 0 12px; }

.progress-card { margin-top: 14px; background: var(--bg); border-radius: var(--r); padding: 12px; }
.progress-top { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 11.5px; }
.progress-file { color: var(--text); font-weight: 500; }
.progress-count { color: var(--muted); font-family: var(--mono); }
.progress-track { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 3px; transition: width .4s; }

.batch-btn-row { display: flex; gap: 8px; margin-top: 14px; }
.btn-run { flex: 1; padding: 12px; background: var(--hu-grn); color: #fff; border: none; border-radius: var(--r); font-weight: 600; font-size: 14px; cursor: pointer; transition: background .15s; }
.btn-run:hover { background: #227040; }
.btn-run:disabled { background: var(--muted2); cursor: not-allowed; }
.btn-abort { padding: 12px 16px; background: var(--surface); color: var(--ai-red); border: 1px solid rgba(201,53,53,.3); border-radius: var(--r); font-weight: 500; font-size: 13px; cursor: pointer; }
.btn-abort:disabled { opacity: .4; cursor: not-allowed; }

.batch-log { background: var(--surface); border-radius: var(--r2); min-height: 600px; display: flex; flex-direction: column; box-shadow: var(--sh); }
.bl-hd { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border2); flex-wrap: wrap; gap: 8px; }
.bl-title { font-weight: 600; font-size: 13px; }
.bl-stats { display: flex; gap: 16px; font-family: var(--mono); font-size: 11.5px; }
.bl-stat { display: flex; align-items: center; gap: 5px; }
.bl-dot { width: 7px; height: 7px; border-radius: 50%; }
.bl-dot.ai { background: var(--ai-red); } .bl-dot.hu { background: var(--hu-grn); } .bl-dot.ed { background: var(--ed-blu); } .bl-dot.pd { background: var(--muted2); }

.bl-body { flex: 1; overflow-y: auto; padding: 10px 18px; font-family: var(--mono); font-size: 12px; line-height: 1.7; }
.bl-empty { color: var(--muted2); font-style: italic; padding: 20px 0; text-align: center; }
.bl-file-group { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border2); }
.bl-file-group:last-child { border-bottom: none; margin-bottom: 0; }
.bl-fname { display: flex; align-items: center; gap: 8px; font-family: var(--ui); font-weight: 600; font-size: 12.5px; margin-bottom: 6px; color: var(--text); }
.bl-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.bl-scores { color: var(--muted); font-size: 11px; margin-bottom: 6px; padding-left: 16px; }
.bl-scores b.ai { color: var(--ai-red); } .bl-scores b.hu { color: var(--hu-grn); } .bl-scores b.ed { color: var(--ed-blu); }
.bl-cit-row { padding-left: 16px; font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.bl-cit-icon.ok { color: var(--hu-grn); } .bl-cit-icon.sus { color: var(--amber); } .bl-cit-icon.bad { color: var(--ai-red); }
.bl-cit-sum { padding-left: 16px; font-size: 11px; margin-top: 2px; }
.bl-cit-sum .ok { color: var(--hu-grn); } .bl-cit-sum .sus { color: var(--amber); } .bl-cit-sum .bad { color: var(--ai-red); }
.bl-tag { color: var(--blue); font-size: 10px; }
.bl-tag.am { color: var(--amber); }
.bl-error { color: var(--ai-red); font-size: 11.5px; padding-left: 16px; }

.bl-ft { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border2); }
.bl-cost { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 440px; gap: 12px; color: var(--muted2); text-align: center; padding: 40px; }
.ph-glyph { font-size: 34px; opacity: .25; }
.ph-txt { font-size: 13px; line-height: 1.8; max-width: 280px; }

footer { text-align: center; padding: 18px 20px 56px; font-size: 11px; color: var(--muted2); border-top: 1px solid var(--border2); line-height: 2; margin-top: auto; }
footer a { color: var(--muted); }

/* ══════════ RESPONSIVE ══════════ */
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .brand { order: 1; }
  .mode-toggle { order: 3; margin-left: 0; width: 100%; }
  .key-chip { order: 2; flex: 1 1 100%; }
  .icon-btn { order: 4; }
  .substrip { padding: 6px 14px; flex-wrap: wrap; row-gap: 4px; }
  .risk-pill { margin-left: 0; width: 100%; }
  .shell { padding: 14px; gap: 12px; }
  .card-bd { padding: 14px; }
  .score-seg .sv { font-size: 10px; }
  .score-legend { gap: 12px; row-gap: 6px; }
  .drawer { width: 100%; max-width: 100%; }
  .batch-log { min-height: 400px; }
  .bl-scores, .bl-cit-row { font-size: 10.5px; }
  .service-chips { gap: 5px; }
  .chip { font-size: 10px; padding: 4px 9px; }
  footer { padding: 16px 14px; font-size: 10px; }
  .key-field-label { display: none; }
  .status-bar { flex-direction: column; align-items: stretch; }
  .remember-bar { flex-direction: column; align-items: stretch; }
}
@media (max-width: 400px) {
  .brand-v { display: none; }
  .mode-btn { font-size: 11.5px; padding: 6px 12px; }
}

/* ══════════ CAPTCHA MODAL ══════════ */
.captcha-overlay {
  position: fixed; inset: 0; background: rgba(27,42,69,.55);
  display: none; align-items: center; justify-content: center;
  z-index: 800;
}
.captcha-overlay.open { display: flex; }
.captcha-modal {
  background: var(--surface); border-radius: var(--r2);
  padding: 24px; max-width: 340px; width: 92vw;
  box-shadow: var(--sh2); text-align: center;
}
.captcha-hd { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.captcha-sub { font-size: 12px; color: var(--muted); line-height: 1.5; }
.captcha-status { font-size: 12px; color: var(--ai-red); min-height: 18px; margin-top: 8px; }

/* ══════════ COLOR THEMES ══════════ */
/* Default theme "light" uses the :root variables already defined above. */

html[data-theme="dark"] {
  --navy:     #0D1420;
  --navy-lt:  #16202F;
  --blue:     #4A9EFF;
  --blue-lt:  #1A2A3F;
  --bg:       #0F1621;
  --surface:  #171F2E;
  --border:   #2A3548;
  --border2:  #212B3C;
  --text:     #E4E9F2;
  --muted:    #8A97AE;
  --muted2:   #5C6880;
  --amber-bg: #2E2610;
}
html[data-theme="dark"] body { color: var(--text); }
html[data-theme="dark"] .cost-preview,
html[data-theme="dark"] .progress-card,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .url-input,
html[data-theme="dark"] .upload-zone,
html[data-theme="dark"] .drop-zone,
html[data-theme="dark"] .file-item,
html[data-theme="dark"] .uploaded-file,
html[data-theme="dark"] .cit-item,
html[data-theme="dark"] .conf-inline,
html[data-theme="dark"] .input-tabs { background: var(--bg); }
html[data-theme="dark"] select,
html[data-theme="dark"] .field-input { background: var(--surface); color: var(--text); }
html[data-theme="dark"] .chip { background: var(--surface); }

html[data-theme="lark"] {
  --navy:     #3B4252;
  --navy-lt:  #434C5E;
  --blue:     #5E81AC;
  --blue-lt:  #D8E1EC;
  --bg:       #D8DEE9;
  --surface:  #ECEFF4;
  --border:   #C7CEDB;
  --border2:  #D2D9E4;
  --text:     #2E3440;
  --muted:    #5E6779;
  --muted2:   #8D96A8;
  --ai-red:   #BF616A;
  --hu-grn:   #4C8567;
  --ed-blu:   #5E81AC;
  --un-gry:   #8D96A8;
  --amber:    #A17E1E;
  --amber-bg: #F0E4C0;
}
html[data-theme="lark"] textarea,
html[data-theme="lark"] .url-input,
html[data-theme="lark"] select,
html[data-theme="lark"] .field-input { background: #fff; }

/* ══════════ GENERIC CONFIRM MODAL ══════════ */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(27,42,69,.5);
  display: none; align-items: center; justify-content: center; z-index: 900;
}
.confirm-overlay.open { display: flex; }
.confirm-modal {
  background: var(--surface); border-radius: var(--r2); box-shadow: var(--sh2);
  padding: 22px; max-width: 380px; width: 92vw;
}
.confirm-title { font-weight: 600; font-size: 15px; margin-bottom: 10px; }
.confirm-body { font-size: 13px; line-height: 1.6; color: var(--muted); }
.confirm-body b { color: var(--text); }
.confirm-suppress { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-top: 14px; color: var(--muted); cursor: pointer; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ══════════ LICENSE GATE (first run) ══════════ */
.license-gate {
  position: fixed; inset: 0; background: rgba(15,22,33,.85);
  display: none; align-items: center; justify-content: center; z-index: 950;
}
.license-gate.open { display: flex; }
.license-gate-modal {
  background: var(--surface); border-radius: var(--r2); box-shadow: var(--sh2);
  padding: 26px; max-width: 440px; width: 92vw;
}
.license-gate-hd { font-weight: 600; font-size: 17px; margin-bottom: 12px; }
.license-gate-body { font-size: 13px; line-height: 1.6; color: var(--muted); }
.license-gate-body a { color: var(--blue); }

/* ══════════ CONNECT KEY BUTTON ══════════ */
.key-connect-btn {
  background: linear-gradient(135deg, var(--blue) 0%, #0052A8 100%);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 6px 16px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,.08) inset;
  transition: transform .12s, box-shadow .15s, background .2s;
}
.key-connect-btn::before {
  content: "\26A1";
  font-size: 11px;
}
.key-connect-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,102,204,.4), 0 0 0 1px rgba(255,255,255,.1) inset;
}
.key-connect-btn:active { transform: translateY(0); }
.key-connect-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.key-connect-btn.connected {
  background: linear-gradient(135deg, var(--hu-grn) 0%, #1F7038 100%);
}
.key-connect-btn.connected::before { content: "\2713"; }
.key-connect-btn.connected:hover {
  background: linear-gradient(135deg, var(--ai-red) 0%, #A02525 100%);
  box-shadow: 0 3px 8px rgba(201,53,53,.4), 0 0 0 1px rgba(255,255,255,.1) inset;
}
.key-connect-btn.connected:hover::before { content: "\2715"; }

/* ══════════ TOOLTIP ICON + SHARED FLOATING POPOVER ══════════ */
.tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--ui);
  cursor: help;
  margin-left: 5px;
  flex-shrink: 0;
  user-select: none;
  transition: background .15s, color .15s;
}
.tip-icon:hover {
  background: var(--blue);
  color: #fff;
}

