@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  --bg: #edf0f3;
  --surface: #ffffff;
  --surface-sunk: #f6f8f9;
  --rail: #16202b;
  --rail-line: #2a3846;
  --rail-text: #93a3b3;
  --ink: #16202b;
  --ink-2: #46545f;
  --muted: #7b8894;
  --line: #dce2e8;
  --line-strong: #c3ccd5;

  --accent: #0c6b4f;
  --accent-hover: #095740;
  --accent-soft: #e2f0eb;
  --down: #b4232a;
  --down-soft: #fbeaea;
  --warn: #9a5d00;
  --warn-soft: #fbf1e0;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(22, 32, 43, 0.06), 0 6px 20px rgba(22, 32, 43, 0.06);

  --font-ui: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

a:hover {
  border-bottom-color: currentColor;
}

a.btn:hover {
  border-bottom-color: var(--line-strong);
}

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

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

.hidden {
  display: none !important;
}

/* ==================================================================
   로그인
   ================================================================== */

.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--surface);
}

.gate__brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  background: var(--rail);
  color: #fff;
  overflow: hidden;
}

.gate__brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--rail-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--rail-line) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.4;
  mask-image: radial-gradient(circle at 30% 40%, #000 0%, transparent 72%);
}

.gate__brand > * {
  position: relative;
  z-index: 1;
}

.gate__mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rail-text);
}

.gate__mark span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2fbf7f;
  box-shadow: 0 0 0 4px rgba(47, 191, 127, 0.16);
}

.gate__title {
  margin: 0 0 14px;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.gate__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.gate__list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  color: #c3cfda;
  font-size: 15px;
  line-height: 1.6;
}

.gate__list li:last-child {
  margin-bottom: 0;
}

.gate__list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2fbf7f;
}

.gate__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--rail-text);
}

.gate__meta strong {
  display: block;
  color: #dbe4ec;
  font-weight: 500;
  word-break: break-all;
}

.gate__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.gate__form {
  width: 100%;
  max-width: 340px;
}

.gate__form h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.gate__form p.lede {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 13px;
}

/* ==================================================================
   폼 요소
   ================================================================== */

.field {
  margin-bottom: 16px;
}

.field > label,
.label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: -0.01em;
}

.hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #a9b4bf;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
  min-height: 96px;
  font-family: var(--font-mono);
  font-size: 13px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%237b8894' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

.segmented {
  display: flex;
  padding: 3px;
  margin-bottom: 18px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented button {
  flex: 1;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(22, 32, 43, 0.1);
}

.check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 7px 0;
  cursor: pointer;
}

.check input {
  width: 15px;
  height: 15px;
  margin: 3px 0 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.check span {
  font-size: 13px;
}

.check small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

/* ==================================================================
   버튼
   ================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  border-color: #a9b4bf;
  background: var(--surface-sunk);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--danger {
  color: var(--down);
  border-color: #e5bcbe;
}

.btn--danger:hover:not(:disabled) {
  background: var(--down-soft);
  border-color: #d99ba0;
}

.btn--block {
  width: 100%;
}

.btn--sm {
  padding: 6px 11px;
  font-size: 12px;
}

/* ==================================================================
   레이아웃
   ================================================================== */

.app {
  display: grid;
  grid-template-columns: 236px 1fr;
  height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  background: var(--rail);
  color: #fff;
}

.rail__head {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--rail-line);
}

.rail__head h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.rail__head p {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rail-text);
}

.rail__nav {
  flex: 1;
  padding: 10px 10px;
  overflow-y: auto;
}

.rail__group {
  padding: 14px 8px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5d6e7e;
}

.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 2px;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  color: #c3cfda;
  background: none;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.tab code {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #6d8091;
  padding: 2px 5px;
  border: 1px solid var(--rail-line);
  border-radius: 3px;
  transition: inherit;
}

.tab:hover {
  background: #1e2b38;
  color: #fff;
}

