/* Graphite neutrals, teal accent. Light only. */
:root {
  --gray-0: oklch(99% 0.002 255);
  --gray-1: oklch(97% 0.003 255);
  --gray-2: oklch(93% 0.004 255);
  --gray-3: oklch(86% 0.005 255);
  --gray-6: oklch(55% 0.012 255);
  --gray-7: oklch(42% 0.014 255);
  --gray-9: oklch(18% 0.012 255);
  --accent: oklch(48% 0.12 195);
  --accent-hover: oklch(43% 0.12 195);
  --accent-tint: oklch(48% 0.12 195 / 0.08);
  --on-accent: oklch(99% 0.002 255);
  --success: oklch(42% 0.11 155);
  --danger: oklch(48% 0.16 25);
  --font-sans: "IBM Plex Sans", "Noto Sans KR", "Noto Sans CJK KR", "Source Han Sans KR", sans-serif;
  --font-mono: "IBM Plex Mono", "Noto Sans Mono", ui-monospace, monospace;
  --radius-input: 0.375rem;
  --radius-card: 0.625rem;
  --radius-modal: 0.875rem;
  --shadow-card: 0 0 0 1px oklch(0% 0 0 / 0.04), 0 1px 2px oklch(0% 0 0 / 0.05);
  --shadow-overlay: 0 0 0 1px oklch(0% 0 0 / 0.05), 0 8px 24px oklch(0% 0 0 / 0.12);
  --motion-fast: 120ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-9);
  background: var(--gray-0);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--gray-1);
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.nav {
  background: var(--gray-1);
  border-inline-end: 1px solid var(--gray-2);
  padding: 16px 12px;
}

.brand {
  margin: 4px 8px 20px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: var(--gray-6);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}

.nav a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-input);
  text-decoration: none;
}

.nav a:hover { background: var(--gray-0); }

.nav a[aria-current="page"] {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--accent);
}

.nav a[aria-current="page"]:hover { background: var(--accent-tint); }

.main { min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 8px 24px;
  background: var(--gray-0);
  border-bottom: 1px solid var(--gray-2);
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.who {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gray-7);
}

.logout { margin: 0; }

.content {
  padding: 16px 24px 32px;
}

.content .lead {
  max-width: 42rem;
  margin: 0 0 16px;
  color: var(--gray-7);
}

.summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  align-items: end;
  margin-bottom: 16px;
}

.hero-number {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 36px;
  font-variant-numeric: tabular-nums slashed-zero;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--accent);
}

.summary p { margin: 0; }

.summary .meta,
.sync-note,
.hint,
.trust {
  color: var(--gray-6);
}

.banner {
  margin: 0 0 16px;
  padding: 8px 12px;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-input);
  background: var(--gray-0);
}

.banner[role="alert"] {
  border-color: var(--danger);
  color: var(--danger);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.search {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin: 0;
}

.search .field { margin-bottom: 0; }

.field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 16px;
}

.field label { font-weight: 500; }

.hint { margin: 0; font-size: 13px; }

.field .error,
.error-msg {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.error-msg { display: none; }

input[type="text"],
input[type="password"],
input[type="search"] {
  font: inherit;
  font-size: max(1rem, 1em);
  min-height: 48px;
  width: min(100%, 28rem);
  padding: 8px 12px;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius-input);
  background: var(--gray-0);
  color: var(--gray-9);
}

:is(input:user-invalid, input.user-invalid-fallback, input[aria-invalid="true"]) {
  border-color: var(--danger);
}

:is(input:user-invalid, input.user-invalid-fallback) + .error-msg {
  display: block;
}

.password-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: min(100%, 28rem);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius-input);
  background: var(--gray-0);
  color: var(--gray-9);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out);
}

button:hover,
.button:hover { background: var(--gray-1); }

button.primary,
.button.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
}

button.primary:hover { background: var(--accent-hover); }

button.danger {
  border-color: transparent;
  background: var(--danger);
  color: var(--on-accent);
}

button.ghost {
  background: transparent;
  border-color: transparent;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--gray-7);
}

.table-wrap {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(640px, 70vh);
  background: var(--gray-0);
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  container-type: inline-size;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

caption {
  padding: 12px 12px 8px;
  text-align: start;
  font-weight: 500;
}

caption .count {
  margin-inline-start: 8px;
  color: var(--gray-6);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
}

thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  background: var(--gray-0);
}

th, td {
  padding: 8px 12px;
  border-top: 1px solid var(--gray-2);
  text-align: start;
  vertical-align: middle;
}

th {
  font-weight: 500;
  color: var(--gray-7);
}

th a { text-decoration: none; }

th[aria-sort] a { font-weight: 600; color: var(--gray-9); }

tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 0;
  background: var(--gray-0);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums slashed-zero;
  font-weight: 400;
}

tbody tr:hover td,
tbody tr:hover th { background: var(--gray-1); }

.name {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply {
  max-width: 20rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gray-7);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status i {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--gray-3);
}

.status.on { color: var(--success); }
.status.on i { background: var(--success); }
.status.off { color: var(--danger); }
.status.off i { background: var(--danger); }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.row-actions form { margin: 0; }

.row-actions button,
.row-actions a {
  min-height: 32px;
  padding: 4px 8px;
}

.empty {
  padding: 24px 12px 28px;
}

.empty p { margin: 0 0 12px; }

.panel {
  width: min(100%, 28rem);
  padding: 16px;
  background: var(--gray-0);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.panel.wide { width: min(100%, 42rem); }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.check input { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

dialog {
  width: min(100% - 32px, 28rem);
  padding: 20px;
  border: 0;
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-overlay);
  color: var(--gray-9);
}

dialog:modal { overscroll-behavior: contain; }

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: oklch(18% 0.012 255 / 0.4);
}

dialog h1 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.auth-card {
  width: min(100%, 380px);
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 28px;
  letter-spacing: -0.02em;
  font-weight: 500;
}

.auth-card .lead { margin: 0 0 20px; color: var(--gray-6); }

.auth-card form { width: 100%; }

.auth-card input { width: 100%; }

.auth-card .primary { width: 100%; min-height: 48px; }

.recover { margin: 12px 0 0; }

.trust { margin: 16px 0 0; font-size: 13px; }

code, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums slashed-zero;
}

pre.command {
  overflow: auto;
  padding: 12px;
  background: var(--gray-1);
  border-radius: var(--radius-input);
  font-family: var(--font-mono);
  font-size: 13px;
}

@container (width < 600px) {
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tbody tr {
    margin: 0 8px 12px;
    border: 1px solid var(--gray-2);
    border-radius: var(--radius-input);
  }
  tbody th {
    position: sticky;
    inset-block-start: 0;
    inset-inline-start: auto;
    z-index: 2;
  }
  td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--gray-6);
    font-size: 12px;
  }
  td:nth-child(2)::before { content: "상태"; }
  td:nth-child(3)::before { content: "응답 메시지"; }
  td:nth-child(4)::before { content: "작업"; }
}

@media (pointer: coarse) {
  input[type="text"],
  input[type="password"],
  input[type="search"],
  button,
  .button { min-height: 48px; }
}

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border-inline-end: 0;
    border-bottom: 1px solid var(--gray-2);
  }
  .brand { margin: 4px 8px; }
  .brand span { display: inline; margin-inline-start: 8px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .content, .topbar { padding-inline: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  button, .button { transition: none; }
}
