/* =========================================================
   Samsung Reporting Tools — Demo design system
   Refined enterprise financial workspace
   ========================================================= */

:root {
  /* Surfaces */
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eef2f9;

  /* Ink */
  --ink: #11151f;
  --ink-2: #3c4453;
  --ink-3: #565e6e;
  --muted: #707a8c;
  --faint: #9aa3b2;

  /* Brand — Samsung deep blue */
  --brand: #1428a0;
  --brand-600: #1b35c4;
  --brand-500: #2e54e8;
  --brand-tint: #eaeefb;
  --brand-tint-2: #dde4fa;

  /* AI accent — indigo/violet */
  --ai: #6a3ff0;
  --ai-600: #5a2fe0;
  --ai-tint: #efeafe;
  --ai-tint-2: #e3daff;

  /* States */
  --success: #12925a;
  --success-tint: #e3f5ec;
  --warn: #b8730a;
  --warn-tint: #fdf1dd;
  --danger: #c2362f;
  --danger-tint: #fbe9e8;

  /* Lines */
  --line: #e3e8f0;
  --line-2: #d4dae6;
  --line-strong: #c0c8d8;

  /* Radius */
  --r-sm: 7px;
  --r: 11px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* Shadow */
  --sh-1: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.05);
  --sh-2: 0 4px 12px rgba(16,24,40,.07), 0 2px 4px rgba(16,24,40,.04);
  --sh-3: 0 12px 32px rgba(16,24,40,.12), 0 4px 8px rgba(16,24,40,.06);
  --sh-pop: 0 24px 64px rgba(16,24,40,.22), 0 8px 16px rgba(16,24,40,.1);

  --header-h: 60px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
/* Inline icon default — explicit rules (.thumb svg, .ai-orb svg, etc.) override this */
svg { width: 1em; height: 1em; flex: 0 0 auto; }
.ic { display: inline-flex; align-items: center; justify-content: center; }
.ic > svg { width: 1em; height: 1em; }
::selection { background: var(--brand-tint-2); }

/* =================== App shell =================== */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top bar */
.topbar {
  height: var(--header-h);
  flex: 0 0 auto;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 40;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -.02em;
  color: var(--ink);
  white-space: nowrap;
}
.brand-logo .mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-500) 100%);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: 0 2px 6px rgba(20,40,160,.35);
}
.brand-logo .sub {
  font-weight: 500; color: var(--faint); font-size: 12px;
  padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line-2);
}

/* Global step indicator in topbar */
.flowsteps {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 auto;
}
.flowsteps .fs {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--faint);
  font-weight: 600; font-size: 12.5px;
  white-space: nowrap;
  transition: all .25s;
}
.flowsteps .fs .idx {
  width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--faint);
  font-size: 11px; font-weight: 700;
  transition: all .25s;
}
.flowsteps .fs.done { color: var(--ink-2); }
.flowsteps .fs.done .idx { background: var(--success); color: #fff; }
.flowsteps .fs.active { color: var(--brand); background: var(--brand-tint); }
.flowsteps .fs.active .idx { background: var(--brand); color: #fff; }
.flowsteps .sep { width: 14px; height: 1.5px; background: var(--line-2); border-radius: 2px; }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-tint-2); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.userbox { display:flex; align-items:center; gap:9px; }
.userbox .nm { font-weight: 600; font-size: 13px; }
.userbox .em { color: var(--faint); font-size: 11.5px; }

/* =================== Viewport / scenes =================== */
.viewport {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
}
.scene {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  display: none;
}
.scene.active {
  display: block;
}
.scene.active .scene-inner {
  animation: sceneIn .32s ease;
}
@keyframes sceneIn {
  from { transform: translateY(10px); }
  to { transform: none; }
}
.scene-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 32px 60px;
}
.scene-inner.wide { max-width: 1360px; }

/* Page heading */
.page-h {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px; gap: 20px;
}
.page-h h1 {
  margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -.03em;
}
.page-h .desc { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; }
.page-h-actions { display: flex; align-items: center; gap: 10px; }

/* =================== Buttons =================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 600; font-size: 13.5px;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 16px; height: 16px; display:inline-flex; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; gap: 5px; }
.btn.lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(20,40,160,.25); }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.ai { background: var(--ai); border-color: var(--ai); color: #fff; box-shadow: 0 2px 8px rgba(106,63,240,.3); }
.btn.ai:hover { background: var(--ai-600); border-color: var(--ai-600); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--danger); border-color: var(--line-2); }
.btn.danger:hover { background: var(--danger-tint); border-color: #eecbc8; }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; box-shadow: 0 2px 6px rgba(18,146,90,.25); }
.btn.success:hover { filter: brightness(.96); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; justify-content: center; }

.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  transition: all .15s;
}
.icon-btn:hover { background: var(--surface-2); }

/* =================== Cards =================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}

/* Section label */
.sec-label {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 13px;
}
.sec-label h2 {
  margin: 0; font-size: 14px; font-weight: 700; color: var(--ink);
  letter-spacing: -.01em; display: flex; align-items: center; gap: 8px;
}
.sec-label .meta { font-size: 12.5px; color: var(--faint); }

