:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #fbfcfd;
  --surface-2: #eceff3;
  --surface-3: #e2e6eb;
  --text: #171a1f;
  --muted: #626a76;
  --faint: #8b929d;
  --line: #d7dce2;
  --line-strong: #bdc4ce;
  --accent: #2459d3;
  --accent-soft: #e5ebfb;
  --accent-text: #173f9d;
  --danger: #b4232f;
  --danger-soft: #fce8e9;
  --danger-line: #e9aeb3;
  --success: #287a4b;
  --success-soft: #e5f3ea;
  --shadow: 0 16px 42px rgba(41, 47, 58, 0.12);
  --radius: 6px;
  --sidebar: 260px;
  --topbar: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121417;
  --surface: #191c20;
  --surface-2: #22262b;
  --surface-3: #2b3037;
  --text: #edf0f4;
  --muted: #a8afb9;
  --faint: #747c88;
  --line: #30353c;
  --line-strong: #434a54;
  --accent: #7ca0f9;
  --accent-soft: #202d4e;
  --accent-text: #b9cbff;
  --danger: #ff8992;
  --danger-soft: #3a2025;
  --danger-line: #7d3b43;
  --success: #79c995;
  --success-soft: #1d3527;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0;
}

button, input, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 2px;
}

.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;
}

.is-hidden { display: none !important; }

.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  grid-template-rows: var(--topbar) minmax(0, 1fr);
}

.app-shell.is-guest { grid-template-columns: minmax(0, 1fr); }
.app-shell.is-guest .sidebar { display: none; }
.app-shell.is-guest .workspace { grid-column: 1; }

.topbar {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  height: var(--topbar);
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--surface);
  font-weight: 750;
  font-size: 16px;
}

.brand > span:last-child { display: flex; align-items: baseline; gap: 8px; }
.brand strong { font-size: 15px; letter-spacing: 0; }
.brand small { color: var(--muted); font-size: 12px; }

.top-actions { display: flex; align-items: center; gap: 8px; }
.sync-copy { margin-right: 4px; color: var(--muted); font-size: 12px; }

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background 150ms ease, border-color 150ms ease, transform 100ms ease;
}

.icon-button:hover { background: var(--surface-2); border-color: var(--line-strong); }
.icon-button:active, .primary-button:active, .secondary-button:active { transform: translateY(1px); }

.sidebar {
  grid-column: 1;
  grid-row: 2;
  position: sticky;
  top: var(--topbar);
  height: calc(100dvh - var(--topbar));
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 18px 10px;
  color: var(--muted);
  font-size: 12px;
}

.archive-tree { padding: 2px 10px 16px; }

.person-group { margin: 5px 0 12px; }

.person-label {
  display: grid;
  grid-template-columns: 16px 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
}

.person-label::-webkit-details-marker { display: none; }
.person-label:hover { background: var(--surface-2); }
.person-main { min-width: 0; }
.person-label strong, .person-label small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-label strong { font-size: 13px; font-weight: 650; }
.person-label small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.person-chevron {
  width: 16px;
  color: var(--faint);
  font-size: 17px;
  line-height: 1;
  text-align: center;
  transform: rotate(0deg);
  transform-origin: center;
  transition: transform 150ms ease;
}
.person-group[open] .person-chevron { transform: rotate(90deg); }

.year-list { padding-top: 2px; }

.year-group { margin: 2px 0; }

.year-label {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 9px 5px 33px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
}

.year-label::-webkit-details-marker { display: none; }
.year-label:hover { background: var(--surface-2); }
.year-label .device-count { margin-left: auto; }
.year-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.year-chevron {
  width: 14px;
  color: var(--faint);
  font-size: 15px;
  line-height: 1;
  text-align: center;
  transform: rotate(0deg);
  transform-origin: center;
  transition: transform 150ms ease;
}
.year-group[open] .year-chevron { transform: rotate(90deg); }

.day-list { padding: 2px 0 0 53px; }

.day-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: left;
  cursor: pointer;
}

