:root {
  --bg: #0b1020;
  --panel: #131a2e;
  --border: #243049;
  --text: #e8ecf4;
  --muted: #97a3b9;
  --accent: #5b8def;
  --accent-2: #38d9a9;
  --warn: #f59f00;
  --danger: #ff6b6b;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif; }
header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
header h1 { margin: 0; font-size: 18px; }
header .sub { color: var(--muted); font-size: 12px; }
header .status { margin-left: auto; font-size: 12px; color: var(--muted); }
main { padding: 24px; max-width: 1400px; margin: 0 auto; display: grid; gap: 18px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.panel h2 { margin: 0 0 12px 0; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, textarea {
  background: #0d1426; color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; font: inherit;
}
textarea { font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.45; width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.actions { display: flex; gap: 10px; margin-top: 12px; }
button { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:hover:not(:disabled) { filter: brightness(1.1); }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 8px 0; }
.hint code { background: #0d1426; padding: 1px 6px; border-radius: 4px; }
.meta { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 8px; }
.status.ok { color: var(--accent-2); }
.status.err { color: var(--danger); }
#result { overflow: auto; max-height: 65vh; border: 1px solid var(--border); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 12px; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: #0d1426; z-index: 1; font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .03em; }
td { max-width: 540px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td:hover { white-space: normal; word-break: break-word; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #0d1426; }
a { color: var(--accent); }
footer { padding: 18px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.error-box { background: #2a1417; border: 1px solid var(--danger); color: #ffd7d7; padding: 12px; border-radius: 6px; font-family: ui-monospace, monospace; font-size: 12px; white-space: pre-wrap; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

/* row view button */
.view-btn { background: transparent; border: 1px solid var(--border); color: var(--accent); padding: 3px 8px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.view-btn:hover { background: var(--bg); border-color: var(--accent); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: stretch; justify-content: flex-end; }
.modal.hidden { display: none; }
.modal-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.modal-panel { position: relative; width: min(820px, 100%); height: 100vh; background: var(--panel); border-left: 1px solid var(--border); padding: 24px 32px; overflow-y: auto; box-shadow: -8px 0 32px rgba(0,0,0,.4); }
.modal-close { position: absolute; top: 14px; right: 18px; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; padding: 4px 10px; }
.modal-close:hover { color: var(--text); background: var(--bg); }
.modal-header { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0 0 10px 0; font-size: 22px; line-height: 1.3; color: var(--text); text-transform: none; letter-spacing: 0; }
.modal-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.modal-meta .chip { background: var(--bg); border: 1px solid var(--border); padding: 2px 8px; border-radius: 12px; }
.modal-meta .chip.lang { color: var(--accent-2); border-color: var(--accent-2); }
.modal-link { display: inline-block; font-size: 13px; color: var(--accent); text-decoration: none; }
.modal-link:hover { text-decoration: underline; }
.modal-description { color: var(--muted); font-style: italic; font-size: 14px; line-height: 1.55; border-left: 3px solid var(--border); padding-left: 12px; margin: 16px 0; }
.modal-text { white-space: pre-wrap; font-size: 14px; line-height: 1.7; color: var(--text); font-family: Georgia, "Times New Roman", serif; max-width: 70ch; }
.modal-text p { margin: 0 0 1em 0; }
