/* PEGR 가치평가 모니터 */
:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --header: #e9f0f7;
  --line: #d8e1ec;
  --line-soft: #e8edf3;
  --text: #1e293b;
  --muted: #64748b;
  --blue: #2563eb;
  --amber: #b45309;
  --green: #15803d;
  --orange: #c2410c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.header-left h1 { color: #0f172a; font-size: 1.18rem; font-weight: 760; line-height: 1.25; }
.header-left p { margin-top: 4px; color: var(--muted); font-size: 0.78rem; }
.header-right { display: flex; align-items: center; gap: 8px; }
.status-msg { color: var(--muted); font-size: 0.72rem; }

.save-btn {
  padding: 8px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: #eff6ff;
  color: var(--blue);
  cursor: pointer;
  font: 700 0.78rem/1 inherit;
  white-space: nowrap;
}
.save-btn:hover { background: #dbeafe; border-color: #93c5fd; }
.save-btn.saved { border-color: #86efac; background: #f0fdf4; color: var(--green); }
.save-btn.unsaved { border-color: #fed7aa; background: #fff7ed; color: var(--orange); }

main { padding-top: 16px; }
.definition-bar {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 12px 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: #475569;
  font-size: 0.76rem;
}
.definition-bar strong { color: #1d4ed8; font-size: 0.8rem; }

.section { padding: 18px 10px 0; }
.section + .section { padding-top: 28px; }
.market-heading {
  margin: 0 0 9px 2px;
  color: #0f172a;
  font-size: 0.94rem;
  font-weight: 760;
  line-height: 1.2;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  -webkit-overflow-scrolling: touch;
}
.table-wrap::-webkit-scrollbar { height: 10px; }
.table-wrap::-webkit-scrollbar-thumb { border-radius: 8px; background: #cbd5e1; }
.table-wrap::-webkit-scrollbar-track { background: #f1f5f9; }

table {
  width: 100%;
  min-width: 938px;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--panel);
  font-size: 0.82rem;
  line-height: 1.25;
}
.col-name { width: 130px; }
.col-marketcap { width: 104px; }
.col-per { width: 84px; }
.col-growth { width: 140px; }
.col-pegr { width: 80px; }
.col-price { width: 100px; }
.col-eps { width: 100px; }
.col-earnings { width: 104px; }
.col-shares { width: 96px; }

thead tr { border-bottom: 1px solid var(--line); }
th {
  padding: 10px 9px;
  background: var(--header);
  color: #475569;
  font-size: 0.72rem;
  font-weight: 720;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--line-soft); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--panel-soft); }
td {
  overflow: hidden;
  padding: 9px 10px;
  color: #334155;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  text-align: right;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}
td:first-child { overflow: visible; text-align: left; white-space: normal; }
tbody td:nth-child(3),
tbody td:nth-child(6) { border-left: 1px solid var(--line-soft); }
tbody td:nth-child(5),
tbody td:nth-child(9) { border-right: 1px solid var(--line-soft); }

.name { color: #0f172a; font-size: 0.84rem; font-weight: 720; line-height: 1.2; }
.ticker { margin-top: 2px; color: var(--muted); font-size: 0.72rem; line-height: 1.15; }
.metric-cell { color: #475569; font-weight: 520; }
.marketcap-cell { color: #334155; font-weight: 650; }
.per-cell { color: #334155; font-weight: 650; }
.eps-cell { color: #475569; }
.earnings-cell { color: #475569; }
.earnings-period { margin-top: 2px; color: var(--muted); font-size: 0.66rem; line-height: 1.1; }
.shares-cell { overflow: visible; }

.eps-cagr-editor { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.eps-cagr-input {
  -moz-appearance: textfield;
  width: 62px;
  height: 27px;
  padding: 0 6px;
  border: 1px solid #f0c36d;
  border-radius: 6px;
  outline: none;
  background: #fffbeb;
  color: #0f172a;
  font-family: inherit;
  font-size: inherit;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.eps-cagr-input:focus { border-color: #f59e0b; background: #fff7d6; outline: 2px solid #fef3c7; }
.eps-cagr-input:disabled { border-color: #cbd5e1; background: #f1f5f9; color: #94a3b8; }
.eps-cagr-input::-webkit-inner-spin-button,
.eps-cagr-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.unit { color: var(--muted); font-size: 0.76rem; line-height: 26px; }
.eps-cagr-reset {
  width: 25px;
  height: 27px;
  padding: 0;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--blue);
  cursor: pointer;
  font: 700 0.86rem/1 sans-serif;
}
.eps-cagr-reset:hover:not(:disabled) { border-color: #60a5fa; background: #dbeafe; }
.eps-cagr-reset:disabled { opacity: 0.28; cursor: default; }

.pegr-val { font-size: 0.86rem; font-weight: 740; }
.pegr-val.growth-low { color: var(--blue); }
.pegr-val.growth-high { color: var(--amber); }
.pegr-val.neutral { color: var(--muted); }

.note { padding: 12px 20px 24px; color: #475569; font-size: 0.72rem; line-height: 1.5; }
.note strong { color: var(--blue); }

@media (max-width: 720px) {
  header { padding: 15px 14px 12px; }
  main { padding-top: 12px; }
  .definition-bar { margin: 0 8px 2px; }
  .section { padding: 14px 6px 0; }
  .note { padding: 10px 12px 20px; }
}
