:root {
  color-scheme: light;
  --navy: #12304a;
  --ink: #13283a;
  --muted: #5b6f7c;
  --canvas: #f3f6f7;
  --surface: #fff;
  --line: #dce4e9;
  --green: #1f8063;
  --green-soft: #edf8f4;
  --amber: #a86516;
  --amber-soft: #fff7e9;
  --red: #aa4343;
  --red-soft: #fff4f3;
  --gray: #788b97;
  --gray-soft: #f4f7f8;
  font-family: Inter, Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 92% 0%, rgba(76, 145, 156, .08), transparent 30rem), var(--canvas);
  line-height: 1.55;
}

a, button { -webkit-tap-highlight-color: transparent; }

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 60px;
  padding: 0 30px;
  border-bottom: 1px solid #d9e2e7;
  color: #6b7e89;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
}

.portal-topbar p { margin: 0; font-size: 13px; font-weight: 500; }
.portal-topbar p span { margin: 0 8px; color: #a2b0b8; }
.portal-topbar > span { color: #687c89; font-size: 11px; font-weight: 650; }

.monitor-container { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 14px 0 32px; }

.monitor-header,
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 3px; font-size: clamp(28px, 3.5vw, 36px); letter-spacing: -.04em; line-height: 1.15; }
h2 { margin-bottom: 0; font-size: 16px; letter-spacing: -.015em; }
.description, .section-heading > p { margin-bottom: 0; color: #566b79; font-weight: 500; }
.eyebrow { margin-bottom: 4px; color: #0f806f; font-size: 9px; font-weight: 850; letter-spacing: .14em; }
.last-check { min-width: 225px; text-align: right; }
.last-check span { display: block; color: #687c89; font-size: 11px; font-weight: 650; }
.last-check strong { color: #344d5d; font-size: 13px; font-variant-numeric: tabular-nums; }

.error-banner { margin-top: 12px; padding: 10px 13px; border: 1px solid #e8c2bd; border-radius: 10px; color: #87433c; background: var(--red-soft); font-size: 12px; font-weight: 600; }
.action-banner { margin-top: 9px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; font-weight: 650; }
.action-banner--good { color: #17644f; border-color: #b9dfd2; background: var(--green-soft); }
.action-banner--error { color: #87433c; border-color: #e8c2bd; background: var(--red-soft); }
.action-banner--neutral { color: #4d6472; background: var(--gray-soft); }
.overview-grid { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); align-items: stretch; }
.overview-panel { margin-top: 14px; padding: 0; overflow: hidden; }
.overview-panel > .status-card {
  min-height: 100%;
  border-top: 0;
  border-right: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 0;
  box-shadow: none;
}
.overview-panel > .status-card::after { display: none; }
.overview-connections { min-width: 0; padding: 11px 12px; }
.overview-connections > .section-heading { margin-bottom: 7px; }
.overview-connections .eyebrow { font-size: 12px; font-weight: 850; letter-spacing: .06em; }
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.status-grid--single { grid-template-columns: minmax(0, 280px); }
.status-grid--dongle { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0; }
.dongle-block {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(18, 48, 74, .045);
}
.dongle-block .dongle-section-heading {
  align-items: center;
  margin-bottom: 10px;
  padding: 1px 2px;
}
.dongle-section-heading > div:first-child { min-width: 0; }
.dongle-section-heading h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}
.dongle-title-busid {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 7px;
  border: 1px solid #c8d9e2;
  border-radius: 6px;
  color: #355e72;
  background: #eef5f8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}
.dongle-title-busid--missing {
  color: #87433c;
  border-color: #e8c2bd;
  background: var(--red-soft);
}
.dongle-summary { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.dongle-block:not(.is-collapsed) .dongle-summary { display: none; }
.dongle-summary-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid #d5e0e5;
  border-radius: 999px;
  color: #516875;
  background: var(--gray-soft);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.dongle-summary-badge--good { color: #17644f; border-color: #b9dfd2; background: var(--green-soft); }
.dongle-summary-badge--warn { color: #8b5716; border-color: #ead2ad; background: var(--amber-soft); }
.dongle-summary-badge--error { color: #87433c; border-color: #e8c2bd; background: var(--red-soft); }
.collapsible-section.is-collapsed > .section-heading { margin-bottom: 0; }
.collapse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 70px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #cbd8df;
  border-radius: 9px;
  color: #355263;
  background: #f8fafb;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.collapse-toggle:hover { border-color: #9fb4c0; background: #f0f5f7; }
.collapse-toggle:focus-visible { outline: 3px solid #e49b36; outline-offset: 3px; }
.collapse-toggle-icon { display: inline-block; font-size: 17px; line-height: 1; transition: transform .18s ease; }
.collapse-toggle[aria-expanded="true"] .collapse-toggle-icon { transform: rotate(180deg); }
.collapse-description { margin: 0 0 9px; color: #566b79; font-size: 11px; font-weight: 500; }
.dongle-client-panel { margin-top: 9px; }
.hfss-mode-panel { margin-top: 9px; }
.dongle-inline-control {
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafb;
}
.dongle-inline-control > .section-heading {
  align-items: center;
  margin: 0;
  padding: 8px 10px;
}
.client-disconnect-content { padding: 10px; border-top: 1px solid var(--line); background: var(--surface); }
.page-collapsible-section > .section-heading { align-items: center; }
.page-collapse-description { margin: 0 0 8px; color: #566b79; font-size: 10px; font-weight: 500; }
.mode-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.mode-button { min-height: 36px; padding: 0 13px; border: 1px solid transparent; border-radius: 8px; color: #fff; font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; transition: transform .15s ease, opacity .15s ease, box-shadow .15s ease; }
.mode-button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(18, 48, 74, .14); }
.mode-button--server { background: var(--green); }
.mode-button--usbip { background: var(--navy); }
.disconnect-button { margin-top: 1px; background: var(--red); }
.mode-button:disabled { cursor: not-allowed; opacity: .42; }
.mode-button:focus-visible { outline: 3px solid #e49b36; outline-offset: 3px; }
.control-message { margin: 8px 0 0; color: #607581; font-size: 10px; font-weight: 550; }
.control-message--error { color: var(--red); }
.status-card,
.panel { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 5px 16px rgba(18, 48, 74, .045); }
.status-card {
  --tone: var(--gray);
  --tone-soft: var(--gray-soft);
  position: relative;
  min-height: 105px;
  padding: 13px 14px 12px;
  overflow: hidden;
  border-left: 4px solid var(--tone);
}
.status-card::after { content: ""; position: absolute; right: -34px; bottom: -54px; width: 112px; height: 112px; border-radius: 50%; background: var(--tone-soft); opacity: .55; }
.status-card.status-good { --tone: var(--green); --tone-soft: var(--green-soft); }
.status-card.status-warn { --tone: var(--amber); --tone-soft: var(--amber-soft); }
.status-card.status-error { --tone: var(--red); --tone-soft: var(--red-soft); }
.status-card.status-neutral { --tone: var(--gray); --tone-soft: var(--gray-soft); }
.card-label { margin-bottom: 7px; color: #687c89; font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.card-state { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; font-size: 18px; font-weight: 800; }
.card-state::before { content: ""; flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 14%, transparent); }
.card-detail { position: relative; z-index: 1; margin-bottom: 0; color: #5b6f7c; font-size: 11px; font-weight: 500; line-height: 1.4; }

.panel { margin-top: 10px; padding: 15px; }
.section-heading { margin-bottom: 10px; }
.section-heading > p { font-size: 11px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.detail-grid div { min-width: 0; padding: 9px 11px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-grid div:nth-child(3n) { border-right: 0; }
.detail-grid div:nth-last-child(-n+3) { border-bottom: 0; }
dt { color: #607581; font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
th { color: #526a78; background: #f5f8f9; font-size: 10px; letter-spacing: .045em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcfc; }
td:last-child { width: 100%; white-space: normal; }
.empty-row { height: 48px; color: #617581; text-align: center; vertical-align: middle; }
.event-name { color: #324d5d; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 750; }
.connection-state { font-weight: 800; }
.connection-state.attached { color: var(--amber); }
.connection-state.checking, .connection-state.disconnecting { color: var(--gray); }
footer { padding-top: 14px; color: #647985; font-size: 11px; text-align: center; }

a:focus-visible { outline: 3px solid #e49b36; outline-offset: 3px; }

@media (max-width: 900px) {
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid div:nth-child(3n) { border-right: 1px solid var(--line); }
  .detail-grid div:nth-child(2n) { border-right: 0; }
  .detail-grid div:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .detail-grid div:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 600px) {
  .portal-topbar { min-height: 52px; padding: 0 16px; }
  .portal-topbar p { font-size: 11px; font-weight: 800; letter-spacing: .08em; }
  .portal-topbar > span { display: none; }
  .monitor-container { width: min(100% - 24px, 1180px); padding-top: 14px; }
  .monitor-header, .section-heading { align-items: flex-start; flex-direction: column; gap: 11px; }
  .dongle-section-heading,
  .client-disconnect-panel > .section-heading,
  .page-collapsible-section > .section-heading { align-items: center; flex-direction: row; }
  .collapse-toggle { flex: 0 0 auto; }
  h1 { font-size: 27px; }
  .description { font-size: 12px; }
  .last-check { min-width: 0; text-align: left; }
  .overview-grid { grid-template-columns: 1fr; }
  .overview-panel > .status-card { border-right: 0; border-bottom: 1px solid var(--line); }
  .status-grid, .detail-grid { grid-template-columns: 1fr; }
  .status-card { min-height: 100px; }
  .detail-grid div { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
  .detail-grid div:last-child { border-bottom: 0 !important; }
  .panel { padding: 13px; }
  .dongle-block { padding: 10px; }
}
