/* 정엘 디자인 — 정엘 CRM(pm.jeongellab.com)과 같은 모양: 남색 상단바, 밑줄 탭, 얇은 테두리 카드, Pretendard.
   토큰은 jeongel-crm/frontend/src/styles/tokens.css 를 그대로 옮겼다. 로그인 화면과 본 화면이 함께 쓴다. */
:root {
  /* Brand and surfaces */
  --navy: #12233f;
  --navy-strong: #0d1a30;
  --brand-accent: #8fb6f0;
  --accent: #2f6bd8;
  --accent-soft: #edf3fd;
  --accent-line: #88a8ea;
  --canvas: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #f9fbfd;

  /* Text and lines */
  --ink: #1f2430;
  --ink-soft: #4a5262;
  --ink-muted: #6b7280;
  --line: #e4e7ec;
  --line-strong: #c9ced6;

  /* Status: ink / background / hairline */
  --danger: #cc0000;
  --danger-bg: #fdecec;
  --danger-line: #f3c9c9;
  --warning-ink: #8a5c00;
  --warning-bg: #fff6e5;
  --warning-line: #f0d69b;
  --success: #1e7a38;
  --success-bg: #e8f6ec;
  --success-line: #bce4d4;
  --info-ink: #2a61c8;
  --info-bg: var(--accent-soft);
  --neutral-ink: #5f6672;
  --neutral-bg: #eeeeee;
  --violet-ink: #6d28d9;
  --violet-bg: #f1ecfb;
  --orange-ink: #c2410c;
  --orange-bg: #fff1e6;

  /* Type */
  --font: Pretendard, "Pretendard Variable", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  --text-xs: 11px;
  --text-action: 11.5px;
  --text-sm: 12px;
  --text-control: 12.5px;
  --text-base: 13px;
  --text-input: 13.5px;
  --text-body: 14px;
  --text-lg: 15px;
  --text-xl: 18px;
  --text-title: 20px;
  --text-metric-sm: 22px;
  --text-metric: 26px;

  /* Shape and rhythm */
  --radius-badge: 5px;
  --radius-control: 7px;
  --radius-inset: 8px;
  --radius-panel: 10px;
  --radius-card: 12px;
  --radius-modal: 14px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 14px;
  --space-5: 18px;
  --space-6: 24px;
  --shell-width: 1180px;
  --tap: 32px;

  /* app.js 의 인라인 스타일이 쓰는 원래 이름 — 같은 뜻의 정엘 토큰으로 잇는다. */
  --red: var(--danger);
  --ink-2: var(--ink-soft);

  color-scheme: light;
}

/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 100%; }
body {
  min-width: 320px;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: var(--text-xl); font-weight: 700; color: var(--navy); letter-spacing: -0.01em; }
h2 { font-size: var(--text-lg); font-weight: 700; color: var(--navy); }
h3 { font-size: var(--text-base); font-weight: 700; color: var(--navy); }
a { color: var(--accent); text-underline-offset: 3px; }
p { line-height: 1.6; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-control); }

