/* Framed sheet (100% desktop-first) — Riot Games .zip archive viewer */

:root {
  --ground: #f9fbfc;
  --surface: #ffffff;
  --raised: #f4f6f8;
  --active: #ebedee;
  --border: #e8eaec;
  --rule: #f0f1f2;
  --control: #cdced1;
  --text: #131416;
  --muted: #5d5f60;
  --faint: #6b6e70;

  --accent: #c81e2b;
  --primary: #131416;
  --primary-ink: #ffffff;
  --positive: #1e7b4f;
  --negative: #c4242a;
  --warning: #92400e;

  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e;
  --pill-neutral-bg: #ebedee; --pill-neutral-ink: #353736;

  --chart-1: #c81e2b;
  --chart-2: #2f70bb;
  --chart-3: #a86f0c;
  --chart-muted: #cfd3d6;
  --chart-mark: #131416;
  --chart-span: 0.06;
  --grid: var(--rule);
  --axis-ink: var(--muted);
  --ink: var(--text);

  --font: "IBM Plex Sans", Inter, system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  --fs-title: 22px;
  --fs-section: 16px;
  --fs-kpi: 26px;
  --fs-body: 14px;
  --fs-small: 12px;

  --sidebar-width: 228px;
  --pad: 24px;
  --gap: 24px;
  --card-pad: 20px;
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-sheet: 16px;
  --sheet-inset: 8px;
  --control-height: 32px;
  --row-height: 48px;
  --nav-row: 34px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-press: 120ms;
  --t-hover: 150ms;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2.5 8 6l-3.5 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 var(--fs-body)/20px var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num, table, .kpi-value { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- Upload landing (framed-sheet desktop-first) ---------- */
.upload-screen {
  min-height: 100svh;
  padding: var(--sheet-inset);
  display: flex;
  flex-direction: column;
}
.upload-topbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.upload-sheet {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 40px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}
.upload-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 48px;
  align-items: center;
}
.upload-intro h1 {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}
.upload-scope {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.upload-scope-item {
  padding: 16px 18px;
}
.upload-scope-item + .upload-scope-item {
  border-left: 1px solid var(--border);
}
.upload-scope-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}
.upload-scope-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.upload-intro p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  max-width: 52ch;
}
.upload-steps {
  margin-top: 24px;
  border-top: 1px solid var(--rule);
}
.upload-step {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.upload-step-name { font-weight: 500; color: var(--text); }
.upload-step-note { font-size: 13px; color: var(--muted); text-align: right; }

.dropzone {
  border: 1px dashed var(--control);
  border-radius: var(--radius-card);
  background: var(--ground);
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  transition: border-color var(--t-hover) ease, background-color var(--t-hover) ease;
}
.dropzone.dragover {
  border-color: var(--accent);
  background: #fdf6f6;
}
.dropzone-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.dropzone-hint {
  font-size: 13px;
  color: var(--muted);
}
.dropzone-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.upload-error {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: var(--pill-negative-bg);
  color: var(--pill-negative-ink);
  font-size: 13px;
}
.privacy-note {
  font-size: var(--fs-small);
  color: var(--faint);
}

/* ---------- L-frame dashboard shell (desktop-first) ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100svh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  overflow: auto;
  background: var(--ground);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 14px;
}
.brand-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
}
.brand-scope {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar .group-label {
  margin: 12px 8px 4px;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--faint);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: var(--nav-row);
  padding: 0 8px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item[aria-current="page"] {
  background: var(--active);
  color: var(--text);
  font-weight: 500;
}

.sidebar .bottom {
  margin-top: auto;
  padding: 12px 8px 4px;
  display: grid;
  gap: 10px;
  font-size: var(--fs-small);
  color: var(--faint);
  line-height: 1.45;
}

.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 var(--sheet-inset) var(--sheet-inset) 0;
}

.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px 0 4px;
  background: var(--ground);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.topbar-search {
  width: min(460px, 100%);
  height: var(--control-height);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 13px;
}
.topbar-search::placeholder { color: var(--faint); }
.topbar-meta {
  font-size: var(--fs-small);
  color: var(--muted);
  white-space: nowrap;
}

.sheet {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  padding: var(--pad);
}

.view { display: none; }
.view.active { display: block; }

.title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.title-row h1 {
  font-size: var(--fs-title);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.title-row .sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--fs-body);
}

/* ---------- KPI strip ---------- */
.kpis {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
}
.kpi { padding: 16px 18px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--muted);
}
.kpi-value {
  margin-top: 6px;
  font-size: clamp(19px, 1.95vw, 26px);
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
}
.kpi-value.money { font-weight: 600; }
.kpi-value small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 3px;
}
.kpi-sub {
  margin-top: 4px;
  font-size: var(--fs-small);
  color: var(--muted);
}

