@font-face {
  font-family: "Gmarket Sans";
  src: url("assets/font.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #08110d;
  --sidebar: #0b1712;
  --panel: #102019;
  --panel-2: #13271f;
  --panel-3: #172e25;
  --line: #284037;
  --line-soft: #1d342b;
  --text: #f5f8f6;
  --muted: #96a79f;
  --muted-2: #6f8178;
  --lime: #cfef67;
  --green: #3ccf91;
  --green-deep: #1d9368;
  --red: #ff6f6f;
  --cyan: #61d8db;
  --amber: #ffbd59;
  --blue: #74a6ff;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 86px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", sans-serif; font-size: 14px; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 226px; display: flex; flex-direction: column; padding: 24px 14px 18px; border-right: 1px solid #21372e; background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; border-bottom: 1px solid var(--line-soft); }
.brand-mark { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: var(--lime); }
.brand-mark img { width: 34px; height: 29px; object-fit: contain; }
.brand > span:last-child { display: flex; flex-direction: column; gap: 4px; }
.brand strong { font: 700 15px/1 "Gmarket Sans", sans-serif; }
.brand small { color: #7d9086; font: 700 8px/1 "Gmarket Sans", sans-serif; letter-spacing: 1.1px; }
nav { display: grid; gap: 4px; padding-top: 24px; }
nav a { height: 43px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 1px solid transparent; border-radius: 7px; color: #84968d; text-decoration: none; font-size: 12px; font-weight: 700; transition: .18s ease; }
nav a b { width: 23px; color: #53665d; font: 700 9px "Gmarket Sans", sans-serif; }
nav a:hover { color: #dce5e0; background: #11221b; }
nav a.active { border-color: rgba(207,239,103,.22); background: rgba(207,239,103,.1); color: var(--lime); }
nav a.active b { color: var(--lime); }
.sidebar-foot { display: grid; grid-template-columns: 9px 1fr; align-items: center; gap: 9px; margin-top: auto; padding: 15px 11px; border: 1px solid var(--line-soft); border-radius: 8px; background: #0e1d17; }
.sidebar-foot > div { display: flex; flex-direction: column; gap: 3px; }
.sidebar-foot strong { font-size: 10px; }
.sidebar-foot small { color: var(--muted-2); font-size: 9px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(255,189,89,.08); }

main { min-width: 0; margin-left: 226px; }
.topbar { position: sticky; top: 0; z-index: 30; min-height: 76px; display: flex; align-items: center; gap: 20px; padding: 14px 30px; border-bottom: 1px solid rgba(49,78,66,.78); background: rgba(8,17,13,.91); backdrop-filter: blur(18px); }
.topbar h1 { margin: 0; font: 700 22px/1.25 "Gmarket Sans", sans-serif; letter-spacing: -.2px; }
.topbar p { margin: 5px 0 0; color: var(--muted-2); font-size: 10px; }
.top-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.demo-badge { display: inline-flex; align-items: center; justify-content: center; height: 25px; padding: 0 9px; border: 1px solid rgba(255,189,89,.32); border-radius: 99px; background: rgba(255,189,89,.08); color: var(--amber); font: 700 9px "Gmarket Sans", sans-serif; letter-spacing: .7px; }
.ghost-button, .primary-button { height: 38px; padding: 0 13px; border-radius: 7px; font-size: 11px; font-weight: 800; }
.ghost-button { border: 1px solid var(--line); background: #112019; color: #bac7c1; }
.ghost-button:hover { border-color: #416255; background: #182a23; }
.primary-button { border: 1px solid var(--lime); background: var(--lime); color: #122017; }
.primary-button:hover { background: #dafa72; }
.mobile-menu { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }

.dashboard { width: min(1450px, 100%); margin: 0 auto; padding: 28px 30px 70px; }
.section-block { margin-bottom: 52px; }
.section-title { min-height: 60px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.section-title > div:first-child > span, .summary-drawer > span { color: var(--lime); font: 700 9px "Gmarket Sans", sans-serif; letter-spacing: 1.1px; }
.section-title h2 { margin: 7px 0 0; font: 700 20px/1.25 "Gmarket Sans", sans-serif; }
.section-title p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.fresh { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.fresh i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(60,207,145,.09); }
.filters { display: flex; gap: 8px; }
select { height: 36px; padding: 0 34px 0 11px; border: 1px solid var(--line); border-radius: 7px; background: #102019; font-size: 10px; }

.period-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.period-card { min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-align: left; transition: border-color .18s, background .18s, transform .18s; }
.period-card:hover { transform: translateY(-2px); border-color: #416457; }
.period-card.selected { border-color: var(--lime); background: linear-gradient(145deg, #15291f 0%, #102019 70%); box-shadow: 0 0 0 2px rgba(207,239,103,.08); }
.period-head { display: flex; align-items: center; gap: 7px; color: #d8e1dd; font-size: 12px; font-weight: 800; }
.period-head small { color: var(--muted); font-size: 10px; }
.period-head em { margin-left: auto; padding: 4px 7px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 8px; font-style: normal; }
.period-card.selected .period-head em { border-color: rgba(207,239,103,.3); color: var(--lime); }
.period-card > strong { font: 700 25px/1.1 "Gmarket Sans", sans-serif; letter-spacing: -.8px; }
.compare { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.compare small { color: var(--muted-2); font-size: 9px; }
.compare b { color: #cbd5d0; font-size: 10px; }
.compare i, .comparison-card i { min-width: 49px; padding: 4px 6px; border-radius: 99px; background: rgba(60,207,145,.12); color: var(--green); text-align: center; font-size: 9px; font-style: normal; font-weight: 900; }
.compare i.down, .comparison-card i.down { background: rgba(255,111,111,.11); color: var(--red); }
.insight { padding: 8px 9px; border-radius: 6px; background: rgba(60,207,145,.09); color: #8dbda7; font-size: 9px; }
.insight b { color: var(--green); }

.panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.sales-breakdown { margin-top: 12px; padding: 16px; }
.segmented { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line-soft); border-radius: 8px; background: #0b1712; }
.segmented button { height: 34px; padding: 0 13px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 800; }
.segmented button.active { background: var(--lime); color: #132017; }
.segmented.compact button { height: 30px; padding-inline: 10px; font-size: 9px; }
.panel-meta { display: flex; align-items: center; gap: 12px; margin: 15px 0 17px; padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 6px; color: var(--muted); font-size: 9px; }
.panel-meta b { margin-left: auto; color: #ccd6d1; }
.sales-columns { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(260px,.7fr); gap: 14px; }
.mini-kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--line-soft); }
.mini-kpis span { display: flex; flex-direction: column; gap: 5px; padding: 12px; background: #12241c; }
.mini-kpis small, .summary-grid small { color: var(--muted-2); font-size: 9px; }
.mini-kpis strong { font: 700 16px "Gmarket Sans", sans-serif; }
h3 { margin: 18px 0 12px; font: 700 13px "Gmarket Sans", sans-serif; }
.ranking-bars, .marketing-bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 70px minmax(90px,1fr) 70px 55px; align-items: center; gap: 9px; font-size: 9px; }
.bar-row > span:first-child { color: #c9d3ce; font-weight: 800; }
.bar-track { height: 8px; overflow: hidden; border-radius: 99px; background: #20372e; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-deep), var(--lime)); }
.bar-row strong { text-align: right; font-size: 10px; }
.bar-row em { color: var(--green); text-align: right; font-style: normal; font-weight: 800; }
.bar-row em.down { color: var(--red); }
.comparison-card { padding: 0 15px 14px; border: 1px solid var(--line-soft); border-radius: 9px; background: #0d1a15; }
.comparison-card div { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: 9px; }
.comparison-card div span { color: var(--muted); }
.comparison-card div strong { font-size: 10px; }
.comparison-card p { margin: 13px 0 0; color: #81938a; font-size: 9px; line-height: 1.65; }

.summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.summary-grid > div { min-height: 95px; display: flex; flex-direction: column; gap: 7px; padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.summary-grid strong { font: 700 19px "Gmarket Sans", sans-serif; }
.summary-grid span { color: var(--muted); font-size: 9px; }
.positive { color: var(--green) !important; }
.chart-panel { padding: 14px; }
.chart-legend { display: flex; justify-content: flex-end; gap: 18px; min-height: 25px; color: var(--muted); font-size: 9px; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 18px; height: 2px; display: block; }
.line-lime { background: var(--lime); }
.line-gray { background: #819087; }
.line-dash { border-top: 2px dashed var(--amber); }
.svg-chart { min-height: 260px; }
.svg-chart.tall { min-height: 320px; padding: 10px 14px 4px; }
.svg-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.grid-line { stroke: #20372e; stroke-width: 1; }
.axis-label { fill: #71847a; font-size: 9px; font-family: sans-serif; }
.target-line { stroke: var(--amber); stroke-width: 1; stroke-dasharray: 5 6; opacity: .8; }
.branch-toggles { display: flex; flex-wrap: wrap; gap: 7px; padding: 14px 14px 0; }
.branch-toggles button { height: 29px; padding: 0 10px; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 800; }
.branch-toggles button.active { border-color: currentColor; background: rgba(255,255,255,.05); color: var(--lime); }

.table-panel { padding-top: 8px; }
.table-note { min-height: 39px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; color: var(--muted-2); font-size: 9px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th { height: 39px; padding: 0 13px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line); background: #13261e; color: #8fa198; text-align: right; font-size: 9px; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
td { height: 47px; padding: 0 13px; border-bottom: 1px solid var(--line-soft); color: #d4ddd9; text-align: right; font-size: 10px; white-space: nowrap; }
tbody tr:hover { background: rgba(207,239,103,.025); }
td[data-cell] { cursor: pointer; }
td.selected { background: rgba(207,239,103,.12); color: var(--lime); font-weight: 900; }
td.total { color: var(--green); font-weight: 900; }
.warning { margin: 0; padding: 12px 14px; background: rgba(255,189,89,.04); color: #907e58; font-size: 9px; }

.employee-layout { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 0; }
.employee-layout > div:first-child { padding: 0 16px 16px; border-right: 1px solid var(--line); }
.employee-rank { display: grid; gap: 8px; }
.rank-row { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; min-height: 45px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 7px; background: #0d1b15; }
.rank-row b { color: var(--lime); font: 700 14px "Gmarket Sans", sans-serif; }
.rank-row span { display: flex; flex-direction: column; gap: 3px; }
.rank-row span strong { font-size: 10px; }
.rank-row span small { color: var(--muted-2); font-size: 8px; }
.rank-row > strong { font-size: 10px; }
.employee-table { min-width: 680px; }
.employee-table th, .employee-table td { text-align: right; }
.employee-table th:nth-child(2), .employee-table th:nth-child(3), .employee-table td:nth-child(2), .employee-table td:nth-child(3) { text-align: left; }

.funnel-panel { display: grid; grid-template-columns: minmax(470px,1fr) minmax(340px,.8fr); gap: 22px; padding: 18px; }
.funnel { display: grid; grid-template-columns: repeat(6,minmax(70px,1fr)); align-items: end; gap: 7px; min-height: 230px; padding: 18px 0 0; }
.funnel-step { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; }
.funnel-step strong { font: 700 15px "Gmarket Sans", sans-serif; }
.funnel-step span { color: var(--muted); font-size: 8px; text-align: center; }
.funnel-step i { width: 100%; min-height: 28px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, rgba(207,239,103,.75), rgba(29,147,104,.45)); }
.marketing-bars { margin-top: 18px; }

.summary-drawer { position: fixed; z-index: 60; top: 76px; right: 18px; width: min(390px,calc(100vw - 36px)); padding: 22px; border: 1px solid #3e5b50; border-radius: 12px; background: #14271f; box-shadow: 0 24px 70px rgba(0,0,0,.45); }
.summary-drawer button { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: #20372e; color: var(--muted); }
.summary-drawer h2 { margin: 9px 28px 12px 0; font: 700 17px/1.45 "Gmarket Sans", sans-serif; }
.summary-drawer ul { display: grid; gap: 8px; margin: 0; padding-left: 18px; color: #a9b8b1; font-size: 10px; line-height: 1.55; }

.chat-launcher { position: fixed; z-index: 55; right: 22px; bottom: 22px; height: 46px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border: 1px solid #d9f57a; border-radius: 10px; background: #cfef67; color: #14211b; box-shadow: 0 14px 38px rgba(0,0,0,.35); font: 700 11px "Gmarket Sans", sans-serif; }
.chat-launcher:hover { background: #dcfa77; color: #0c1812; }
.chat-launcher span { color: #1d6f50; }
.chat-panel { position: fixed; z-index: 56; right: 22px; bottom: 22px; width: min(370px, calc(100vw - 32px)); height: min(520px, calc(100vh - 44px)); display: grid; grid-template-rows: auto minmax(0,1fr) auto auto auto; overflow: hidden; border: 1px solid #d9e1dd; border-radius: 13px; background: #ffffff; color: #14211b; box-shadow: 0 24px 70px rgba(0,0,0,.48); }
.chat-panel[hidden], .chat-launcher[hidden] { display: none; }
.chat-header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px 12px 17px; border-bottom: 1px solid #e3e9e6; background: #f7faf8; color: #14211b; }
.chat-header > div { display: flex; flex-direction: column; gap: 4px; }
.chat-header span { color: #1d7e59; font: 700 8px "Gmarket Sans", sans-serif; letter-spacing: 1px; }
.chat-header h2 { margin: 0; color: #14211b; font: 700 15px/1.2 "Gmarket Sans", sans-serif; }
.chat-header button { width: 32px; height: 32px; border: 1px solid #dce4e0; border-radius: 7px; background: #ffffff; color: #53645c; font-size: 19px; line-height: 1; }
.chat-header button:hover { background: #edf3f0; color: #14211b; }
.chat-messages { min-height: 0; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; padding: 16px; background: #ffffff; color: #14211b; }
.chat-empty { margin: auto; color: #718078; text-align: center; font-size: 11px; line-height: 1.65; }
.chat-message { max-width: 84%; margin: 0; padding: 10px 12px; border-radius: 10px; color: #14211b; font-size: 11px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message.user { align-self: flex-end; border: 1px solid #d8e9a2; border-bottom-right-radius: 3px; background: #eef8cf; color: #1b2a21; }
.chat-message.assistant { align-self: flex-start; border: 1px solid #dfe6e2; border-bottom-left-radius: 3px; background: #f4f7f5; color: #223129; }
.chat-status { min-height: 34px; padding: 9px 16px; border-top: 1px solid #e5ebe8; background: #f7faf8; color: #586860; font-size: 10px; }
.chat-status.waiting { color: #376b55; }
.chat-status.waiting::before { content: ""; width: 7px; height: 7px; display: inline-block; margin-right: 7px; border-radius: 50%; background: #1d9368; animation: chat-pulse 1s infinite alternate; }
.chat-status.error { background: #fff5f3; color: #a23f35; }
.chat-retry { justify-self: start; margin: 9px 16px 0; padding: 7px 10px; border: 1px solid #e2b5ae; border-radius: 6px; background: #ffffff; color: #9b3d34; font-size: 10px; font-weight: 800; }
.chat-retry:hover { background: #fff0ed; color: #7e2922; }
.chat-form { padding: 13px 14px 14px; border-top: 1px solid #e3e9e6; background: #f7faf8; color: #14211b; }
.chat-form label { display: block; margin-bottom: 7px; color: #53645c; font-size: 9px; font-weight: 800; }
.chat-form > div { display: grid; grid-template-columns: minmax(0,1fr) 62px; gap: 7px; }
.chat-form input { width: 100%; min-width: 0; height: 40px; padding: 0 11px; border: 1px solid #ccd8d2; border-radius: 7px; outline: 0; background: #ffffff; color: #14211b; caret-color: #1d7e59; font-size: 11px; }
.chat-form input::placeholder { color: #87958e; opacity: 1; }
.chat-form input:focus { border-color: #4c9f7b; box-shadow: 0 0 0 3px rgba(29,147,104,.12); }
.chat-form input:disabled { background: #eef2f0; color: #65736c; }
.chat-form button { height: 40px; border: 1px solid #183126; border-radius: 7px; background: #183126; color: #ffffff; font-size: 10px; font-weight: 900; }
.chat-form button:hover:not(:disabled) { background: #24503e; color: #ffffff; }
.chat-form button:disabled { border-color: #d6ded9; background: #e4e9e6; color: #98a49e; cursor: not-allowed; }
@keyframes chat-pulse { from { opacity: .35; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 1120px) {
  .sales-columns, .funnel-panel { grid-template-columns: 1fr; }
  .employee-layout { grid-template-columns: 1fr; }
  .employee-layout > div:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .employee-rank { grid-template-columns: repeat(5,1fr); }
  .rank-row { grid-template-columns: 22px 1fr; }
  .rank-row > strong { grid-column: 2; }
}

@media (max-width: 840px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,.45); }
  main { margin-left: 0; }
  .mobile-menu { display: block; }
  .dashboard { padding: 24px 18px 60px; }
  .topbar { padding-inline: 18px; }
  .period-grid { width: 100%; max-width: 100%; grid-template-columns: minmax(0,1fr); overflow: hidden; }
  .period-card { width: 100%; max-width: 100%; overflow: hidden; }
  .period-head { flex-wrap: wrap; }
  .compare { display: flex; align-items: flex-start; flex-direction: column; gap: 5px; }
  .compare small { line-height: 1.45; }
  .compare b, .compare i { align-self: flex-start; }
  .summary-grid { grid-template-columns: repeat(2,1fr); }
  .employee-rank { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 560px) {
  .topbar h1 { font-size: 16px; }
  .topbar p, .top-actions .demo-badge, #amountMode { display: none; }
  .primary-button { padding-inline: 10px; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .section-title h2 { font-size: 17px; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .summary-grid > div { min-height: 88px; padding: 12px; }
  .summary-grid strong { font-size: 15px; }
  .mini-kpis { grid-template-columns: 1fr; }
  .segmented { max-width: 100%; overflow-x: auto; }
  .segmented button { flex: 0 0 auto; }
  .funnel { grid-template-columns: repeat(3,1fr); min-height: 330px; }
  .employee-rank { grid-template-columns: 1fr; }
  .filters { width: 100%; overflow-x: auto; }
  .chat-launcher { right: 14px; bottom: 14px; }
  .chat-panel { right: 10px; bottom: 10px; width: calc(100vw - 20px); height: min(560px, calc(100dvh - 20px)); border-radius: 11px; }
  .chat-header { min-height: 62px; }
  .chat-form { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
