/* SRT-style light design tokens for KIS dashboard
   - Light theme only (SRT 자동예매 앱 스타일)
   - KRX colors: red = up, blue = down (P&L semantics untouched)
*/
:root {
  /* Background layers */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-elevated: #f2f3f7;   /* repurposed: subtle gray fill (chips, avatars, table heads) */
  --surface-pressed: #e8e9ee;
  --border: #e5e6eb;
  --border-strong: #d4d6dd;

  /* Text */
  --fg: #191f28;
  --fg-secondary: #4e5561;
  --fg-tertiary: #6b7280;
  --fg-disabled: #a9adb8;

  /* KRX semantic */
  --up: #d22730;          /* gain - KRX red */
  --up-soft: #e04352;
  --up-bg: rgba(210, 39, 48, 0.08);
  --down: #2563eb;        /* loss - KRX blue */
  --down-soft: #4c7ef2;
  --down-bg: rgba(37, 99, 235, 0.08);

  /* SRT purple accent (used sparingly for non-PL UI) */
  --accent: #6f2b8f;
  --accent-soft: #8a4dab;
  --accent-bg: rgba(111, 43, 143, 0.10);

  /* Neutral / utility */
  --purple: #6f2b8f;      /* internal transfer, FX */
  --amber: #b45309;       /* cost basis / warnings */

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(25, 31, 40, 0.06), 0 4px 14px rgba(25, 31, 40, 0.05);
  --shadow-float: 0 8px 24px rgba(25, 31, 40, 0.14);

  /* Type */
  --font: -apple-system, "Pretendard", "Apple SD Gothic Neo", "Spoqa Han Sans Neo",
          "Noto Sans KR", "Roboto", system-ui, sans-serif;
  --font-num: "SF Pro Display", -apple-system, "Pretendard", "Roboto", system-ui, sans-serif;

  /* Sizing */
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Animations */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }

.kis-screen {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  overflow-y: auto;
  overflow-x: hidden;
  letter-spacing: -0.01em;
  font-feature-settings: "tnum" 1;
}

.kis-screen::-webkit-scrollbar { display: none; }
.kis-screen { scrollbar-width: none; }

/* Type scale tuned for dense Korean financial UI */
.t-md   { font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -0.015em; }
.t-base { font-size: 15px; font-weight: 500; line-height: 1.4; }
.t-sm   { font-size: 13px; font-weight: 500; line-height: 1.4; }
.t-xs   { font-size: 11px; font-weight: 600; line-height: 1.3; letter-spacing: 0.02em; text-transform: uppercase; }

.num { font-family: var(--font-num); font-feature-settings: "tnum" 1; }
.up   { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--fg-secondary); }
.dim   { color: var(--fg-tertiary); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

/* Elevated card stays a WHITE bordered card — --surface-elevated is now the
   subtle gray fill token (chips/avatars/table heads), not a card background. */
.card-elev {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.spacer-8  { height: 8px; }
.spacer-16 { height: 16px; }

/* Toss-style top app bar (no shadow, big title) */
.kis-appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 8px;
}

.kis-appbar .left,
.kis-appbar .right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--fg);
  border: none;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-elevated); }

/* Bottom tab bar (Toss-style) */
.kis-tabbar {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px 4px;
}

.kis-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  color: var(--fg-tertiary);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: none;
}
.kis-tab.active { color: var(--accent); }
.kis-tab svg { width: 22px; height: 22px; }

/* Pill / chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-elevated);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-secondary);
}

.chip-up   { background: var(--up-bg);   color: var(--up); }
.chip-down { background: var(--down-bg); color: var(--down); }

/* Toss-style row item (account, holding) */
.row-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  cursor: pointer;
}
.row-item + .row-item { border-top: 1px solid var(--border); }
.row-item:hover { opacity: 0.85; }

.row-item .avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--surface-elevated);
  color: var(--fg);
  font-weight: 700;
  font-size: 13px;
}

.row-item .body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row-item .right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

/* Buttons */
/* White bordered pill — --surface-elevated is invisible against --bg, so
   ghost buttons that sit on the page background need a real edge. */
.btn-ghost {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px;
}
.section-head .title {
  font-size: 17px;
  font-weight: 700;
}
.section-head .more {
  color: var(--fg-tertiary);
  font-size: 13px;
}

/* Padded list container */
.list {
  padding: 0 20px;
}

/* No-tap-highlight */
button, .row-item, .kis-tab { -webkit-tap-highlight-color: transparent; }

/* Flow card category icon */
.flow-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 800;
}
.flow-icon.dep { background: var(--up-bg); color: var(--up); }
.flow-icon.wd  { background: var(--down-bg); color: var(--down); }
.flow-icon.int { background: var(--accent-bg); color: var(--purple); }
.flow-icon.fx  { background: var(--accent-bg); color: var(--purple); }
/* Buys/sells render as neutral "internal move" (purple, no +/- sign) in
   FlowRow, so their icons must be purple too — an amber/red icon next to a
   purple amount read as contradictory. */
.flow-icon.buy { background: var(--accent-bg); color: var(--purple); }
.flow-icon.sell{ background: var(--accent-bg); color: var(--purple); }
.flow-icon.div { background: var(--up-bg); color: var(--up); }