/* ---------- panels and grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.grid:last-child { margin-bottom: 0; }
.grid.top { align-items: start; }

.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--card-pad);
  min-width: 0;
}
.panel.standalone { margin-bottom: var(--gap); }
.panel.standalone:last-child { margin-bottom: 0; }

.panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 16px;
}
.panel h2 {
  font-size: var(--fs-section);
  line-height: 1.3;
  font-weight: 600;
  color: var(--text);
}
.panel .meta {
  color: var(--muted);
  font-size: var(--fs-small);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: var(--fs-small);
  font-weight: 500;
  cursor: pointer;
  text-underline-offset: 3px;
}
.card-link::after {
  content: "";
  width: 12px;
  height: 12px;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--chevron) center / 12px no-repeat;
  mask: var(--chevron) center / 12px no-repeat;
}
.card-link:hover { text-decoration: underline; }

.rows { display: grid; }
.row-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}
.row-item + .row-item { border-top: 1px solid var(--rule); }
.row-title { font-weight: 500; color: var(--text); }
.row-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.row-aside {
  flex: none;
  text-align: right;
  font-size: var(--fs-small);
  color: var(--muted);
  white-space: nowrap;
}

.table-wrap { overflow-x: auto; }
.table-scroll { max-height: 440px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  height: 36px;
  padding: 0 12px;
  text-align: left;
  font-weight: 500;
  font-size: var(--fs-small);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}
.table-scroll th { position: sticky; top: 0; z-index: 2; }
td {
  padding: calc((var(--row-height) - 20px) / 2) 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
  font-size: var(--fs-body);
}
tbody tr:last-child td { border-bottom: 0; }
th.n, td.n { text-align: right; }

.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: var(--fs-small);
  font-weight: 500;
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-ink);
  white-space: nowrap;
}
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.input, select.input {
  height: var(--control-height);
  padding: 0 10px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 13px;
}
.input::placeholder { color: var(--faint); }

.segmented {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  padding: 2px;
  border-radius: 8px;
  background: var(--raised);
}
.segmented button {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-height);
  padding: 0 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--control);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: transparent;
}
.btn.primary:hover { background: #26282c; }

/* ---------- 7x24 activity matrix ---------- */
.hm-wrap { overflow-x: auto; }
.hm-grid {
  display: grid;
  grid-template-columns: 72px repeat(24, minmax(18px, 1fr));
  gap: 3px;
  align-items: center;
  min-width: 600px;
}
.hm-hour {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hm-day {
  font-size: 12px;
  color: var(--muted);
  padding-right: 6px;
}
.hm-cell {
  height: 24px;
  border-radius: 3px;
  border: 1px solid var(--rule);
  cursor: default;
}
.hm-cell:hover { border-color: var(--text); }
.hm-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-small);
  color: var(--muted);
}
.hm-swatches { display: inline-flex; gap: 2px; }
.hm-swatches span {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid var(--rule);
  display: inline-block;
}

.panel-foot {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-small);
  color: var(--muted);
}

.empty {
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 16px;
  border: 1px dashed var(--control);
  border-radius: var(--radius-control);
  color: var(--muted);
  text-align: center;
}

/* Desktop-first safety stack only for tighter laptop windows (< 1160px) */
@media (max-width: 1160px) {
  .col-4, .col-5, .col-7, .col-8 { grid-column: span 12; }
  .upload-sheet { padding: 32px; gap: 28px; }
  .upload-hero { grid-template-columns: 1fr; gap: 28px; }
  .upload-scope { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upload-scope-item:nth-child(3) { border-left: 0; }
  .upload-scope-item:nth-child(n + 3) { border-top: 1px solid var(--border); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
