/* ==========================================================================
   AILO Dashboard D07 — 캠페인랩 (랜딩·광고 캠페인 성과)
   원형: 벤토 카드 그리드 + 떠 있는 카드형 사이드바(접기/오프캔버스)
   타이포: Pretendard + Space Grotesk(숫자·라틴) / 컬러: 라이트 라벤더 + 바이올렛
   ========================================================================== */

:root {
  --ailo-bg: #f3f1fa;
  --ailo-fg: #17142b;
  --ailo-muted: #625d7c;
  --ailo-line: rgba(23, 20, 43, .09);
  --ailo-accent: #6d4ae0;

  --d07-card: #ffffff;
  --d07-soft: #f0ecff;
  --d07-ink-2: #3b3654;
  --d07-num: "Space Grotesk", var(--ailo-font);
  --d07-radius: 20px;
  --d07-shadow: 0 1px 2px rgba(23, 20, 43, .04), 0 8px 24px -12px rgba(52, 30, 140, .14);

  /* 차트 시리즈 (dataviz 검증: 3색 all-pairs PASS, 아쿠아는 3:1 미만 → 라벨 병기) */
  --d07-s1: #6d4ae0;
  --d07-s1-hover: #5233c4;
  --d07-s1-soft: #c7bbf7;
  --d07-s2: #eb6834;
  --d07-s3: #1baf7a;
  /* 퍼널 서열 램프 (--ordinal PASS) */
  --d07-o1: #ac9bf6;
  --d07-o2: #8d74f2;
  --d07-o3: #6d4ae0;
  --d07-o4: #5233c4;
  --d07-o5: #3a2496;
  /* 차트 크롬 */
  --d07-grid: #ebe8f3;
  --d07-base: #d3cfe0;
  --d07-axis: #7b7695;
  --d07-tip: #1d173d;
  /* 상태 */
  --d07-good: #0b7a3e;
  --d07-good-bg: #e3f6ea;
  --d07-bad: #c3302f;
  --d07-bad-bg: #fde9e7;
  --d07-warn: #9a5b00;
  --d07-warn-bg: #fff2d6;

  --d07-sb-w: 252px;
  --d07-gap: clamp(12px, 1.2vw, 18px);
}

body { background: var(--ailo-bg); font-size: 14px; }
.num, .kpi__value, .hero__value, .ab__rate, .funnel__val { font-variant-numeric: normal; }
td.num, .pager, .log__time { font-variant-numeric: tabular-nums; }
.btn-accent, .btn-ghost, .link-btn, .icon-btn { -webkit-tap-highlight-color: transparent; }

/* ---------- App frame ---------- */
.app { display: flex; min-height: 100vh; }
.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Sidebar ---------- */
.sb {
  position: sticky; top: 16px; align-self: flex-start;
  width: var(--d07-sb-w); height: calc(100vh - 32px); margin: 16px 0 16px 16px;
  background: var(--d07-card); border-radius: 24px; box-shadow: var(--d07-shadow);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 14px;
  transition: width .3s var(--ailo-ease); overflow: hidden; flex-shrink: 0; z-index: 60;
}
.sb__head { display: flex; align-items: center; gap: 8px; padding: 2px 6px; }
.sb__logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; white-space: nowrap; flex: 1; min-width: 0; }
.sb__logo b { color: var(--ailo-accent); }
.sb__mark { width: 32px; height: 32px; border-radius: 10px; background: var(--d07-tip); display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 3px; padding: 7px; flex-shrink: 0; }
.sb__mark i { display: block; background: #a995ff; border-radius: 2px; }
.sb__mark i:nth-child(1) { height: 40%; }
.sb__mark i:nth-child(2) { height: 70%; background: #c9bdff; }
.sb__mark i:nth-child(3) { height: 100%; background: #fff; }
.sb__collapse, .sb__close {
  width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--ailo-line); background: transparent;
  display: grid; place-items: center; color: var(--ailo-muted); flex-shrink: 0; transition: background .2s, color .2s;
}
.sb__collapse:hover, .sb__close:hover { background: var(--d07-soft); color: var(--ailo-accent); }
.sb__close { display: none; }

.sb__ws { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--ailo-bg); }
.sb__ws-ava { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #f7b5c4, #b49cff); color: #2a1660; font-weight: 800; font-size: 12px; display: grid; place-items: center; flex-shrink: 0; }
.sb__ws-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; white-space: nowrap; }
.sb__ws-txt small { color: var(--ailo-muted); font-size: 11px; }
.sb__ws-txt b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }

