/* 미아전기조명 공통 스타일 (Stitch 디자인 규칙의 색·모양 사용) */
:root {
  --primary: #d97706;
  --primary-hover: #b45309;
  --primary-soft: #fef3c7;
  --glow: 0 0 0 3px rgba(217, 119, 6, 0.18);
  --navy: #0f172a;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --placeholder: #94a3b8;
  --canvas: #f8fafc;
  --surface: #ffffff;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --input-line: #cbd5e1;
  --error: #b91c1c;
  --error-bg: #fef2f2;
  --error-line: #fecaca;
  --ok: #047857;
  --radius: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-1: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-3: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--primary-hover); }
h1, h2, h3 { margin: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 공통 요소 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  display: grid; place-items: center;
  font-size: 18px;
}
.brand-name { font-weight: 700; font-size: 17px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); line-height: 1.3; }

.label { display: block; font-size: 14px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.req { color: var(--error); font-weight: 700; }
.optional { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }

.input {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--input-line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 휴대폰에서 자동 확대 방지 */
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--placeholder); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--glow); }
textarea.input { resize: vertical; min-height: 90px; }
select.input { appearance: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:focus-visible { outline: none; box-shadow: var(--glow); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #1e293b; }
.btn-outline { background: var(--surface); border-color: var(--input-line); color: var(--text-2); }
.btn-outline:hover:not(:disabled) { background: var(--line-soft); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--line-soft); color: var(--text-2); }
.btn-danger { background: var(--surface); border-color: #fecaca; color: var(--error); }
.btn-danger:hover:not(:disabled) { background: var(--error-bg); border-color: var(--error); }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 17px; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: 14px; }

.error-banner {
  padding: 12px 14px;
  border: 1px solid var(--error-line);
  border-radius: var(--radius);
  background: var(--error-bg);
  color: var(--error);
  font-size: 14px; font-weight: 500;
  white-space: pre-line;
}

/* ---------- 손님 화면 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.site-header-inner {
  max-width: 640px; margin: 0 auto;
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.header-call {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 14px; font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.customer-main { max-width: 640px; margin: 0 auto; padding: 16px; }
.hero-card { border-radius: var(--radius-xl); padding: 24px 18px; }
.card-head { margin-bottom: 20px; }
.page-title { font-size: 24px; line-height: 1.35; font-weight: 700; letter-spacing: -0.01em; }
.page-desc { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.page-desc strong { color: var(--error); }

.fieldset { padding: 20px 0 4px; border-top: 1px solid var(--line-soft); }
.fieldset:first-of-type { border-top: 0; padding-top: 0; }
.fieldset-title { padding: 0; margin-bottom: 12px; font-size: 16px; font-weight: 700; color: var(--text); }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 0 12px; }

.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.choice {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 84px;
  padding: 10px 6px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-icon { font-size: 22px; line-height: 1; }
.choice-text { font-size: 13px; font-weight: 500; color: var(--text-2); line-height: 1.3; }
.choice:hover { background: var(--canvas); }
.choice:has(input:checked) { border-color: var(--primary); background: #fffbeb; }
.choice:has(input:checked) .choice-text { color: var(--primary-hover); font-weight: 700; }
.choice:has(input:focus-visible) { box-shadow: var(--glow); }

.input-suffix { position: relative; }
.input-suffix .input { padding-right: 36px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; }

.upload-box {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 20px 12px;
  border: 1.5px dashed var(--input-line);
  border-radius: var(--radius-lg);
  background: var(--canvas);
  text-align: center;
  cursor: pointer;
}
.upload-box:hover { border-color: var(--primary); background: #fffbeb; }
#file-input:focus-visible + .file-list, .upload-box:focus-within { box-shadow: var(--glow); }
.upload-icon { font-size: 26px; }
.upload-title { font-weight: 700; color: var(--primary-hover); }
.upload-hint { font-size: 12px; color: var(--muted); }

.file-list { list-style: none; margin: 10px 0 16px; padding: 0; display: grid; gap: 6px; }
.file-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
  font-size: 14px;
}
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-remove {
  flex: none;
  min-height: 32px; padding: 4px 10px;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--error);
  font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer;
}
.file-remove:hover { background: var(--error-bg); }

.consent-box {
  margin: 8px 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--canvas);
}
.consent-title { font-weight: 700; margin-bottom: 8px; }
.consent-list { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: var(--text-2); line-height: 1.7; }
.checkbox { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }

#form-error { margin-bottom: 12px; }

.success-card { text-align: center; padding: 40px 20px; }
.success-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 50%;
  background: #ecfdf5; color: var(--ok);
  display: grid; place-items: center;
  font-size: 32px; font-weight: 700;
}
.success-text { margin: 8px 0 20px; font-size: 16px; font-weight: 500; color: var(--text-2); }
.info-box {
  max-width: 360px; margin: 0 auto 24px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--canvas);
  border: 1px solid var(--line);
  font-size: 14px; color: var(--text-2);
}

.site-footer {
  max-width: 640px; margin: 8px auto 0;
  padding: 24px 16px 40px;
  text-align: center;
  font-size: 13px; color: var(--muted);
}
.footer-name { font-weight: 700; color: var(--text-2); }
.site-footer a { color: inherit; }

.hp-field { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

@media (min-width: 480px) {
  .hero-card { padding: 32px 28px; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .choice-text { font-size: 14px; }
}

/* ---------- 관리자 화면 ---------- */
.admin-body { font-size: 14px; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; padding: 28px 24px; border-radius: var(--radius-xl); }
.auth-form { margin-top: 24px; display: grid; gap: 12px; }
.auth-form .label { margin-bottom: -6px; }

.admin-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.admin-header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.admin-main { max-width: 1280px; margin: 0 auto; padding: 20px 24px 40px; display: grid; gap: 16px; }

.new-alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  border: 1px solid #fde68a;
  color: var(--primary-hover);
  font-weight: 700;
}

