/* jogi-validation — dark theme, gold-cyan accent.
   가독성 우선: 큰 글자, 넉넉한 행간, 고대비.
*/

:root {
  --bg-1: #0F1116;
  --bg-2: #14171F;
  --bg-3: #1A1D27;
  --line: #2A2E3A;
  --line-2: #3B4150;
  --ink: #E5E7EB;
  --ink-2: #C2C7D0;
  --muted: #8A92A0;
  --accent: #22D3EE;
  --accent-2: #0891B2;
  --gold: #F2C94C;
  --pos: #34D399;
  --neg: #F87171;
  --zero: #94A3B8;
  --me: #FACC15;
  --card-bg: rgba(255,255,255,0.03);
  --card-border: rgba(255,255,255,0.08);
  --field-bg: rgba(0,0,0,0.35);
  --field-border: rgba(255,255,255,0.18);
  --shadow: 0 10px 30px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(ellipse at 80% -10%, rgba(34,211,238,0.08) 0%, rgba(34,211,238,0) 55%),
    radial-gradient(ellipse at 20% 110%, rgba(242,201,76,0.05) 0%, rgba(242,201,76,0) 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg-1));
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ─── 헤더 ─── */
.hdr {
  background: rgba(20, 23, 31, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.hdr-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand h1 { margin: 0; font-size: 20px; letter-spacing: -0.01em; color: var(--accent); }
.brand-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.brand-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-install-mini {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: rgba(34,211,238,0.10);
  color: var(--accent);
  border: 1px solid rgba(34,211,238,0.35);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  text-decoration: none;
  transition: all 0.12s;
}
.btn-install-mini:hover {
  background: var(--accent);
  color: #0B1014;
  border-color: var(--accent);
}
.hdr-right { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.me strong { color: var(--me); font-weight: 700; }

/* ─── 메인 ─── */
.main {
  max-width: 1400px; margin: 0 auto;
  padding: 20px;
}

/* ─── 툴바 ─── */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar-hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

/* ─── 버튼 ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px; font-weight: 600;
  cursor: pointer; user-select: none;
  text-decoration: none;
  transition: all 0.12s;
}
.btn-primary {
  background: var(--accent);
  color: #0B1014;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-2); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--field-border);
}
.btn-ghost:hover { background: var(--card-bg); color: var(--ink); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 14px;
  cursor: pointer;
  margin-left: 2px;
  color: var(--ink-2);
}
.icon-btn:hover { background: var(--card-bg); border-color: var(--field-border); }

/* ─── 주차 필터 ─── */
.week-bar {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.week-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--field-border);
  background: var(--card-bg);
  color: var(--ink-2);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}
.week-chip:hover { border-color: var(--accent); color: var(--ink); }
.week-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0B1014;
}
.week-chip .chip-count {
  font-size: 11px; font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}
.week-chip.active .chip-count { color: #0B1014; opacity: 0.7; }
.week-chip .chip-now {
  font-size: 10px;
  margin-left: 2px;
  opacity: 0.8;
}
.week-chip.month-toggle {
  border-style: dashed;
  color: var(--muted);
  font-weight: 500;
}
.week-chip.month-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* ─── 보드 ─── */
.board-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 4px;
  box-shadow: var(--shadow);
}
.board-scroll { overflow-x: auto; }
.board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 900px;
}
.board-table th, .board-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
.board-table thead th {
  font-size: 12px; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line-2);
  background: rgba(0,0,0,0.15);
  position: sticky; top: 0;
}
.col-day, .col-buy, .col-score { text-align: right; }
.col-actions { width: 88px; text-align: right; }
.col-name { min-width: 220px; }
.col-day.total { color: var(--ink); border-left: 1px solid var(--line-2); padding-left: 16px; }

