/* 통합 로그인·어드민 공통 스타일. 라이트 테마, 둥근 카드, 모바일에서는 표가 카드로 쌓인다. 다른 야구백화점 사이트와 같은 색·글꼴을 쓴다. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --track: #eef0f4;
  --border: #e5e7eb;
  --border-strong: #cfd4dc;

  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;

  --green: #15803d;
  --green-soft: #e7f6ec;
  --red: #c62f3f;
  --red-soft: #fdeced;
  --amber: #a15c00;
  --amber-soft: #fff4dc;

  --radius-card: 16px;
  --radius-input: 10px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 1px rgba(16, 24, 40, 0.03);
  --shadow-pop: 0 14px 36px rgba(16, 24, 40, 0.16), 0 2px 6px rgba(16, 24, 40, 0.06);
  --maxw: 1180px;

  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5;
  min-height: 100vh; word-break: keep-all; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 8px; top: -48px; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }

/* ---------- 로그인·비밀번호 카드 ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow-card); padding: 28px 24px; display: flex; flex-direction: column; gap: 18px;
}
.auth-logo { width: 48px; height: 48px; border-radius: 12px; display: block; }
.auth-brand { color: var(--muted); font-size: 13px; font-weight: 600; }
.auth-card h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }

/* ---------- 폼 ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 600; color: var(--text-2); }
.field .help, .help { color: var(--muted); font-size: 12.5px; }
input[type="text"], input[type="password"], select, textarea {
  height: 44px; width: 100%; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-input); background: var(--surface);
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input:disabled, select:disabled { background: var(--track); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: var(--radius-input);
  border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; text-decoration: none; color: var(--text-2); white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-block { width: 100%; height: 46px; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-danger { color: var(--red); border-color: #f3c3c8; }
.btn-ghost { background: transparent; }

.msg { padding: 10px 12px; border-radius: var(--radius-input); font-size: 13.5px; border: 1px solid transparent; }
.msg.error { background: var(--red-soft); color: var(--red); border-color: #f6cdd1; }
.msg.ok { background: var(--green-soft); color: var(--green); border-color: #bfe3cb; }
.msg.info { background: var(--primary-soft); color: var(--primary); border-color: #d6dcff; }
.msg.warn { background: var(--amber-soft); color: var(--amber); border-color: #f3dfaa; }

/* ---------- 위쪽 바 ---------- */
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--border); }
.hdr-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; height: 58px; display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: block; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.brand-sub { font-size: 12.5px; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--border-strong); }
.hdr-end { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); }

.page { max-width: var(--maxw); margin: 0 auto; padding: 24px 20px 64px; display: flex; flex-direction: column; gap: 20px; }
.topbar h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.topbar .sub { color: var(--muted); margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.card-title { font-size: 16px; font-weight: 700; }
.card-foot { color: var(--muted); font-size: 12.5px; }
.actions { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- 탭 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 10px 16px; border: 0; background: none; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- 칩 ---------- */
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--track); color: var(--text-2); white-space: nowrap; }
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-primary { background: var(--primary-soft); color: var(--primary); }
.chip-gray { background: var(--track); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- 표 ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr.is-off td { color: var(--muted); }
.tbl .actions-cell { text-align: right; }

/* ---------- 포털: 내 사이트 ---------- */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.site-card {
  display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  text-decoration: none; color: var(--text);
}
.site-card:hover { border-color: var(--primary); box-shadow: var(--shadow-card); }
.site-card strong { font-size: 16px; }
.site-card .host { color: var(--muted); font-size: 12.5px; }

/* ---------- 모달 ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, 0.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60; }
.modal { width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-pop); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { font-size: 18px; }
.modal .actions { justify-content: flex-end; }
.code-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: var(--track); border-radius: var(--radius-input); }
.code-box code { font-size: 18px; letter-spacing: 0.04em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; }

.flash { position: sticky; top: 66px; z-index: 20; }

/* ---------- 좁은 화면: 표를 카드로 ---------- */
@media (max-width: 760px) {
  .hdr-inner { padding: 0 14px; }
  .brand-sub { display: none; }
  .page { padding: 16px 14px 56px; }
  .tbl-stack thead { display: none; }
  .tbl-stack, .tbl-stack tbody, .tbl-stack tr, .tbl-stack td { display: block; width: 100%; }
  .tbl-stack tr { border: 1px solid var(--border); border-radius: 12px; padding: 8px 4px; margin-bottom: 10px; }
  .tbl-stack td { border: 0; padding: 4px 10px; }
  .tbl-stack td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
  .tbl-stack .actions-cell { text-align: left; }
}

/* ---------- 어드민 ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.field-inline { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- 사이트 체크 목록 (이용자 만들기·사이트 설정) ---------- */
.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset legend { padding: 0; margin-bottom: 6px; font-weight: 600; color: var(--text-2); }
.site-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 8px; }
.site-check { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.site-check.is-on { border-color: var(--primary); background: var(--primary-soft); }
.site-check.is-off { opacity: 0.6; }
.site-check-main { display: flex; gap: 10px; align-items: center; min-width: 0; cursor: pointer; }
.site-check-main input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--primary); cursor: pointer; }
.site-check-main input:disabled { cursor: not-allowed; }
.site-check-main strong, .site-check-main .help { display: block; }
.site-check select { height: 38px; }
@media (max-width: 760px) {
  .site-check { grid-template-columns: 1fr; }
  .site-check select { width: 100%; }
}

/* ---------- 업무시스템 사용 설정·등록 ---------- */
.host-input { display: flex; align-items: center; gap: 6px; }
.host-input input { flex: 1; min-width: 0; }
.host-suffix { color: var(--muted); white-space: nowrap; }
.use-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.use-toggle input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.site-groups { display: flex; flex-direction: column; gap: 12px; }
.site-group-title { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-bottom: -4px; }
.site-hint { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--muted); }