.sb__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.sb__label { font-size: 11px; font-weight: 700; color: var(--ailo-muted); letter-spacing: .08em; padding: 12px 12px 6px; white-space: nowrap; }
.sb__nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--d07-ink-2); font-weight: 600; white-space: nowrap; position: relative; transition: background .2s, color .2s;
}
.sb__nav a i { width: 18px; text-align: center; font-size: 15px; color: var(--ailo-muted); transition: color .2s; }
.sb__nav a:hover { background: var(--ailo-bg); color: var(--ailo-fg); }
.sb__nav a.is-active { background: var(--d07-tip); color: #fff; }
.sb__nav a.is-active i { color: #b6a6ff; }
.sb__nav em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--d07-soft); color: var(--ailo-accent); }
.sb__nav em.is-hot { background: var(--d07-s2); color: #fff; }

.sb__budget { padding: 14px; border-radius: 16px; background: linear-gradient(160deg, var(--d07-soft), #fbeee9); white-space: nowrap; }
.sb__budget p { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.sb__budget p b { font-family: var(--d07-num); font-size: 15px; }
.sb__budget small { display: block; color: var(--ailo-muted); font-size: 11px; margin-top: 8px; }
.meter { height: 8px; border-radius: 99px; background: #ddd5fb; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--ailo-accent); }

/* collapsed rail */
html.sb-mini .sb { width: 84px; }
html.sb-mini .sb__name, html.sb-mini .sb__ws-txt, html.sb-mini .sb__nav a span, html.sb-mini .sb__nav em,
html.sb-mini .sb__label, html.sb-mini .sb__budget { display: none; }
html.sb-mini .sb__head { flex-direction: column; padding: 0; }
html.sb-mini .sb__logo { flex: none; }
html.sb-mini .sb__collapse i { rotate: 180deg; }
html.sb-mini .sb__ws { justify-content: center; padding: 8px 0; }
html.sb-mini .sb__nav a { justify-content: center; padding: 12px 0; }
html.sb-mini .sb__nav a i { font-size: 16px; }

.sb-overlay { display: none; }

/* ---------- Topbar ---------- */
.top {
  display: flex; align-items: center; gap: 16px; padding: 22px clamp(16px, 2vw, 28px) 10px;
}
.top__burger { display: none; width: 42px; height: 42px; border-radius: 12px; border: 0; background: var(--d07-card); box-shadow: var(--d07-shadow); flex-shrink: 0; }
.top__title { min-width: 0; margin-right: auto; }
.crumb { display: flex; gap: 6px; font-size: 12px; color: var(--ailo-muted); margin-bottom: 2px; }
.crumb li + li::before { content: "/"; margin-right: 6px; opacity: .5; }
.crumb a:hover { color: var(--ailo-accent); }
.top h1 { font-size: clamp(20px, 1.9vw, 26px); font-weight: 800; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top__search { position: relative; width: clamp(220px, 24vw, 340px); }
.top__search i { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--ailo-muted); font-size: 13px; }
.top__search input {
  width: 100%; height: 42px; border-radius: 14px; border: 1px solid transparent; background: var(--d07-card);
  padding: 0 40px 0 38px; font: inherit; color: inherit; box-shadow: var(--d07-shadow); transition: border-color .2s;
}
.top__search input:focus { outline: none; border-color: var(--ailo-accent); }
.top__search kbd { position: absolute; right: 10px; top: 50%; translate: 0 -50%; background: var(--ailo-bg); color: var(--ailo-muted); border-radius: 6px; font-size: 11px; padding: 2px 7px; font-family: var(--d07-num); }
.top__actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { position: relative; width: 42px; height: 42px; border-radius: 14px; border: 0; background: var(--d07-card); box-shadow: var(--d07-shadow); display: grid; place-items: center; font-size: 16px; }
.icon-btn:hover { color: var(--ailo-accent); }
.badge-dot { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; border-radius: 99px; background: var(--d07-s2); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--ailo-bg); padding: 0 4px; }
.profile { display: flex; align-items: center; gap: 10px; border: 0; background: var(--d07-card); box-shadow: var(--d07-shadow); border-radius: 14px; padding: 5px 14px 5px 5px; text-align: left; }
.profile__ava { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--ailo-accent), #a17bff); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.profile__txt { display: flex; flex-direction: column; line-height: 1.25; }
.profile__txt b { font-size: 13px; }
.profile__txt small { font-size: 11px; color: var(--ailo-muted); }

/* notifications */
.notif { position: relative; }
.notif__panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(340px, calc(100vw - 32px)); z-index: 80;
  background: var(--d07-card); border-radius: 18px; box-shadow: 0 20px 50px -16px rgba(30, 18, 90, .35); padding: 8px; border: 1px solid var(--ailo-line);
}
.notif__head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 10px; }
.link-btn { border: 0; background: none; color: var(--ailo-accent); font-size: 12px; font-weight: 600; padding: 2px 4px; }
.link-btn:hover { text-decoration: underline; }
.notif__panel li { display: flex; gap: 10px; padding: 10px; border-radius: 12px; position: relative; }
.notif__panel li:hover { background: var(--ailo-bg); }
.notif__panel li.is-new::after { content: ""; position: absolute; right: 12px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--ailo-accent); }
.notif__panel p { font-size: 13px; line-height: 1.45; padding-right: 16px; }
.notif__panel small { display: block; color: var(--ailo-muted); font-size: 11px; margin-top: 2px; }
.n-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--d07-soft); color: var(--ailo-accent); flex-shrink: 0; font-size: 13px; }
.n-ico--warn { background: var(--d07-warn-bg); color: var(--d07-warn); }
.n-ico--ok { background: var(--d07-good-bg); color: var(--d07-good); }
.n-ico--bad { background: var(--d07-bad-bg); color: var(--d07-bad); }