/* user row */
.user-row td {
  background: rgba(255,255,255,0.025);
  font-weight: 600;
  border-top: 1px solid var(--line-2);
}
.user-row.is-me td { background: rgba(250,204,21,0.06); }
.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: none;
  font: inherit; color: inherit;
  cursor: pointer;
  padding: 0;
}
.caret { color: var(--muted); font-size: 11px; width: 14px; }
.user-anon { font-size: 15px; font-weight: 700; color: var(--accent); }
.user-row.is-me .user-anon { color: var(--me); }
.me-badge {
  background: var(--me); color: #1F1500;
  font-size: 10px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
  margin-left: 4px;
}
.user-meta {
  margin-left: 10px;
  font-size: 12px; color: var(--muted); font-weight: 500;
}

/* position row */
.pos-row td { font-size: 13.5px; }
.pos-row.empty td { color: var(--muted); font-style: italic; }
.indent { color: var(--muted); margin-right: 6px; }
.market-tag {
  display: inline-block;
  font-size: 10px; font-weight: 800;
  padding: 1px 5px; border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
.market-KR { background: rgba(34,211,238,0.18); color: var(--accent); }
.market-US { background: rgba(242,201,76,0.18); color: var(--gold); }
.ticker { font-family: "JetBrains Mono", "Menlo", monospace; font-weight: 700; margin-right: 6px; }
.pos-name { color: var(--ink-2); }
.qty { color: var(--muted); font-size: 11px; margin-left: 4px; }

/* 점수 표시 */
.score-total { font-weight: 800; color: var(--ink); margin-right: 6px; }
.sig {
  display: inline-block;
  font-size: 10px; font-weight: 800;
  padding: 1px 5px; border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
.sig-go    { background: rgba(52,211,153,0.18); color: var(--pos); }
.sig-wait  { background: rgba(148,163,184,0.18); color: var(--zero); }
.sig-pass  { background: rgba(248,113,113,0.18); color: var(--neg); }
.score-detail { color: var(--muted); font-size: 11px; font-family: "JetBrains Mono", monospace; }
.avg-score { color: var(--accent); font-weight: 700; font-size: 13px; }
.cost-total { color: var(--ink-2); font-weight: 600; font-size: 12px; }

.muted { color: var(--muted); }
.pos { color: var(--pos); font-weight: 700; }
.neg { color: var(--neg); font-weight: 700; }
.zero { color: var(--zero); }

.loading { text-align: center; color: var(--muted); padding: 28px 0 !important; }
.footnote { font-size: 12px; color: var(--muted); margin-top: 14px; text-align: right; }

/* ─── 모달 ─── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
  overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  width: 100%; max-width: 640px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 26px; cursor: pointer; padding: 0; line-height: 1;
}
.modal-close:hover { color: var(--ink); }

.position-form {
  padding: 18px 20px 16px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }

@media (max-width: 600px) {
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field-optional { color: var(--muted); font-weight: 500; opacity: 0.75; margin-left: 2px; }
.currency-hint {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(34,211,238,0.15);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.field input, .field select, textarea {
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  color: var(--ink);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.1s;
}
.field input:focus, .field select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; width: 100%; }

.paste-block {
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.18);
}
.paste-block summary {
  cursor: pointer; font-size: 13px; color: var(--ink-2);
  margin-bottom: 6px;
}
.paste-block summary:hover { color: var(--accent); }
.paste-block textarea { margin: 8px 0; font-family: "JetBrains Mono", monospace; font-size: 12px; }

.form-error { color: var(--neg); font-size: 13px; margin: 0; min-height: 16px; }

.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ─── 로그인 ─── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
}
.login-main { width: 100%; padding: 20px; }
.login-card {
  max-width: 380px; margin: 0 auto;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-title { margin: 0 0 4px; font-size: 24px; color: var(--accent); }
.login-sub { margin: 0 0 22px; font-size: 13px; color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form input {
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.05em;
  text-align: center;
}
.login-form input:focus { outline: none; border-color: var(--accent); }
.login-error { color: var(--neg); font-size: 13px; margin: 0; min-height: 16px; text-align: center; }
.login-hint { margin: 18px 0 0; font-size: 12px; color: var(--muted); }
