:root {
  --bg: #080d18;
  --bg-soft: #0d1422;
  --sidebar: #0a101c;
  --panel: #111a2a;
  --panel-2: #151f31;
  --panel-hover: #19253a;
  --line: #233149;
  --line-soft: rgba(148, 163, 184, .14);
  --text: #edf3fb;
  --text-2: #c6d0df;
  --muted: #7f8da3;
  --blue: #5b8cff;
  --purple: #9668ff;
  --green: #3dd598;
  --orange: #ffad5a;
  --cyan: #42c8e8;
  --pink: #f27bb2;
  --red: #ff6b75;
  --yellow: #f6ca58;
  --chart-1: #5b8cff;
  --chart-2: #9668ff;
  --chart-3: #3dd598;
  --chart-4: #ffad5a;
  --chart-5: #42c8e8;
  --chart-6: #f27bb2;
  --chart-7: #f6ca58;
  --chart-8: #75839a;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 18px 45px rgba(0,0,0,.26);
  --sidebar-width: 248px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 83% -10%, rgba(91,140,255,.13), transparent 30%),
    radial-gradient(circle at 30% 120%, rgba(150,104,255,.09), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
button, input, select { font: inherit; }
button { color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, rgba(12,19,32,.98), rgba(8,14,25,.99));
  border-right: 1px solid var(--line-soft);
  box-shadow: 12px 0 42px rgba(0,0,0,.16);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 24px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 13px; background: linear-gradient(145deg, #6c96ff, #674fe9);
  box-shadow: 0 10px 28px rgba(91,140,255,.28);
}
.brand-mark svg { width: 23px; height: 23px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; font-size: 15px; letter-spacing: .01em; }
.brand span { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.nav-groups { display: grid; gap: 20px; }
.nav-label { margin: 0 10px 7px; color: #65738a; font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.nav-item {
  width: 100%; height: 44px; display: flex; align-items: center; gap: 11px;
  padding: 0 12px; border: 0; border-radius: 12px; background: transparent;
  color: #929fb3; cursor: pointer; text-align: left; transition: .16s ease;
}
.nav-item svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { color: #d9e5f4; background: rgba(255,255,255,.035); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(91,140,255,.22), rgba(91,140,255,.08)); box-shadow: inset 3px 0 0 var(--blue); }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 6px; border-radius: 999px; background: rgba(61,213,152,.14); color: var(--green); font-size: 11px; font-weight: 700; }
.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.server-state { display: flex; align-items: center; gap: 10px; padding: 8px; }
.server-state strong, .server-state span { display: block; }
.server-state strong { font-size: 12px; color: var(--text-2); }
.server-state span { font-size: 10px; color: var(--muted); }
.status-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #6b7280; box-shadow: 0 0 0 4px rgba(107,114,128,.11); }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(61,213,152,.12), 0 0 16px rgba(61,213,152,.28); }
.status-dot.error { background: var(--red); box-shadow: 0 0 0 4px rgba(255,107,117,.12); }
.sidebar-backdrop { display: none; }

.main-shell { min-height: 100vh; margin-left: var(--sidebar-width); padding: 0 30px 48px; }
.topbar {
  position: sticky; top: 0; z-index: 25;
  min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 16px 0; background: rgba(8,13,24,.84); backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(148,163,184,.08);
}
.topbar-title { display: flex; align-items: center; gap: 12px; }
.topbar-title h1 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.eyebrow, .section-kicker { margin: 0 0 2px; color: #71819a; font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.refresh-status { display: flex; align-items: center; gap: 10px; min-width: 155px; }
.refresh-status strong, .refresh-status span { display: block; }
.refresh-status strong { font-size: 11px; color: var(--text-2); }
.refresh-status span { color: var(--muted); font-size: 10px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 11px; background: var(--panel); cursor: pointer;
  transition: background .16s, border-color .16s, transform .16s;
}
.icon-btn:hover { background: var(--panel-hover); border-color: #31425e; transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mobile-menu { display: none; }
.btn {
  min-height: 40px; padding: 0 15px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel-2); color: var(--text-2); cursor: pointer; font-weight: 650; font-size: 12px;
  transition: .16s ease;
}
.btn:hover { background: var(--panel-hover); border-color: #354764; color: #fff; }
.btn.primary { background: linear-gradient(135deg, #587fe8, #6959df); border-color: transparent; color: white; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .48; cursor: not-allowed; transform: none; }
select, input {
  min-height: 40px; padding: 0 12px; color: var(--text-2); background: #0c1422;
  border: 1px solid var(--line); border-radius: 10px; outline: none;
}
select:focus, input:focus { border-color: rgba(91,140,255,.68); box-shadow: 0 0 0 3px rgba(91,140,255,.1); }
.compact-select select { min-width: 88px; }

.error-banner {
  position: sticky; top: 92px; z-index: 24; display: flex; align-items: center; gap: 10px;
  margin: 14px 0; padding: 11px 14px; color: #ffd8dc; background: rgba(127,29,29,.78);
  border: 1px solid rgba(255,107,117,.4); border-radius: 12px; box-shadow: var(--shadow);
}
.error-banner svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.error-banner span { flex: 1; white-space: pre-wrap; }
.error-banner button { border: 0; background: none; color: inherit; font-size: 22px; cursor: pointer; }

.view { display: none; padding-top: 28px; animation: view-in .2s ease; }
.view.active { display: block; }
@keyframes view-in { from { opacity: .45; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-heading h2 { margin: 3px 0 5px; font-size: 25px; letter-spacing: -.035em; }
.page-heading p:not(.section-kicker) { max-width: 720px; margin: 0; color: var(--muted); font-size: 12px; }
.period-control { display: grid; gap: 6px; min-width: 144px; }
.period-control span, .filter-grid label > span { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.heading-stat { min-width: 125px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); text-align: right; }
.heading-stat span { display: block; color: var(--muted); font-size: 10px; }
.heading-stat strong { display: block; margin-top: 3px; font-size: 24px; }

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 15px; }
.kpi-card {
  position: relative; min-height: 120px; display: flex; align-items: flex-start; gap: 11px; overflow: hidden;
  padding: 17px; border: 1px solid var(--line-soft); border-radius: 17px;
  background: linear-gradient(145deg, rgba(20,31,49,.96), rgba(14,23,37,.98)); box-shadow: 0 10px 30px rgba(0,0,0,.13);
}
.kpi-card::after { content: ""; position: absolute; right: -34px; bottom: -44px; width: 100px; height: 100px; border-radius: 50%; opacity: .12; background: currentColor; filter: blur(4px); }
.kpi-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: currentColor; }
.kpi-icon svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kpi-content { min-width: 0; }
.kpi-content > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.kpi-content strong { display: block; color: var(--text); font-size: 25px; line-height: 1.15; letter-spacing: -.04em; }
.kpi-content strong.kpi-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; padding-top: 4px; }
.kpi-content small { display: block; margin-top: 7px; color: #71819a; font-size: 9px; }
.accent-blue { color: var(--blue); } .accent-purple { color: var(--purple); } .accent-green { color: var(--green); }
.accent-orange { color: var(--orange); } .accent-cyan { color: var(--cyan); } .accent-pink { color: var(--pink); }

.panel { border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: linear-gradient(155deg, rgba(17,26,42,.98), rgba(12,20,34,.98)); box-shadow: 0 14px 38px rgba(0,0,0,.16); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 19px 20px 4px; }
.panel-head h3 { margin: 2px 0 2px; font-size: 15px; letter-spacing: -.015em; }
.panel-head span { color: var(--muted); font-size: 10px; }
.text-btn { border: 0; background: none; color: #7da2ff; padding: 4px; cursor: pointer; font-size: 10px; font-weight: 700; }
.text-btn:hover { color: #a9c2ff; }
.dashboard-grid { display: grid; gap: 15px; margin-bottom: 15px; }
.primary-grid { grid-template-columns: minmax(0, 2.1fr) minmax(260px, .9fr) minmax(260px, .9fr); }
.secondary-grid { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .8fr); }
.trend-panel { min-width: 0; }
.chart-summary { text-align: right; }
.chart-summary strong { display: block; font-size: 25px; line-height: 1.1; }
.chart-summary span { font-size: 9px; }
.chart-canvas { width: 100%; min-height: 250px; padding: 7px 14px 14px; }
.chart-canvas.large { min-height: 308px; }
.chart-svg { width: 100%; height: 100%; overflow: visible; }
.chart-grid-line { stroke: rgba(148,163,184,.12); stroke-width: 1; }
.chart-axis-label { fill: #66768e; font-size: 9px; }
.chart-bar { fill: #5b8cff; opacity: .72; rx: 5; transition: opacity .15s; }
.chart-bar:hover { opacity: 1; }
.chart-line { fill: none; stroke: #8aa9ff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: url(#areaGradient); }
.chart-dot { fill: #b9caff; stroke: #111a2a; stroke-width: 2; }
.empty-state { min-height: 170px; display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; padding: 25px; }

.donut-container { min-height: 300px; display: grid; align-content: center; padding: 8px 18px 19px; }
.donut-layout { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(120px, .92fr); align-items: center; gap: 14px; }
.donut-visual { position: relative; width: min(160px, 100%); aspect-ratio: 1; margin: auto; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.05), 0 16px 35px rgba(0,0,0,.2); }
.donut-hole { position: absolute; inset: 24%; display: grid; place-items: center; align-content: center; border-radius: 50%; background: #101929; box-shadow: 0 0 0 1px rgba(255,255,255,.04); text-align: center; }
.donut-hole strong { font-size: 22px; letter-spacing: -.035em; }
.donut-hole span { color: var(--muted); font-size: 9px; }
.donut-legend { display: grid; gap: 8px; }
.legend-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 7px; font-size: 10px; }
.legend-row i { width: 8px; height: 8px; border-radius: 3px; }
.legend-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.legend-row strong { color: var(--muted); font-size: 9px; }

.calendar-panel { overflow: hidden; }
.calendar-legend { display: flex; justify-content: flex-end; align-items: center; gap: 4px; padding: 4px 20px 9px; color: var(--muted); font-size: 8px; }
.calendar-legend i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(255,255,255,.04); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.compact-calendar { gap: 5px; padding: 0 20px 20px; }
.calendar-weekday { padding: 3px 2px 7px; color: #67778e; text-align: center; font-size: 9px; font-weight: 700; }
.calendar-cell { position: relative; min-width: 0; border: 1px solid rgba(255,255,255,.035); border-radius: 8px; color: #aebacf; cursor: pointer; transition: transform .14s, border-color .14s, filter .14s; }
.calendar-cell:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.16); filter: brightness(1.12); }
.calendar-cell.blank { visibility: hidden; pointer-events: none; }
.compact-calendar .calendar-cell { min-height: 48px; padding: 7px; }
.calendar-cell .day-number { display: block; font-size: 9px; font-weight: 750; }
.calendar-cell .day-metric { display: block; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; color: rgba(235,243,255,.72); }
.calendar-cell.selected { outline: 2px solid rgba(125,162,255,.9); outline-offset: 1px; }
.heat-0 { background: #121c2c; } .heat-1 { background: #162a3f; } .heat-2 { background: #1d4058; }
.heat-3 { background: #245c73; } .heat-4 { background: #287b8e; } .heat-5 { background: #32a7b3; }

.active-preview-list { display: grid; gap: 9px; padding: 10px 20px 20px; }
.active-preview-item { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.018); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(145deg, rgba(91,140,255,.28), rgba(150,104,255,.23)); color: #dce7ff; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.active-preview-item strong, .active-preview-item span { display: block; }
.active-preview-item strong { font-size: 11px; }
.active-preview-item span { color: var(--muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-time { color: var(--green) !important; font-weight: 700; }

.recent-panel { margin-bottom: 15px; }
.event-feed { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 10px 20px 20px; }
.event-item { min-width: 0; padding: 11px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.016); }
.event-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.event-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.event-item p { margin: 8px 0 2px; color: var(--text-2); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-item time { color: var(--muted); font-size: 8px; }
.event-badge { padding: 2px 6px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.event-badge.open { color: var(--green); background: rgba(61,213,152,.11); }
.event-badge.close { color: var(--orange); background: rgba(255,173,90,.11); }

.calendar-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .7fr); gap: 15px; }
.full-calendar-panel { padding-bottom: 20px; }
.calendar-toolbar { display: flex; justify-content: center; align-items: center; gap: 22px; padding: 18px 20px 7px; }
.calendar-toolbar > div { min-width: 180px; text-align: center; }
.calendar-toolbar strong { display: block; font-size: 17px; }
.full-calendar { gap: 7px; padding: 2px 20px 0; }
.full-calendar .calendar-cell { min-height: 91px; padding: 10px; }
.full-calendar .calendar-cell .day-number { font-size: 11px; }
.full-calendar .calendar-cell .day-metric { margin-top: 23px; font-size: 9px; }
.day-detail-panel { min-height: 510px; }
.day-detail-empty { min-height: 380px; display: grid; place-items: center; padding: 30px; color: var(--muted); text-align: center; }
.day-detail-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 12px 20px; }
.mini-stat { padding: 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.018); }
.mini-stat span { display: block; color: var(--muted); font-size: 9px; }
.mini-stat strong { display: block; margin-top: 4px; font-size: 17px; }
.day-event-list { display: grid; gap: 7px; padding: 5px 20px 20px; }
.day-event-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.day-event-row strong { font-size: 10px; }
.day-event-row span { color: var(--muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-event-row time { color: #74839a; font-size: 8px; }

.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .7fr); gap: 15px; }
.span-two { grid-column: 1 / -1; }
.horizontal-bars { display: grid; gap: 14px; padding: 18px 20px 24px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 130px) minmax(0,1fr) auto; align-items: center; gap: 12px; }
.bar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: 10px; }
.bar-track { height: 9px; overflow: hidden; border-radius: 999px; background: #0a1220; }
.bar-fill { height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #5b8cff, #9668ff); box-shadow: 0 0 14px rgba(91,140,255,.24); }
.bar-value { color: var(--muted); font-size: 9px; white-space: nowrap; }

.active-card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 15px; }
.active-session-card { padding: 16px; border: 1px solid var(--line-soft); border-radius: 16px; background: linear-gradient(145deg, rgba(17,27,44,.98), rgba(13,21,35,.98)); }
.active-card-head { display: flex; align-items: center; gap: 10px; }
.active-card-head div { min-width: 0; }
.active-card-head strong, .active-card-head span { display: block; }
.active-card-head strong { font-size: 12px; }
.active-card-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 9px; }
.active-card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.active-card-meta div { padding: 9px; border-radius: 10px; background: rgba(255,255,255,.025); }
.active-card-meta span { display: block; color: var(--muted); font-size: 8px; }
.active-card-meta strong { display: block; margin-top: 3px; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filter-panel { padding: 14px; margin-bottom: 13px; }
.filter-grid { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)) auto; align-items: end; gap: 10px; }
.filter-grid label { display: grid; gap: 5px; }
.filter-actions { display: flex; gap: 7px; }
.new-events-banner { width: 100%; margin: 0 0 11px; padding: 10px; border: 1px solid rgba(91,140,255,.34); border-radius: 11px; color: #b9ccff; background: rgba(91,140,255,.11); cursor: pointer; font-size: 11px; }
.table-panel { overflow: hidden; }
.table-meta { display: flex; justify-content: space-between; padding: 13px 17px; color: var(--muted); font-size: 9px; border-bottom: 1px solid var(--line-soft); }
.table-scroll { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; font-size: 10px; }
th { color: #71819a; background: rgba(255,255,255,.015); font-size: 9px; letter-spacing: .025em; }
td { color: #b9c5d7; }
tbody tr:hover td { background: rgba(91,140,255,.035); }
.table-event { display: inline-flex; padding: 3px 7px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.table-event.open { color: var(--green); background: rgba(61,213,152,.1); }
.table-event.close { color: var(--orange); background: rgba(255,173,90,.1); }
.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 5px; padding: 16px; }
.page-btn { min-width: 33px; height: 33px; display: grid; place-items: center; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: #0d1625; color: var(--muted); cursor: pointer; font-size: 10px; }
.page-btn:hover { color: #fff; border-color: #3a4d6a; }
.page-btn.active { color: #fff; border-color: rgba(91,140,255,.65); background: rgba(91,140,255,.18); }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }

@media (max-width: 1450px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .primary-grid { grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(230px, .75fr)); }
  .event-feed { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .main-shell { padding-left: 22px; padding-right: 22px; }
  .primary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trend-panel { grid-column: 1 / -1; }
  .secondary-grid, .calendar-layout, .analysis-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .active-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
}
@media (max-width: 850px) {
  :root { --sidebar-width: 248px; }
  .sidebar { transform: translateX(-103%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.58); backdrop-filter: blur(2px); }
  .sidebar-backdrop.show { display: block; }
  .main-shell { margin-left: 0; padding: 0 16px 40px; }
  .mobile-menu { display: grid; }
  .refresh-status { display: none; }
  .topbar { min-height: 76px; }
  .page-heading { flex-direction: column; }
  .period-control { width: 100%; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .event-feed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 590px) {
  .topbar-actions .compact-select, #refresh-toggle { display: none; }
  .topbar-title h1 { font-size: 19px; }
  .page-heading h2 { font-size: 22px; }
  .kpi-grid, .primary-grid, .active-card-grid { grid-template-columns: 1fr; }
  .kpi-card { min-height: 104px; }
  .ratio-panel { min-width: 0; }
  .donut-layout { grid-template-columns: 1fr; }
  .donut-visual { width: 145px; }
  .event-feed { grid-template-columns: 1fr; }
  .full-calendar { gap: 3px; padding-left: 9px; padding-right: 9px; }
  .full-calendar .calendar-cell { min-height: 65px; padding: 6px; border-radius: 6px; }
  .full-calendar .calendar-cell .day-metric { margin-top: 12px; font-size: 7px; }
  .calendar-weekday { font-size: 8px; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-actions { grid-column: auto; }
  .bar-row { grid-template-columns: 82px minmax(0,1fr); }
  .bar-value { grid-column: 2; }
}


/* SESSION_HISTORY_UI_V1 */
.history-tabs { display: inline-flex; gap: 5px; margin: 0 0 13px; padding: 4px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.018); }
.history-tab { min-width: 108px; padding: 8px 13px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; }
.history-tab:hover { color: var(--text-2); }
.history-tab.active { color: #fff; background: rgba(91,140,255,.18); box-shadow: inset 0 0 0 1px rgba(91,140,255,.28); }
.session-row { cursor: pointer; }
.session-row:focus { outline: 1px solid rgba(91,140,255,.72); outline-offset: -2px; }
.session-link { display: block; color: #b9ccff; font-size: 10px; }
.session-row-sub { display: block; margin-top: 2px; color: #66758d; font-size: 8px; }
.session-status { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.session-status.active { color: var(--green); background: rgba(61,213,152,.11); }
.session-status.closed { color: #9eb5dc; background: rgba(126,158,211,.11); }
.session-status.unresolved { color: var(--orange); background: rgba(255,173,90,.11); }
body.modal-open { overflow: hidden; }
.session-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; }
.session-modal-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(2,6,13,.78); backdrop-filter: blur(7px); cursor: default; }
.session-modal-dialog { position: relative; width: min(920px, 100%); max-height: min(850px, calc(100vh - 44px)); overflow: auto; border: 1px solid #2b3b55; border-radius: 20px; background: linear-gradient(160deg, #121c2d, #0c1422); box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.session-modal-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 21px 24px 17px; border-bottom: 1px solid var(--line-soft); background: rgba(17,27,44,.94); backdrop-filter: blur(15px); }
.session-modal-header h2 { margin: 1px 0 2px; font-size: 20px; }
.session-modal-header p:last-child { margin: 0; color: var(--muted); font-size: 10px; }
.session-modal-close { width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 10px; color: #aab7ca; background: rgba(255,255,255,.025); cursor: pointer; font-size: 24px; line-height: 1; }
.session-detail-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; padding: 20px 24px 12px; }
.session-detail-summary > div { min-width: 0; padding: 13px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.018); }
.session-detail-summary span { display: block; color: var(--muted); font-size: 8px; }
.session-detail-summary strong { display: block; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-size: 11px; white-space: nowrap; }
.session-timeline-section { margin: 4px 24px 16px; padding: 17px; border: 1px solid var(--line-soft); border-radius: 15px; background: rgba(4,10,19,.28); }
.session-timeline { display: grid; gap: 13px; margin-top: 16px; }
.session-day-row { display: grid; grid-template-columns: 88px minmax(0,1fr); align-items: center; gap: 12px; }
.session-day-label { color: #8695aa; font-size: 9px; }
.session-day-track { position: relative; height: 37px; border: 1px solid #253650; border-radius: 9px; background: #09111e; overflow: hidden; }
.session-day-grid { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(25% - 1px), rgba(139,158,189,.14) calc(25% - 1px), rgba(139,158,189,.14) 25%); }
.session-day-active { position: absolute; top: 8px; bottom: 8px; min-width: 3px; border-radius: 6px; background: linear-gradient(90deg, #5b8cff, #8d69ff); box-shadow: 0 0 18px rgba(91,140,255,.38); }
.session-day-active.live { background: linear-gradient(90deg, #36c88e, #55e5b0); box-shadow: 0 0 18px rgba(61,213,152,.35); }
.session-day-hours { position: absolute; inset: auto 5px 2px; display: flex; justify-content: space-between; pointer-events: none; color: #53627a; font-size: 7px; }
.session-timeline-note { margin: 12px 0 0; color: #697991; font-size: 8px; }
.session-detail-meta { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding: 0 24px 24px; }
.session-detail-meta > div { min-width: 0; padding: 11px 13px; border: 1px solid var(--line-soft); border-radius: 11px; background: rgba(255,255,255,.014); }
.session-detail-meta span { display: block; color: var(--muted); font-size: 8px; }
.session-detail-meta code { display: block; margin-top: 4px; overflow: auto; color: #aebbd0; font-size: 9px; white-space: nowrap; }
@media (max-width: 760px) {
  .session-modal { padding: 8px; }
  .session-modal-dialog { max-height: calc(100vh - 16px); border-radius: 15px; }
  .session-detail-summary, .session-detail-meta { grid-template-columns: 1fr 1fr; padding-left: 13px; padding-right: 13px; }
  .session-timeline-section { margin-left: 13px; margin-right: 13px; }
  .session-day-row { grid-template-columns: 1fr; gap: 5px; }
}
@media (max-width: 480px) {
  .session-detail-summary, .session-detail-meta { grid-template-columns: 1fr; }
  .history-tabs { width: 100%; }
  .history-tab { flex: 1; }
}


/* user duration donut legend v1 */
.donut-hole-empty {
  display: block;
}

.legend-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.legend-row .legend-copy > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}

.user-duration-legend {
  align-items: start;
  padding: 3px 0;
}

.user-duration-legend > i {
  margin-top: 3px;
}

.user-duration-legend .legend-copy small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  white-space: nowrap;
}

.user-duration-legend > strong {
  padding-top: 1px;
  color: var(--text-2);
  font-size: 10px;
}


/* dashboard auth logout v1 */
.dashboard-auth-logout {
  position: static;
  z-index: auto;
  flex: 0 0 auto;
  min-width: 72px;
  height: 36px;
  margin: 0;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: rgba(15, 19, 31, .9);
  color: var(--text-2, #d9ddeb);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  backdrop-filter: blur(12px);
  white-space: nowrap;
}

.dashboard-auth-logout:hover {
  border-color: rgba(126, 146, 255, .45);
  color: var(--text-1, #fff);
}

.dashboard-auth-logout:disabled {
  cursor: wait;
  opacity: .65;
}

@media (max-width: 720px) {
  .dashboard-auth-logout {
    min-width: 62px;
    padding: 0 10px;
    font-size: 10px;
  }
}


/* active session termination controls v1 */
.active-card-head {
  justify-content: space-between;
}

.active-card-user {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.active-card-identity {
  min-width: 0;
}

.session-stop-button {
  flex: 0 0 auto;
  min-width: 54px;
  height: 31px;
  padding: 0 11px;
  border: 1px solid rgba(255, 105, 120, .38);
  border-radius: 9px;
  background: rgba(255, 86, 105, .09);
  color: #ff9ba6;
  font: inherit;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.session-stop-button:hover {
  border-color: rgba(255, 105, 120, .7);
  background: rgba(255, 86, 105, .16);
  color: #ffd2d7;
}

.session-stop-button.compact {
  min-width: 46px;
  height: 27px;
  padding: 0 9px;
  font-size: 8px;
}

.session-stop-button:disabled {
  cursor: wait;
  opacity: .55;
}

.session-stop-unavailable {
  color: var(--muted);
}
