/* =========================================================
   Global / Auth base tokens
   ========================================================= */
/* Devise 인증 화면 공통 스타일 (시스템 다크/라이트 테마 자동 대응) */
:root {
  --auth-bg: #f5f5f7;
  --auth-card-bg: rgba(255, 255, 255, 0.9);
  --auth-card-border: #e5e5ea;
  --auth-text-main: #1d1d1f;
  --auth-text-sub: #6e6e73;
  --auth-accent: #0071e3;
  --auth-input-bg: #ffffff;
  --auth-input-border: #d2d2d7;
  --auth-danger-bg: #fef2f2;
  --auth-danger-text: #991b1b;
  --auth-danger-border: #fecaca;
  --headup-notice-bg: #ecfdf3;
  --headup-notice-text: #166534;
  --headup-alert-bg: #fef2f2;
  --headup-alert-text: #991b1b;
  --auth-link-muted: #8e8e93;
}

@media (prefers-color-scheme: dark) {
  :root {
    --auth-bg: #000000;
    --auth-card-bg: rgba(28, 28, 30, 0.88);
    --auth-card-border: #3a3a3c;
    --auth-text-main: #f5f5f7;
    --auth-text-sub: #a1a1a6;
    --auth-accent: #0a84ff;
    --auth-input-bg: #1c1c1e;
    --auth-input-border: #4a4a4d;
    --auth-danger-bg: rgba(153, 27, 27, 0.2);
    --auth-danger-text: #fecaca;
    --auth-danger-border: rgba(239, 68, 68, 0.45);
    --headup-notice-bg: rgba(34, 197, 94, 0.18);
    --headup-notice-text: #86efac;
    --headup-alert-bg: rgba(239, 68, 68, 0.2);
    --headup-alert-text: #fca5a5;
    --auth-link-muted: #8e8e93;
  }
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body.auth-screen {
  overflow-x: hidden;
}

.global-head-up {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.global-head-up__messages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
  pointer-events: auto;
}

.global-head-up__messages:empty {
  display: none;
}

.head-up-badge {
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.3;
  border: 1px solid transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.head-up-badge.is-fading {
  opacity: 0;
  transform: translateY(-6px);
}

.head-up-badge--notice {
  background: var(--headup-notice-bg);
  color: var(--headup-notice-text);
  border-color: color-mix(in srgb, var(--headup-notice-text) 28%, transparent);
}

.head-up-badge--alert {
  background: var(--headup-alert-bg);
  color: var(--headup-alert-text);
  border-color: color-mix(in srgb, var(--headup-alert-text) 28%, transparent);
}

.global-user-chip {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--auth-card-border);
  background: var(--auth-card-bg);
  color: var(--auth-text-sub);
  font-size: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.global-user-chip__email {
  max-width: min(34vw, 280px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-user-chip__role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 20px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--auth-accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--auth-accent) 38%, transparent);
  color: var(--auth-accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 8px;
}

.global-user-chip form {
  margin: 0;
}

.global-user-chip__logout {
  border: 1px solid var(--auth-input-border);
  border-radius: 999px;
  background: var(--auth-input-bg);
  color: var(--auth-text-main);
  padding: 4px 9px;
  font-size: 11px;
  cursor: pointer;
}

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: max(56px, env(safe-area-inset-top) + 36px) 16px max(24px, env(safe-area-inset-bottom) + 8px);
  background: var(--auth-bg);
  overflow: hidden;
}

.auth-card {
  width: min(460px, 100%);
  padding: 30px 26px;
  border-radius: 20px;
  border: 1px solid var(--auth-card-border);
  background: linear-gradient(
      180deg,
      color-mix(in srgb, var(--auth-card-bg) 96%, #ffffff 4%),
      var(--auth-card-bg)
    );
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
}

.auth-brand {
  margin: 0 0 8px;
  color: var(--auth-link-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.auth-title {
  margin: 0 0 8px;
  color: var(--auth-text-main);
  font-size: 34px;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin: 0 0 22px;
  color: var(--auth-text-sub);
  font-size: 14px;
  line-height: 1.45;
  max-width: 34ch;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-label {
  display: block;
  margin-bottom: 6px;
  color: var(--auth-text-main);
  font-size: 13px;
  font-weight: 600;
}

.auth-input {
  width: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-input-bg);
  color: var(--auth-text-main);
  min-height: 44px;
  padding: 11px 13px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input::placeholder {
  color: color-mix(in srgb, var(--auth-text-sub) 72%, transparent);
}

.auth-input:focus {
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-accent) 22%, transparent);
}

.auth-help {
  margin: 4px 0 8px;
  color: var(--auth-text-sub);
  font-size: 12px;
}

.auth-remember {
  margin: 4px 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--auth-text-sub);
  font-size: 13px;
}

.auth-remember input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.auth-submit {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: var(--auth-accent);
  color: #fff;
  min-height: 44px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--auth-accent) 32%, transparent);
}

.auth-submit:hover {
  opacity: 0.92;
}

.auth-submit:active {
  transform: translateY(1px);
}

.auth-oauth {
  margin-top: 18px;
}

.auth-oauth__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--auth-text-sub);
  font-size: 12px;
}

.auth-oauth__divider::before,
.auth-oauth__divider::after {
  content: "";
  height: 1px;
  flex: 1 1 0;
  background: var(--auth-card-border);
}

.auth-oauth__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.auth-oauth__form {
  margin: 0;
}

.auth-oauth__button {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-input-bg);
  color: var(--auth-text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.auth-oauth__mark {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 850;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
}

.auth-oauth__button--apple {
  background: #111;
  color: #fff;
  border-color: #111;
}

.auth-oauth__button--kakao {
  background: #fee500;
  color: #191600;
  border-color: #f2d800;
}

.auth-oauth__button--naver {
  background: #03c75a;
  color: #fff;
  border-color: #03b752;
}

.auth-oauth__button--naver .auth-oauth__mark {
  color: #03a84d;
}

.auth-links {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--auth-card-border);
}

