:root {
  color-scheme: light;
  --ink: #202523;
  --muted: #68716d;
  --line: #dedbd4;
  --paper: #ffffff;
  --canvas: #f5f3ee;
  --sand: #d3ad86;
  --sand-soft: #f1e3d2;
  --pineapple: #efc843;
  --ocean: #177b83;
  --leaf: #26715f;
  --danger: #a44732;
  --shadow: 0 8px 24px rgba(41, 48, 45, 0.06);
  font-family: Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 16px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, .button { min-height: 44px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); padding: 9px 16px; cursor: pointer; }
button.primary, .button.primary { background: var(--ink); color: #fff; }
button:disabled { cursor: not-allowed; opacity: .48; }

.site-header { position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); }
.brand-row { max-width: 1180px; margin: 0 auto; padding: 18px 22px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-size: 25px; font-weight: 350; letter-spacing: .035em; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.back-link, .home-link { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 9px 12px; border: 1px solid var(--line); background: var(--paper); font-size: 14px; font-weight: 750; white-space: nowrap; }
.back-link { color: var(--ocean); cursor: pointer; }
.home-link { color: var(--ink); }
.connection-pill { min-height: 32px; display: inline-flex; align-items: center; border: 1px solid var(--line); padding: 4px 11px; font-size: 13px; color: var(--muted); background: #fff; }
.connection-pill.ok { color: var(--leaf); border-color: #a9c8bf; background: #eef7f4; }
.connection-pill.waiting { color: #7a5c10; border-color: #e6cf86; background: #fff9df; }
.primary-nav { max-width: 1180px; margin: 0 auto; padding: 0 14px; display: flex; overflow-x: auto; scrollbar-width: none; }
.primary-nav a { min-width: max-content; min-height: 46px; display: inline-flex; align-items: center; padding: 0 15px; font-size: 14px; border-bottom: 3px solid transparent; }
.primary-nav a.active { border-bottom-color: var(--pineapple); font-weight: 700; }

.page-shell { max-width: 1180px; margin: 0 auto; padding: 22px; }
.page-heading { margin: 0 0 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.page-heading h1 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 750; letter-spacing: -.03em; }
.page-heading p { margin: 5px 0 0; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.eyebrow { margin: 0 0 4px; color: var(--ocean); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.notice { margin: 0 0 18px; border-left: 4px solid var(--pineapple); background: #fff9df; padding: 14px 16px; }
.notice strong { display: block; font-size: 14px; }
.notice p { margin: 2px 0 0; color: #655c43; font-size: 14px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { background: var(--paper); border: 1px solid var(--line); padding: 18px; min-height: 116px; box-shadow: var(--shadow); }
.metric span { display: block; color: var(--muted); font-size: 14px; }
.metric b { display: block; margin-top: 12px; font-size: 28px; line-height: 1; }
.metric small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }

.grid-two { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, .8fr); gap: 14px; }
.panel { background: var(--paper); border: 1px solid var(--line); padding: 18px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 14px; }
.grid-two .panel + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel h2 { margin: 0; font-size: 18px; }
.panel h3 { margin: 0; font-size: 16px; }
.panel p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 48px; border-top: 1px solid #ece9e3; }
.status-list li:first-child { border-top: 0; }
.status-list span { font-size: 14px; }
.status-list b { font-size: 13px; }

.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 9px; border: 1px solid var(--line); background: #f8f8f6; font-size: 12px; font-weight: 750; }
.badge.ok { color: var(--leaf); border-color: #a9c8bf; background: #eef7f4; }
.badge.waiting { color: #7a5c10; border-color: #e6cf86; background: #fff9df; }
.badge.locked { color: #5f6462; background: #f0f1ef; }
.badge.danger { color: var(--danger); border-color: #e1b3a8; background: #fff1ed; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid #ece9e3; vertical-align: top; }
th { color: var(--muted); font-size: 13px; font-weight: 700; background: #faf9f6; }
td { font-size: 14px; }
td strong { font-size: 15px; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); background: #faf9f6; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 13px; border: 1px solid var(--line); font-size: 14px; background: #fff; }
.tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.capability-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.capability { border: 1px solid var(--line); padding: 14px; background: #fff; }
.capability strong { display: block; }
.capability p { color: var(--muted); font-size: 13px; }

.diagnostic { display: grid; grid-template-columns: minmax(150px,.7fr) minmax(0,1.8fr) auto; gap: 12px; align-items: center; min-height: 68px; border-top: 1px solid #ece9e3; }
.diagnostic:first-child { border-top: 0; }
.diagnostic p { color: var(--muted); font-size: 13px; }
.incident { border: 1px solid #e1b3a8; background: #fff7f4; padding: 14px; margin-top: 10px; }
.incident-head { display: flex; justify-content: space-between; gap: 12px; }

.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 700; }
input, textarea, select { width: 100%; min-height: 44px; border: 1px solid #c9c6be; background: #fff; padding: 10px 12px; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.operation-box { border: 1px solid var(--line); padding: 14px; background: #faf9f6; }
.operation-box + .operation-box { margin-top: 10px; }

.site-footer { max-width: 1180px; margin: 0 auto; padding: 22px; display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 13px; }
.site-footer a { text-decoration: underline; text-underline-offset: 3px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 10; max-width: min(420px, calc(100% - 36px)); background: var(--ink); color: #fff; padding: 13px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.toast.error { background: var(--danger); }

@media (max-width: 820px) {
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid-two { grid-template-columns: 1fr; }
  .grid-two .panel + .panel { margin-top: 0; }
}

@media (max-width: 600px) {
  .brand-row { padding: 15px 14px 10px; align-items: flex-start; flex-wrap: wrap; }
  .brand { font-size: 22px; }
  .header-actions { width: 100%; justify-content: space-between; gap: 6px; }
  .back-link, .home-link { padding-inline: 10px; }
  .connection-pill { max-width: 142px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-shell { padding: 16px 12px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading h1 { font-size: 23px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric { min-height: 104px; padding: 14px; }
  .metric b { font-size: 24px; }
  .panel { padding: 15px; }
  .capability-grid, .form-grid { grid-template-columns: 1fr; }
  .diagnostic { grid-template-columns: 1fr auto; padding: 12px 0; }
  .diagnostic p { grid-column: 1 / -1; margin: -6px 0 0; }
  .site-footer { flex-direction: column; padding: 18px 14px; }
}
