/* JenaWork v3 operations console. Neutral, restrained, light and dark. No gradients, no decorative icons. */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --sunken: #eef1f5;
  --line: #d8dde6;
  --line-strong: #bcc4d0;
  --text: #1c2330;
  --muted: #5a6474;
  --subtle: #6b7585;
  --accent: #1d5fbf;
  --accent-ink: #ffffff;
  --ok: #1d6b44;
  --ok-bg: #e6f3ec;
  --warn: #8a5300;
  --warn-bg: #fdf3e1;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --focus: #1d5fbf;
  --radius: 6px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14171c;
  --panel: #1b1f26;
  --sunken: #232831;
  --line: #303641;
  --line-strong: #434b59;
  --text: #e4e8ee;
  --muted: #a4adbb;
  --subtle: #8c96a6;
  --accent: #8bb4ff;
  --accent-ink: #10203a;
  --ok: #7fd1a3;
  --ok-bg: #1c3427;
  --warn: #f2c46d;
  --warn-bg: #3a2e16;
  --bad: #ff9b93;
  --bad-bg: #3d1f1d;
  --focus: #8bb4ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans KR", "Malgun Gothic", sans-serif; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--accent); }
code, pre, .mono { font-family: var(--mono); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -40px; background: var(--panel); padding: 6px 10px; z-index: 10; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }

.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand-mark { width: 30px; height: 30px; display: inline-grid; place-items: center; background: var(--text); color: var(--panel); border-radius: 4px; font-weight: 700; font-size: 12px; }
.brand strong, .brand small { display: block; }
.brand small, .subtle, .footnote, .rail-foot { color: var(--subtle); font-size: 12.5px; }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a { color: var(--text); text-decoration: none; padding: 7px 10px; border-radius: var(--radius); border-left: 2px solid transparent; }
.rail nav a:hover { background: var(--sunken); }
.rail nav a[aria-current="page"] { background: var(--sunken); border-left-color: var(--accent); font-weight: 600; }
.rail-foot { margin-top: auto; line-height: 1.5; }

.work { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.mobile-brand { display: none; font-weight: 700; }
.scope { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scope label { font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
main { padding: 22px 24px 48px; max-width: 1280px; }

.notice { border: 1px solid var(--line-strong); background: var(--warn-bg); color: var(--warn); padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; }
.notice.error { background: var(--bad-bg); color: var(--bad); }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.eyebrow { color: var(--subtle); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.lead { color: var(--muted); margin-top: 6px; max-width: 760px; }

.btn { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; min-height: 32px; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--sunken); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover:not(:disabled) { filter: brightness(.96); background: var(--accent); }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.danger { color: var(--bad); }
input[type="search"], input[type="text"], input[type="number"], select {
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px 9px; min-height: 32px; min-width: 0;
}
input[type="search"] { width: 240px; }
input[type="number"] { width: 96px; }
input[aria-invalid="true"] { border-color: var(--bad); }
label { font-size: 13px; color: var(--muted); }
.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar label { display: flex; flex-direction: column; gap: 4px; }
.toolbar .search { min-width: 240px; flex: 1 1 260px; }
.toolbar .search input { width: 100%; }
.inline { display: inline-flex; gap: 8px; align-items: center; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.field-error { color: var(--bad); font-size: 12.5px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat span { display: block; color: var(--subtle); font-size: 12.5px; }
.stat b { display: block; font-size: 1.35rem; font-weight: 600; margin-top: 2px; }
.stat.bad b { color: var(--bad); }
.stat.warn b { color: var(--warn); }
.stat.ok b { color: var(--ok); }

.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; min-width: 0; }
.two-col > .panel { margin-bottom: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head p { color: var(--subtle); font-size: 12.5px; margin-top: 2px; }
.panel-body { padding: 12px 14px; }
.form-panel { padding-bottom: 14px; }
.form-panel form { padding: 12px 14px 0; }
.panel-body ul { margin: 0; padding-left: 18px; }
.table-meta { padding: 10px 14px; color: var(--subtle); font-size: 12.5px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); background: var(--sunken); font-size: 12.5px; white-space: nowrap; position: sticky; top: 0; }
tbody tr:hover { background: var(--sunken); }
tbody tr:last-child td { border-bottom: 0; }
td.empty { color: var(--subtle); text-align: center; padding: 18px; }
.unit-button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--accent); font-family: var(--mono); font-size: 13px; text-align: left; }
.unit-button:hover { text-decoration: underline; }
.star { background: none; border: 0; cursor: pointer; font-size: 16px; color: var(--subtle); padding: 0 4px; line-height: 1; }
.star[aria-pressed="true"] { color: var(--accent); }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.badge.bad { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.muted { color: var(--muted); }
.footnote { margin-top: 12px; line-height: 1.6; max-width: 900px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; display: flex; flex-direction: column; gap: 3px; min-width: 0; background: var(--panel); }
.row-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.row small { color: var(--subtle); overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0; }
.kv dt { color: var(--subtle); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.log { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 12.5px; line-height: 1.55; max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.log-wrap { padding: 12px 14px 0; }
.checks-row { display: grid; grid-template-columns: minmax(180px, 2fr) minmax(90px, 1fr) minmax(120px, 2fr) auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.checks-row label { display: flex; flex-direction: column; gap: 4px; }
.checks-row input { width: 100%; }
.checks-row .field-error { grid-column: 1 / -1; margin-top: -6px; }

dialog { border: 1px solid var(--line-strong); border-radius: 8px; padding: 0; background: var(--panel); color: var(--text); width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(10, 14, 20, .42); }
.dialog-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dialog-content { padding: 14px 16px 18px; overflow: auto; max-height: calc(100vh - 140px); }
.dialog-content section + section { margin-top: 18px; }
.dialog-content h3 { font-size: 13.5px; margin-bottom: 8px; color: var(--muted); font-weight: 600; }
.meta-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; }
.meta-form label { display: flex; flex-direction: column; gap: 4px; }
.meta-form input { width: 100%; }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }

@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: column; gap: 10px; padding: 12px 14px; }
  .rail nav { flex-direction: row; flex-wrap: wrap; }
  .rail-foot { display: none; }
  .two-col { grid-template-columns: 1fr; }
  .top { position: static; padding: 10px 14px; }
  main { padding: 16px 14px 36px; }
  .mobile-brand { display: block; }
  .checks-row { grid-template-columns: 1fr 1fr; }
  .toolbar .search, input[type="search"] { width: 100%; min-width: 0; }
}
@media (max-width: 520px) {
  .brand small { display: none; }
  .scope { width: 100%; }
  .scope select { flex: 1; }
  .checks-row { grid-template-columns: 1fr; }
  th, td { padding: 7px 8px; }
}

.lab-body { display: flex; flex-direction: column; gap: 6px; }
.lab-body h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 8px; }
.lab-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lab-head h2 { margin-right: auto; }
.lab-body ul { margin: 0; padding-left: 18px; }
details summary { cursor: pointer; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