.day-link:hover { background: var(--surface-2); }
.day-link.is-active { background: var(--accent-soft); color: var(--accent-text); }
.day-link.has-warning:not(.is-active) { background: color-mix(in srgb, var(--danger-soft) 65%, transparent); }
.day-date { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.day-link:active, .home-card:active { transform: translateY(1px); }

.device-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.device-count { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.device-tail { display: inline-flex; align-items: center; gap: 6px; }
.warning-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.workspace {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: calc(100dvh - var(--topbar));
  padding: 32px clamp(20px, 3vw, 48px) 72px;
}

.status-state {
  min-height: calc(100dvh - var(--topbar) - 104px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.home-state { max-width: 1100px; margin: 0 auto; }
.home-header { margin-bottom: 22px; }

.login-state { min-height: calc(100dvh - var(--topbar) - 104px); display: grid; place-items: center; }
.login-card {
  width: min(340px, 100%);
  display: grid;
  gap: 13px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card .home-eyebrow { margin: 0; }
.login-field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.login-field input {
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}
.login-error { margin: 0; color: var(--danger); font-size: 12px; }
.login-card .primary-button { width: 100%; }
.home-eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 700; }
.home-header h1 { margin: 0; font-size: clamp(22px, 2.4vw, 28px); letter-spacing: 0; line-height: 1.2; }
.home-sub { display: block; max-width: 480px; margin-top: 12px; color: var(--muted); line-height: 1.7; }

.home-metrics { display: flex; align-items: center; margin: 0 0 22px; }
.home-metrics .metric:first-child { padding-left: 0; border-left: 0; }

.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }

.home-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.home-card:hover { background: var(--surface-2); }
.home-card.has-warning { background: color-mix(in srgb, var(--danger-soft) 65%, transparent); border-color: var(--danger-line); }
.home-card .device-avatar { width: 34px; height: 34px; }
.home-card-main { min-width: 0; }
.home-card-main strong, .home-card-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-card-main strong { font-size: 13px; font-weight: 650; }
.home-card-main small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.home-card-status { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-card-status.is-warning { color: var(--danger); }

.device-view { max-width: 1500px; margin: 0 auto; }

.device-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: stretch;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.device-overview {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(230px, 0.72fr);
  gap: clamp(24px, 3vw, 48px);
  align-items: start;
}

.date-line { margin: 0 0 7px; color: var(--accent); font-size: 12px; font-weight: 700; }
.device-title-block h1 { margin: 0; font-size: clamp(28px, 4vw, 46px); line-height: 1.08; letter-spacing: 0; }
.profile-list { display: grid; gap: 7px; margin: 17px 0 0; }
.profile-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 10px; align-items: start; }
.profile-row dt { color: var(--faint); font-size: 11px; line-height: 1.65; }
.profile-row dd { min-width: 0; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }

.client-status {
  min-width: 0;
  margin-top: 27px;
  padding-left: 24px;
  border-left: 1px solid var(--line);
}
.client-status-heading { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 10px; }
.client-status-heading > span { color: var(--faint); font-size: 11px; }
.status-value { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.status-value i { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--faint) 16%, transparent); }
.status-value.is-online { color: var(--success); }
.status-value.is-online i { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 16%, transparent); }
.status-value.is-offline { color: var(--danger); }
.status-value.is-offline i { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent); }
.client-status-list { display: grid; gap: 6px; margin: 14px 0 12px; }
.client-status-list > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; }
.client-status-list dt { color: var(--faint); font-size: 11px; }
.client-status-list dd { min-width: 0; margin: 0; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.metric-strip { align-self: end; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(76px, auto); }
.metric { padding: 0 18px; border-left: 1px solid var(--line); }
.metric strong { display: block; font-family: "SFMono-Regular", Consolas, monospace; font-size: 22px; font-variant-numeric: tabular-nums; }
.metric span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.metric-risk.has-risk strong, .metric-risk.has-risk span { color: var(--danger); }

.control-bar {
  position: sticky;
  top: var(--topbar);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px);
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.segmented button {
  min-width: 66px;
  min-height: 32px;
  padding: 5px 14px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(31, 37, 46, 0.12); }

.control-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }

.search-field {
  width: min(310px, 38vw);
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-field input::placeholder { color: var(--faint); opacity: 1; }

.content-section { padding: 24px 0 18px; }
.content-section + .content-section { border-top: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: 0; }
.section-heading span { color: var(--muted); font-size: 12px; }

.report-list { display: grid; gap: 8px; }
.report-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.report-row.has-warning { border-color: var(--danger-line); }

.file-mark { display: grid; place-items: center; width: 38px; height: 42px; border-radius: 3px; background: var(--accent-soft); color: var(--accent-text); font-size: 10px; font-weight: 750; }
.report-copy { min-width: 0; }
.report-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.report-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.report-title-line { display: flex; align-items: center; gap: 9px; min-width: 0; }
.report-title-line strong { min-width: 0; }
.risk-badge {
  flex: 0 0 auto;
  display: inline-flex !important;
  align-items: center;
  min-height: 20px;
  margin: 0 !important;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px !important;
  font-weight: 700;
}
.risk-badge.is-warning { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.risk-badge.is-clear { border-color: color-mix(in srgb, var(--success) 35%, var(--line)); background: var(--success-soft); color: var(--success); }
.risk-badge.is-unknown { background: var(--surface-2); color: var(--muted); }
.report-actions { display: flex; gap: 8px; }

.conclusion {
  margin: 8px 0 4px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.conclusion.has-warning { border-color: var(--danger-line); background: color-mix(in srgb, var(--danger-soft) 45%, transparent); }
.conclusion .section-heading { margin-bottom: 10px; }
.conclusion .section-heading h2 { font-size: 15px; }
.conclusion-summary { margin: 0; line-height: 1.8; }
.conclusion-risk { margin: 10px 0 0; color: var(--danger); font-weight: 650; line-height: 1.6; }
.conclusion-estimates { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }

.duration-bar { display: flex; height: 10px; overflow: hidden; border-radius: var(--radius); background: var(--surface-3); }
.duration-segment { display: block; min-width: 2px; }
.duration-shade-0 { background: color-mix(in srgb, var(--accent) 92%, var(--surface-3)); }
.duration-shade-1 { background: color-mix(in srgb, var(--accent) 70%, var(--surface-3)); }
.duration-shade-2 { background: color-mix(in srgb, var(--accent) 50%, var(--surface-3)); }
.duration-shade-3 { background: color-mix(in srgb, var(--accent) 34%, var(--surface-3)); }
.duration-shade-4 { background: color-mix(in srgb, var(--accent) 22%, var(--surface-3)); }
.duration-shade-rest { background: var(--surface-3); }
.dw-5 { width: 5%; }
.dw-10 { width: 10%; }
.dw-15 { width: 15%; }
.dw-20 { width: 20%; }
.dw-25 { width: 25%; }
.dw-30 { width: 30%; }
.dw-35 { width: 35%; }
.dw-40 { width: 40%; }
.dw-45 { width: 45%; }
.dw-50 { width: 50%; }
.dw-55 { width: 55%; }
.dw-60 { width: 60%; }
.dw-65 { width: 65%; }
.dw-70 { width: 70%; }
.dw-75 { width: 75%; }
.dw-80 { width: 80%; }
.dw-85 { width: 85%; }
.dw-90 { width: 90%; }
.dw-95 { width: 95%; }
.dw-100 { width: 100%; }
.duration-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 7px; }
.duration-legend li { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.duration-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 2px; }
.duration-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duration-value { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.timeline-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: var(--radius);
  font-size: 12px;
}
.timeline-item.is-app { cursor: pointer; }
.timeline-item.is-app:hover { background: var(--surface-2); }
.timeline-item.is-app:active { transform: translateY(1px); }
.timeline-item.is-away { background: var(--surface-2); color: var(--muted); }
.timeline-time {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.timeline-main { min-width: 0; }
.timeline-main strong, .timeline-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-main strong { font-size: 12px; font-weight: 650; }
.timeline-main small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.timeline-duration { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }

.timeline-fragments { margin: 0; }
.timeline-item.is-fragments { grid-template-columns: 14px 52px minmax(0, 1fr) auto; cursor: pointer; list-style: none; }
.timeline-item.is-fragments:hover { background: var(--surface-2); }
.timeline-item.is-fragments::-webkit-details-marker { display: none; }
.timeline-chevron {
  width: 14px;
  color: var(--faint);
  font-size: 15px;
  line-height: 1;
  text-align: center;
  transform: rotate(0deg);
  transform-origin: center;
  transition: transform 150ms ease;
}
.timeline-fragments[open] .timeline-chevron { transform: rotate(90deg); }
.timeline-sublist {
  list-style: none;
  margin: 2px 0 6px;
  padding: 0 0 0 62px;
  display: grid;
  gap: 2px;
  color: var(--muted);
}
.timeline-sublist li { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; padding: 3px 9px; font-size: 11px; }
.timeline-subname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.primary-button, .secondary-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 13px;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 100ms ease, background 150ms ease, border-color 150ms ease;
}

.primary-button { border: 1px solid var(--accent); background: var(--accent); color: #f7f9ff; }
.primary-button:hover { background: color-mix(in srgb, var(--accent) 88%, #101217); }
.primary-button:disabled, .secondary-button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.secondary-button:hover { border-color: var(--line-strong); background: var(--surface-2); }

.program-group { margin-top: 26px; }
.program-group:first-child { margin-top: 0; }
.program-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.program-heading h3 { margin: 0; font-size: 14px; font-weight: 700; }
.program-heading span { color: var(--muted); font-size: 11px; }

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 12px;
}

.program-footer { display: flex; justify-content: center; margin-top: 14px; }
.program-toggle-button { min-width: 154px; }

.screenshot-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.screenshot-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.screenshot-card:active { transform: translateY(0); }
.screenshot-frame { aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.screenshot-frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.screenshot-frame img.is-broken { display: none; }
.image-error { width: 100%; height: 100%; display: none; place-items: center; color: var(--danger); font-size: 12px; }
.image-error.is-visible { display: grid; }
.screenshot-info { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 11px; }
.screenshot-info time { color: var(--text); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; font-variant-numeric: tabular-nums; }
.screenshot-info span { color: var(--muted); font-size: 11px; }

.empty-state { padding: 64px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 7px; color: var(--text); font-size: 16px; }
.empty-state p { margin: 0; }

.status-mark { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 18px; border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line)); border-radius: var(--radius); color: var(--danger); font-size: 22px; font-weight: 700; }
.status-state h2 { margin: 0; font-size: 22px; }
.status-state p { max-width: 520px; margin: 9px 0 20px; color: var(--muted); line-height: 1.6; }

.preview-dialog {
  width: min(1180px, calc(100vw - 36px));
  max-width: none;
  max-height: calc(100dvh - 36px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.preview-dialog::backdrop { background: rgba(12, 15, 20, 0.72); backdrop-filter: blur(5px); }
.dialog-shell { min-height: min(760px, calc(100dvh - 38px)); display: grid; grid-template-rows: auto minmax(0, 1fr); }
.dialog-header { min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dialog-header > div:first-child { min-width: 0; }
.dialog-header p { margin: 0 0 3px; color: var(--muted); font-size: 11px; }
.dialog-header h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.dialog-actions { display: flex; gap: 8px; }
.dialog-body { min-height: 0; overflow: auto; display: grid; place-items: center; background: var(--surface-2); }
.timeline-dialog { place-self: stretch; padding: 18px; background: var(--surface); }
.dialog-body > img { display: block; max-width: 100%; max-height: calc(100dvh - 116px); object-fit: contain; }

.report-preview { width: 100%; height: 100%; align-self: stretch; padding: 18px; overflow: auto; background: var(--surface); }
.sheet-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.sheet-tab { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); cursor: pointer; }
.sheet-tab.is-active { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.excel-table { width: 100%; border-collapse: collapse; table-layout: auto; font-size: 12px; }
.excel-table td { min-width: 110px; max-width: 620px; padding: 9px 11px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.excel-table tr:first-child td { font-weight: 650; background: var(--surface-2); }
.excel-table tr:last-child td { border-bottom: 0; }
.excel-table td:last-child { border-right: 0; }

.loading-layout { padding-top: 26px; }
.skeleton { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--surface-2); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 65%, transparent), transparent); animation: shimmer 1.4s infinite; }
.skeleton-title { width: 180px; height: 24px; margin-bottom: 18px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.skeleton-image { aspect-ratio: 16 / 10; }

.mobile-only, .mobile-scrim { display: none; }

@keyframes shimmer { to { transform: translateX(100%); } }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121417;
    --surface: #191c20;
    --surface-2: #22262b;
    --surface-3: #2b3037;
    --text: #edf0f4;
    --muted: #a8afb9;
    --faint: #747c88;
    --line: #30353c;
    --line-strong: #434a54;
    --accent: #7ca0f9;
    --accent-soft: #202d4e;
    --accent-text: #b9cbff;
    --danger: #ff8992;
    --danger-soft: #3a2025;
    --danger-line: #7d3b43;
    --success: #79c995;
    --success-soft: #1d3527;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 1199px) {
  .device-header { grid-template-columns: minmax(0, 1fr); }
  .metric-strip { width: 100%; grid-auto-columns: 1fr; padding-top: 4px; }
  .metric:first-child { padding-left: 0; border-left: 0; }
}

@media (max-width: 767px) {
  :root { --topbar: 58px; }
  .app-shell { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; }
  .mobile-only { display: inline-grid; }
  .brand { margin-right: auto; margin-left: 9px; }
  .brand small, .sync-copy { display: none; }
  .sidebar { position: fixed; z-index: 30; top: var(--topbar); bottom: 0; left: 0; width: min(88vw, 310px); height: auto; transform: translateX(-102%); transition: transform 180ms ease; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-scrim { position: fixed; z-index: 25; inset: var(--topbar) 0 0; background: rgba(12, 15, 20, 0.58); }
  .mobile-scrim.is-visible { display: block; }
  .workspace { grid-column: 1; padding: 22px 14px 54px; }
  .status-state { min-height: calc(100dvh - var(--topbar) - 76px); }
  .device-header { grid-template-columns: 1fr; align-items: start; gap: 20px; }
  .device-overview { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .client-status { margin-top: 0; padding: 18px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .metric-strip { grid-auto-flow: column; grid-auto-columns: 1fr; }
  .metric:first-child { padding-left: 0; border-left: 0; }
  .metric { padding: 0 8px; }
  .control-bar { top: var(--topbar); align-items: stretch; flex-direction: column; }
  .segmented { align-self: start; }
  .control-actions { width: 100%; }
  .control-actions .primary-button { flex: 0 0 auto; }
  .search-field { width: 100%; }
  .screenshot-grid { grid-template-columns: 1fr; }
  .report-row { grid-template-columns: 38px minmax(0, 1fr); }
  .report-actions { grid-column: 1 / -1; }
  .report-actions > * { flex: 1; }
  .report-title-line { align-items: flex-start; flex-direction: column; gap: 5px; }
  .dialog-header { align-items: flex-start; }
  .dialog-header .secondary-button { width: 36px; overflow: hidden; padding: 7px 9px; color: transparent; position: relative; }
  .dialog-header .secondary-button::after { content: "↓"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--text); font-size: 17px; }
  .preview-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .dialog-shell { min-height: calc(100dvh - 18px); }
  .skeleton-grid { grid-template-columns: 1fr; }
  .skeleton-grid > :nth-child(n+2) { display: none; }
}