.controls-card { padding: 16px; display: grid; gap: 14px; }
.status-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.tab-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit; font-weight: 500;
  cursor: pointer;
}
.tab-btn:hover { background: var(--canvas); }
.tab-btn.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.tab-count {
  min-width: 22px; padding: 0 6px;
  border-radius: 999px;
  background: var(--line-soft); color: var(--text-2);
  font-size: 12px; font-weight: 700; text-align: center;
  font-variant-numeric: tabular-nums;
}
.tab-btn.active .tab-count { background: rgba(255, 255, 255, .2); color: #fff; }
.tab-btn[data-status="new"] .tab-count { background: var(--primary-soft); color: var(--primary-hover); }

.search-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.search-box { display: flex; gap: 8px; flex: 1 1 360px; max-width: 520px; }
.search-box .input { min-height: 44px; font-size: 15px; }

.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 12px 16px;
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px; font-weight: 700;
  text-align: left;
  white-space: nowrap;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.row-link { cursor: pointer; }
.row-link:hover, .row-link:focus { background: var(--canvas); outline: none; }
.row-link:focus-visible { box-shadow: inset 3px 0 0 var(--primary); }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; }
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-empty { padding: 40px 16px !important; text-align: center; color: var(--muted); }

.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.pagination { display: flex; gap: 4px; flex-wrap: wrap; }
.page-btn {
  min-width: 36px; min-height: 36px; padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit; cursor: pointer;
}
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.page-btn:disabled { opacity: .4; cursor: default; }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  white-space: nowrap;
}
.status-new { color: #334155; background: #f1f5f9; border-color: #cbd5e1; }
.status-contacted { color: #4338ca; background: #eef2ff; border-color: #c7d2fe; }
.status-quoted { color: #b45309; background: #fef3c7; border-color: #fde68a; }
.status-contracted { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.status-completed { color: #0f766e; background: #ccfbf1; border-color: #99f6e4; }
.status-on_hold { color: #be123c; background: #ffe4e6; border-color: #fecdd3; }

/* 상세 창 */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 32px 16px;
  background: rgba(15, 23, 42, .4);
  overflow-y: auto;
}
.modal-box {
  width: 100%; max-width: 760px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 40px; height: 40px;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--muted);
  font-size: 26px; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: var(--line-soft); }
.modal-body { padding: 20px 24px 24px; display: grid; gap: 16px; }

.detail-grid { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; }
.detail-item { min-width: 0; }
.detail-label { margin-bottom: 2px; font-size: 12px; font-weight: 700; color: var(--muted); }
.detail-value { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.detail-block { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.detail-text { white-space: pre-wrap; overflow-wrap: anywhere; }

.attach-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.attach-file {
  display: inline-flex; align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
  text-decoration: none; font-weight: 500;
}
.attach-file.is-image { padding: 0; overflow: hidden; }
.attach-thumb { display: block; width: 140px; height: 105px; object-fit: cover; }

.detail-editor {
  display: grid; gap: 4px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--canvas);
  border: 1px solid var(--line);
}
.detail-editor .field { margin-bottom: 10px; }
.detail-danger { display: grid; gap: 4px; padding-top: 8px; }
.save-msg { min-height: 20px; font-size: 14px; font-weight: 700; text-align: center; }
.save-msg.ok { color: var(--ok); }
.save-msg.fail { color: var(--error); }

@media (max-width: 640px) {
  .admin-header-inner, .admin-main { padding-left: 16px; padding-right: 16px; }
  .modal-backdrop { padding: 0; }
  .modal-box { border-radius: 0; min-height: 100%; }
  .modal-header, .modal-body { padding-left: 16px; padding-right: 16px; }
}
