/* =============================================================================
 * KDoorLock 데모앱 — styles
 * 톤·컬러: frontend-demo(jacks-concept) 팔레트 정합 (navy/blue/red).
 * 작성: 제품클라. SPEC §2 비주얼(폰 프레임=실 앱 목업처럼 / 데스크탑 와이드).
 * ========================================================================== */
:root {
  --navy: #071e42;
  --navy-2: #0c2d5b;
  --blue: #174b97;
  --blue-soft: #edf4ff;
  --red: #e52231;
  --ink: #0d2445;
  --text: #43536d;
  --muted: #74839b;
  --line: #e4eaf2;
  --soft: #f4f7fb;
  --white: #fff;
  --ok: #1a8f5b;
  --warn: #b9791a;
  --shadow: 0 18px 48px rgba(7, 30, 66, .14);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eef3fa 0%, #e3ebf6 100%);
  min-height: 100vh;
}

/* ---------- 런처 상단 ---------- */
.launcher {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  flex-wrap: wrap;
  padding: 16px 28px;
  background: var(--navy);
  color: #fff;
}
.launcher__brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-weight: 800; font-size: 20px; letter-spacing: .3px; color: #fff; }
.badge-demo {
  font-size: 11px; font-weight: 700; letter-spacing: .4px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--red); color: #fff;
}
.launcher__apps { display: flex; gap: 6px; background: rgba(255,255,255,.08); padding: 5px; border-radius: 12px; }
.app-tab {
  border: 0; cursor: pointer; font-size: 13px; font-weight: 600;
  color: #cdd8ea; background: transparent; padding: 8px 14px; border-radius: 8px;
  transition: .15s;
}
.app-tab:hover { color: #fff; }
.app-tab.is-active { color: var(--navy); background: #fff; }
.launcher__lang { display: flex; align-items: center; gap: 10px; }
.lang-label { font-size: 12px; color: #aebbd2; }
.lang-toggle { display: flex; background: rgba(255,255,255,.1); border-radius: 8px; padding: 4px; }
.lang-toggle button {
  border: 0; cursor: pointer; font-size: 12px; font-weight: 700;
  color: #cdd8ea; background: transparent; padding: 5px 11px; border-radius: 6px;
}
.lang-toggle button.is-active { color: var(--navy); background: #fff; }

.launcher__note {
  margin: 0; text-align: center; font-size: 12px; color: var(--muted);
  padding: 8px 16px; background: #fafcff; border-bottom: 1px solid var(--line);
}
.launcher__foot { text-align: center; font-size: 12px; color: var(--muted); padding: 20px; display: flex; gap: 16px; align-items: center; justify-content: center; }
.back-home { color: var(--blue); text-decoration: none; font-weight: 700; }
.back-home:hover { text-decoration: underline; }

/* ---------- 디바이스 스테이지 ---------- */
.stage { display: flex; justify-content: center; padding: 32px 16px 8px; }
.device { display: none; }
.device.is-active { display: block; }

/* ---------- 폰 프레임 ---------- */
.phone {
  position: relative;
  width: 390px; height: 800px;
  background: #fff;
  border-radius: 44px;
  border: 12px solid #0a1730;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.phone__notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 150px; height: 26px; background: #0a1730;
  border-bottom-left-radius: 16px; border-bottom-right-radius: 16px; z-index: 5;
}
.phone__statusbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 26px 4px; font-size: 12px; font-weight: 600; color: var(--navy);
}
.phone__statusbar-right { letter-spacing: 2px; font-size: 10px; }
.phone__app { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--soft); }
.phone__placeholder, .desktop__placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; color: var(--navy);
}
.desktop__placeholder {
  width: min(1100px, 92vw); height: 620px; background: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.phone__placeholder h3, .desktop__placeholder h3 { margin: 6px 0 0; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- Customer App 내부 ---------- */
.capp { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.capp__head {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  color: #fff; padding: 16px 18px 18px;
}
.capp__head .eyebrow { font-size: 11px; opacity: .75; letter-spacing: .5px; text-transform: uppercase; }
.capp__head h2 { margin: 4px 0 2px; font-size: 19px; }
.capp__head p { margin: 0; font-size: 12.5px; opacity: .85; }
.capp__body { flex: 1; overflow-y: auto; padding: 16px; }
.capp__body::-webkit-scrollbar { width: 0; }

/* 스텝 진행 표시 */
.steps { display: flex; gap: 6px; margin: 12px 0 4px; }
.steps span { flex: 1; height: 4px; border-radius: 999px; background: rgba(255,255,255,.25); }
.steps span.done { background: #fff; }
.steps span.active { background: var(--red); }

/* 카드 */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: 0 6px 18px rgba(7,30,66,.05);
}
.card h3 { margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.card .desc { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.field-label { font-size: 12px; font-weight: 600; color: var(--navy); margin-bottom: 5px; display: block; }
.field-value {
  font-size: 14px; color: var(--ink); background: var(--soft);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
}
.row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.row:last-child { border-bottom: 0; }
.row .k { font-size: 12.5px; color: var(--muted); }
.row .v { font-size: 13px; font-weight: 600; color: var(--ink); text-align: right; }

/* 버튼 */
.btn {
  width: 100%; border: 0; cursor: pointer; font-size: 14px; font-weight: 700;
  padding: 13px; border-radius: 12px; transition: .15s; font-family: inherit;
}
.btn.primary { color: #fff; background: var(--red); box-shadow: 0 10px 22px rgba(229,34,49,.24); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.dark { color: #fff; background: var(--navy); }
.btn.ghost { color: var(--navy); background: #fff; border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn + .btn { margin-top: 9px; }

/* 사진 그리드 */
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.photo-slot {
  aspect-ratio: 4/3; border-radius: 12px; border: 1.5px dashed #c6d2e4;
  background: var(--soft); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer; font-size: 12px; color: var(--muted); transition: .15s;
}
.photo-slot:hover { border-color: var(--blue); color: var(--blue); }
.photo-slot.filled { border-style: solid; border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.photo-slot .ic { font-size: 20px; }

/* 태그 / 칩 / 상태 */
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .3px; padding: 3px 8px; border-radius: 6px; }
.tag.verified { color: var(--ok); background: #e7f6ee; }
.tag.partner  { color: var(--blue); background: var(--blue-soft); }
.tag.review   { color: var(--warn); background: #fbf2e1; }
.chip { display:inline-block; font-size: 11px; font-weight: 600; color: var(--blue); background: var(--blue-soft); border-radius: 999px; padding: 4px 10px; margin: 0 5px 5px 0; }
.pending-label { border-bottom: 1px dotted #c0a062; } /* V1.1 대기 라벨 표시 */

.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 6px 11px; border-radius: 999px; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.s-assigned { color: var(--blue); background: var(--blue-soft); }
.status-pill.s-progress { color: var(--warn); background: #fbf2e1; }
.status-pill.s-completed, .status-pill.s-resolved { color: var(--ok); background: #e7f6ee; }
.status-pill.s-requested, .status-pill.s-received, .status-pill.s-fit { color: var(--muted); background: #eef2f8; }

/* 가드 문구 박스 */
.guard {
  font-size: 11.5px; line-height: 1.5; color: var(--navy);
  background: #fff7e9; border: 1px solid #f0dcb4; border-radius: 10px;
  padding: 10px 12px; margin-top: 10px;
}
.guard::before { content: "⚠ "; }

/* Fit Check 결과 박스 */
.fit-result { text-align: center; padding: 10px 0 4px; }
.fit-result .big { font-size: 17px; font-weight: 800; color: var(--ink); margin: 6px 0; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%; margin: 14px auto;
  border: 3px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 연결 배지 (같은 ID가 3앱에 뜬다는 설득 포인트) */
.linked {
  font-size: 10.5px; color: var(--blue); background: var(--blue-soft);
  border-radius: 6px; padding: 3px 7px; font-weight: 600;
}

/* 하단 탭 바 */
.capp__tabs {
  display: flex; border-top: 1px solid var(--line); background: #fff;
}
.capp__tabs button {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  padding: 10px 4px 12px; font-size: 10.5px; font-weight: 600; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-family: inherit;
}
.capp__tabs button .ic { font-size: 17px; }
.capp__tabs button.is-active { color: var(--blue); }

.toast {
  position: absolute; left: 50%; bottom: 86px; transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .25s; z-index: 9;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Technician App ---------- */
.capp__head--tech { background: linear-gradient(135deg, #0a2e23 0%, #156c4a 100%); }
.tech-tabs { display: flex; gap: 6px; margin-top: 12px; }
.tech-tabs button {
  flex: 1; border: 0; cursor: pointer; font-size: 12.5px; font-weight: 700; font-family: inherit;
  color: #cfe9dd; background: rgba(255,255,255,.12); padding: 8px; border-radius: 8px;
}
.tech-tabs button.on { color: #0a2e23; background: #fff; }
.job-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.job-head h3 { margin: 0; }
.tech-nav button.is-active { color: var(--ok); }

/* ---------- Partner Dashboard (데스크탑 와이드) ---------- */
.device--desktop { width: 100%; }
.device--desktop.is-active { display: flex; justify-content: center; }
.dash {
  width: min(1180px, 95vw); background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; max-height: 82vh; display: flex; flex-direction: column;
}
.dash-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 26px; background: var(--navy); color: #fff;
}
.dash-head .eyebrow { font-size: 11px; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }
.dash-head h2 { margin: 4px 0 2px; font-size: 21px; }
.dash-head .muted { color: #aebbd2; }
.dash-disc { font-size: 11px; color: #ffd9dd; background: rgba(229,34,49,.22); border: 1px solid rgba(229,34,49,.4); padding: 7px 12px; border-radius: 8px; max-width: 280px; text-align: right; }

.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; padding: 18px 26px 4px; }
.kpi { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.kpi-n { font-size: 26px; font-weight: 800; color: var(--navy); }
.kpi-l { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.3; }

.dash-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 14px 26px 0; border-bottom: 1px solid var(--line); }
.dash-tabs button {
  border: 0; cursor: pointer; font-size: 12.5px; font-weight: 600; font-family: inherit;
  color: var(--muted); background: transparent; padding: 9px 14px; border-radius: 8px 8px 0 0;
}
.dash-tabs button:hover { color: var(--navy); }
.dash-tabs button.on { color: #fff; background: var(--navy); }

.dash-panel { padding: 18px 26px 26px; overflow-y: auto; }
.dash-panel h3 { margin: 0 0 12px; font-size: 15px; color: var(--ink); }

.dtable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dtable th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .3px;
  color: var(--muted); font-weight: 700; padding: 8px 12px; border-bottom: 2px solid var(--line);
}
.dtable td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: middle; }
.dtable tbody tr:hover { background: #fafcff; }
.dtable tr.is-linked { background: var(--blue-soft); }
.dtable tr.is-linked:hover { background: #e3eeff; }
.dtable tr.is-linked td:first-child b { color: var(--blue); }

.metric-row { display: flex; gap: 22px; margin-bottom: 14px; font-size: 13px; color: var(--text); }
.metric-row b { color: var(--navy); }

/* 표 모바일 가로 스크롤 래퍼 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap .dtable { min-width: 560px; }   /* 좁은 화면에서만 스크롤(데스크탑은 100% 유지) */

/* ---------- SEA Service Network (정적 지도 패널) ---------- */
.netmap { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); }
.netmap img { display: block; width: 100%; height: auto; max-height: 460px; object-fit: cover; }
.netmap-badge {
  position: absolute; left: 12px; bottom: 12px; font-size: 11px; font-weight: 700;
  color: #fff; background: rgba(7,30,66,.82); padding: 6px 11px; border-radius: 999px;
}
.net-sub { margin: 16px 0 8px; font-size: 13px; color: var(--ink); }
.city-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.city-stat { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.city-stat b { display: block; color: var(--navy); font-size: 13px; }
.city-stat span { font-size: 11px; color: var(--muted); }

/* 기사앱 Customer Location 정적 지도 썸네일 */
.loc-thumb { position: relative; height: 96px; border-radius: 10px; overflow: hidden; margin: 4px 0 4px; border: 1px solid var(--line); }
.loc-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; filter: saturate(.9); }
.loc-pin {
  position: absolute; left: 10px; bottom: 8px; font-size: 11px; font-weight: 700;
  color: #fff; background: rgba(7,30,66,.78); padding: 4px 9px; border-radius: 999px;
}
.osm-credit {
  position: absolute; right: 6px; bottom: 5px; font-size: 9px; line-height: 1;
  color: #2a3a52; background: rgba(255,255,255,.78); padding: 2px 5px; border-radius: 4px;
}

/* =====================================================================
 * 반응형 (데스크탑 시연 경험은 회귀 없이 유지 — 모바일 분기만 추가)
 * ===================================================================== */
@media (max-width: 980px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}

/* 모바일: 폰 프레임 풀어 풀스크린, 대시보드 풀폭 */
@media (max-width: 600px) {
  body { background: #fff; }
  .launcher { padding: 10px 14px; gap: 10px; }
  .launcher__apps { order: 4; width: 100%; justify-content: center; }
  .launcher__note { font-size: 11px; }
  .stage { padding: 0; }

  /* 폰: 프레임 제거 → 화면 꽉 채움 */
  .device--phone .phone {
    width: 100vw; height: auto; min-height: calc(100vh - 150px);
    border: 0; border-radius: 0; box-shadow: none;
  }
  .phone__notch, .phone__statusbar { display: none; }

  /* 대시보드: 풀폭·세로 스택 */
  .device--desktop.is-active { display: block; }
  .device--desktop .dash { width: 100vw; max-height: none; border-radius: 0; box-shadow: none; }
  .dash-head { flex-direction: column; gap: 10px; }
  .dash-disc { max-width: none; text-align: left; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); padding: 14px 16px 0; }
  .dash-tabs { padding: 12px 16px 0; }
  .dash-panel { padding: 16px; }
  .city-stats { grid-template-columns: repeat(2, 1fr); }
}
