:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e6e9f0;
  --border-strong: #d6dbe6;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --primary: #2563eb;
  --primary-soft: #eaf1ff;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --topbar: #0b1220;
  --topbar-text: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  font-feature-settings: "tnum";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}

/* ── Topbar ─────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--topbar);
  color: var(--topbar-text);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 16px;
}
.brand__mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}
.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #cbd5e1;
}
.topbar__user {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}
.topbar__btn {
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  font-size: 12px;
}
.topbar__btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ── Tabs ───────────────────────────────────── */
.tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  position: relative;
  padding: 14px 14px;
  font-size: 14px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  border-radius: 8px 8px 0 0;
}
.tab:hover {
  color: var(--text);
  background: #f8fafc;
}
.tab.is-active {
  color: var(--primary);
  font-weight: 600;
}
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}
.tab__icon {
  font-size: 14px;
}
.tabs__spacer {
  flex: 1;
}

/* ── Page ───────────────────────────────────── */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}
.view {
  display: block;
}
.view[hidden] {
  display: none !important;
}

.hero {
  margin: 4px 4px 22px;
}
.hero__title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero__sub {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

.grid--hero {
  margin-bottom: 22px;
}

.grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ── Card ───────────────────────────────────── */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease;
}
.service-card {
  cursor: pointer;
}
.service-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.service-card--lg .card__body {
  padding: 22px 22px 24px;
  min-height: 168px;
  display: flex;
  flex-direction: column;
}
.service-card--lg .card__title {
  font-size: 18px;
  margin-top: 6px;
}
.service-card--lg .card__head {
  margin-bottom: 0;
}
.service-card--lg .card__cta {
  margin-top: auto;
}
.service-card--lg .card__emoji {
  font-size: 24px;
}
.card__bar {
  display: block;
  height: 4px;
  width: 100%;
}
.card__body {
  padding: 18px 18px 20px;
}
.card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.card__emoji {
  font-size: 18px;
}
.card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card__desc {
  margin: 6px 0 8px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}
.card__host {
  margin: 0 0 14px;
  font-size: 11px;
  color: var(--text-soft);
  font-family:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
.card__cta {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}
.service-card:hover .card__cta {
  text-decoration: underline;
}
.service-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Badge ──────────────────────────────────── */
.badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  background: #f8fafc;
  white-space: nowrap;
}
.badge--ok {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.badge--bad {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}
.badge--muted {
  color: var(--text-soft);
}

/* ── Panel / Status / Quick ─────────────────── */
.panel__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 16px 18px 0;
}
.panel__head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.panel__sub {
  font-size: 12px;
  color: var(--text-soft);
}
.status-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 6px 6px 14px;
}
.status-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
}
.status-list--info li {
  cursor: default;
}
.status-list--info li:hover {
  background: transparent;
}
.status-list .name {
  font-size: 14px;
  font-weight: 600;
}
.status-list .host {
  font-size: 11.5px;
  color: var(--text-soft);
  font-family:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
.status-list .meta {
  font-size: 12px;
  color: var(--text-soft);
  margin-left: auto;
}
.status-list .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--text-soft);
  flex-shrink: 0;
}
.status-list .dot.is-up {
  background: var(--ok);
}
.status-list .dot.is-down {
  background: var(--bad);
}

.quick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px 18px;
}
.quick__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.quick__btn:hover {
  border-color: var(--border-strong);
  background: #f8fafc;
}
.quick__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

/* ── Frame view (iframe) ────────────────────── */
.view--frame {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: calc(100vh - 160px);
}
.frame-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.frame-toolbar .link {
  color: var(--primary);
  font-weight: 600;
}
.service-frame {
  flex: 1;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ── Settings ───────────────────────────────── */
.kv {
  margin: 0;
  padding: 14px 18px 18px;
  display: grid;
  grid-template-columns: 160px 1fr;
  row-gap: 10px;
  column-gap: 16px;
  font-size: 14px;
}
.kv dt {
  color: var(--text-muted);
}
.kv dd {
  margin: 0;
  color: var(--text);
}
.hint {
  padding: 0 18px 18px;
  font-size: 12px;
  color: var(--text-soft);
}
code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* ── Login ──────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.login {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-md);
}
.login h1 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
}
.login p {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 13px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.field label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.field input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  outline: none;
}
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}
.btn:hover {
  filter: brightness(1.05);
}
.error {
  display: none;
  margin: -4px 0 12px;
  padding: 8px 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 8px;
  font-size: 12px;
}
.error.is-show {
  display: block;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 880px) {
  .grid--3 {
    grid-template-columns: 1fr 1fr;
  }
  .grid--2 {
    grid-template-columns: 1fr;
  }
  .quick {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .grid--3 {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 10px 16px;
  }
  .page {
    padding: 16px;
  }
}

/* 접근 기록 패널 */
.history-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  padding: 14px 0 6px;
}
.history-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.history-toolbar__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}
.history-toolbar select {
  min-width: 130px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
}
.history-toolbar #historyRefresh {
  margin-left: auto;
}

.history-table-wrap {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.history-table thead th {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.history-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.history-table tbody tr:last-child td {
  border-bottom: none;
}
.history-table tbody tr:hover {
  background: #f8fafc;
}
.history-table .col-time {
  white-space: nowrap;
}
.history-table .col-path code {
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}
.history-table .col-ip {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12px;
}
.history-table .muted {
  color: var(--text-soft);
}
.history-table .tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.history-table .tag--ok {
  background: #ecfdf5;
  color: #047857;
}
.history-table .tag--bad {
  background: #fef2f2;
  color: #b91c1c;
}
.history-empty {
  text-align: center;
  color: var(--text-soft);
  padding: 28px 12px;
}

.history-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 4px 4px;
  font-size: 13px;
  color: var(--text-muted);
}
.history-footer button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 사용 이력 (기능) */
.panel--activity .panel__head--stack {
  align-items: flex-start;
  gap: 12px;
}
.panel--activity .panel__hint {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.45;
}
.panel__sub--badge {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.activity-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin-top: 4px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.activity-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.activity-filter__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.02em;
}
.activity-filter select {
  min-width: 112px;
  max-width: 160px;
  padding: 7px 28px 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
}
.btn-refresh {
  margin-left: auto;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-refresh:hover {
  color: var(--primary);
  border-color: #93c5fd;
  background: var(--primary-soft);
}

.activity-timeline {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.activity-item {
  padding: 14px 16px 14px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.activity-item:hover {
  box-shadow: var(--shadow-md);
}
.activity-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.activity-item__who {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.activity-item__time {
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
  flex-shrink: 0;
}
.activity-item__action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.activity-item__service {
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.activity-item__label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.35;
}
.activity-item__detail {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}
.activity-empty {
  text-align: center;
  color: var(--text-soft);
  padding: 32px 16px;
  font-size: 14px;
  line-height: 1.6;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #fafbfc;
}
.activity-empty .muted {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-soft);
}

.activity-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.activity-footer__pager {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 4.5em;
  text-align: center;
}
.btn-pager {
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-pager:hover:not(:disabled) {
  color: var(--primary);
  border-color: #93c5fd;
  background: var(--primary-soft);
}
.btn-pager:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