/* ---------- Main / filters ---------- */
.main { padding: 6px clamp(16px, 2vw, 28px) 24px; flex: 1; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-bottom: var(--d07-gap); }
.seg { display: inline-flex; background: var(--d07-card); border-radius: 14px; padding: 4px; box-shadow: var(--d07-shadow); }
.seg button { border: 0; background: transparent; border-radius: 10px; padding: 7px 16px; font-weight: 600; font-size: 13px; color: var(--ailo-muted); transition: background .2s, color .2s; }
.seg button:hover { color: var(--ailo-fg); background: var(--ailo-bg); }
.seg button[aria-pressed="true"] { background: var(--ailo-accent); color: #fff; }
.filters__range { color: var(--ailo-muted); font-size: 13px; }
.filters__range i { margin-right: 4px; }
.filters__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ailo-muted); }
.live__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--d07-s3); box-shadow: 0 0 0 0 rgba(27, 175, 122, .5); animation: d07-pulse 2s infinite; }
@keyframes d07-pulse { 70% { box-shadow: 0 0 0 7px rgba(27, 175, 122, 0); } 100% { box-shadow: 0 0 0 0 rgba(27, 175, 122, 0); } }
.btn-ghost, .btn-accent { display: inline-flex; align-items: center; gap: 7px; border-radius: 12px; padding: 9px 14px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .2s, color .2s, box-shadow .2s; }
.btn-ghost { border: 1px solid var(--d07-base); background: transparent; }
.btn-ghost:hover { background: var(--d07-card); color: var(--ailo-accent); }
.btn-accent { border: 0; background: var(--ailo-accent); color: #fff; }
.btn-accent:hover { background: var(--d07-s1-hover); }

/* ---------- Bento ---------- */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--d07-gap); grid-auto-flow: dense; transition: opacity .2s; }
.bento.is-loading { opacity: .55; }
.tile { background: var(--d07-card); border-radius: var(--d07-radius); box-shadow: var(--d07-shadow); padding: clamp(16px, 1.4vw, 22px); min-width: 0; position: relative; }
.tile__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tile__head h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.tile__sub { font-size: 12px; color: var(--ailo-muted); margin-top: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 10px; border-radius: 99px; background: var(--d07-soft); color: var(--d07-ink-2); white-space: nowrap; }
.chip b { font-family: var(--d07-num); color: var(--ailo-fg); }
.chip--soft { background: var(--ailo-bg); }
.link-more { font-size: 12px; font-weight: 600; color: var(--ailo-accent); white-space: nowrap; }
.link-more:hover { color: var(--d07-s1-hover); text-decoration: underline; }

