/* Prina Cloud dashboard — common component classes on top of tokens.css (v4).
   디자인 정답지: docs/design/cloud-v4.dc.html — 반복 인라인 패턴을 클래스로 정규화한 것.
   수치는 디자인 실측 그대로 — 임의 변경 금지.
   파일 구성: §1 base · §2 animations · §3 v4 components · §4 app shell · §5 utilities.
   (구 §4 legacy compat — 구 토큰 별칭·구 클래스 — 는 2단계에서 제거됨.) */

/* ═══ §1 Base (design helmet 그대로) ═══════════════════════ */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--tx); }
body { font-family: "Geist", system-ui, -apple-system, sans-serif; font-size: 14px; letter-spacing: -0.006em; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--bd-2); }
a:hover { text-decoration-color: currentColor; }
input, button, select { font-family: inherit; letter-spacing: inherit; }
input { border-radius: 6px; }
input:focus-visible, button:focus-visible { outline: 1px solid currentColor; outline-offset: 1px; }
::placeholder { color: var(--tx-3); }

/* ═══ §2 Animations ════════════════════════════════════════ */
@keyframes shift { to { background-position: 22px 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ═══ §3 v4 components ═════════════════════════════════════ */
/* Buttons — 디자인 실측 높이 매핑 (cloud-v4.dc.html):
     30px  카드 푸터 보조 버튼(Backups·Settings), 탑바 상태 칩 버튼        → .btn-sm
     31px  프로젝트 카드 하단(Open Prina admin····)                        → .btn-grid
     32px  카드 헤더 액션(Restore backup·Open Prina admin), 메뉴 트리거   → .btn-md
     34px  페이지 기본 버튼(New project), 사이드바 검색                    → .btn (기본)
     36px  체크리스트 행 (전용 마크업 — 버튼 클래스 아님)
     38px  로그인 카드 버튼·입력, 랜딩 헤더 버튼                           → .btn-lg
     42px  플랜 카드 CTA, 랜딩 목업 입력                                   → .btn-xl
     48px  랜딩 히어로 CTA (랜딩 밴드는 1회성 — 모듈 인라인 유지)          */
.btn { height: 34px; padding: 0 12px; border: 1px solid var(--bd); border-radius: 6px; background: var(--panel); color: var(--tx); font-size: 13.5px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--hover); border-color: var(--bd-2); text-decoration: none; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn-md { height: 32px; padding: 0 11px; font-size: 13px; }
.btn-lg { height: 38px; padding: 0 14px; font-size: 14px; }
.btn-xl { height: 42px; padding: 0 18px; font-size: 14px; font-weight: 600; }
.btn-grid { height: 31px; padding: 0 11px; font-size: 12.5px; flex: 1; }
.btn-acc, .btn-primary { background: var(--acc); border-color: var(--acc); color: var(--acc-on); }
.btn-acc:hover, .btn-primary:hover { background: var(--acc-hover); border-color: var(--acc-hover); color: var(--acc-on); }
.btn-adm { background: var(--adm); border-color: var(--adm-bd); color: #ffffff; }
.btn-adm:hover { background: var(--adm-hover); border-color: var(--adm-bd); color: #ffffff; }
.btn-dgr, .btn-danger { color: var(--dgr); border-color: color-mix(in srgb, var(--dgr) 40%, transparent); background: var(--panel); }
.btn-dgr:hover, .btn-danger:hover { background: var(--dgr-bg); border-color: var(--dgr); color: var(--dgr); }
.btn-ghost { height: auto; padding: 0; border: none; background: none; color: var(--tx-2); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.btn-ghost:hover { color: var(--tx); }
.btn-block { width: 100%; }
.btn[disabled], .btn.busy, .btn-ghost[disabled], .btn-ghost.busy { opacity: 0.5; cursor: default; pointer-events: none; }

/* Cards — 1px bd · r10 · panel (design shell 카드 그대로) */
.card { border: 1px solid var(--bd); border-radius: 10px; background: var(--panel); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--bd); flex-wrap: wrap; }
.card-head h2 { flex: 1; }
.card-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--bd); background: var(--panel-2); border-radius: 0 0 10px 10px; flex-wrap: wrap; }

/* Inputs */
.input, .select { height: 36px; width: 100%; padding: 0 11px; border: 1px solid var(--bd); border-radius: 6px; background: var(--panel); color: var(--tx); font-size: 14px; outline: none; }
.input:focus, .select:focus { border-color: var(--bd-2); }
.input.bad { border-color: var(--dgr); }
.input[readonly] { background: var(--panel-2); color: var(--tx-2); }
.fld-label { display: block; font-size: 13px; color: var(--tx-2); margin-bottom: 6px; }
.addr-box { display: flex; border: 1px solid var(--bd); border-radius: 6px; background: var(--panel); overflow: hidden; }
.addr-box input { flex: 1; height: 36px; min-width: 0; padding: 0 11px; border: none; background: transparent; color: var(--tx); font-family: var(--mono); font-size: 13.5px; outline: none; border-radius: 0; }
.addr-suffix { display: flex; align-items: center; padding: 0 11px; border-left: 1px solid var(--bd); background: var(--panel-2); font-family: var(--mono); font-size: 13px; color: var(--tx-3); white-space: nowrap; }

/* Segment control (Region · Starter content) */
.seg2 { display: flex; border: 1px solid var(--bd); border-radius: 6px; overflow: hidden; width: fit-content; }
.seg2-it { padding: 8px 13px; font-size: 13.5px; color: var(--tx-2); background: transparent; border: none; cursor: pointer; font-family: inherit; letter-spacing: inherit; }
.seg2-it + .seg2-it { border-left: 1px solid var(--bd); }
.seg2-it.on { background: var(--acc); color: var(--acc-on); }
.seg2-it.off { color: var(--tx-3); cursor: not-allowed; }

/* Status dot (7px) · mono chip */
.dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; flex: none; display: inline-block; }
.chip-mono { font-family: var(--mono); font-size: 11.5px; color: var(--tx-2); background: var(--panel-2); border: 1px solid var(--bd); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }

/* Dropdown menu */
.menu { position: absolute; width: 230px; border: 1px solid var(--bd); border-radius: 10px; background: var(--panel); padding: 5px; z-index: 40; }
.menu-label { font-size: 11.5px; color: var(--tx-3); padding: 7px 9px 5px; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; height: 32px; padding: 0 9px; border: none; background: transparent; color: var(--tx); font-size: 13.5px; cursor: pointer; border-radius: 6px; text-align: left; font-family: inherit; letter-spacing: inherit; }
.menu-item:hover { background: var(--hover); color: var(--tx); }
.menu-sep { height: 1px; background: var(--bd); margin: 5px 0; }

/* Modal (440px) — .overlay는 구명칭 별칭 (layout.js modal()이 사용) */
.modal-backdrop, .overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; padding: 26px; animation: fadeIn 0.15s ease both; z-index: 100; }
.modal { width: 440px; max-width: 100%; max-height: calc(100vh - 48px); overflow: auto; background: var(--panel); border: 1px solid var(--bd); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 14px; animation: rise 0.16s ease both; }
.modal h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.modal p { margin: 0; font-size: 13.5px; color: var(--tx-2); line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; }