/* =================== Chips / pills =================== */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  transition: all .15s; user-select: none; white-space: nowrap;
}
.chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.on:hover { background: var(--brand-600); }
.chip.ai { background: var(--ai-tint); border-color: var(--ai-tint-2); color: var(--ai-600); }
.chip.ai.on { background: var(--ai); border-color: var(--ai); color: #fff; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.chip .x { opacity: .6; font-size: 14px; line-height: 1; }
.chip .x:hover { opacity: 1; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 5px;
  font-size: 11.5px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap;
}
.tag.brand { background: var(--brand-tint); color: var(--brand); }
.tag.ai { background: var(--ai-tint); color: var(--ai-600); }
.tag.success { background: var(--success-tint); color: var(--success); }
.tag.warn { background: var(--warn-tint); color: var(--warn); }
.tag.muted { background: var(--surface-3); color: var(--muted); }

/* =================== AI orb =================== */
.ai-orb {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ai) 0%, #9a6bff 100%);
  color: #fff; flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(106,63,240,.35);
}
.ai-orb svg { width: 15px; height: 15px; }
.ai-orb.sm { width: 20px; height: 20px; }
.ai-orb.sm svg { width: 12px; height: 12px; }
.ai-orb.lg { width: 46px; height: 46px; }
.ai-orb.lg svg { width: 26px; height: 26px; }

/* spin */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse-soft { animation: pulseSoft 1.6s ease-in-out infinite; }
@keyframes pulseSoft { 0%,100%{opacity:.55} 50%{opacity:1} }

/* =================== Toast =================== */
.toast-wrap {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.toast {
  display: flex; align-items: center; gap: 11px;
  background: #16191f; color: #fff;
  padding: 12px 18px; border-radius: var(--r);
  box-shadow: var(--sh-3); font-size: 13.5px; font-weight: 600;
  animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2);
  max-width: 460px;
}
.toast .ic { width: 20px; height: 20px; flex:0 0 auto; }
.toast.success .ic { color: #4ade80; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }

/* =================== Modal =================== */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(13,18,30,.5);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 30px;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility 0s linear .25s;
}
.overlay.show { opacity: 1; visibility: visible; transition: opacity .25s; }
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-pop);
  width: 100%;
  max-height: calc(100vh - 60px);
  display: flex; flex-direction: column;
  transform: translateY(12px) scale(.985);
  transition: transform .28s cubic-bezier(.2,.9,.3,1.05);
  overflow: hidden;
}
.overlay.show .modal { transform: none; }
.modal.sm { max-width: 480px; }
.modal.md { max-width: 660px; }
.modal.lg { max-width: 880px; }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.modal-head .x {
  margin-left: auto; width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; border: none; background: transparent;
  color: var(--faint);
}
.modal-head .x:hover { background: var(--surface-3); color: var(--ink); }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* =================== Form =================== */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  margin-bottom: 7px; letter-spacing: -.01em;
}
.input, .textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 9px 12px;
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }

.token-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 7px 9px; background: var(--surface); min-height: 42px;
}
.token-input:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-tint); }
.token {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 5px 0 10px; border-radius: 6px;
  background: var(--brand-tint); color: var(--brand);
  font-size: 12.5px; font-weight: 600;
}
.token .x { width: 17px; height: 17px; border-radius: 4px; display: grid; place-items: center; opacity: .65; }
.token .x:hover { opacity: 1; background: rgba(20,40,160,.12); }
.token-input .ti-ghost { border: none; outline: none; flex: 1; min-width: 120px; font-size: 13px; background: transparent; padding: 4px 0; color: var(--ink); }

/* checkbox */
.check {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 500; color: var(--ink-2); user-select: none;
}
.check .box {
  width: 18px; height: 18px; border-radius: 5px; flex: 0 0 auto;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  display: grid; place-items: center; transition: all .15s; color: #fff;
}
.check .box svg { width: 12px; height: 12px; opacity: 0; transform: scale(.6); transition: all .15s; }
.check.on .box { background: var(--brand); border-color: var(--brand); }
.check.on .box svg { opacity: 1; transform: none; }

/* =================== Utilities =================== */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1 1 auto; }
.wrap { flex-wrap: wrap; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.ml-auto { margin-left: auto; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }
.fw7 { font-weight: 700; } .fw8 { font-weight: 800; }
.f12 { font-size: 12px; } .f13 { font-size: 13px; } .f15 { font-size: 15px; } .f17 { font-size: 17px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.hidden { display: none !important; }

/* Icon size overrides for specific containers */
.icon-btn svg, .modal-head .x svg, .pager .pg-btn svg { width: 18px; height: 18px; }
.done-check svg { width: 38px; height: 38px; }
.searchbox .ic svg { width: 17px; height: 17px; }
.token .x svg { width: 13px; height: 13px; }
.check .box svg { width: 12px; height: 12px; }
