/* 최상단 공통 머리줄 · 공통 창 — 서버 화면(콘솔 · watch · Charty)이 같이 쓴다(admin/top_bar.py).
   Tailwind · Charty 스타일 어느 쪽에도 기대지 않는다 — 어느 화면에서 봐도 같은 모양이어야 한다.
   색 · 크기는 medikit(Linky 화면 · 콘솔)과 같은 값이다. */
.shell-topbar, .shell-common, .shell-dialog, .shell-footer, .shell-policy {
  --shell-white: #ffffff;
  --shell-black: #000000;
  --shell-gray-100: #fbfbfb;
  --shell-gray-200: #f3f3f3;
  --shell-gray-300: #e3e3e3;
  --shell-gray-500: #cfcfcf;
  --shell-gray-600: #9f9f9f;
  --shell-gray-700: #6e6e6e;
  --shell-gray-800: #3e3e3e;
  --shell-primary: #20c8d6;
  --shell-primary-100: #e8f8fa;
  --shell-primary-300: #c8f0f4;
  --shell-primary-700: #148a94;
  --shell-yellow: #fd9400;
  --shell-yellow-100: #fff7ec;
  --shell-orange-700: #c2410c; /* 경고 띠 글자 — 연한 노랑 바탕 위 대비 4.87:1 */
  --shell-red: #ff4e51;
  --shell-red-100: #ffefef;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", sans-serif;
  line-height: 1.4;
}
.shell-topbar [hidden], .shell-dialog [hidden], .shell-footer [hidden] { display: none !important; }

/* ── 최상단 줄: 왼쪽 기능 탭 · 오른쪽 공통 항목 ── */
.shell-topbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  height: 38px; padding: 6px 32px 0; background: var(--shell-gray-200); flex-shrink: 0;
}
.shell-topbar--wide-only { display: none; }
@media (min-width: 1280px) { .shell-topbar--wide-only { display: flex; } }
/* 콘솔 · watch 는 좁은 폭에도 최상단을 그린다 — 한 줄에 들어가게 여백을 줄이고 시계는 숨긴다
   (예전 콘솔 머리줄에도 시계는 없었다) */
@media (max-width: 1279px) {
  .shell-topbar { padding: 6px 16px 0; }
  .shell-topbar .shell-clock { display: none; }
}
.shell-tabs { display: flex; align-items: flex-end; gap: 12px; }
.shell-tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  border: 0; border-radius: 14px 14px 0 0; background: transparent; color: var(--shell-gray-700);
  font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.shell-tab svg { flex-shrink: 0; }
a.shell-tab:hover, button.shell-tab:hover { background: var(--shell-gray-100); color: var(--shell-black); }
.shell-tab.is-current { z-index: 1; background: var(--shell-white); color: var(--shell-black); cursor: default; box-shadow: 0 -3px 6px -2px rgba(0, 0, 0, .05); }
.shell-tab.is-current::before, .shell-tab.is-current::after { content: ""; position: absolute; bottom: 0; width: 14px; height: 14px; }
.shell-tab.is-current::before { left: -14px; background: radial-gradient(circle at 0 0, transparent 14px, var(--shell-white) 14.5px); }
.shell-tab.is-current::after { right: -14px; background: radial-gradient(circle at 100% 0, transparent 14px, var(--shell-white) 14.5px); }
.shell-tab.is-disabled { opacity: .4; cursor: not-allowed; }
/* STG 만 — 기능 탭 뒤 배포 버전(상단 버전 표기 기획, 2026-11-08) */
.shell-versions {
  display: inline-flex; align-items: center; height: 32px; padding: 0 4px; white-space: nowrap;
  font-size: 12px; font-variant-numeric: tabular-nums; color: var(--shell-gray-600); cursor: default;
}
.product-icon-admin { color: var(--shell-black); }
.product-icon-data { color: var(--shell-yellow); }