input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  font-size: var(--text-input);
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
}
:where(input:not([type="checkbox"]):not([type="radio"]), select) { min-height: 40px; }
input[type="date"] { padding-block: 8px; }
input::placeholder, textarea::placeholder { color: var(--ink-muted); font-weight: 400; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
textarea { resize: vertical; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--navy); }
.header-inner {
  width: min(var(--shell-width), 100%);
  min-height: 54px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.brand { display: inline-flex; align-items: baseline; gap: 5px; color: #fff !important; text-decoration: none; white-space: nowrap; }
.brand strong { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.brand small { color: var(--brand-accent); font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.header-user {
  margin-left: auto;
  min-width: 0;
  color: rgb(255 255 255 / 0.75);
  font-size: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-user b { font-weight: 400; }
.header-logout {
  flex: 0 0 auto;
  margin-left: var(--space-2);
  min-height: 30px;
  padding: 5px 11px;
  color: #fff;
  background: rgb(255 255 255 / 0.15);
  border: 1.5px solid transparent;
  border-radius: var(--radius-control);
  font-size: var(--text-sm);
  font-weight: 700;
}
.header-logout:hover:not(:disabled) { background: rgb(255 255 255 / 0.25); }

/* Menu sits on its own white strip under the navy bar, like the CRM. */
.header-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-inline: max(var(--space-5), calc((100% - var(--shell-width)) / 2 + var(--space-5)));
  overflow-x: auto;
  scrollbar-width: none;
}
.header-tabs::-webkit-scrollbar { display: none; }
.header-tabs > button {
  flex: 0 0 auto;
  padding: 11px 13px;
  color: var(--ink-muted);
  background: none;
  border: 0;
  border-bottom: 2.5px solid transparent;
  border-radius: 0;
  font-size: var(--text-base);
  font-weight: 700;
  white-space: nowrap;
}
.header-tabs > button:hover { color: var(--ink-soft); }
.header-tabs > button.on { color: var(--navy); border-bottom-color: var(--accent); }

.app-shell {
  width: min(var(--shell-width), 100%);
  min-height: calc(100vh - 104px);
  margin: 0 auto;
  padding: var(--space-5) var(--space-5) 48px;
}

/* ---------- sign-in ---------- */
.auth-page { display: grid; place-items: center; min-height: calc(100vh - 160px); padding: 4vh 0; }
.auth-card { width: min(360px, 100%); padding: var(--space-6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.auth-heading h1 { font-size: var(--text-xl); }
.auth-heading > p:last-child { margin-top: 4px; color: var(--ink-muted); font-size: var(--text-sm); }
.login-form { display: grid; gap: 10px; margin-top: var(--space-5); }
.login-form label { display: grid; gap: 5px; font-size: var(--text-sm); font-weight: 700; color: var(--ink-soft); }
.login-form input { min-height: 40px; }
.login-code { display: grid; gap: 5px; }
.login-code > label { display: block; }
.code-field { position: relative; }
.login-form .code-field input { padding-right: 44px; }
.code-masked { -webkit-text-security: disc; }
.code-masked:placeholder-shown { -webkit-text-security: none; }
.code-masked:not(:placeholder-shown) { letter-spacing: 0.25em; }
.code-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 36px;
  min-height: var(--tap);
  padding: 0;
  color: var(--ink-muted);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--radius-control);
}
.code-toggle:hover:not(:disabled) { color: var(--ink); background: var(--surface-muted); }
.code-toggle[aria-pressed="true"] { color: var(--accent); }
.login-form input:not([type="checkbox"]):disabled { color: var(--ink-muted); background: var(--surface-muted); cursor: not-allowed; }
.login-form .login-remember { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: var(--text-base); font-weight: 400; cursor: pointer; }
.login-form .login-remember input { min-height: 0; }
.login-remember-hint { margin: -6px 0 2px 24px; color: var(--ink-muted); font-size: var(--text-sm); text-wrap: pretty; }
.auth-submit {
  width: 100%;
  min-height: 40px;
  margin-top: 2px;
  color: #fff;
  background: var(--navy);
  border: 1.5px solid transparent;
  border-radius: var(--radius-control);
  font-size: 12.5px;
  font-weight: 700;
}
.auth-submit:hover:not(:disabled) { background: var(--navy-strong); }
.auth-card p[role="alert"] { padding: 8px 12px; color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-line); border-radius: var(--radius-control); font-size: var(--text-sm); font-weight: 700; }
.auth-help { margin-top: var(--space-3); color: var(--ink-muted); font-size: var(--text-sm); }

@media (max-width: 760px) {
  .header-inner { padding: 10px var(--space-3); gap: 10px; }
  .header-tabs { padding-inline: var(--space-3); }
  .header-tabs > button { padding: 10px; }
  .header-tabs::after { content: ""; position: sticky; right: calc(-1 * var(--space-3)); flex: 0 0 32px; background: linear-gradient(to right, rgb(255 255 255 / 0), var(--surface)); pointer-events: none; }
  .header-user { font-size: var(--text-xs); }
  .app-shell { padding: var(--space-4) var(--space-3) 40px; }
  input, select, textarea { font-size: 16px; }
  :where(input:not([type="checkbox"]):not([type="radio"]), select) { min-height: 44px; }
}
@media (max-width: 420px) {
  .header-user .who-note { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