.tab[aria-selected="true"] {
  background: #223141;
  color: #fff;
}

.tab[aria-selected="true"] code {
  color: #4fd39b;
  border-color: #2f5c4b;
}

.rail__foot {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--rail-line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--rail-text);
}

.rail__foot dl {
  margin: 0 0 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
}

.rail__foot dt {
  color: #5d6e7e;
}

.rail__foot dd {
  margin: 0;
  min-width: 0;
  color: #dbe4ec;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail__foot button {
  width: 100%;
  padding: 6px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: #c3cfda;
  background: none;
  border: 1px solid var(--rail-line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.12s ease;
}

.rail__foot button:hover {
  background: #1e2b38;
  color: #fff;
}

.main {
  overflow-y: auto;
  padding: 28px 32px 64px;
}

.view {
  max-width: 1180px;
  margin: 0 auto;
}

.view__head {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.view__head h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.view__head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ==================================================================
   카드 / 그리드
   ================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-sunk);
}

.card__head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card__head .count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.card__body {
  padding: 18px;
}

.card__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-sunk);
}

.card__foot .spacer {
  flex: 1;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

/* ==================================================================
   상태 표시
   ================================================================== */

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.stat {
  min-width: 74px;
}

.stat dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat dd {
  margin: 1px 0 0;
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.stat dd.is-ok {
  color: var(--accent);
}

.stat dd.is-fail {
  color: var(--down);
}

.progress {
  height: 3px;
  background: var(--line);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.25s ease;
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  border-radius: 3px;
  background: var(--surface-sunk);
  color: var(--ink-2);
  border: 1px solid var(--line);
}

.badge--ok {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #b9dcd0;
}

.badge--fail {
  background: var(--down-soft);
  color: var(--down);
  border-color: #eec6c8;
}

.badge--warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: #e8d3ab;
}

.notice {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  margin-bottom: 16px;
  font-size: 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-sunk);
  white-space: pre-wrap;
}

.notice--error {
  background: var(--down-soft);
  border-color: #eec6c8;
  color: #8e1c22;
}

.notice--ok {
  background: var(--accent-soft);
  border-color: #b9dcd0;
  color: var(--accent);
}

/* ==================================================================
   표
   ================================================================== */

.table-wrap {
  max-height: 460px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-sunk);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: var(--surface-sunk);
}

td.num,
th.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

tr.is-invalid td {
  background: var(--down-soft);
}