.auth-links a {
  color: var(--auth-accent);
  font-size: 13px;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.auth-links a + a {
  color: var(--auth-link-muted);
}

.auth-errors {
  margin-bottom: 14px;
  border: 1px solid var(--auth-danger-border);
  border-radius: 10px;
  background: var(--auth-danger-bg);
  color: var(--auth-danger-text);
  padding: 11px 12px;
}

.auth-errors h2 {
  margin: 0 0 6px;
  font-size: 13px;
}

.auth-errors ul {
  margin: 0;
  padding-left: 18px;
}

.auth-errors li {
  font-size: 12px;
}

@media (max-width: 640px) {
  .global-head-up {
    top: 8px;
    left: 8px;
    right: 8px;
  }

  .global-user-chip__email {
    max-width: 42vw;
  }

  .auth-card {
    width: min(520px, 100%);
    border-radius: 16px;
    padding: 24px 16px 20px;
  }

  .auth-brand {
    margin-bottom: 6px;
  }

  .auth-title {
    font-size: 30px;
  }

  .auth-oauth__grid {
    grid-template-columns: 1fr;
  }

  .auth-subtitle {
    font-size: 13px;
  }

  .auth-input {
    font-size: 16px;
  }

  .auth-page {
    padding-top: max(54px, env(safe-area-inset-top) + 30px);
  }
}

/* 상세 모바일 메뉴 버튼 탭 충돌 방지: 앱 화면에서는 전역 칩을 숨기고 화면별 헤더 우선 */
@media (max-width: 968px) {
  body.search-detail-page .global-head-up {
    display: none;
  }
}

/* =========================================================
   Home page (simple search)
   ========================================================= */
.home-page {
  --home-bg: #ffffff;
  --home-text: #1d1d1f;
  --home-input-bg: #f5f5f7;
  --home-input-shadow: rgba(0, 0, 0, 0.05);
  --home-focus: #0071e3;
}

body.home-index-page {
  background-color: var(--home-bg);
  color: var(--home-text);
}

@media (prefers-color-scheme: dark) {
  .home-page {
    --home-bg: #000000;
    --home-text: #f5f5f7;
    --home-input-bg: #1c1c1e;
    --home-input-shadow: rgba(255, 255, 255, 0.05);
    --home-focus: #0a84ff;
  }
}

.home-page {
  background-color: var(--home-bg);
  color: var(--home-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.home-page__container {
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: max(56px, env(safe-area-inset-top) + 36px) 20px max(20px, env(safe-area-inset-bottom) + 8px);
  overflow-x: hidden;
  overflow-y: auto; /* 라이브 미리보기가 길어질 때만 세로 스크롤 */
}

.home-page__title {
  font-size: clamp(2.2rem, 8vw, 3rem);
  font-weight: 700;
  margin: 0 0 2rem;
  letter-spacing: -0.02em;
  text-align: center;
}

.home-page__search-wrap {
  width: 100%;
  max-width: 720px;
}

.home-page__input-wrap {
  position: relative;
}

.home-page__input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 18px 58px 18px 28px;
  font-size: clamp(1rem, 3.6vw, 1.25rem);
  border: 1px solid transparent;
  border-radius: 30px;
  background-color: var(--home-input-bg);
  color: var(--home-text);
  box-shadow: 0 4px 20px var(--home-input-shadow);
  outline: none;
  transition: all 0.2s ease;
}

.home-page__upload-icon-btn {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: color-mix(in srgb, var(--home-text) 46%, transparent);
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.home-page__upload-icon-btn:hover {
  color: var(--home-focus);
  border-color: color-mix(in srgb, var(--home-focus) 35%, transparent);
  background: color-mix(in srgb, var(--home-focus) 9%, transparent);
}

.home-page__upload-file {
  display: none;
}

.home-page__input:focus {
  background-color: var(--home-bg);
  border-color: var(--home-focus);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--home-focus) 22%, transparent);
}

.home-page__hint {
  margin-top: 1.5rem;
  font-size: 0.82rem;
  color: #9aa0a6;
}

.home-quality-card {
  width: 100%;
  max-width: 720px;
  margin-top: 20px;
  border: 1px solid color-mix(in srgb, var(--home-text) 12%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--home-bg) 92%, #fff 8%);
  padding: 14px 16px;
  box-sizing: border-box;
}

.home-quality-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.home-quality-card__head h2 {
  margin: 0;
  font-size: 15px;
}

.home-quality-card__head span {
  font-size: 12px;
  color: #86868b;
}

.home-quality-card__metrics {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.home-quality-card__metric {
  border: 1px solid color-mix(in srgb, var(--home-text) 10%, transparent);
  border-radius: 10px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--home-bg) 94%, #fff 6%);
}

.home-quality-card__label {
  display: block;
  font-size: 11px;
  color: #86868b;
}

.home-quality-card__metric strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.home-quality-card__failures {
  margin-top: 12px;
}

.home-quality-card__failures h3 {
  margin: 0 0 6px;
  font-size: 13px;
}

.home-quality-card__failures ul {
  margin: 0;
  padding-left: 18px;
}

.home-quality-card__failures li,
.home-quality-card__failures p {
  font-size: 12px;
  line-height: 1.45;
  color: var(--home-text);
}

.home-quality-card__count {
  font-weight: 700;
}

.home-quality-card__ops-alert {
  margin: 12px 0 2px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  color: #b42318;
  font-size: 12px;
  padding: 8px 10px;
}

@media (prefers-color-scheme: dark) {
  .home-page__hint {
    color: #8f939a;
  }
  .home-quality-card__head span,
  .home-quality-card__label {
    color: #a1a1a6;
  }
}

@media (max-width: 900px) {
  .home-quality-card__metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 홈: Turbo Frame 라이브 검색 미리보기 (홈 토큰·글래스 톤과 통일) */
.home-live-search--frame {
  width: 100%;
  max-width: 720px;
  margin-top: 10px;
  display: block;
  min-height: 0;
  transition: opacity 0.2s ease;
}

.home-live-search--frame[busy] {
  opacity: 0.55;
  pointer-events: none;
}

.home-live-search__empty,
.home-live-search__notice {
  border-radius: 18px;
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid color-mix(in srgb, var(--home-text) 10%, transparent);
  background: color-mix(in srgb, var(--home-input-bg) 88%, var(--home-bg) 12%);
  color: color-mix(in srgb, var(--home-text) 72%, transparent);
  box-shadow: 0 4px 18px var(--home-input-shadow);
}

.home-live-search__empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.home-live-search__empty-title {
  font-weight: 600;
  color: var(--home-text);
}

.home-live-search__empty-hint {
  font-size: 12px;
  color: color-mix(in srgb, var(--home-text) 55%, transparent);
}

.home-live-search__notice--alert {
  border-color: color-mix(in srgb, #ef4444 35%, transparent);
  background: color-mix(in srgb, #fef2f2 88%, var(--home-bg) 12%);
  color: #991b1b;
}

@media (prefers-color-scheme: dark) {
  .home-live-search__notice--alert {
    background: color-mix(in srgb, rgba(239, 68, 68, 0.2) 75%, var(--home-bg) 25%);
    color: #fecaca;
    border-color: color-mix(in srgb, #f87171 28%, transparent);
  }
}

.home-live-search__panel {
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--home-text) 10%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--home-input-bg) 92%, #ffffff 8%),
    var(--home-input-bg)
  );
  box-shadow: 0 8px 28px var(--home-input-shadow);
  overflow: hidden;
}

@media (prefers-color-scheme: dark) {
  .home-live-search__panel {
    background: linear-gradient(
      180deg,
      color-mix(in srgb, var(--home-input-bg) 85%, #ffffff 4%),
      var(--home-input-bg)
    );
  }
}

.home-live-search__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--home-text) 8%, transparent);
  font-size: 12px;
  color: color-mix(in srgb, var(--home-text) 62%, transparent);
}

