:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --error: #f85149;
  --fatal: #d73a49;
  --warn: #d29922;
  --info: #58a6ff;
  --debug: #8b949e;
  --trace: #6e7681;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.nav { display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.nav .brand { font-weight: 700; font-size: 16px; color: var(--text); }
.nav .brand span { color: var(--accent); }
.nav a.link { color: var(--muted); padding: 4px 9px; border-radius: 6px; }
.nav a.link.active { color: #fff; background: #f0883e; }
.nav a.link:hover:not(.active) { color: var(--text); background: var(--bg3); }
.nav .spacer { flex: 1; }
.nav .status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.on { background: #3fb950; box-shadow: 0 0 6px #3fb95088; }

#progressWrap { position: fixed; top: 0; left: 0; right: 0; height: 12px; z-index: 999; opacity: 0; transition: opacity .3s ease; pointer-events: none; background: rgba(13,17,23,.35); }
#progressBar { position: absolute; top: 0; left: 0; bottom: 0; width: 0%; background: #f0883e; box-shadow: 0 0 8px #f0883e88; transition: width .25s ease; min-width: 0; }
#progressPct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #fff; font-family: ui-monospace, Consolas, monospace; }
.dot.err { background: var(--error); }

.path-row { display: flex; gap: 6px; align-items: center; }
.path-row input { flex: 1; min-width: 0; }
.browse-box { max-height: 58vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px; background: var(--bg3); margin-top: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.browse-item { padding: 4px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browse-item:hover { background: var(--bg2); }
.browse-item .bk { display: inline-block; width: 20px; color: var(--muted); }
.browse-item .bmsize { color: var(--muted); font-size: 11px; }
.browse-gz { display: inline-block; margin-right: 2px; padding: 0 5px; border-radius: 5px; background: #d2992230; color: var(--warn); border: 1px solid #d2992255; font-size: 10px; font-weight: 700; vertical-align: 1px; }
.browse-item.gz { color: var(--warn); }

.rows-grid { display: grid; gap: 14px; }
.wrap { padding: 20px; max-width: 1400px; margin: 0 auto; }
.wrap.wrap-wide { max-width: 2200px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.card .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card .value.err { color: var(--error); }
.card .value.warn { color: var(--warn); }

.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 20px; }
.grid2b { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
@media (max-width: 900px) { .grid2, .grid2b { grid-template-columns: 1fr; } }
.panel { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600; }
canvas.chart { width: 100%; height: 220px; display: block; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 8px 10px; border-bottom: 1px solid var(--bg3); vertical-align: top; }
tr:hover td { background: var(--bg3); }
td.time { white-space: nowrap; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
td.src { white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
td.actions { white-space: nowrap; text-align: right; }
td.msg { font-family: ui-monospace, Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-word; max-width: 0; cursor: pointer; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.FATAL { background: #d73a4922; color: var(--fatal); border: 1px solid #d73a4955; }
.badge.ERROR { background: #f8514922; color: var(--error); border: 1px solid #f8514955; }
.badge.WARN  { background: #d2992222; color: var(--warn); border: 1px solid #d2992255; }
.badge.INFO  { background: #58a6ff22; color: var(--info); border: 1px solid #58a6ff55; }
.badge.DEBUG { background: #8b949e22; color: var(--debug); border: 1px solid #8b949e55; }
.badge.TRACE { background: #6e768122; color: var(--trace); border: 1px solid #6e768155; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.toolbar select, .toolbar input, .toolbar button { background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; outline: none; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); }
.toolbar button { cursor: pointer; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.toolbar button.secondary { background: var(--bg3); border-color: var(--border); }

.dtwrap { display: inline-flex; align-items: stretch; }
.dtwrap input { width: 230px; font-family: ui-monospace, Consolas, monospace; }
.dtwrap .dtbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; padding: 8px 6px; margin-left: 6px; background: var(--bg3); border-color: var(--border); color: var(--muted); flex: none; }
.dtwrap .dtbtn:hover { color: var(--text); border-color: var(--accent); }
.dtwrap input:disabled, .dtwrap .dtbtn:disabled { opacity: .45; filter: grayscale(1); cursor: not-allowed; }
.dtwrap input:disabled:hover, .dtwrap .dtbtn:disabled:hover { border-color: var(--border); color: var(--muted); }

.picker { position: absolute; z-index: 50; width: 248px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.picker .pk-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.picker .pk-head button { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 16px; padding: 2px 8px; }
.picker .pk-title { font-weight: 600; font-size: 13px; }
.picker .pk-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 8px; }
.picker .pk-grid .pk-dow { text-align: center; font-size: 11px; color: var(--muted); padding: 3px 0; }
.picker .pk-grid .pk-day { text-align: center; border: none; background: none; color: var(--text); padding: 5px 0; border-radius: 6px; cursor: pointer; font-size: 12px; }
.picker .pk-grid .pk-day:hover { background: var(--bg3); }
.picker .pk-grid .pk-day.other { color: var(--muted); opacity: .5; }
.picker .pk-grid .pk-day.today { border: 1px solid var(--accent); }
.picker .pk-grid .pk-day.sel { background: var(--accent); color: #fff; }
.picker .pk-time { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.picker .pk-time select { flex: 1; background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px; font-size: 13px; }
.picker .pk-time span { color: var(--muted); }
.picker .pk-foot { display: flex; gap: 6px; }
.picker .pk-foot button { flex: 1; padding: 6px; border-radius: 6px; cursor: pointer; font-size: 12px; background: var(--bg3); border: 1px solid var(--border); color: var(--text); }
.picker .pk-foot button.pk-ok { background: var(--accent); border-color: var(--accent); font-weight: 600; }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--muted); font-size: 13px; }
.pager button { background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: default; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

.entry { padding: 12px 14px; margin: 8px 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg2); font-size: 13px; }
.entry:hover { background: var(--bg3); }
.entry:last-child { margin-bottom: 0; }
.entry .meta { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.entry .meta .time { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry .meta .src { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.entry .meta .cpy { margin-left: auto; background: var(--bg3); border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 2px 8px; cursor: pointer; font-size: 12px; line-height: 1.4; }
.entry .meta .cpy:hover { color: var(--text); border-color: var(--accent); }
.entry .msg { color: var(--text); white-space: pre-wrap; word-break: break-word; line-height: 1.45; }

.pill-list { list-style: none; margin: 0; padding: 0; }
.pill-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--bg3); font-size: 13px; }
.pill-list li:last-child { border-bottom: none; }
.pill-list .n { color: var(--muted); }
.pill-list .bar { height: 4px; background: var(--bg3); border-radius: 2px; flex: 1; margin: 0 10px; }
.pill-list .bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--bg2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 8px; display: none; z-index: 60; }

.live-box { height: calc(100vh - 130px); overflow: auto; background: #0a0c10; border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.live-line { display: flex; gap: 10px; padding: 2px 6px; border-radius: 4px; white-space: pre-wrap; word-break: break-word; }
.live-line:hover { background: var(--bg3); }
.live-line .t { color: var(--muted); flex-shrink: 0; }
.live-line .badge { flex-shrink: 0; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 30px 10px; overflow: auto; }
.modal-bg.show { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; width: 560px; max-width: 100%; padding: 20px; }
.modal h3 { margin: 0 0 16px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; outline: none; }
.form-row input:focus, .form-row select:focus { border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal input[type="checkbox"] { margin: 0; accent-color: #f0883e; }
#srcCheckboxes input[type="checkbox"] { margin: 0; flex: none; }
.env-grp { width: 100%; margin-bottom: 4px; }
.env-hd { display: grid; grid-template-columns: 16px auto 1fr; align-items: center; column-gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--bg3); margin-top: 2px; }
.env-hd .env-cnt { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 12px; }
.env-srcs { display: grid; grid-template-columns: 16px 1fr; align-items: center; column-gap: 6px; row-gap: 4px; padding: 6px 0 4px 22px; }
.env-srcs label { font-weight: 400; font-size: 12px; cursor: pointer; }
.btn { background: var(--accent); border: 1px solid var(--accent); color: var(--text); border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn.secondary { background: var(--bg3); border-color: var(--border); }
.btn.danger { background: #f8514922; border-color: #f8514955; color: var(--error); }
.btn:disabled { opacity: .5; cursor: default; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; }
.switch input { display: none; }
.switch .slider { position: absolute; inset: 0; background: var(--border); border-radius: 22px; transition: .2s; cursor: pointer; }
.switch .slider:before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: var(--muted); border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: #238636; }
.switch input:checked + .slider:before { transform: translateX(18px); background: #fff; }

.stat-pill { font-size: 12px; color: var(--muted); }

.env-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.env-badge.prod { background: #f8514922; color: var(--error); border: 1px solid #f8514955; }
.env-badge.staging { background: #d2992222; color: var(--warn); border: 1px solid #d2992255; }
.env-badge.dev { background: #58a6ff22; color: var(--info); border: 1px solid #58a6ff55; }
.env-badge.none { background: #8b949e22; color: var(--muted); border: 1px solid #8b949e55; }

code { background: var(--bg3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12px; color: var(--accent); }

.avail-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 13px; }
.avail-title { font-weight: 700; color: var(--text); margin-bottom: 8px; font-size: 14px; }
.avail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.avail-col { display: flex; flex-direction: column; }
@media (max-width: 900px) { .avail-cols { grid-template-columns: 1fr; } }
.avail-src { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.avail-srclabel { font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; }
.avail-src select { min-width: 260px; }
.avail-group { margin-bottom: 10px; }
.avail-span { font-weight: 400; color: var(--muted); font-size: 11px; text-transform: none; letter-spacing: 0; }
.avail-days { display: flex; flex-wrap: wrap; gap: 4px; }
.avail-label { font-weight: 600; color: var(--accent); margin-bottom: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.avail-day { margin-bottom: 4px; }
.avail-toggle, .avail-date, .avail-hour { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text); cursor: pointer; font-size: 13px; }
.avail-toggle { padding: 3px 6px; margin-right: 4px; }
.avail-date { padding: 3px 10px; font-family: ui-monospace, Consolas, monospace; font-weight: 600; }
.avail-date:hover, .avail-hour:hover { border-color: var(--accent); color: var(--accent); }
.avail-hours { margin: 4px 0 6px 0; display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; }
.avail-hour { padding: 2px 0; font-family: ui-monospace, Consolas, monospace; text-align: center; }
.avail-hour.sel { background: #f0883e; border-color: #f0883e; color: #fff; font-weight: 700; }

.srcpick { position: relative; display: inline-block; }
.pick-btn { background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; cursor: pointer; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-btn:hover { border-color: var(--accent); }
.pick-panel { position: absolute; z-index: 50; min-width: 340px; max-width: min(520px, calc(100vw - 40px)); background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.5); top: 100%; left: 0; margin-top: 6px; max-height: 70vh; display: flex; flex-direction: column; }
#pickList { flex: 1; min-height: 0; max-height: 320px; overflow: auto; margin-bottom: 10px; }
.pick-row { display: flex; align-items: center; gap: 4px; padding: 3px 0; border-bottom: 1px solid var(--bg3); }
.pick-row:last-child { border-bottom: none; }
.pick-mv { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 2px 7px; cursor: pointer; font-size: 11px; line-height: 1.3; flex: none; }
.pick-mv:hover { color: var(--text); border-color: var(--accent); }
.pick-label { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; padding: 2px 4px; }
.pick-label input { accent-color: var(--accent); }
.pkcount { color: var(--muted); font-size: 12px; }
.pick-foot { display: flex; gap: 8px; flex: none; }
.pick-foot button { background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; font-weight: 600; }
.pick-foot button:hover { border-color: var(--accent); }
.pick-foot button.primary { background: var(--accent); border-color: var(--accent); }

.rows-grid { display: grid; gap: 12px; align-items: start; max-width: 100%; overflow-x: auto; }
.vcol { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; min-width: 0; display: flex; flex-direction: column; }
.vcol-head { padding: 8px 12px; background: var(--bg3); border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcol-body { padding: 10px 12px; }
.vcol-scroll { flex: 1; height: calc(100vh - 210px); min-height: 320px; overflow: auto; background: var(--bg2); padding: 10px 12px; }
.vcol-scroll .entry { margin: 0 0 10px; }
.vcol-scroll .entry:last-child { margin-bottom: 0; }
.live-grid { align-items: stretch; }
.vcol-body .entry { margin: 0 0 10px; }
.vcol-body .entry:last-child { margin-bottom: 0; }
.vcol-empty { display: block; color: var(--muted); text-align: center; padding: 24px 0; font-size: 12px; }
.vcol-err { display: block; color: var(--error); font-size: 12px; padding: 10px; word-break: break-word; }