.empty {
  padding: 40px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.picker {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.picker label {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 6px 11px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.picker label:last-child {
  border-bottom: 0;
}

.picker label:hover {
  background: var(--surface-sunk);
}

.picker input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.picker .id {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar .field {
  margin: 0;
}

.dropzone {
  display: block;
  padding: 26px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-sunk);
  cursor: pointer;
  transition: all 0.12s ease;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone strong {
  display: block;
  font-size: 13px;
}

.dropzone span {
  font-size: 12px;
  color: var(--muted);
}

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: 380px;
  padding: 12px 16px;
  font-size: 13px;
  color: #fff;
  background: var(--rail);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(22, 32, 43, 0.24);
  animation: rise 0.2s ease;
}

.toast--error {
  background: #8e1c22;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 900px) {
  .gate {
    grid-template-columns: 1fr;
  }

  .gate__brand {
    display: none;
  }

  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .rail {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .rail__head,
  .rail__foot dl {
    display: none;
  }

  .rail__nav {
    display: flex;
    gap: 4px;
    padding: 8px;
  }

  .rail__group {
    display: none;
  }

  .tab {
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .rail__foot {
    flex-shrink: 0;
    border: 0;
    padding: 8px 12px;
    margin-left: auto;
  }

  .rail__foot button {
    width: auto;
    padding: 6px 12px;
  }

  .main {
    padding: 20px 16px 48px;
  }
}

/* 접기 영역 — .label의 display:block이 삼각형을 지우지 않도록 */
summary.label {
  display: list-item;
  list-style-position: inside;
  margin-bottom: 0;
}

summary.label::marker {
  color: var(--muted);
}

/* 선택 상자는 너무 넓어지지 않게 */
.field--narrow {
  max-width: 420px;
}

/* 선택 목록 (검색 · 전체선택) */
.pick {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pick__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.pick__head .label {
  margin: 0;
}

.pick__head .count {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.pick__search {
  margin-bottom: 6px;
  padding: 7px 11px;
  font-size: 13px;
}

.pick__search::-webkit-search-cancel-button {
  cursor: pointer;
}

.pick__actions {
  display: flex;
  gap: 12px;
  margin-bottom: 6px;
  padding-left: 2px;
}

.pick__actions button {
  padding: 0;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
}

.pick__actions button:hover {
  color: var(--accent);
  border-bottom-color: currentColor;
}

/* 높이를 고정해야 목록이 늘어나지 않고 안에서 스크롤된다. */
.picker--tall {
  flex: none;
  height: 300px;
  max-height: 300px;
}

/* 단일 선택 목록에는 전체선택 줄이 없으므로 자리만 비워 높이를 맞춘다. */
.pick__actions--placeholder {
  visibility: hidden;
}

.picker label span:not(.id) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 도움말 (Passhash 확인 방법) */
.help {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 5px;
}

.help__trigger {
  width: 16px;
  height: 16px;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  color: var(--muted);
  background: var(--surface-sunk);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.12s ease;
}

.help__trigger:hover,
.help__trigger[aria-expanded="true"] {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.help__panel {
  /* 기본은 버튼 아래로 편다. */
  position: absolute;
  top: calc(100% + 8px);
  left: -6px;
  z-index: 50;
  width: 620px;
  max-width: calc(100vw - 32px);
  max-height: 82vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(22, 32, 43, 0.2);
  text-align: left;
  font-weight: 400;
  cursor: default;
}

.help__panel[hidden] {
  display: none;
}

.help__head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-sunk);
  border-bottom: 1px solid var(--line);
}

.help__head strong {
  font-size: 13px;
}

.help__close {
  padding: 0 4px;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
}

.help__close:hover {
  color: var(--ink);
}

.help__body {
  padding: 16px;
}

.help__intro,
.help__step p {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

.help__step {
  margin-bottom: 18px;
}

.help__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-right: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  vertical-align: 1px;
}

.help__step img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.help__note {
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid #e8d3ab;
  border-radius: var(--radius);
}

/* 로그인 화면은 아래 공간이 없어서 입력란 왼쪽 여백으로 편다. */
.help--left > .help__panel {
  top: 50%;
  left: auto;
  right: calc(100% + 12px);
  transform: translateY(-50%);
}

/* 오른쪽 끝에 있는 버튼은 패널을 왼쪽으로 정렬한다. */
.help--end > .help__panel {
  left: auto;
  right: -6px;
}

/* 옆/아래 공간이 부족하면 화면 아래쪽에 붙인다. */
@media (max-width: 1100px) {
  .help__panel,
  .help--left > .help__panel,
  .help--end > .help__panel {
    position: fixed;
    inset: auto 16px 16px;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    width: auto;
    max-height: 76vh;
  }
}

/* 도움말 버튼이 달린 입력란.
   DOM 순서는 라벨 → 입력 → 도움말(탭 순서 때문)이고,
   화면에서는 도움말을 라벨 옆으로 끌어올린다. */
.field--help {
  display: grid;
  grid-template-columns: auto 1fr;
  /* stretch면 라벨과 입력칸이 늘어나 옆 칸과 줄이 어긋난다. */
  align-items: start;
  align-content: start;
}

.field--help > label {
  grid-area: 1 / 1;
}

.field--help > .help {
  grid-area: 1 / 2;
  justify-self: start;
  align-self: center;
  margin: 0 0 6px 5px;
}

.field--help > input {
  grid-area: 2 / 1 / 3 / 3;
}

/* 빠른 기간 선택 */
.quick-range {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.quick-range .label {
  margin: 0 4px 0 0;
}

.quick-range .btn.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #b9dcd0;
}

/* 펼칠 수 있는 표 행 */
tr.is-expandable {
  cursor: pointer;
}

tr.is-expandable > td:first-child {
  position: relative;
  padding-left: 24px;
}

tr.is-expandable > td:first-child::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 14px;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

tr.is-expandable.is-open > td:first-child::before {
  transform: rotate(45deg);
}

tr.is-expandable.is-open > td {
  background: var(--surface-sunk);
}

tr.detail > td {
  padding: 0;
  background: var(--surface-sunk);
}

.detail__panel {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding: 14px 18px 16px 24px;
  border-left: 2px solid var(--accent);
}

.detail__label {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail__message p {
  margin: 0;
  padding: 9px 11px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--down);
  background: var(--down-soft);
  border: 1px solid #eec6c8;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
}

.detail__message p.detail__empty {
  font-family: var(--font-ui);
  color: var(--muted);
  background: var(--surface);
  border-color: var(--line);
}

.detail__facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 14px;
  margin: 0;
  font-size: 12px;
}

.detail__facts dt {
  color: var(--muted);
  white-space: nowrap;
}

.detail__facts dd {
  margin: 0;
  word-break: break-word;
}

@media (max-width: 720px) {
  .detail__panel {
    grid-template-columns: 1fr;
  }
}

/* 카드 헤더 오른쪽 버튼 묶음 */
.card__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card__head h3 .help {
  margin-left: 4px;
}

/* 글자로 된 도움말 트리거 */
.help__trigger--text {
  width: auto;
  height: auto;
  padding: 5px 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius);
}

/* 도움말 안의 설명 표 */
.help__table {
  margin-bottom: 14px;
  font-size: 12px;
}

.help__table th {
  position: static;
  padding: 6px 10px;
}

.help__table td {
  padding: 7px 10px;
  vertical-align: top;
}

.help__table td:first-child,
.help__table td:last-child {
  white-space: nowrap;
}

.help__body code {
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: 3px;
}

/* 결과 표 위 검색줄 */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}

.filter-bar .pick__search {
  max-width: 320px;
  margin: 0;
}

.filter-bar .count {
  font-size: 12px;
  color: var(--muted);
}

/* 도움말 패널이 카드 밖으로 나가야 하므로 잘라내지 않는다. */
.card:has(.help__panel) {
  overflow: visible;
}

.card:has(.help__panel) > .card__head {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* 안내 문구 안의 예시 값 */
.hint code {
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: 3px;
}

/* 모달 (자동 로그아웃 경고) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(22, 32, 43, 0.42);
}

.modal.hidden {
  display: none;
}

.modal__box {
  width: 100%;
  max-width: 380px;
  padding: 22px 24px 18px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(22, 32, 43, 0.28);
}

.modal__box h3 {
  margin: 0 0 8px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.modal__box p {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-2);
}

.modal__box strong {
  color: var(--down);
  font-weight: 600;
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 사이드바의 자동 로그아웃 남은 시간 */
.rail__foot dd.is-soon {
  color: #ff8f8f;
}

/* 홈 화면 바로가기 카드 */
/* 넓은 화면에서 2×2로 떨어지도록 폭을 제한한다. */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  max-width: 820px;
}

.home-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  gap: 4px 12px;
  padding: 20px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.home-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(22, 32, 43, 0.07), 0 10px 24px rgba(22, 32, 43, 0.09);
}

.home-card__code {
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius);
}

.home-card strong {
  align-self: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.home-card__desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.home-card__go {
  grid-column: 2;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.home-card__go::after {
  content: " →";
  transition: margin 0.12s ease;
}

.home-card:hover .home-card__go::after {
  margin-left: 3px;
}
