/* POWERCUBE 채팅 — 기본 스타일.
   AS 기사 모바일(mobile/assets/mobile.css)에서 채팅 화면이 쓰는 m-* 컴포넌트만 옮겨 왔다.
   chat.css 가 이 위에 얹힌다 (변수 --top-h 와 .m-top 의 z-index 40 을 참조하므로 그 둘은 바꾸지 말 것).
   하단 탭바(.m-tabs)는 이 앱에 없다. */
:root {
  --pc-brand: #2f8f88;
  --pc-brand-dark: #1f6f8a;
  --pc-brand-soft: #e8f9d8;
  --pc-brand-soft-2: #d7ebff;
  --pc-brand-rgb: 47, 143, 136;
  --pc-red: var(--pc-brand);
  --pc-red-dark: var(--pc-brand-dark);
  --bg: #f3f6f7;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e2e8f0;
  --ok: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --tab-h: 0px; /* 탭바 없음 */
  --top-h: 52px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

/* 상단 헤더 */
.m-top {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: linear-gradient(135deg, #e8f9d8 0%, #d4f1e8 48%, #d7ebff 100%);
  color: #1f6b5a;
  border-bottom: 1px solid #c5e6d8;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.08);
}

.m-top__title {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.m-top__sub {
  font-size: 11px;
  color: #2563eb;
  opacity: 0.85;
}

.m-top__link {
  font-size: 12px;
  font-weight: 800;
  color: #1d4ed8;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.m-top__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* 본문 — 탭바가 없으므로 아래 여백은 안전영역만 */
.m-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 12px calc(env(safe-area-inset-bottom, 0px) + 20px);
}

/* 폼 상자 (방 만들기·설정) */
.m-search {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.m-search__row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.m-search__row > * {
  min-width: 0;
}

.m-search__row > select,
.m-search__row > input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  flex: 1 1 0;
  width: auto;
}

.m-search__row > .m-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.m-search__check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  width: auto;
  max-width: 100%;
}

.m-search__check input[type="checkbox"] {
  width: auto;
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  accent-color: var(--pc-brand);
}

.m-search input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.m-search select,
.m-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
}

.m-search textarea,
.m-field-area {
  width: 100%;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  resize: vertical;
}

.m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--pc-brand) 0%, var(--pc-brand-dark) 100%);
  color: #fff;
}

.m-btn--ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.m-btn--block {
  width: 100%;
}

.m-meta {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
}

.m-empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.m-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #e5e7eb;
  color: #374151;
}

.m-badge--ok {
  background: #d1fae5;
  color: var(--ok);
}

.m-badge--warn {
  background: #fef3c7;
  color: var(--warn);
}

.m-badge--bad {
  background: #fee2e2;
  color: var(--bad);
}

.m-form-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 4px;
  font-weight: 600;
}

.m-form-group {
  margin-bottom: 12px;
}

.m-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.m-actions .m-btn {
  flex: 1;
}

.m-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.m-chip {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.m-chip.is-on {
  border-color: var(--pc-brand);
  color: var(--pc-brand-dark);
  background: rgba(var(--pc-brand-rgb), 0.1);
}

/* 로그인 화면 */
.m-login {
  max-width: 420px;
  margin: 0 auto;
  padding: 48px 20px calc(env(safe-area-inset-bottom, 0px) + 32px);
}

.m-login__brand {
  margin-bottom: 28px;
  text-align: center;
}

.m-login__eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--pc-brand);
}

.m-login__title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.m-login__error {
  margin: 0 0 16px;
  padding: 11px 13px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fef2f2;
  color: var(--bad);
  font-size: 13px;
  font-weight: 600;
}

.m-login__form {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 2px 10px rgba(31, 41, 55, 0.05);
}

.m-login__form .m-btn {
  margin-top: 4px;
}

.m-login__help {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* 페이지 이동 로딩 인디케이터 — 오버레이 DOM 은 assets/base.js 가 만든다 */
.m-loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(243, 246, 247, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
}

.m-loading.is-active {
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.18s ease 0.15s;
}

.m-loading__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.m-loading__spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(var(--pc-brand-rgb), 0.18);
  border-top-color: var(--pc-brand);
  animation: m-loading-spin 0.8s linear infinite;
}

.m-loading__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

@keyframes m-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .m-loading__spinner {
    animation-duration: 1.6s;
  }
}

/* 표 (setup.php 환경 점검) */
.m-tablewrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 10px;
}

.m-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 13px;
}

.m-table th {
  position: sticky;
  top: 0;
  background: #eef4f8;
  color: #1f2937;
  font-weight: 700;
  white-space: nowrap;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.m-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

.m-table tbody tr:last-child td {
  border-bottom: 0;
}

.m-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}

.m-table td.m-table--left {
  text-align: left;
}

.m-table td.m-table--wrap {
  white-space: normal;
  word-break: break-all;
  min-width: 220px;
}

/* 웹푸시 — 헤더 「알림」 버튼과 안내 패널 (assets/push.js) */
.m-top__bell {
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.m-top__bell.is-on {
  color: #047857;
  background: rgba(209, 250, 229, 0.95);
}

.push-panel {
  margin: 0 0 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  box-shadow: 0 2px 10px rgba(31, 41, 55, 0.05);
}

.push-panel p {
  margin: 0 0 8px;
}

.push-panel__steps {
  margin: 0 0 8px;
  padding-left: 20px;
}

.push-panel__steps li {
  margin: 0 0 4px;
}

.push-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.push-panel__actions .m-btn {
  padding: 7px 12px;
  font-size: 12px;
}

.push-panel__err {
  color: var(--bad);
}