/* Banner — 기본은 warn 톤, 변형 ok/warn/dgr */
.banner { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--bd); border-radius: 10px; font-size: 13.5px; background: var(--warn-bg); color: var(--warn); }
.banner svg { flex: none; }
.banner-ok { background: var(--ok-bg); color: var(--ok); }
.banner-warn { background: var(--warn-bg); color: var(--warn); }
.banner-dgr { background: var(--dgr-bg); color: var(--dgr); }

/* Table row grid — 컬럼은 사용처에서 grid-template-columns 인라인 지정 */
.trow { display: grid; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--bd); font-size: 13.5px; }
.trow:last-child { border-bottom: none; }

/* Progress — striped creating bar (design shift animation) · plain usage meter */
.stripe { height: 4px; background: var(--panel-2); overflow: hidden; border-radius: 99px; }
.stripe > i { display: block; height: 100%; background: repeating-linear-gradient(115deg, var(--tx-2) 0 5px, var(--tx-3) 5px 11px); background-size: 22px 4px; animation: shift 0.9s linear infinite; transition: width 0.4s ease; }
.meter { height: 4px; background: var(--panel-2); overflow: hidden; border-radius: 99px; }
.meter > i { display: block; height: 100%; background: var(--tx-2); border-radius: 99px; transition: width 0.4s ease; }
.meter.warn > i { background: var(--warn); }