.home-live-search__count strong {
  color: var(--home-text);
  font-weight: 700;
}

.home-live-search__all-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--home-focus);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--home-focus) 28%, transparent);
  background: color-mix(in srgb, var(--home-focus) 10%, transparent);
}

.home-live-search__all-link:hover {
  text-decoration: none;
  opacity: 0.9;
}

.home-live-search__list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.home-live-search__item {
  margin: 0;
  display: block;
}

/* 한 줄 전체가 링크 히트 영역; 상세 이동은 뷰에서 data-turbo-frame=_top */
.home-live-search__item-link {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 0.95fr) auto;
  gap: 8px 12px;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 16px;
  text-decoration: none;
  color: inherit;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid color-mix(in srgb, var(--home-text) 6%, transparent);
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.home-live-search__item:last-child .home-live-search__item-link {
  border-bottom: none;
}

.home-live-search__item-link:hover {
  background: color-mix(in srgb, var(--home-focus) 8%, transparent);
}

.home-live-search__item-link:focus-visible {
  outline: 2px solid var(--home-focus);
  outline-offset: -2px;
}

.home-live-search__tag {
  font-weight: 700;
  color: var(--home-focus);
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-live-search__sub {
  min-width: 0;
  font-size: 12px;
  color: color-mix(in srgb, var(--home-text) 72%, transparent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-live-search__dot {
  opacity: 0.45;
}

.home-live-search__model {
  font-weight: 600;
  color: color-mix(in srgb, var(--home-text) 92%, transparent);
}

.home-live-search__ip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", monospace;
  font-size: 12px;
  color: color-mix(in srgb, var(--home-text) 78%, transparent);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-live-search__pill {
  justify-self: end;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.home-live-search__pill--on {
  background: color-mix(in srgb, #34c759 22%, transparent);
  color: #1a7a32;
}

.home-live-search__pill--off {
  background: color-mix(in srgb, #ff3b30 18%, transparent);
  color: #b42318;
}

@media (prefers-color-scheme: dark) {
  .home-live-search__pill--on {
    color: #86efac;
  }

  .home-live-search__pill--off {
    color: #fca5a5;
  }
}

.home-live-search__more-hint {
  margin: 0;
  padding: 10px 16px 12px;
  font-size: 11px;
  color: color-mix(in srgb, var(--home-text) 55%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--home-text) 6%, transparent);
}

@media (max-width: 640px) {
  .home-live-search__item-link {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }

  .home-live-search__tag {
    grid-column: 1 / 2;
  }

  .home-live-search__pill {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
  }

  .home-live-search__sub {
    grid-column: 1 / -1;
    grid-row: 2 / 3;
    white-space: normal;
  }

  .home-live-search__ip {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-live-search--frame {
    transition: none;
  }

  .home-live-search__item-link {
    transition: none;
  }
}

/* =========================================================
   Search result page
   ========================================================= */
.search-page {
  --sp-bg: #f5f5f7;
  --sp-card-bg: #ffffff;
  --sp-text-main: #1d1d1f;
  --sp-text-sub: #86868b;
  --sp-accent: #0071e3;
  --sp-border: #e5e5ea;
}

body.search-index-page {
  background-color: var(--sp-bg);
  color: var(--sp-text-main);
}

@media (prefers-color-scheme: dark) {
  .search-page {
    --sp-bg: #000000;
    --sp-card-bg: #1c1c1e;
    --sp-text-main: #f5f5f7;
    --sp-text-sub: #a1a1a6;
    --sp-accent: #0a84ff;
    --sp-border: #38383a;
  }
}

.search-page {
  background-color: var(--sp-bg);
  color: var(--sp-text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

.search-page__container {
  max-width: 1000px;
  margin: 0 auto;
  padding: max(40px, env(safe-area-inset-top) + 22px) 20px max(28px, env(safe-area-inset-bottom) + 12px);
}

.search-page__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.search-page__meta {
  font-size: 14px;
  color: var(--sp-text-sub);
}

.search-page__back {
  color: var(--sp-accent);
  text-decoration: none;
  font-weight: 500;
}

.search-page__card {
  background-color: var(--sp-card-bg);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
  margin-bottom: 20px;
  border: 1px solid var(--sp-border);
}

.search-page__row {
  display: grid;
  grid-template-columns: 1.5fr 2fr 1.5fr 1fr;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--sp-border);
  transition: background-color 0.2s ease;
}

.search-page__row:hover {
  background-color: color-mix(in srgb, var(--sp-accent) 6%, transparent);
}

.search-page__row:last-child {
  border-bottom: none;
}

.search-page__row--head {
  color: var(--sp-text-sub);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.search-page__tag a {
  font-weight: 700;
  color: var(--sp-accent);
  text-decoration: none;
}

.search-page__tag a:hover {
  text-decoration: underline;
}

.search-page__model {
  font-weight: 600;
}

.search-page__host {
  font-size: 12px;
  color: var(--sp-text-sub);
}

.search-page__ip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", monospace;
}

.search-page__status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  width: fit-content;
}

.search-page__status--on { background: #e5f5ea; color: #34c759; }
.search-page__status--off { background: #fcebeb; color: #ff3b30; }
@media (prefers-color-scheme: dark) {
  .search-page__status--on { background: #1c3d28; color: #30d158; }
  .search-page__status--off { background: #4d1916; color: #ff453a; }
}

.search-page__empty {
  text-align: center;
  padding: 60px;
}

@media (max-width: 720px) {
  .search-page__container {
    padding: max(24px, env(safe-area-inset-top) + 18px) max(14px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom) + 18px) max(14px, env(safe-area-inset-left));
  }
  .search-page__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 28px;
  }
  .search-page__row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 16px 0;
  }
  .search-page__card > .search-page__row--head {
    display: none;
  }
}

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

/* =========================================================
   Server detail (search#detail) — application.css 통합
   토큰·배경은 body.search-detail-page 에만 적용 (홈/검색과 CSS 변수 충돌 방지)
   ========================================================= */

body.search-detail-page {
    --bg-main: #f5f5f7;
    --sidebar-bg: rgba(255, 255, 255, 0.8);
    --card-bg: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --accent: #0071e3;
    --border: #e5e5ea;
    --success: #34c759;
}

@media (prefers-color-scheme: dark) {
  body.search-detail-page {
      --bg-main: #000000;
      --sidebar-bg: rgba(28, 28, 30, 0.8);
      --card-bg: #1c1c1e;
      --text-primary: #f5f5f7;
      --text-secondary: #a1a1a6;
      --accent: #0a84ff;
      --border: #38383a;
      --success: #30d158;
  }
}

body.search-detail-page {
    background-color: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: hidden;
  }

  /* 상세 페이지 레이아웃 루트 (모바일: 세로 + 드로어, PC: 가로) */
  .server-detail-root {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-header { margin-bottom: 30px; padding-left: 10px; }
  .sidebar-tag-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
  }
  .sidebar-tag-value {
    font-size: 20px;
    font-weight: 700;
  }
  .nav-item {
    padding: 12px 15px;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
    box-sizing: border-box;
    transition: background 0.2s;
  }
  .nav-item:hover { background: rgba(0, 113, 227, 0.1); }
  .nav-item.active { background: var(--accent); color: #fff; }
  .main-content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 40px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  .main-content h2 {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    word-break: keep-all;
  }

  /* 모바일 전용 UI — 기본은 숨김 */
  .mobile-topbar {
    display: none;
  }

  .sidebar-backdrop {
    display: none;
  }

  .sidebar-mobile-close-wrap {
    display: none;
  }
  .content-section { display: none; animation: fadeIn 0.3s ease-in-out; }
  .content-section.active { display: block; }
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    box-sizing: border-box;
  }
  .card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  .data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
  .data-table th {
    text-align: left;
    color: var(--text-secondary);
    padding: 10px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
  }
  .data-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
  .badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    background: var(--bg-main);
  }
  .empty-note { color: var(--text-secondary); font-size: 14px; padding: 12px 0; }
  .empty-note--compact {
    padding: 8px 0;
    margin: 0;
  }
  .empty-note--no-top {
    margin-top: 0;
  }
  .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", monospace;
  }

  .section-title {
    margin-top: 0;
  }
  .section-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 16px;
  }

  .detail-overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }
  .overview-kv-label {
    color: var(--text-secondary);
    font-size: 13px;
  }
  .overview-ip {
    color: var(--accent);
  }
  .overview-health-ok {
    color: var(--success);
  }
  .bios-key-cell {
    color: var(--text-secondary);
    width: 280px;
  }
  .log-col-time-wide { width: 11rem; }
  .log-col-severity { width: 5.5rem; }
  .log-col-sensor { width: 7rem; }
  .log-col-code { width: 6rem; }
  .log-col-message-id { width: 8rem; }
  .log-col-args { width: 9rem; }
  .muted-small {
    color: var(--text-secondary);
    word-break: break-all;
  }

  /* 사이드바 하단: 검색 홈 / 검색 결과 */
  .sidebar-actions {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .sidebar-actions form {
    margin: 0;
  }
  .sidebar-actions form .sidebar-btn {
    width: 100%;
  }
  .sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
  }
  .sidebar-btn:hover { transform: translateY(-1px); }
  .sidebar-btn:active { transform: translateY(0); }
  .sidebar-btn--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.28);
  }
  .sidebar-btn--primary:hover { opacity: 0.95; }
  @media (prefers-color-scheme: dark) {
    .sidebar-btn--primary { box-shadow: 0 4px 16px rgba(10, 132, 255, 0.35); }
  }
  .sidebar-btn--ghost {
    background: rgba(255, 255, 255, 0.55);
    color: var(--text-primary);
    border: 1px solid var(--border);
  }
  .sidebar-btn--ghost:hover {
    background: rgba(0, 113, 227, 0.08);
    border-color: rgba(0, 113, 227, 0.25);
  }
  @media (prefers-color-scheme: dark) {
    .sidebar-btn--ghost {
      background: rgba(44, 44, 46, 0.72);
    }
    .sidebar-btn--ghost:hover {
      background: rgba(10, 132, 255, 0.12);
      border-color: rgba(10, 132, 255, 0.35);
    }
  }
  .sidebar-btn .btn-icon { font-size: 15px; line-height: 1; opacity: 0.9; }

  /* 펌웨어: 요약 / 전체 목록 탭 */
  .firmware-tab-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
  }
  .firmware-tab {
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
  }
  .firmware-tab:hover {
    background: rgba(0, 113, 227, 0.08);
    border-color: rgba(0, 113, 227, 0.35);
  }
  .firmware-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
  }
  .firmware-panel { display: none; }
  .firmware-panel.active { display: block; }
  /* 요약 탭: 전체 목록과 동일한 테이블 톤, 넓은 화면에서 이름 열이 늘어나도록 */
  .firmware-summary-wrap { overflow-x: auto; margin: 0 -4px; }
  .firmware-summary-wrap .data-table { table-layout: auto; }
  .firmware-summary-wrap .data-table th:first-child,
  .firmware-summary-wrap .data-table td:first-child {
    white-space: nowrap;
    width: 1%;
    color: var(--text-secondary);
    font-weight: 600;
  }
  .firmware-summary-wrap .data-table td:nth-child(2) {
    word-break: break-word;
    min-width: 12rem;
  }
  .bios-summary-list {
    display: grid;
    gap: 12px;
  }
  .bios-summary-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
  }
  .bios-summary-section h3 {
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 16px;
    line-height: 1.25;
    font-weight: 800;
  }
  .bios-summary-rows {
    padding: 0 14px 8px;
  }
  .bios-summary-row {
    display: grid;
    grid-template-columns: minmax(12rem, 0.58fr) minmax(10rem, 0.42fr);
    gap: 22px;
    align-items: start;
    padding: 9px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }
  .bios-summary-row:first-child {
    border-top: none;
  }
  .bios-summary-row span {
    color: var(--text-secondary);
    font-weight: 650;
    line-height: 1.35;
    word-break: break-word;
  }
  .bios-summary-row strong {
    justify-self: end;
    text-align: right;
    color: var(--text-primary);
    font-weight: 750;
    line-height: 1.35;
    word-break: break-word;
  }
  .bios-setup-list {
    display: grid;
    gap: 12px;
  }
  .bios-setup-section,
  .bios-setup-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }
  .bios-setup-section__summary,
  .bios-setup-group__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    user-select: none;
    min-width: 0;
  }
  .bios-setup-section__summary {
    padding: 14px 16px;
    font-size: 17px;
    font-weight: 800;
  }
  .bios-setup-group {
    margin: 0 12px 12px;
  }
  .bios-setup-group__summary {
    padding: 11px 14px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
    border-top: 1px solid var(--border);
  }
  .bios-setup-section__summary small,
  .bios-setup-group__summary small {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .bios-setup-section__summary span,
  .bios-setup-group__summary span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .bios-setup-rows {
    padding: 0 14px 10px;
  }
  .bios-setup-row {
    display: grid;
    grid-template-columns: minmax(14rem, 1fr) minmax(8rem, 0.65fr);
    gap: 24px;
    align-items: start;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    min-width: 0;
  }
  .bios-setup-row strong {
    display: block;
    font-size: 13px;
    line-height: 1.35;
  }
  .bios-setup-row small {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 11px;
    word-break: break-word;
  }
  .bios-setup-row > span {
    justify-self: end;
    text-align: right;
    color: var(--text-primary);
    font-weight: 600;
    word-break: break-word;
    min-width: 0;
  }

  /* 로그 카탈로그: SEL / LC 탭 + 스크롤 영역 + 심각도 배지 */
  .log-catalog-tab-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
  }
  .log-catalog-tab {
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
  }
  .log-catalog-tab:hover {
    background: rgba(0, 113, 227, 0.08);
    border-color: rgba(0, 113, 227, 0.35);
  }
  .log-catalog-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
  }
  .log-catalog-panel { display: none; }
  .log-catalog-panel.active { display: block; }
  .tsr-archive-table th,
  .tsr-archive-table td {
    white-space: nowrap;
  }
  .tsr-archive-download-link {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
  }
  .tsr-archive-download-link:hover {
    text-decoration: underline;
  }
  .log-filter-form {
    margin-bottom: 14px;
  }
  .log-filter-form__row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 180px)) minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: end;
  }
  .log-filter-form__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .log-filter-form__field label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
  }
  .log-filter-form__select,
  .log-filter-form__input {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
  }
  .log-filter-form__actions {
    display: flex;
    align-items: end;
    gap: 8px;
  }
  .log-filter-form__button {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }
  .log-filter-form__button--ghost {
    text-decoration: none;
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border);
  }
  .bios-filter-form .log-filter-form__row {
    grid-template-columns: minmax(220px, 1fr) auto;
  }
  .log-col-source { width: 5.8rem; }
  .log-table-scroll {
    max-height: min(70vh, 560px);
    overflow: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-top: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .log-table-scroll .data-table {
    margin: 0;
    table-layout: fixed;
    font-size: 13px;
  }
  .log-table-scroll .data-table th,
  .log-table-scroll .data-table td {
    word-break: break-word;
    vertical-align: top;
  }
  .log-table-scroll .data-table td.log-col-msg {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-primary);
  }
  .log-sev-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }
  .log-sev--ok {
    background: rgba(52, 199, 89, 0.18);
    color: #1a7a32;
  }
  @media (prefers-color-scheme: dark) {
    .log-sev--ok { color: #5de389; }
  }
  .log-sev--warn {
    background: rgba(255, 159, 10, 0.22);
    color: #a35a00;
  }
  @media (prefers-color-scheme: dark) {
    .log-sev--warn { color: #ffb340; }
  }
  .log-sev--crit {
    background: rgba(255, 59, 48, 0.2);
    color: #c41a0f;
  }
  @media (prefers-color-scheme: dark) {
    .log-sev--crit { color: #ff6961; }
  }
  .log-sev--info {
    background: rgba(0, 113, 227, 0.12);
    color: var(--accent);
  }
  .log-sev--muted {
    background: var(--bg-main);
    color: var(--text-secondary);
    font-weight: 600;
  }
  .log-catalog-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
  }
  @media (max-width: 900px) {
    .log-filter-form__row {
      grid-template-columns: 1fr;
    }
  }

  /* 저장소: 컨트롤러 → 볼륨 → 디스크 (볼륨 많을 때만 <details> 아코디언) */
  .storage-volume-block {
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(0, 113, 227, 0.04);
  }
  @media (prefers-color-scheme: dark) {
    .storage-volume-block {
      background: rgba(10, 132, 255, 0.08);
    }
  }
  .storage-volume-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
  }
  .storage-volume-head .sv-meta,
  .storage-volume-summary .sv-meta {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
  }
  .storage-volume-details {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    overflow: hidden;
  }
  .storage-volume-details summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    user-select: none;
  }
  .storage-volume-details summary::-webkit-details-marker {
    display: none;
  }
  .storage-volume-details summary::after {
    content: "▸";
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
    transition: transform 0.2s ease;
  }
  .storage-volume-details[open] summary::after {
    transform: rotate(90deg);
  }
  .storage-volume-details .storage-volume-body {
    padding: 0 16px 14px;
    border-top: 1px solid var(--border);
  }
  .storage-volume-block .storage-volume-body {
    padding-top: 0;
  }
  /* 같은 컨트롤러 안 볼륨 카드 여러 개일 때 열이 세로로 맞도록 설정 */
  .storage-controller-card .storage-disk-mini {
    table-layout: fixed;
    width: 100%;
  }
  .storage-controller-card .storage-disk-mini th,
  .storage-controller-card .storage-disk-mini td {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .storage-controller-card .storage-disk-mini th:nth-child(1),
  .storage-controller-card .storage-disk-mini td:nth-child(1) {
    width: 7%;
  }
  .storage-controller-card .storage-disk-mini th:nth-child(2),
  .storage-controller-card .storage-disk-mini td:nth-child(2) {
    width: 36%;
    word-break: break-word;
  }
  .storage-controller-card .storage-disk-mini th:nth-child(3),
  .storage-controller-card .storage-disk-mini td:nth-child(3) {
    width: 14%;
  }
  .storage-controller-card .storage-disk-mini th:nth-child(4),
  .storage-controller-card .storage-disk-mini td:nth-child(4) {
    width: 23%;
    word-break: break-word;
  }
  .storage-controller-card .storage-disk-mini th:nth-child(5),
  .storage-controller-card .storage-disk-mini td:nth-child(5) {
    width: 20%;
  }
  .storage-orphan-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 16px 0 8px;
  }
  .storage-disk-mini {
    margin: 0;
  }

  /* 좁은 화면: 폴드·아이폰 등 (Fold 메인 폭 ~872px 대응) */
  @media (max-width: 968px) {
    body.search-detail-page {
      overflow-y: auto;
      overflow-x: hidden;
    }

    .server-detail-root {
      flex-direction: column;
      height: auto;
      min-height: 100vh;
      min-height: 100dvh;
      overflow: visible;
    }

    .mobile-topbar {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-shrink: 0;
      padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 12px 14px;
      padding-left: max(14px, env(safe-area-inset-left));
      padding-right: max(14px, env(safe-area-inset-right));
      background: var(--sidebar-bg);
      border-bottom: 1px solid var(--border);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      position: sticky;
      top: 0;
      z-index: 300;
    }

    .mobile-menu-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 44px;
      height: 44px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--card-bg);
      color: var(--text-primary);
      font-size: 20px;
      line-height: 1;
      cursor: pointer;
      flex-shrink: 0;
      touch-action: manipulation;
      font-family: inherit;
      position: relative;
      z-index: 410;
      pointer-events: auto;
    }

    .mobile-topbar-title {
      flex: 1;
      min-width: 0;
    }

    .mobile-topbar-label {
      display: block;
      font-size: 11px;
      color: var(--text-secondary);
      margin-bottom: 2px;
    }

    .mobile-topbar-tag {
      display: block;
      font-size: 17px;
      font-weight: 700;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .sidebar-backdrop {
      display: block;
      position: fixed;
      inset: 0;
      z-index: 350;
      margin: 0;
      padding: 0;
      border: none;
      background: rgba(0, 0, 0, 0.42);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.22s ease;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }

    .sidebar-backdrop.is-visible {
      opacity: 1;
      pointer-events: auto;
    }

    .sidebar {
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      width: min(300px, 88vw);
      max-width: 100vw;
      z-index: 400;
      transform: translateX(-108%);
      transition: transform 0.28s ease;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding-top: calc(12px + env(safe-area-inset-top, 0px));
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
      padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
      box-shadow: none;
    }

    body.search-detail-page.detail-drawer-open {
      overflow: hidden;
      touch-action: none;
    }

    .sidebar.is-open {
      transform: translateX(0);
      box-shadow: 8px 0 36px rgba(0, 0, 0, 0.18);
    }

    .sidebar-mobile-close-wrap {
      display: flex;
      justify-content: flex-end;
      margin: 0 0 12px;
    }

    .sidebar-mobile-close {
      padding: 8px 12px;
      font-size: 13px;
      font-weight: 600;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--card-bg);
      color: var(--text-primary);
      cursor: pointer;
      font-family: inherit;
      touch-action: manipulation;
    }

    .main-content {
      flex: 1;
      min-height: 0;
      width: 100%;
      max-width: 100%;
      padding: 16px max(14px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom) + 16px) max(14px, env(safe-area-inset-left));
      box-sizing: border-box;
    }

    .detail-overview-grid {
      grid-template-columns: 1fr !important;
      gap: 20px !important;
    }

    .card {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      max-width: 100%;
      padding: 18px;
    }

    #bios .card {
      overflow: hidden;
    }

    .data-table {
      font-size: 13px;
    }

    .data-table th,
    .data-table td {
      padding: 10px 8px;
    }

    .firmware-summary-wrap .data-table td:nth-child(2) {
      min-width: 0;
    }

    .bios-setup-section__summary {
      padding: 12px 14px;
      font-size: 16px;
    }

    .bios-setup-group {
      margin: 0 8px 10px;
    }

    .bios-setup-row {
      grid-template-columns: 1fr;
      gap: 4px;
      padding: 11px 0;
    }

    .bios-setup-row > span {
      justify-self: start;
      text-align: left;
    }
  }

  @media (max-width: 480px) {
    .mobile-topbar {
      gap: 14px;
      padding-top: calc(14px + env(safe-area-inset-top, 0px));
      padding-bottom: 14px;
    }

    .mobile-menu-btn {
      width: 48px;
      height: 48px;
      border-radius: 14px;
    }

    .mobile-topbar-label {
      font-size: 13px;
    }

    .mobile-topbar-tag {
      font-size: 20px;
      line-height: 1.15;
    }

    .main-content {
      padding: 24px max(16px, env(safe-area-inset-right)) max(44px, env(safe-area-inset-bottom) + 28px) max(16px, env(safe-area-inset-left));
    }

    .main-content h2,
    .section-title {
      font-size: 34px;
      line-height: 1.12;
      margin: 0 0 16px;
      letter-spacing: 0;
    }

    .section-description {
      font-size: 15px;
      line-height: 1.45;
      margin-bottom: 20px;
      overflow-wrap: anywhere;
    }

    .card {
      padding: 18px;
      border-radius: 22px;
      margin-bottom: 18px;
      overflow: hidden;
      box-shadow: 0 8px 28px rgba(0, 0, 0, 0.035);
    }

    .card-title {
      font-size: 22px;
      line-height: 1.2;
      margin-bottom: 16px;
    }

    .mobile-kv-table {
      display: block;
      width: 100%;
      max-width: 100%;
      border-collapse: separate;
    }

    .mobile-kv-table thead {
      display: none;
    }

    .mobile-kv-table tbody {
      display: grid;
      gap: 12px;
      width: 100%;
    }

    .mobile-kv-table tr {
      display: block;
      width: 100%;
      padding: 14px 0;
      border-top: 1px solid var(--border);
      box-sizing: border-box;
    }

    .mobile-kv-table tr:first-child {
      border-top: none;
      padding-top: 0;
    }

    .mobile-kv-table tr:last-child {
      padding-bottom: 0;
    }

    .mobile-kv-table td {
      display: grid;
      grid-template-columns: minmax(104px, 0.42fr) minmax(0, 1fr);
      gap: 14px;
      align-items: start;
      width: auto !important;
      min-width: 0 !important;
      max-width: 100%;
      border-bottom: none;
      padding: 7px 0;
      font-size: 16px;
      line-height: 1.32;
      word-break: break-word;
      overflow-wrap: anywhere;
      box-sizing: border-box;
    }

    .mobile-kv-table td::before {
      content: attr(data-label);
      color: var(--text-secondary);
      font-size: 13px;
      font-weight: 700;
      line-height: 1.35;
      word-break: keep-all;
    }

    .mobile-kv-table td[data-label="메시지"],
    .mobile-kv-table td[data-label="원본 파일명"],
    .mobile-kv-table td[data-label="Description"] {
      grid-template-columns: 1fr;
      gap: 4px;
    }

    .mobile-kv-table .muted-small {
      word-break: break-word;
      overflow-wrap: anywhere;
    }

    .mobile-kv-table td > * {
      min-width: 0;
    }

    .log-table-scroll {
      max-height: none;
      overflow: visible;
      border: none;
      border-radius: 0;
      margin-top: 12px;
    }

    .log-table-scroll .data-table {
      table-layout: auto;
      font-size: 16px;
    }

    .log-table-scroll .data-table td.log-col-msg {
      font-size: 16px;
      line-height: 1.38;
    }

    .tsr-archive-table th,
    .tsr-archive-table td {
      white-space: normal;
    }

    .tsr-archive-download-link {
      min-height: 44px;
      display: inline-flex;
      align-items: center;
      color: #fff;
      background: var(--accent);
      border-radius: 12px;
      padding: 0 16px;
      font-size: 15px;
      text-decoration: none;
    }

    .detail-tsr-meta__badge {
      margin-left: 0;
    }

    .log-catalog-tab-bar {
      gap: 10px;
      margin-bottom: 18px;
    }

    .log-catalog-tab {
      min-height: 44px;
      padding: 10px 16px;
      border-radius: 14px;
      font-size: 16px;
    }

    .log-filter-form {
      margin-bottom: 18px;
    }

    .log-filter-form__row {
      gap: 14px;
    }

    .log-filter-form__select,
    .log-filter-form__input {
      min-height: 46px;
      border-radius: 14px;
      padding: 10px 14px;
      font-size: 16px;
      box-sizing: border-box;
    }

    .log-filter-form__actions {
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .log-filter-form__button {
      min-height: 44px;
      border-radius: 14px;
      padding: 10px 18px;
      font-size: 16px;
    }

    .firmware-tab-bar {
      gap: 8px;
      margin-bottom: 14px;
      padding: 2px;
    }

    .firmware-tab {
      min-height: 44px;
      padding: 10px 15px;
      border-radius: 12px;
      font-size: 16px;
    }

    .bios-setup-list {
      gap: 10px;
    }

    .bios-summary-list {
      gap: 10px;
    }

    .bios-summary-section {
      border-radius: 10px;
    }

    .bios-summary-section h3 {
      padding: 13px 14px;
      font-size: 18px;
    }

    .bios-summary-row {
      grid-template-columns: 1fr;
      gap: 4px;
      padding: 11px 0;
    }

    .bios-summary-row span {
      font-size: 15px;
    }

    .bios-summary-row strong {
      justify-self: start;
      text-align: left;
      font-size: 17px;
    }

    .bios-setup-section,
    .bios-setup-group {
      border-radius: 10px;
    }

    .bios-setup-section__summary {
      padding: 13px 14px;
      font-size: 19px;
      line-height: 1.2;
    }

    .bios-setup-group {
      margin: 0 0 10px;
      border-left: none;
      border-right: none;
      border-radius: 0;
    }

    .bios-setup-group__summary {
      padding: 12px 14px;
      font-size: 17px;
      line-height: 1.25;
    }

    .bios-setup-section__summary small,
    .bios-setup-group__summary small {
      font-size: 11px;
      opacity: 0.8;
    }

    .bios-setup-rows {
      padding: 0 14px 10px;
    }

    .bios-setup-row strong {
      font-size: 16px;
      line-height: 1.28;
    }

    .bios-setup-row small {
      margin-top: 3px;
      font-size: 13px;
      line-height: 1.25;
    }

    .bios-setup-row > span {
      font-size: 17px;
      line-height: 1.3;
      font-weight: 650;
    }
  }

/* =========================================================
   TSR upload UX
   ========================================================= */
.home-tsr-drop-overlay {
  position: absolute;
  inset: 0;
  border: 2px dashed color-mix(in srgb, #0a84ff 60%, transparent);
  background: color-mix(in srgb, #0a84ff 10%, transparent);
  border-radius: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 24px;
  z-index: 15;
  pointer-events: none;
}

.home-tsr-drop-overlay.is-active {
  display: flex;
}

.home-tsr-drop-overlay__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0a84ff;
}

.home-tsr-drop-overlay__hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: #6e6e73;
}

.home-tsr-upload-status {
  margin-top: 12px;
  min-height: 20px;
  font-size: 13px;
  color: #1d1d1f;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.home-tsr-upload-status.is-visible {
  opacity: 1;
}

.home-tsr-upload-status.is-error {
  color: #b42318;
}

.home-live-search__tsr-badge {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.home-live-search__tsr-badge--ok {
  background: #e8f3ff;
  color: #0a63c9;
}

.home-live-search__tsr-badge--fail {
  background: #fdecec;
  color: #b42318;
}

.search-page__tsr-tag {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.search-page__tsr-tag--ok {
  background: #e8f3ff;
  color: #0a63c9;
}

.search-page__tsr-tag--fail {
  background: #fdecec;
  color: #b42318;
}

.detail-tsr-meta {
  margin-top: 16px;
}

.detail-tsr-meta__badge {
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.detail-tsr-meta__badge--ok {
  background: #e5f5ea;
  color: #15803d;
}

.detail-tsr-meta__badge--fail {
  background: #fdecec;
  color: #b42318;
}

.detail-tsr-meta__badge--pending {
  background: rgba(120, 120, 128, 0.16);
  color: #6e6e73;
}

.detail-tsr-meta__archives {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.detail-tsr-meta__download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0a84ff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.detail-tsr-meta__download small {
  color: #6e6e73;
  font-size: 12px;
  font-weight: 600;
}

.detail-tsr-meta__download:hover {
  text-decoration: underline;
}

.detail-tsr-upload {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(120, 120, 128, 0.2);
}

.detail-tsr-upload form {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-tsr-upload__label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #6e6e73;
}

.detail-tsr-upload__input {
  max-width: 360px;
}

.detail-tsr-upload__submit {
  border: 1px solid #0a84ff;
  background: #0a84ff;
  color: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.tsr-toast {
  width: min(340px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid #ececf1;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  padding: 12px 12px 10px;
  pointer-events: auto;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.tsr-toast.is-closing {
  opacity: 0;
  transform: translateX(20px);
}

.tsr-toast__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tsr-toast__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

.tsr-toast__message {
  margin: 5px 0 0;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

.tsr-toast__message--error {
  color: #b42318;
  font-weight: 600;
}

.tsr-toast__message--done {
  color: #15803d;
  font-weight: 600;
}

.tsr-toast__close {
  border: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}

.tsr-toast__progress {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: #f1f3f5;
  overflow: hidden;
}

.tsr-toast__bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.tsr-toast__bar--working {
  background: #0a84ff;
}

.tsr-toast__bar--done {
  background: #22c55e;
}

.tsr-toast__bar--error {
  background: #ef4444;
}

.tsr-toast__actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.tsr-toast__link {
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  color: #0a63c9;
  border: 1px solid #cfe3ff;
  background: #f3f8ff;
  border-radius: 8px;
  padding: 5px 10px;
}

.tsr-toast__link:hover {
  background: #e7f1ff;
}

.tsr-toast__actions form {
  margin: 0;
}

.tsr-toast__link--retry {
  margin-right: 6px;
  background: #fff;
}