.shell-common { display: flex; align-items: center; gap: 10px; height: 32px; white-space: nowrap; font-size: 13px; color: var(--shell-gray-800); }
.shell-common form { display: inline-flex; margin: 0; }
.shell-clock { font-variant-numeric: tabular-nums; color: var(--shell-black); }
.shell-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
  background: var(--shell-primary-100); color: var(--shell-primary-700); font-size: 12px; font-weight: 600;
}
button.shell-chip { border: 0; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
button.shell-chip:hover { background: var(--shell-primary-300); }
.shell-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--shell-gray-300);
  border-radius: 999px; background: var(--shell-white); color: var(--shell-gray-700); font: inherit; font-size: 12px;
  font-weight: 500; text-decoration: none; cursor: pointer;
}
.shell-btn:hover { background: var(--shell-gray-100); color: var(--shell-black); }
.shell-btn.is-low { border-color: transparent; background: var(--shell-yellow-100); color: var(--shell-yellow); }
.shell-btn.is-empty { border-color: transparent; background: var(--shell-red-100); color: var(--shell-red); }
.shell-user { border: 0; background: none; padding: 0; color: var(--shell-primary-700); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.shell-user:hover { text-decoration: underline; }
/* 크레딧 — Linky 크레딧 배지(credit-header-badge)와 같은 색 · 높이. 부족 · 없음은 위 is-low · is-empty */
.shell-credit { position: relative; }
.shell-credit-btn { height: 28px; border-color: var(--shell-primary-300); color: var(--shell-primary-700); }
.shell-popover {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 230px; padding: 12px 14px;
  border: 1px solid var(--shell-gray-300); border-radius: 10px; background: var(--shell-white);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12); white-space: normal;
}
.shell-popover dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.shell-popover dt { color: var(--shell-gray-600); }
.shell-popover dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--shell-gray-800); }
.shell-popover dd.is-empty { color: var(--shell-red); font-weight: 600; }
.shell-popover a { display: block; margin-top: 10px; text-align: right; font-size: 12px; color: var(--shell-primary-700); }
/* 좁은 폭(최상단을 숨기는 화면)에서 기능 상단이 대신 그리는 공통 항목 */
.shell-common--compact { height: auto; }
@media (min-width: 1280px) { .shell-common--compact { display: none; } }
@media (max-width: 899px) { .shell-common--compact .shell-clock { display: none; } }
@media (max-width: 639px) {
  .shell-common--compact .shell-clock, .shell-common--compact .shell-pick, .shell-common--compact .shell-user,
  .shell-common--compact .shell-chip, .shell-common--compact .shell-credit { display: none; }
}