.tile--hero { grid-column: span 4; grid-row: span 2; }
.kpi { grid-column: span 2; }
.tile--trend { grid-column: span 8; }
.tile--funnel { grid-column: span 4; }
.tile--ab { grid-column: span 5; }
.tile--channel { grid-column: span 3; }
.tile--hour { grid-column: span 5; }
.tile--device { grid-column: span 3; }
.tile--log { grid-column: span 4; }
.tile--table { grid-column: span 12; }

/* hero */
.tile--hero {
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 140, 190, .45), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(72, 220, 200, .28), transparent 60%),
    linear-gradient(160deg, #2b1781 0%, #4f2fd0 55%, #6d4ae0 100%);
  color: #fff; overflow: hidden; display: flex; flex-direction: column; min-height: 320px;
}
.tile--hero::after { content: ""; position: absolute; width: 220px; height: 220px; right: -70px; bottom: 70px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); box-shadow: 0 0 0 30px rgba(255, 255, 255, .04), 0 0 0 60px rgba(255, 255, 255, .03); pointer-events: none; }
.hero__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.hero__top h2 { font-size: 15px; font-weight: 600; color: rgba(255, 255, 255, .86); }
.chip--glass { background: rgba(255, 255, 255, .14); color: #fff; backdrop-filter: blur(6px); font-size: 11px; }
.hero__value { font-family: var(--d07-num); font-weight: 700; font-size: clamp(36px, 3.5vw, 54px); letter-spacing: -.035em; line-height: 1.05; margin-top: 22px; position: relative; z-index: 1; }
.hero__delta { margin-top: 10px; font-size: 13px; color: rgba(255, 255, 255, .8); }
.hero__delta .up, .hero__delta .down, .hero__roas .up, .hero__roas .down, .hero__roas .neutral { display: inline-block; padding: 2px 8px; border-radius: 99px; font-weight: 700; }
.tile--hero .up { background: rgba(120, 255, 190, .2); color: #c6ffe2; }
.tile--hero .down { background: rgba(255, 140, 140, .22); color: #ffd4d4; }
.tile--hero .neutral { background: rgba(255, 255, 255, .16); color: #fff; }
.hero__roas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; position: relative; z-index: 1; }
.hero__roas div { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.hero__roas small { color: rgba(255, 255, 255, .72); font-size: 12px; }
.hero__roas b { font-family: var(--d07-num); font-size: 22px; letter-spacing: -.02em; }
.hero__roas span { font-size: 11px; align-self: flex-start; }
.hero__spark { margin-top: auto; height: 70px; position: relative; padding-top: 16px; }

/* KPI tiles */
.kpi { display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.kpi__head { display: flex; align-items: center; gap: 8px; }
.kpi__head h3 { font-size: 13px; font-weight: 600; color: var(--ailo-muted); }
.kpi__ico { width: 28px; height: 28px; border-radius: 9px; background: var(--d07-soft); color: var(--ailo-accent); display: grid; place-items: center; font-size: 12px; }
.kpi__value { font-family: var(--d07-num); font-size: clamp(20px, 1.75vw, 27px); font-weight: 700; letter-spacing: -.03em; margin-top: 8px; white-space: nowrap; }
.delta { font-size: 12px; color: var(--ailo-muted); }
.up { color: var(--d07-good); font-weight: 700; }
.down { color: var(--d07-bad); font-weight: 700; }
.neutral { font-weight: 700; }
.kpi__spark { height: 38px; margin-top: auto; padding-top: 8px; position: relative; }
.kpi__spark svg, .hero__spark svg { width: 100%; height: 100%; overflow: visible; }
.spark-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; translate: -50% -50%; box-shadow: 0 0 0 2px var(--d07-card); margin-top: 0; }
.kpi__spark .spark-dot { margin-top: 4px; }
.hero__spark .spark-dot { box-shadow: 0 0 0 2px #5a39d8; margin-top: 8px; }
.kpi__spark, .hero__spark { --pad: 0; }

/* chart containers (height includes axis band) */
.chart { position: relative; width: 100%; }
.chart--trend { height: 236px; }
.tile--channel, .tile--hour { display: flex; flex-direction: column; }
.chart--channel, .chart--hour { flex: 1; min-height: 220px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--d07-ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.lg-line { display: inline-block; width: 14px; height: 2px; border-radius: 2px; background: var(--c); }
.lg-box { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* funnel */
.funnel { display: flex; flex-direction: column; gap: 12px; counter-reset: f; }
.funnel li { counter-increment: f; }
.funnel__row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; margin-bottom: 5px; }
.funnel__name::before { content: counter(f); display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; background: var(--ailo-bg); font-size: 10px; font-weight: 700; color: var(--ailo-muted); margin-right: 8px; }
.funnel__val { font-family: var(--d07-num); font-weight: 700; }
.funnel__track { height: 12px; border-radius: 6px; background: var(--ailo-bg); }
.funnel__bar { display: block; height: 100%; border-radius: 0 6px 6px 0; transition: width .5s var(--ailo-ease); }
.funnel__rate { display: block; font-size: 11px; color: var(--ailo-muted); margin-top: 4px; }
.funnel__tip { margin-top: 16px; font-size: 12px; background: var(--ailo-bg); padding: 10px 12px; border-radius: 12px; color: var(--d07-ink-2); }
.funnel__tip i { color: var(--d07-warn); margin-right: 4px; }

/* A/B */
.ab-list { display: flex; flex-direction: column; gap: 12px; }
.ab { border: 1px solid var(--ailo-line); border-radius: 16px; padding: 14px; }
.ab__head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 12px; }
.ab__head h3 { font-size: 13px; font-weight: 700; flex: 1; min-width: 150px; }
.ab__id { font-family: var(--d07-num); font-size: 11px; font-weight: 700; background: var(--d07-tip); color: #fff; padding: 2px 8px; border-radius: 6px; }
.ab__vs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ab__var { background: var(--ailo-bg); border-radius: 12px; padding: 10px 12px; min-width: 0; border: 1px solid transparent; }
.ab__var.is-win { background: var(--d07-soft); border-color: #cbbefb; }
.ab__tag { font-size: 11px; font-weight: 700; color: var(--ailo-muted); }
.ab__var.is-win .ab__tag { color: var(--ailo-accent); }
.ab__copy { font-size: 12px; color: var(--d07-ink-2); margin: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab__rate { font-family: var(--d07-num); font-size: 24px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.ab__rate small { font-size: 14px; margin-left: 1px; }
.ab__bar { height: 6px; border-radius: 99px; background: #e2ddf2; margin: 8px 0 6px; }
.ab__bar span { display: block; height: 100%; border-radius: inherit; background: var(--d07-o1); }
.ab__var.is-win .ab__bar span { background: var(--ailo-accent); }
.ab__n { font-size: 11px; color: var(--ailo-muted); }
.ab__foot { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--ailo-muted); }
.ab__foot b { color: var(--ailo-fg); }
.ab__foot b.up { color: var(--d07-good); }
.conf { height: 6px; border-radius: 99px; background: #e2ddf2; position: relative; }
.conf span { display: block; height: 100%; border-radius: inherit; background: var(--d07-o4); }
.conf i { position: absolute; top: -4px; width: 2px; height: 14px; background: var(--ailo-fg); border-radius: 2px; }

/* status badges (icon + label, never colour alone) */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.status--good { background: var(--d07-good-bg); color: var(--d07-good); }
.status--run { background: var(--d07-soft); color: #4b2fc0; }
.status--warn { background: var(--d07-warn-bg); color: var(--d07-warn); }
.status--mute { background: #eeedf2; color: #55526a; }

/* device */
.segbar { display: flex; gap: 2px; height: 28px; border-radius: 4px; overflow: hidden; margin: 4px 0 12px; }
.segbar span { display: flex; align-items: center; padding-left: 8px; color: #fff; font-size: 12px; font-weight: 700; border-radius: 4px; min-width: 0; transition: flex-basis .5s var(--ailo-ease); }
.legend--stack { flex-direction: column; gap: 6px; }
.device-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 0; }
.device-stats div { background: var(--ailo-bg); border-radius: 12px; padding: 10px 12px; }
.device-stats dt { font-size: 11px; color: var(--ailo-muted); font-weight: 500; }
.device-stats dd { margin: 0; font-family: var(--d07-num); font-weight: 700; font-size: 18px; }

/* log */
.log { position: relative; }
.log li { display: grid; grid-template-columns: 42px 14px 1fr; gap: 8px; align-items: start; padding: 8px 0; font-size: 13px; position: relative; }
.log li + li { border-top: 1px dashed transparent; }
.log li::before { content: ""; position: absolute; left: 55px; top: 22px; bottom: -8px; width: 1px; background: var(--ailo-line); }
.log li:last-child::before { display: none; }
.log__time { color: var(--ailo-muted); font-size: 12px; padding-top: 1px; }
.log__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--d07-o1); margin-top: 5px; box-shadow: 0 0 0 3px var(--d07-card); position: relative; z-index: 1; }
.log__dot--good { background: var(--d07-good); }
.log__dot--warn { background: #e09a00; }
.log__dot--bad { background: var(--d07-bad); }
.log p { line-height: 1.45; color: var(--d07-ink-2); }
.log p b { color: var(--ailo-fg); }

/* table */
.tile__head--table { align-items: center; flex-wrap: wrap; }
.tbl-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.tbl-search { position: relative; display: block; }
.tbl-search i { position: absolute; left: 12px; top: 50%; translate: 0 -50%; font-size: 12px; color: var(--ailo-muted); }
.tbl-search input { height: 38px; border-radius: 12px; border: 1px solid var(--d07-base); background: var(--d07-card); padding: 0 12px 0 32px; font: inherit; font-size: 13px; width: 220px; max-width: 100%; }
.tbl-search input:focus { outline: none; border-color: var(--ailo-accent); box-shadow: 0 0 0 3px var(--d07-soft); }
.tbl-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; -webkit-overflow-scrolling: touch; }
.tbl-wrap:focus-visible { outline-offset: 0; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 920px; font-size: 13px; }
.tbl th { font-size: 12px; font-weight: 600; color: var(--ailo-muted); border-bottom: 1px solid var(--ailo-line); padding: 0; white-space: nowrap; text-align: left; }
.tbl th button { border: 0; background: none; padding: 10px 10px; font-weight: inherit; color: inherit; display: inline-flex; gap: 6px; align-items: center; border-radius: 8px; }
.tbl th button:hover { color: var(--ailo-fg); background: var(--ailo-bg); }
.tbl th button i { font-size: 10px; opacity: .55; }
.tbl th[aria-sort="ascending"] button, .tbl th[aria-sort="descending"] button { color: var(--ailo-accent); }
.tbl th[aria-sort="ascending"] button i, .tbl th[aria-sort="descending"] button i { opacity: 1; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl th.num button { flex-direction: row-reverse; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--ailo-line); white-space: nowrap; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: #faf9fe; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.cell-name { display: flex; align-items: center; gap: 10px; }
.cell-name span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.cell-name small { color: var(--ailo-muted); font-size: 11px; }
.cell-ava { width: 30px; height: 30px; border-radius: 9px; background: var(--d07-soft); color: var(--ailo-accent); font-weight: 800; display: grid; place-items: center; font-size: 12px; flex-shrink: 0; }
.roas { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 70px; }
.roas i { height: 4px; border-radius: 99px; background: var(--ailo-accent); align-self: flex-end; max-width: 100%; }
.empty { text-align: center; color: var(--ailo-muted); padding: 30px !important; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; font-size: 12px; color: var(--ailo-muted); flex-wrap: wrap; }
.pager__list { display: flex; gap: 4px; }
.pager__list button { min-width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--ailo-line); background: var(--d07-card); font-size: 12px; font-weight: 600; }
.pager__list button:hover:not(:disabled) { border-color: var(--ailo-accent); color: var(--ailo-accent); }
.pager__list button.is-current { background: var(--d07-tip); color: #fff; border-color: var(--d07-tip); }
.pager__list button:disabled { opacity: .4; cursor: default; }

/* footer */
.foot { padding: 6px clamp(16px, 2vw, 28px) 24px; font-size: 12px; color: var(--ailo-muted); }
.foot a:hover { color: var(--ailo-accent); text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 1399.98px) {
  .tile--hero { grid-column: span 12; grid-row: auto; min-height: 0; display: grid; grid-template-columns: 1.1fr 1fr 1fr; grid-template-areas: "top top spark" "value roas spark" "delta roas spark"; column-gap: 24px; align-items: end; }
  .hero__top { grid-area: top; }
  .hero__value { grid-area: value; margin-top: 12px; }
  .hero__delta { grid-area: delta; }
  .hero__roas { grid-area: roas; margin-top: 0; }
  .hero__spark { grid-area: spark; height: 110px; margin: 0; }
  .kpi { grid-column: span 3; }
  .tile--trend { grid-column: span 8; }
  .tile--ab { grid-column: span 7; }
  .tile--channel { grid-column: span 5; }
  .tile--hour { grid-column: span 7; }
  .tile--device { grid-column: span 5; }
  .tile--log { grid-column: span 12; }
  .log { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
  .log li::before { display: none; }
}

@media (max-width: 991.98px) {
  .sb {
    position: fixed; top: 0; left: 0; bottom: 0; margin: 0; height: 100%; border-radius: 0 24px 24px 0;
    width: min(300px, 86vw); translate: -105% 0; visibility: hidden;
    transition: translate .32s var(--ailo-ease), visibility .32s; z-index: 200;
  }
  html.sb-open .sb { translate: 0 0; visibility: visible; transition: translate .32s var(--ailo-ease), visibility 0s; } /* 열 때 visibility 즉시 → 곧바로 포커스 가능 */
  html.sb-mini .sb { width: min(300px, 86vw); }
  html.sb-mini .sb__name, html.sb-mini .sb__ws-txt, html.sb-mini .sb__nav a span, html.sb-mini .sb__label { display: revert; }
  html.sb-mini .sb__nav a { justify-content: flex-start; padding: 10px 12px; }
  html.sb-mini .sb__head { flex-direction: row; }
  .sb__collapse { display: none; }
  .sb__close { display: grid; }
  .sb-overlay { display: block; position: fixed; inset: 0; background: rgba(20, 14, 50, .42); backdrop-filter: blur(2px); z-index: 190; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
  html.sb-open .sb-overlay { opacity: 1; visibility: visible; }
  html.sb-open body { overflow: hidden; }
  .top__burger { display: grid; place-items: center; }
  .top { flex-wrap: wrap; }
  .top__search { order: 5; width: 100%; }
  .profile__txt { display: none; }
  .profile { padding: 5px; }
  .tile--trend, .tile--funnel { grid-column: span 12; }
  .tile--funnel .funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 18px; }
}

@media (max-width: 767.98px) {
  .tile--hero { grid-template-columns: 1fr; grid-template-areas: "top" "value" "delta" "roas" "spark"; }
  .hero__roas { margin-top: 16px; }
  .hero__spark { height: 70px; margin-top: 8px; }
  .kpi { grid-column: span 6; }
  .tile--ab, .tile--channel, .tile--hour, .tile--device { grid-column: span 12; }
  .log { grid-template-columns: 1fr; }
  .filters__right { margin-left: 0; width: 100%; justify-content: space-between; }
}

@media (max-width: 575.98px) {
  body { font-size: 13px; }
  .top { padding-top: 14px; gap: 10px; }
  .top h1 { font-size: 20px; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 8px 6px; }
  .ab__vs { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ab__rate { font-size: 20px; }
  .ab__foot { grid-template-columns: auto auto; }
  .ab__foot .conf { grid-column: 1 / -1; }
  .kpi__value { font-size: 20px; }
  .tbl-tools, .tbl-search, .tbl-search input { width: 100%; }
  .tbl-tools .btn-accent { width: 100%; justify-content: center; }
  .filters__right .btn-ghost { padding: 8px 10px; }
  .notif { position: static; }
  .notif__panel { position: fixed; left: 16px; right: 16px; top: 68px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .live__dot { animation: none; }
}