/* Spinner */
.spinner { width: 14px; height: 14px; border: 1.6px solid var(--bd-2); border-top-color: var(--tx-2); border-radius: 99px; animation: spin 0.7s linear infinite; flex: none; }

/* ═══ §4 App shell (design 296–395행) ══════════════════════ */
.shell { min-height: 100vh; display: flex; background: var(--bg); }
.side { width: 250px; flex: none; border-right: 1px solid var(--bd); background: var(--side); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-head { display: flex; align-items: center; gap: 9px; height: 52px; padding: 0 14px; flex: none; }
.org-btn { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 8px; border: none; background: transparent; color: var(--tx); font-size: 14px; font-weight: 500; cursor: pointer; border-radius: 6px; font-family: inherit; letter-spacing: inherit; }
.org-btn:hover { background: var(--hover); }
.org-plan { font-size: 11.5px; font-weight: 400; color: var(--tx-2); border: 1px solid var(--bd); border-radius: 999px; padding: 1px 7px; background: var(--panel); flex: none; }
.side-search { padding: 6px 12px 10px; flex: none; }
.side-search-box { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--bd); border-radius: 7px; background: var(--panel); }
.side-search-box input { flex: 1; height: 100%; border: none; background: transparent; color: var(--tx); font-size: 13.5px; outline: none; padding: 0; min-width: 0; }
.kbd { font-family: var(--mono); font-size: 11px; color: var(--tx-3); border: 1px solid var(--bd); border-radius: 5px; padding: 1px 5px; }
.side-nav { flex: 1; overflow: auto; padding: 0 8px 10px; }
.nav-it { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: none; background: transparent; color: var(--tx-2); font-size: 13.5px; font-weight: 400; cursor: pointer; border-radius: 7px; text-align: left; margin-bottom: 1px; text-decoration: none; font-family: inherit; letter-spacing: inherit; }
.nav-it:hover { background: var(--hover); text-decoration: none; }
.nav-it.on { background: var(--hover); color: var(--tx); font-weight: 500; }
.side-foot { flex: none; border-top: 1px solid var(--bd); padding: 8px 10px; display: flex; align-items: center; gap: 9px; }
.avatar { width: 24px; height: 24px; border-radius: 99px; border: 1px solid var(--bd); background: var(--panel); color: var(--tx-2); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; flex: none; }
.foot-ic { width: 26px; height: 26px; border: none; background: transparent; color: var(--tx-3); cursor: pointer; border-radius: 6px; display: flex; align-items: center; justify-content: center; padding: 0; font-family: inherit; }
.foot-ic:hover { background: var(--hover); color: var(--tx-2); }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tbar { display: flex; align-items: center; gap: 4px; height: 52px; padding: 0 22px; border-bottom: 1px solid var(--bd); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.tbar-title { font-size: 14px; font-weight: 500; }
.tbar-btn { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 9px; border: none; background: transparent; color: var(--tx-2); font-size: 13px; cursor: pointer; border-radius: 6px; font-family: inherit; letter-spacing: inherit; }
.tbar-btn:hover { background: var(--hover); }
.proj-btn { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 9px; border: none; background: transparent; color: var(--tx); font-size: 14px; font-weight: 500; cursor: pointer; border-radius: 6px; font-family: inherit; letter-spacing: inherit; }
.proj-btn:hover { background: var(--hover); }
.content { flex: 1; padding: 22px; display: flex; flex-direction: column; gap: 16px; align-content: start; }
.pg-h1 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.025em; }
.pg-sub { font-size: 13px; color: var(--tx-3); margin-top: 3px; }

/* ═══ §5 Utilities ═════════════════════════════════════════ */
.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.err { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--dgr) 35%, transparent); border-radius: 6px; background: var(--dgr-bg); color: var(--dgr); font-size: 13px; line-height: 1.5; }
.err svg { flex: none; margin-top: 2px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); padding: 9px 14px; border-radius: 6px; background: var(--acc); color: var(--acc-on); font-size: 13px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.18); animation: rise 0.18s ease both; z-index: 120; }
.loading { padding: 80px 24px; text-align: center; color: var(--tx-3); font-size: 14px; }
.code-boxes { display: flex; gap: 7px; }
.code-boxes input { width: 52px; height: 52px; text-align: center; font-family: var(--mono); font-size: 20px; border: 1px solid var(--bd); background: var(--panel); color: var(--tx); outline: none; padding: 0; }
.code-boxes input:focus { border-color: var(--tx); }