/* ── 공통 창(병원 고르기 · 내 정보) — <dialog data-open-on-load>, shell.js 가 연다 ── */
.shell-dialog { width: 480px; max-width: calc(100vw - 32px); margin: auto; padding: 0; border: 0; border-radius: 16px; background: var(--shell-white); color: var(--shell-black); }
.shell-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.shell-dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); margin: 0; }
.shell-me-layout { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.shell-me-layout #shell-me-profile { gap: 14px; max-height: none; }
.shell-consent { border-top: 1px solid var(--shell-gray-200); padding-top: 16px; }
.shell-consent h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.shell-consent form { align-items: flex-start; gap: 12px; margin-top: 12px; }
.shell-consent .shell-banner { margin-top: 12px; }
.shell-consent-choice { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.shell-consent-choice input { width: 16px; height: 16px; accent-color: var(--shell-primary); }
.shell-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 24px 24px 0; }
.shell-dialog-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.shell-hint { margin: 4px 0 0; font-size: 12px; color: var(--shell-gray-700); }
.shell-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 999px; background: none; color: var(--shell-gray-600); cursor: pointer; }
.shell-icon-btn:hover { background: var(--shell-gray-100); }
.shell-dialog-body { display: flex; flex-direction: column; gap: 14px; min-height: 0; padding: 16px 24px; overflow-y: auto; }
.shell-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--shell-gray-200); }
.shell-button { min-width: 84px; height: 40px; padding: 0 16px; border: 1px solid var(--shell-gray-300); border-radius: 8px; background: var(--shell-white); color: var(--shell-gray-800); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.shell-button:hover { background: var(--shell-gray-100); }
a.shell-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.shell-button.is-primary { border-color: var(--shell-primary); background: var(--shell-primary); color: var(--shell-white); }
.shell-button.is-primary:hover { background: var(--shell-primary-700); }
.shell-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.shell-field small { font-size: 12px; font-weight: 400; color: var(--shell-gray-700); }
.shell-input { height: 40px; padding: 0 12px; border: 1px solid var(--shell-gray-300); border-radius: 8px; background: var(--shell-white); color: var(--shell-gray-800); font: inherit; font-size: 14px; }
.shell-input:focus { outline: none; border-color: var(--shell-primary); }
.shell-input[readonly] { color: var(--shell-gray-600); background: var(--shell-gray-100); }
.shell-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--shell-gray-300); border-radius: 8px; color: var(--shell-gray-600); }
.shell-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: inherit; font-size: 14px; color: var(--shell-gray-800); }
.shell-facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 12px; margin: 0; padding: 12px 16px; border-radius: 10px; background: var(--shell-gray-100); font-size: 13px; }
.shell-facts dt { color: var(--shell-gray-700); }
.shell-facts dd { margin: 0; color: var(--shell-gray-800); white-space: pre-line; }
.shell-facts dd.is-empty { color: var(--shell-gray-600); }
.shell-banner { margin: 0; padding: 10px 14px; border-radius: 10px; font-size: 13px; background: var(--shell-primary-100); color: var(--shell-primary-700); }
.shell-banner.is-danger { background: var(--shell-red-100); color: var(--shell-red); }
.shell-banner.is-warning { background: var(--shell-yellow-100); color: var(--shell-orange-700); }
/* 병원 고르기 목록 */
.shell-choices { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.shell-choice {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 14px;
  border: 1px solid var(--shell-gray-300); border-radius: 10px; background: var(--shell-white); color: var(--shell-black);
  font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.shell-choice:hover:not(:disabled), .shell-choice.is-current { border-color: var(--shell-primary); background: var(--shell-primary-100); }
.shell-choice:disabled { cursor: not-allowed; color: var(--shell-gray-600); background: var(--shell-gray-100); }
.shell-choice small { display: block; font-size: 12px; font-weight: 400; color: var(--shell-gray-600); }
.shell-choice .shell-current { font-size: 12px; font-weight: 500; color: var(--shell-primary-700); }
.shell-services { display: flex; gap: 4px; flex-shrink: 0; }
.shell-service { padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; background: var(--shell-primary-100); color: var(--shell-primary-700); }
.shell-choice:disabled .shell-service { background: var(--shell-gray-200); color: var(--shell-gray-600); }

/* ── 공통 footer — Linky footer(medikit compact)와 같은 모양 (shell/footer.html) ── */
.shell-footer { flex-shrink: 0; border-top: 1px solid var(--shell-gray-200); background: var(--shell-white); color: var(--shell-gray-800); font-size: 12px; }
.shell-footer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 8px 24px; }
.shell-footer-brand { display: block; height: 28px; width: auto; }  /* 회사 로고(sso/static/admin/medisolve-ai-logo.svg) */
.shell-footer-ctrls { display: flex; align-items: center; gap: 12px; }
.shell-drop { position: relative; }
.shell-drop-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--shell-gray-300); border-radius: 8px; background: var(--shell-white); color: var(--shell-gray-800); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.shell-drop-btn:hover { background: var(--shell-gray-100); }
.shell-drop-menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 60; min-width: 100%; max-height: 200px; overflow-y: auto; padding: 4px 0; border: 1px solid var(--shell-gray-300); border-radius: 8px; background: var(--shell-white); }
.shell-drop-menu a { display: block; padding: 7px 12px; color: var(--shell-gray-800); text-decoration: none; white-space: nowrap; }
.shell-drop-menu a:hover { background: var(--shell-gray-100); }
.shell-footer-toggle { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--shell-gray-700); cursor: pointer; }
.shell-footer-toggle:hover { background: var(--shell-gray-200); }
.shell-footer-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.shell-footer-company { padding: 0 24px 12px; line-height: 1.7; color: var(--shell-gray-700); }
.shell-footer-company b { color: var(--shell-gray-800); }

/* ── 공통 약관 화면 (/policy/…, admin/routers/policy.py) ── */
.shell-policy { min-height: 100vh; display: flex; flex-direction: column; background: var(--shell-white); color: var(--shell-black); }
.shell-policy-head { border-bottom: 1px solid var(--shell-gray-200); }
.shell-policy-head > div { max-width: 880px; margin: 0 auto; padding: 18px 24px 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.shell-policy-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.shell-policy-head span { color: var(--shell-gray-600); font-size: 13px; }
.shell-policy-tabs { max-width: 880px; margin: 0 auto; padding: 0 24px 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.shell-policy-tabs a { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--shell-gray-300); color: var(--shell-gray-700); text-decoration: none; font-size: 12px; }
.shell-policy-tabs a[aria-current="page"] { border-color: transparent; background: var(--shell-primary-100); color: var(--shell-primary-700); font-weight: 600; }
.shell-policy-body { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 20px 24px 48px; font-size: 14px; line-height: 1.8; color: var(--shell-gray-800); }
.shell-policy-body h2 { margin: 28px 0 10px; font-size: 18px; color: var(--shell-black); }
.shell-policy-body h3 { margin: 22px 0 8px; font-size: 15px; color: var(--shell-black); }
.shell-policy-body h4 { margin: 18px 0 6px; font-size: 14px; color: var(--shell-black); }
.shell-policy-body hr { margin: 28px 0; border: 0; border-top: 1px solid var(--shell-gray-200); }
.shell-policy-body table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; display: block; overflow-x: auto; }
.shell-policy-body th, .shell-policy-body td { border: 1px solid var(--shell-gray-300); padding: 6px 10px; text-align: left; vertical-align: top; }
.shell-policy-body th { background: var(--shell-gray-100); }

