/* PET OPS dark admin UI */

:root,
:root[data-theme="dark"] {
  --bg: #0b0d14;
  --bg-soft: #10121d;
  --sidebar: #131321;
  --sidebar-2: #171729;
  --topbar: #1a1a2d;
  --panel: #202036;
  --panel-2: #24243d;
  --panel-3: #171729;
  --input: #19192d;
  --text: #f5f7ff;
  --text-secondary: #c8d2e7;
  --muted: #8490ad;
  --line: rgba(120, 120, 170, 0.22);
  --line-strong: rgba(140, 140, 190, 0.34);
  --brand: #8b5cf6;
  --brand-hover: #a374ff;
  --cyan: #2dd4bf;
  --green: #55d6a8;
  --amber: #f3c74f;
  --red: #ef6b5b;
  --blue: #7dd3fc;
  --purple: #8b5cf6;
  --chart-grid: rgba(150, 150, 190, 0.16);
  --sidebar-expanded-width: 255px;
  --sidebar-collapsed-width: 72px;
  --sidebar-width: var(--sidebar-expanded-width);
  --radius: 12px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.18);
  --transition: 0.18s ease;
}

:root[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-soft: #eef1f7;
  --sidebar: #ffffff;
  --sidebar-2: #f7f8fc;
  --topbar: #ffffff;
  --panel: #ffffff;
  --panel-2: #f9fafc;
  --panel-3: #eef2f9;
  --input: #ffffff;
  --text: #101525;
  --text-secondary: #3c4861;
  --muted: #69738a;
  --line: rgba(40, 52, 80, 0.14);
  --line-strong: rgba(40, 52, 80, 0.24);
  --chart-grid: rgba(40, 52, 80, 0.12);
  --shadow: 0 18px 42px rgba(25, 40, 80, 0.10);
  --shadow-soft: 0 8px 24px rgba(25, 40, 80, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

a {
  color: var(--brand-hover);
  text-decoration: none;
}

a:hover {
  color: var(--cyan);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

svg {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.22s ease;
}

.app-shell:has(.sidebar:hover),
.app-shell:has(.sidebar:focus-within) {
  grid-template-columns: var(--sidebar-expanded-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-collapsed-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--sidebar) 0%, #10101c 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: width 0.22s ease, padding 0.22s ease;
}

.sidebar:hover,
.sidebar:focus-within {
  width: var(--sidebar-expanded-width);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 28px;
  padding: 0 4px;
  overflow: hidden;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: linear-gradient(135deg, #7dd3fc 0%, #8b5cf6 52%, #f3c74f 100%);
  color: #071019;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(139, 92, 246, 0.22);
}

.brand strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  line-height: 1.1;
  font-weight: 800;
  white-space: nowrap;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.brand > div {
  min-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.sidebar:hover .brand > div,
.sidebar:focus-within .brand > div {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.sidebar-nav {
  display: grid;
  gap: 7px;
  align-content: start;
  flex: 1;
}

.nav-section {
  margin: 14px 8px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.sidebar:hover .nav-section,
.sidebar:focus-within .nav-section {
  opacity: 1;
}

.sidebar nav a {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar nav a.active {
  color: #ffffff;
  background: linear-gradient(90deg, #6366f1 0%, #a855f7 100%);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar nav a.is-disabled {
  opacity: 0.58;
  cursor: default;
}

.nav-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  overflow: hidden;
  color: currentColor;
  opacity: 0.95;
}

.nav-icon svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  display: block;
}

.nav-label {
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.sidebar:hover .nav-label,
.sidebar:focus-within .nav-label {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.sidebar-points-card {
  min-height: 48px;
  margin-top: 14px;
  padding: 9px 10px;
  border: 1px solid rgba(243, 199, 79, 0.24);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(243, 199, 79, 0.12), rgba(139, 92, 246, 0.12));
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  transition: border-color var(--transition), background var(--transition);
}

.sidebar-points-card:hover {
  color: var(--text);
  border-color: rgba(243, 199, 79, 0.48);
  background: linear-gradient(135deg, rgba(243, 199, 79, 0.18), rgba(139, 92, 246, 0.17));
}

.sidebar-points-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: grid;
  place-items: center;
  color: var(--amber);
}

.sidebar-points-copy {
  min-width: 145px;
  display: grid;
  gap: 1px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.sidebar:hover .sidebar-points-copy,
.sidebar:focus-within .sidebar-points-copy {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.sidebar-points-copy small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-points-copy strong {
  color: var(--amber);
  font-size: 14px;
  white-space: nowrap;
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 300;
  height: 70px;
  min-height: 70px;
  padding: 14px 24px;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 520px) minmax(0, 1fr);
  align-items: center;
  justify-content: center;
  gap: 18px;
  overflow: visible;
}

.topbar-search {
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  width: 100%;
  max-width: 520px;
}

.search-shell {
  width: 100%;
  min-height: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: var(--input);
  border-radius: 9px;
  color: var(--muted);
  overflow: hidden;
}

.search-shell svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  min-width: 18px;
}

.search-shell input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.search-shell kbd {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.topbar-right {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  overflow: visible;
}

.topbar-time {
  color: var(--muted);
  font-size: 13px;
}

.live-badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(45, 212, 191, 0.34);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(45, 212, 191, 0.08);
  font-size: 12px;
  font-weight: 700;
}

.live-badge i,
.scope-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.user-pill {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 800;
}

.profile-menu {
  position: relative;
  z-index: 320;
}

.profile-trigger {
  min-height: 40px;
  padding: 3px 10px 3px 3px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--line-strong);
  border-radius: 999px;
}

.profile-trigger.avatar-trigger {
  width: 42px;
  min-width: 42px;
  padding: 3px;
  justify-content: center;
}

.profile-trigger:hover {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.48);
}

.profile-trigger-text {
  display: grid;
  gap: 1px;
  padding-right: 3px;
  text-align: left;
}

.profile-trigger-text strong {
  max-width: 150px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-trigger-text small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 340;
  width: 180px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.language-switcher {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.language-switcher a {
  color: var(--muted);
}

.language-switcher a.active,
.language-switcher a:hover {
  color: var(--text);
}

.profile-dropdown.active {
  display: grid;
  gap: 4px;
}

.profile-dropdown-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.profile-dropdown-head strong,
.profile-dropdown-head small {
  display: block;
}

.profile-dropdown-head strong {
  color: var(--text);
  font-size: 13px;
}

.profile-dropdown-head small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.profile-dropdown a {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
}

.profile-dropdown a:hover {
  background: rgba(139, 92, 246, 0.12);
  color: var(--text);
}

.profile-dropdown a.danger-link {
  color: var(--red);
}

.theme-toggle,
.sidebar-toggle {
  min-height: 34px;
  border-radius: 9px;
}

.sidebar-toggle {
  display: none;
  width: 38px;
  flex: 0 0 38px;
  padding: 0;
}

.sidebar-toggle svg {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
}

.content {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 34px 34px 48px;
}

.page-heading {
  margin-bottom: 24px;
}

.page-heading h1,
.ops-hero h1,
.leaderboard-hero h1 {
  color: var(--text);
  font-size: 28px;
  line-height: 1.15;
  font-weight: 850;
}

.page-subtitle,
.ops-hero p,
.leaderboard-hero p,
.panel-header p {
  margin-top: 6px;
  color: var(--muted);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  background: rgba(0, 0, 0, 0.56);
}

.sidebar-overlay.active {
  display: block;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.gap-sm { gap: 12px; }
.grid.gap-lg { gap: 24px; }

.panel,
.card,
.metric-card,
.stat-card,
.toolbar-card,
.kanban-column,
.task-card,
.soft-card,
.insight-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.panel,
.card {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel h2,
.panel h3,
.panel-header h2,
.panel-header h3 {
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 850;
}

.metric-card,
.stat-card {
  min-height: 106px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.metric-icon,
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.metric-icon svg,
.stat-icon svg {
  width: 24px;
  height: 24px;
}

.metric-icon.blue,
.stat-icon.blue { background: rgba(125, 211, 252, 0.12); color: var(--blue); }
.metric-icon.green,
.stat-icon.green { background: rgba(85, 214, 168, 0.12); color: var(--green); }
.metric-icon.amber,
.stat-icon.amber { background: rgba(243, 199, 79, 0.14); color: var(--amber); }
.metric-icon.red,
.stat-icon.red { background: rgba(239, 107, 91, 0.14); color: var(--red); }
.metric-icon.teal,
.stat-icon.teal { background: rgba(45, 212, 191, 0.12); color: var(--cyan); }
.metric-icon.purple,
.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--brand-hover); }

.metric-label,
.stat-body span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value,
.stat-body strong,
.stat strong {
  display: block;
  color: var(--text);
  font-size: 26px;
  line-height: 1.1;
  margin-top: 5px;
  font-weight: 900;
}

.delta,
.stat-body small,
.metric-card small {
  color: var(--muted);
  font-size: 12px;
}

.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

.ops-hero,
.leaderboard-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.scope-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 0 13px;
  border-radius: 999px;
  background: rgba(85, 214, 168, 0.14);
  color: var(--green);
  border: 1px solid rgba(85, 214, 168, 0.22);
  font-size: 12px;
  font-weight: 800;
}

.hero-actions,
.quick-actions,
.topbar-actions,
.actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-actions {
  margin-bottom: 18px;
}

.ops-filter {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #111b18;
}

.ops-filter span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.ops-kpi {
  min-height: 102px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-lg);
  background: #111d18;
}

.ops-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
}

.ops-kpi strong {
  display: block;
  color: var(--text);
  margin-top: 7px;
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
}

.ops-kpi em {
  font-size: 15px;
  font-style: normal;
  margin-left: 3px;
}

.ops-kpi small {
  display: block;
  margin-top: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.accent-cyan { border-left-color: var(--cyan); }
.accent-amber { border-left-color: var(--amber); }
.accent-red { border-left-color: var(--red); }
.accent-green { border-left-color: var(--green); }
.accent-gold { border-left-color: #d9bd4a; }

.dashboard-board {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

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

.chart-panel {
  min-height: 320px;
}

.chart-container {
  position: relative;
  height: 260px;
}

.chart-container.tall {
  height: 300px;
}

.chart-container.medium {
  height: 250px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.dashboard-page {
  display: grid;
  gap: 16px;
}

.dashboard-page .dashboard-hero {
  margin-bottom: 0;
}

.dashboard-page .dashboard-actions .button svg {
  width: 16px !important;
  height: 16px !important;
}

.dashboard-page .dashboard-filter {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 14px 18px;
  align-items: end;
  margin-bottom: 0;
  padding: 18px;
  border-color: rgba(130, 143, 190, 0.26);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(28, 32, 55, 0.86), rgba(20, 24, 43, 0.86)),
    radial-gradient(circle at 12% 0%, rgba(139, 92, 246, 0.12), transparent 34%);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.16);
}

.dashboard-page .dashboard-filter label {
  gap: 7px;
}

.dashboard-page .dashboard-filter span {
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  text-transform: none;
  letter-spacing: 0;
}

.dashboard-page .dashboard-filter input,
.dashboard-page .dashboard-filter select {
  min-height: 38px;
  border-color: rgba(128, 144, 190, 0.28);
  background: rgba(12, 15, 30, 0.62);
}

.dashboard-page .dashboard-filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.dashboard-page .dashboard-filter-actions .button {
  min-width: 150px;
}

.dashboard-page .dashboard-filter-actions .button:first-child {
  border-color: rgba(45, 212, 191, 0.25);
  background: linear-gradient(90deg, #2dd4bf, #7c3aed);
}

.dashboard-page .dashboard-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 0;
}

.dashboard-page .dashboard-kpi {
  min-height: 112px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(130, 143, 190, 0.22);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(31, 36, 62, 0.92), rgba(18, 22, 42, 0.94)),
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.06), transparent 32%);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
}

.dashboard-page .dashboard-kpi-trigger {
  width: 100%;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 13px;
  padding: 15px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  white-space: normal;
}

.dashboard-page .dashboard-kpi-trigger:hover,
.dashboard-page .dashboard-kpi-trigger:focus-visible {
  filter: none;
  background: rgba(139, 92, 246, 0.08);
}

.dashboard-page .dashboard-kpi-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.14);
  color: var(--cyan);
}

.dashboard-page .dashboard-kpi-icon svg {
  width: 22px !important;
  height: 22px !important;
}

.dashboard-page .dashboard-kpi.is-purple .dashboard-kpi-icon { background: rgba(139, 92, 246, 0.18); color: #a78bfa; }
.dashboard-page .dashboard-kpi.is-orange .dashboard-kpi-icon { background: rgba(251, 146, 60, 0.18); color: #fb923c; }
.dashboard-page .dashboard-kpi.is-red .dashboard-kpi-icon { background: rgba(239, 107, 91, 0.18); color: var(--red); }
.dashboard-page .dashboard-kpi.is-green .dashboard-kpi-icon { background: rgba(85, 214, 168, 0.16); color: var(--green); }
.dashboard-page .dashboard-kpi.is-yellow .dashboard-kpi-icon { background: rgba(243, 199, 79, 0.16); color: var(--amber); }
.dashboard-page .dashboard-kpi.is-blue .dashboard-kpi-icon { background: rgba(125, 211, 252, 0.16); color: var(--blue); }

.dashboard-page .dashboard-kpi-body {
  min-width: 0;
  display: block;
}

.dashboard-page .dashboard-kpi-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  text-transform: uppercase;
}

.dashboard-page .dashboard-kpi strong {
  margin-top: 6px;
  font-size: 27px;
}

.dashboard-page .dashboard-kpi small {
  margin-top: 8px;
  color: var(--cyan);
  line-height: 1.25;
}

.dashboard-page .dashboard-board {
  gap: 14px;
}

.span-3 { grid-column: span 3; }

.dashboard-page .dashboard-panel {
  padding: 18px;
  border-color: rgba(130, 143, 190, 0.24);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(31, 36, 62, 0.91), rgba(17, 21, 40, 0.94)),
    radial-gradient(circle at 14% 0%, rgba(139, 92, 246, 0.1), transparent 34%);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
}

.dashboard-page .dashboard-panel .panel-header {
  margin-bottom: 14px;
}

.dashboard-page .dashboard-panel .panel-header h2 {
  font-size: 16px;
}

.dashboard-page .dashboard-panel .panel-header p {
  color: #a6b0cc;
  font-size: 13px;
}

.dashboard-page .chart-container.tall {
  height: 205px;
}

.dashboard-page .chart-panel {
  min-height: 260px;
}

.dashboard-page .dashboard-table-wrap {
  max-height: 220px;
}

.dashboard-page .dashboard-table th,
.dashboard-page .dashboard-table td {
  padding: 8px 9px;
  font-size: 12px;
}

.dashboard-page .dashboard-table th {
  font-size: 10px;
}

.dashboard-page .dashboard-badge-button {
  cursor: pointer;
}

.dashboard-page .dashboard-link-button {
  min-height: auto;
  margin-top: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-size: 12px;
}

.dashboard-page .dashboard-link-button:hover {
  color: #ffffff;
  background: transparent;
}

.dashboard-page .dashboard-bars {
  display: grid;
  gap: 12px;
}

.dashboard-page .dashboard-bar-row {
  min-height: 28px;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 26px;
  gap: 10px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: left;
}

.dashboard-page .dashboard-bar-row:hover {
  color: var(--text);
  background: transparent;
  filter: none;
}

.dashboard-page .dashboard-bar-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-page .dashboard-bar-row i {
  height: 26px;
  display: block;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
}

.dashboard-page .dashboard-bar-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6, #2dd4bf);
}

.dashboard-page .dashboard-donut-wrap {
  width: 100%;
  display: grid;
  place-items: center;
  min-height: 152px;
  padding: 0;
  border: 0;
  background: transparent;
}

.dashboard-page .dashboard-donut-wrap:hover {
  background: transparent;
  filter: none;
}

.dashboard-page .dashboard-donut {
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 18px 38px rgba(139, 92, 246, 0.18);
}

.dashboard-page .dashboard-donut i {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: inherit;
  background: #161b32;
  font-style: normal;
}

.dashboard-page .dashboard-donut strong,
.dashboard-page .dashboard-donut small {
  display: block;
  margin: 0;
  text-align: center;
}

.dashboard-page .dashboard-donut strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.dashboard-page .dashboard-donut small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-page .dashboard-status-list {
  margin-top: 12px;
  gap: 9px;
}

.dashboard-page .status-row {
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.dashboard-page .status-row:hover {
  color: var(--text);
  background: transparent;
  filter: none;
}

.dashboard-empty {
  min-height: 160px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.dashboard-empty h3 {
  color: var(--text-secondary);
  font-size: 15px;
}

.dashboard-empty p {
  color: var(--muted);
}

.dashboard-detail-modal .modal {
  width: min(1080px, 100%);
}

.dashboard-detail-modal .modal-header h2 {
  font-size: 18px;
}

.dashboard-detail-modal .modal-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.dashboard-modal-metric {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.dashboard-modal-metric strong {
  color: var(--text);
  font-size: 30px;
  line-height: 1;
}

.dashboard-modal-metric span {
  color: var(--muted);
}

.dashboard-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.dashboard-modal-grid .quick-stat {
  display: grid;
  gap: 5px;
}

.dashboard-modal-grid .quick-stat span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status-list,
.insight-list {
  display: grid;
  gap: 12px;
}

.status-row,
.insight-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  color: var(--text-secondary);
}

.status-row span,
.insight-row span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.status-row i,
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: inline-block;
}

.status-row strong {
  color: var(--text);
}

.status-row em {
  color: var(--muted);
  font-style: normal;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-3);
}

.table-wrap.seamless {
  border: 0;
  background: transparent;
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.025);
  white-space: nowrap;
}

th.is-sortable {
  cursor: pointer;
  user-select: none;
}

th.has-sort-link {
  padding: 0;
}

th.has-sort-link .table-sort-link {
  min-height: 42px;
  padding: 12px 16px;
  color: inherit;
  display: inline-flex;
  align-items: center;
}

th.has-sort-link .table-sort-link:hover {
  color: var(--text);
}

th.is-sortable::after {
  content: "\2195";
  display: inline-block;
  margin-left: 6px;
  color: var(--text-faint);
  font-size: 10px;
}

th.is-sortable.is-sort-active::after {
  content: "\2191";
  color: var(--cyan);
}

th.is-sortable.is-sort-active.is-sort-desc::after {
  content: "\2193";
}

th.is-sortable:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.table-pagination-controls,
.table-pagination-pages {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.table-pagination-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 850;
  box-shadow: none;
}

.table-pagination-btn:hover:not(:disabled),
.table-pagination-btn.is-active {
  border-color: rgba(45, 212, 191, 0.48);
  background: rgba(45, 212, 191, 0.14);
  color: var(--text);
  filter: none;
}

.table-pagination-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.table-pagination-gap {
  min-width: 18px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 640px) {
  .table-pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-pagination-controls {
    width: 100%;
    justify-content: space-between;
  }

  .table-pagination-pages {
    flex-wrap: wrap;
  }
}

td {
  color: var(--text-secondary);
}

td strong {
  color: var(--text);
}

tr:last-child td {
  border-bottom: 0;
}

tr:hover td {
  background: rgba(139, 92, 246, 0.06);
}

tr.clickable-row {
  cursor: pointer;
}

tr.clickable-row:focus {
  outline: none;
}

tr.clickable-row:focus-visible td {
  background: rgba(139, 92, 246, 0.1);
  box-shadow: inset 0 1px 0 rgba(139, 92, 246, 0.42), inset 0 -1px 0 rgba(139, 92, 246, 0.42);
}

form {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--input);
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

textarea {
  resize: vertical;
  min-height: 92px;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(139, 92, 246, 0.72);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16);
}

select option {
  color: #101525;
  background: #ffffff;
}

input:disabled,
select:disabled,
textarea:disabled {
  color: var(--muted);
  opacity: 0.7;
  cursor: not-allowed;
}

.button,
button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  color: #ffffff;
  padding: 9px 15px;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--transition), border-color var(--transition), filter var(--transition), background var(--transition);
}

.button:hover,
button:hover {
  color: #ffffff;
  filter: brightness(1.08);
}

.button:active,
button:active {
  transform: translateY(1px);
}

.button.secondary,
button.secondary,
.btn-icon,
.theme-toggle,
.sidebar-toggle {
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  border-color: var(--line-strong);
}

.button.secondary:hover,
button.secondary:hover,
.btn-icon:hover,
.theme-toggle:hover,
.sidebar-toggle:hover {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.48);
}

.button.danger,
button.danger {
  background: var(--red);
}

.btn-sm {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.green { color: var(--green); background: rgba(85, 214, 168, 0.12); border-color: rgba(85, 214, 168, 0.22); }
.badge.amber { color: var(--amber); background: rgba(243, 199, 79, 0.12); border-color: rgba(243, 199, 79, 0.22); }
.badge.red { color: var(--red); background: rgba(239, 107, 91, 0.12); border-color: rgba(239, 107, 91, 0.22); }
.badge.blue { color: var(--blue); background: rgba(125, 211, 252, 0.12); border-color: rgba(125, 211, 252, 0.22); }
.badge.purple { color: var(--brand-hover); background: rgba(139, 92, 246, 0.13); border-color: rgba(139, 92, 246, 0.24); }

.alert {
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-secondary);
}

.alert.success {
  color: var(--green);
  border-color: rgba(85, 214, 168, 0.28);
  background: rgba(85, 214, 168, 0.08);
}

.alert.error {
  color: var(--red);
  border-color: rgba(239, 107, 91, 0.28);
  background: rgba(239, 107, 91, 0.08);
}

.app-toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 3000;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.floating-import-actions {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 190;
  display: grid;
  gap: 10px;
  justify-items: end;
  pointer-events: none;
}

.floating-import-button {
  min-width: 104px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 18px;
  border: 1px solid rgba(125, 211, 252, 0.42);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.96), rgba(45, 212, 191, 0.88)),
    #0ea5e9;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: auto;
}

.floating-import-button.is-pet {
  border-color: rgba(167, 139, 250, 0.46);
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.98), rgba(14, 165, 233, 0.9)),
    #8b5cf6;
}

.floating-import-button svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  flex: 0 0 auto;
}

.floating-import-button:hover,
.floating-import-button:focus-visible {
  color: #ffffff;
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.floating-import-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.84);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .floating-import-actions {
    right: 12px;
    bottom: 74px;
    gap: 8px;
  }

  .floating-import-button {
    min-width: 92px;
    min-height: 42px;
    padding: 10px 12px;
    font-size: 11px;
  }

  .floating-import-button svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
  }
}

.app-toast {
  margin: 0;
  box-shadow: var(--shadow-soft);
  pointer-events: auto;
  transition: opacity var(--transition), transform var(--transition);
}

.app-toast.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
}

.leaderboard-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.leaderboard-global-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.leaderboard-global-filter > span {
  padding-left: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.leaderboard-global-tabs {
  flex: 0 0 auto;
}

.leaderboard-mixed-mode {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 8px;
  color: #f3c74f;
  background: rgba(243, 199, 79, 0.1);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.segmented button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.segmented button.active {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: #ffffff;
}

.segmented-field {
  display: grid;
  gap: 8px;
}

.security-segmented-field > span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 750;
}

.segmented-control {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--input);
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.segmented-control input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.segmented-control input:checked + span {
  color: #ffffff;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

.segmented-control input:disabled + span {
  cursor: not-allowed;
  opacity: 0.58;
}

.score-explain {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #111d18;
  color: var(--text-secondary);
}

.score-explain strong {
  color: var(--green);
  border: 1px solid rgba(85, 214, 168, 0.2);
  border-radius: 7px;
  background: rgba(85, 214, 168, 0.08);
  padding: 4px 9px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.leaderboard-panel {
  max-width: 1320px;
}

.rank-list {
  display: grid;
}

.rank-row {
  display: grid;
  grid-template-columns: 48px minmax(220px, 1fr) 80px minmax(300px, 1.2fr) 150px;
  gap: 18px;
  align-items: center;
  padding: 22px 18px;
  border-top: 1px solid var(--line);
}

.rank-row:first-child {
  border-top: 0;
}

.rank-medal {
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 900;
  text-align: center;
}

.rank-person {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(85, 214, 168, 0.12);
  border: 1px solid rgba(85, 214, 168, 0.2);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.rank-person strong {
  display: block;
  color: var(--text);
  font-weight: 900;
}

.rank-person small,
.rank-score small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.rank-score strong {
  display: block;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  font-weight: 950;
}

.rank-bars {
  display: grid;
  gap: 7px;
}

.rank-bars label {
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.rank-bars i {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.rank-bars b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.rank-bars label:nth-child(2) b { background: var(--amber); }
.rank-bars label:nth-child(3) b { background: var(--blue); }
.rank-bars label:nth-child(4) b { background: var(--red); }

.rank-award {
  justify-self: end;
  color: var(--green);
  border: 1px solid rgba(85, 214, 168, 0.2);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(85, 214, 168, 0.08);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.leaderboard-v2-hero {
  margin-bottom: 14px;
}

.leaderboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.segmented a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.segmented a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.segmented a.active {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: #ffffff;
}

.leaderboard-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.leaderboard-kpi {
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(130, 143, 190, 0.22);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(31, 36, 62, 0.92), rgba(18, 22, 42, 0.94));
  box-shadow: var(--shadow-soft);
}

.leaderboard-kpi.is-production { border-left-color: var(--amber); }
.leaderboard-kpi.is-logs { border-left-color: var(--blue); }
.leaderboard-kpi.is-inactive { border-left-color: var(--cyan); }
.leaderboard-kpi.is-harvest { border-left-color: var(--green); }
.leaderboard-kpi.is-treatment { border-left-color: var(--red); }

.leaderboard-kpi span {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.25;
  font-weight: 850;
  text-transform: uppercase;
}

.leaderboard-kpi strong {
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  font-weight: 950;
}

.leaderboard-kpi small {
  color: var(--muted);
  font-size: 12px;
}

.leaderboard-sort-bar {
  background: linear-gradient(180deg, rgba(32, 32, 54, 0.94), rgba(18, 22, 40, 0.96));
}

.leaderboard-sort-bar a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 850;
}

.leaderboard-sort-bar a:hover,
.leaderboard-sort-bar a.active {
  border-color: rgba(45, 212, 191, 0.42);
  background: rgba(45, 212, 191, 0.12);
  color: var(--cyan);
}

.leaderboard-v2-panel {
  max-width: none;
}

.leaderboard-rank-table {
  overflow-x: auto;
}

.leaderboard-rank-head,
.leaderboard-rank-row {
  display: grid;
  grid-template-columns: 52px minmax(230px, 1.35fr) minmax(140px, 0.8fr) minmax(110px, 0.65fr) minmax(90px, 0.55fr) minmax(96px, 0.55fr) minmax(150px, 0.75fr);
  gap: 14px;
  align-items: center;
  min-width: 980px;
}

.leaderboard-rank-head {
  padding: 0 14px 11px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.leaderboard-rank-row {
  padding: 16px 14px;
  border-top: 1px solid var(--line);
}

.leaderboard-rank-row:first-of-type {
  border-top: 0;
}

.leaderboard-rank-number {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 950;
  text-align: center;
}

.leaderboard-entity {
  min-width: 0;
}

.leaderboard-rank-row > div:not(.leaderboard-entity):not(.leaderboard-status-cell) strong,
.leaderboard-primary-metric strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
}

.leaderboard-rank-row > div small,
.leaderboard-primary-metric small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.leaderboard-primary-metric strong {
  color: var(--cyan);
  font-size: 21px;
}

.leaderboard-status-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.leaderboard-status-cell span:not(.badge) {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.leaderboard-board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.leaderboard-board {
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid rgba(130, 143, 190, 0.26);
  border-top: 4px solid var(--brand);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(32, 32, 54, 0.96), rgba(24, 25, 45, 0.98)),
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.05), transparent 34%);
  box-shadow: var(--shadow-soft);
}

.leaderboard-board.is-wide {
  grid-column: 1 / -1;
}

.leaderboard-board.is-amber { border-top-color: var(--amber); }
.leaderboard-board.is-blue { border-top-color: var(--blue); }
.leaderboard-board.is-cyan { border-top-color: var(--cyan); }
.leaderboard-board.is-green { border-top-color: var(--green); }
.leaderboard-board.is-red { border-top-color: var(--red); }

.leaderboard-board-head,
.leaderboard-board-subhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.leaderboard-board-head {
  margin-bottom: 10px;
}

.leaderboard-board-head h2 {
  color: var(--text);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 950;
}

.leaderboard-board-head p,
.leaderboard-board-subhead p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.leaderboard-board-subhead {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.leaderboard-board-tabs {
  flex: 0 0 auto;
}

.leaderboard-board-list {
  display: grid;
}

.leaderboard-board-row {
  display: grid;
  grid-template-columns: 54px minmax(220px, 1.4fr) minmax(116px, 0.58fr) minmax(260px, 1fr) minmax(150px, 0.72fr);
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.leaderboard-board-row:first-child {
  border-top: 0;
  padding-top: 4px;
}

.leaderboard-board-rank {
  color: var(--text);
  font-size: 18px;
  font-weight: 950;
  text-align: center;
}

.leaderboard-board-person {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.leaderboard-board-person > div {
  min-width: 0;
}

.leaderboard-board-person strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-board-person small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-board-primary strong {
  display: block;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  font-weight: 950;
}

.leaderboard-board-primary small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.leaderboard-board-mini {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.leaderboard-board-mini span {
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.leaderboard-board-mini b {
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  font-weight: 950;
}

.leaderboard-board-mini em {
  color: var(--muted);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.leaderboard-board-status {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.leaderboard-board-status span:not(.badge) {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.leaderboard-board-empty {
  min-height: 180px;
  display: grid;
  align-content: center;
  justify-items: center;
}

.leaderboard-chart-wrap {
  position: relative;
  height: 280px;
  margin: 6px 0 18px;
  padding: 8px 0 10px;
}

.leaderboard-chart-wrap.is-top10 {
  height: 390px;
}

.leaderboard-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.leaderboard-top-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.leaderboard-top-row {
  display: grid;
  grid-template-columns: 52px minmax(220px, 1.15fr) minmax(110px, 0.48fr) minmax(230px, 0.95fr) minmax(150px, 0.62fr);
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.leaderboard-top-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.leaderboard-top-rank {
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
  text-align: center;
}

.leaderboard-top-person {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.leaderboard-top-person > div {
  min-width: 0;
}

.leaderboard-top-person strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-top-person small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-top-primary strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
}

.leaderboard-top-primary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
}

.leaderboard-top-mini {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.leaderboard-top-mini span {
  min-height: 44px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.leaderboard-top-mini b {
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  font-weight: 950;
}

.leaderboard-top-mini em {
  color: var(--muted);
  font-size: 9.5px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.leaderboard-top-status {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.leaderboard-top-status span:not(.badge) {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-grid,
.pet-layout,
.logs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
}

.dashboard-main,
.dashboard-side {
  display: grid;
  gap: 18px;
}

.toolbar-card,
.kanban-column,
.task-card,
.soft-card,
.insight-card {
  padding: 16px;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.tab-btn.active {
  color: #ffffff;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

.admin-tabs-toolbar {
  padding: 12px;
}

.admin-tabs-toolbar .tabs {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  scrollbar-width: thin;
}

.admin-tabs-toolbar .tab-btn {
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-secondary);
  font-weight: 800;
  line-height: 1.2;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.admin-tabs-toolbar .tab-btn:hover {
  color: var(--text);
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.22);
}

.admin-tabs-toolbar .tab-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.admin-tabs-toolbar .tab-btn.active {
  color: #ffffff;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.24);
}

.custom-field-tabs {
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-3);
  scrollbar-width: thin;
}

.custom-field-tabs .tab-btn {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}

.custom-field-tabs .tab-btn:hover {
  color: var(--text);
  background: rgba(125, 211, 252, 0.08);
  border-color: rgba(125, 211, 252, 0.18);
}

.custom-field-tabs .tab-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.18);
}

.custom-field-tabs .tab-btn.active {
  color: #ffffff;
  background: linear-gradient(90deg, #2dd4bf, #6366f1);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 18px rgba(45, 212, 191, 0.16);
}

.journey-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.08), rgba(139, 92, 246, 0.08));
}

.journey-kicker,
.journey-node-type {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
}

.journey-hero h3,
.journey-node-title h3,
.journey-node-title h4 {
  margin: 4px 0 0;
}

.journey-hero p {
  margin: 8px 0 0;
  color: var(--text-secondary);
}

.journey-meta,
.journey-node-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.journey-meta {
  justify-content: flex-end;
  min-width: 220px;
}

.journey-tree {
  display: grid;
  gap: 16px;
}

.journey-bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.08), rgba(99, 102, 241, 0.06)),
    rgba(255, 255, 255, 0.03);
}

#journeyBulkToolbar {
  position: fixed;
  left: calc(var(--sidebar-collapsed-width) + 24px);
  right: 24px;
  bottom: 0;
  z-index: 180;
  margin: 0;
  padding: 12px 20px;
  border-color: rgba(140, 140, 190, 0.38);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.28), rgba(239, 107, 91, 0.24)),
    rgba(32, 32, 54, 0.96);
  box-shadow: 0 -16px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.app-shell:has(.sidebar:hover) #journeyBulkToolbar,
.app-shell:has(.sidebar:focus-within) #journeyBulkToolbar {
  left: calc(var(--sidebar-expanded-width) + 24px);
}

body.has-journey-bulk-selection .content {
  padding-bottom: 132px;
}

.journey-bulk-toolbar > div:first-child {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.journey-bulk-toolbar strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.journey-bulk-toolbar span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.journey-bulk-toolbar b {
  color: #ffffff;
  font-size: 14px;
}

.journey-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.journey-period-card,
.journey-milestone-card,
.journey-checklist-item {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.journey-period-card {
  border-color: var(--line-strong);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.journey-milestone-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding-left: 18px;
  border-left: 2px solid rgba(125, 211, 252, 0.18);
}

.journey-milestone-card {
  border-radius: 10px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.26);
}

.journey-checklist-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-left: 16px;
  border-left: 2px solid rgba(45, 212, 191, 0.16);
}

.journey-checklist-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  border-radius: 8px;
  padding: 12px;
  background: rgba(2, 6, 23, 0.2);
}

.journey-node-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.journey-node-title {
  min-width: 0;
}

.journey-node-title-selectable,
.journey-checklist-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.journey-node-title-selectable > div,
.journey-checklist-main > div {
  min-width: 0;
}

.journey-checklist-main strong {
  display: block;
  margin-top: 4px;
}

.journey-node-select {
  position: relative;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 3px;
  cursor: pointer;
}

.journey-node-select input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.journey-node-select span {
  display: block;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(130, 143, 190, 0.48);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.journey-node-select span::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  width: 6px;
  height: 11px;
  border: solid #04111f;
  border-width: 0 2px 2px 0;
  opacity: 0;
  transform: rotate(45deg) scale(0.8);
  transition: opacity var(--transition), transform var(--transition);
}

.journey-node-select input:checked + span {
  border-color: rgba(45, 212, 191, 0.7);
  background: #2dd4bf;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12);
}

.journey-node-select input:checked + span::after {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}

.journey-node-select input:focus-visible + span {
  outline: none;
  box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.18);
}

.journey-node-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.journey-action-form {
  margin: 0;
}

.journey-collapse {
  margin-top: 14px;
}

.journey-collapse summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  list-style: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.journey-collapse summary::-webkit-details-marker {
  display: none;
}

.journey-collapse summary::before {
  content: ">";
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 900;
  transition: transform var(--transition), color var(--transition);
}

.journey-collapse summary:hover {
  color: var(--text);
  border-color: rgba(45, 212, 191, 0.24);
  background: rgba(45, 212, 191, 0.07);
}

.journey-collapse[open] > summary {
  color: #ffffff;
  border-color: rgba(45, 212, 191, 0.3);
  background: rgba(45, 212, 191, 0.12);
}

.journey-collapse[open] > summary::before {
  color: #2dd4bf;
  transform: rotate(90deg);
}

.journey-collapse-open {
  display: none;
}

.journey-collapse[open] > summary .journey-collapse-closed {
  display: none;
}

.journey-collapse[open] > summary .journey-collapse-open {
  display: inline;
}

.journey-collapse-nested {
  margin-top: 12px;
}

.journey-action-details {
  position: relative;
}

.journey-action-details summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
  list-style: none;
}

.journey-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition);
}

.journey-action-btn:hover:not(:disabled),
.journey-action-btn:focus-visible:not(:disabled) {
  border-color: rgba(125, 211, 252, 0.28);
  background: rgba(125, 211, 252, 0.08);
  outline: none;
}

.journey-action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.journey-duplicate-btn {
  border-color: rgba(45, 212, 191, 0.24);
  color: #b7f7ee;
  background: rgba(45, 212, 191, 0.07);
}

.journey-duplicate-btn:hover:not(:disabled),
.journey-duplicate-btn:focus-visible:not(:disabled) {
  border-color: rgba(45, 212, 191, 0.4);
  background: rgba(45, 212, 191, 0.13);
}

.journey-status-btn.is-activating {
  border-color: rgba(34, 197, 94, 0.32);
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.08);
}

.journey-status-btn.is-activating:hover:not(:disabled),
.journey-status-btn.is-activating:focus-visible:not(:disabled) {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.14);
}

.journey-status-btn.is-deactivating {
  border-color: rgba(245, 158, 11, 0.34);
  color: #fde68a;
  background: rgba(245, 158, 11, 0.08);
}

.journey-status-btn.is-deactivating:hover:not(:disabled),
.journey-status-btn.is-deactivating:focus-visible:not(:disabled) {
  border-color: rgba(245, 158, 11, 0.52);
  background: rgba(245, 158, 11, 0.14);
}

.journey-action-btn.danger {
  border-color: rgba(239, 107, 91, 0.32);
  color: #ffb5ad;
  background: rgba(239, 107, 91, 0.08);
}

.journey-action-btn.danger:hover:not(:disabled),
.journey-action-btn.danger:focus-visible:not(:disabled) {
  border-color: rgba(239, 107, 91, 0.5);
  background: rgba(239, 107, 91, 0.14);
}

.journey-action-btn.secondary {
  color: var(--text-secondary);
}

.category-bulk-toolbar {
  margin-bottom: 12px;
}

.category-admin-table .category-select-cell {
  width: 44px;
  min-width: 44px;
  padding-inline: 12px;
}

.category-admin-table .journey-node-select {
  margin: 0;
}

.category-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.category-row-actions form {
  margin: 0;
}

.category-row-actions .btn-sm {
  min-width: 58px;
}

.journey-action-details summary::-webkit-details-marker {
  display: none;
}

.journey-action-details summary:hover {
  border-color: rgba(125, 211, 252, 0.28);
  background: rgba(125, 211, 252, 0.08);
}

.journey-action-details[open] {
  width: 100%;
}

.journey-action-details[open] summary {
  margin-bottom: 10px;
  color: #ffffff;
  border-color: rgba(139, 92, 246, 0.34);
  background: rgba(139, 92, 246, 0.18);
}

.journey-inline-form {
  width: min(100%, 760px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.28);
}

.journey-inline-form .full {
  grid-column: 1 / -1;
}

.journey-empty-branch {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.filter-bar input,
.filter-bar select {
  width: auto;
  min-width: 160px;
}

.filter-bar .search-input {
  flex: 1;
  min-width: 220px;
}

.quick-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quick-stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-3);
}

.status-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.status-summary-grid .quick-stat {
  position: relative;
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px 14px 14px 38px;
  border-color: rgba(130, 143, 190, 0.34);
  background:
    linear-gradient(145deg, rgba(24, 27, 48, 0.96), rgba(18, 20, 38, 0.96)),
    radial-gradient(circle at 0% 0%, rgba(125, 211, 252, 0.10), transparent 34%);
  box-shadow: none;
  overflow: hidden;
}

.status-summary-grid .quick-stat::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 18px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12);
}

.status-summary-grid .quick-stat:nth-child(2)::before {
  background: var(--brand-hover);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.14);
}

.status-summary-grid .quick-stat:nth-child(3)::before {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(243, 199, 79, 0.14);
}

.status-summary-grid .quick-stat:nth-child(4)::before {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(85, 214, 168, 0.13);
}

.status-summary-grid .quick-stat span {
  display: block;
  color: var(--muted) !important;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-summary-grid .quick-stat strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.mini-bar {
  width: 130px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mini-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--cyan));
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.kanban-column {
  min-height: 360px;
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--text);
  font-weight: 900;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-card {
  background: var(--panel-3);
  box-shadow: none;
}

.task-card h4 {
  font-size: 14px;
  margin-bottom: 8px;
}

.task-meta,
.task-pets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.task-pets {
  margin-top: 10px;
}

.task-metric-card {
  width: 100%;
  min-height: 106px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  color: inherit;
  font: inherit;
  text-align: left;
  white-space: normal;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.task-metric-card:hover,
.task-metric-card:focus-visible,
.task-metric-card.active {
  transform: translateY(-1px);
  border-color: rgba(139, 92, 246, 0.55);
  background: linear-gradient(145deg, rgba(37, 40, 68, 0.98), rgba(28, 30, 55, 0.98));
  filter: none;
  outline: none;
}

.task-table-wrap {
  background: rgba(17, 19, 35, 0.95);
}

.task-table {
  min-width: 1360px;
}

.task-table th {
  background: rgba(139, 92, 246, 0.08);
}

.task-table td {
  vertical-align: top;
}

.task-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.task-date-cell {
  min-width: 116px;
  color: var(--muted);
  white-space: nowrap;
}

.task-id {
  color: var(--cyan);
  font-weight: 900;
  white-space: nowrap;
}

.task-name-cell {
  min-width: 240px;
  max-width: 360px;
  overflow-wrap: anywhere;
}

.task-name-cell strong {
  color: var(--text);
}

.task-context-cell {
  min-width: 150px;
  max-width: 270px;
  overflow-wrap: anywhere;
}

.task-pet-cell {
  min-width: 130px;
  max-width: 220px;
  overflow-wrap: anywhere;
}

.task-action-cell {
  min-width: 230px;
}

.task-action-cell .actions {
  gap: 8px;
}

.task-action-cell input {
  width: 110px;
}

.task-empty-row td {
  padding: 34px 16px;
  color: var(--muted);
  text-align: center;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text);
  font-weight: 900;
}

.step-dot {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--brand);
  font-size: 12px;
}

.form-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-3);
}

.selected-pet-list {
  display: grid;
  gap: 10px;
}

.selected-pet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius);
  background: var(--panel-3);
  color: var(--text);
  font-weight: 800;
}

.timeline {
  display: grid;
  gap: 14px;
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 999px;
  background: var(--line);
}

.timeline-item {
  position: relative;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.timeline-dot {
  position: absolute;
  left: -26px;
  top: 21px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid var(--bg);
}

.timeline-dot.green { background: var(--green); }
.timeline-dot.amber { background: var(--amber); }
.timeline-dot.red { background: var(--red); }
.timeline-dot.blue { background: var(--blue); }
.timeline-dot.purple { background: var(--purple); }

.timeline-item header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.timeline-item pre,
.timeline-payload {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-3);
  color: var(--text-secondary);
  overflow-x: auto;
}

.timeline-payload {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.timeline-payload-item span,
.info-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-payload-item strong,
.info-item strong {
  color: var(--text);
}

.timeline-diff {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(122, 132, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(12, 14, 32, 0.72);
}

.timeline-diff-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.65fr) minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
}

.timeline-diff-field,
.timeline-diff-empty {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.timeline-diff-empty {
  justify-content: center;
  color: var(--muted);
  text-transform: none;
}

.timeline-diff-value {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  overflow: hidden;
}

.timeline-diff-value span {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  color: currentColor;
  opacity: 0.72;
}

.timeline-diff-value strong {
  display: block;
  color: currentColor;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.timeline-diff-old {
  border: 1px solid rgba(248, 113, 113, 0.42);
  background: rgba(127, 29, 29, 0.22);
  color: #fca5a5;
}

.timeline-diff-new {
  border: 1px solid rgba(74, 222, 128, 0.42);
  background: rgba(20, 83, 45, 0.24);
  color: #86efac;
}

.timeline-diff-arrow {
  display: grid;
  place-items: center;
  min-width: 34px;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  flex: 0 0 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--cyan), var(--brand));
  color: #071019;
  font-size: 24px;
  font-weight: 950;
  box-shadow: var(--shadow-soft);
}

.profile-identity h2 {
  color: var(--text);
  font-size: 22px;
  line-height: 1.15;
}

.profile-identity p {
  margin-top: 5px;
  color: var(--muted);
}

.profile-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 12px;
}

.user-admin-list {
  display: grid;
  gap: 14px;
}

.compact-user-list {
  gap: 10px;
}

.user-summary-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(120px, 0.7fr) minmax(120px, 0.7fr) minmax(90px, 0.4fr) minmax(110px, 0.5fr);
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-3);
  color: var(--text);
  text-align: left;
}

.user-summary-card:hover,
.user-summary-card:focus-visible {
  border-color: rgba(139, 92, 246, 0.58);
  background: rgba(139, 92, 246, 0.08);
}

.user-admin-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-3);
}

.user-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.compact-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.user-admin-actions,
.inline-form,
.reset-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-admin-actions {
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.settings-switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-switch-form {
  min-width: 0;
}

.switch-field {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-3);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.switch-field:hover {
  border-color: rgba(139, 92, 246, 0.46);
  background: rgba(139, 92, 246, 0.07);
}

.switch-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.switch-copy strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
}

.switch-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.toggle-switch {
  position: relative;
  flex: 0 0 52px;
  width: 52px;
  height: 30px;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  min-height: 0;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.24);
  transition: transform var(--transition), background var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  border-color: rgba(85, 214, 168, 0.52);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.82), rgba(139, 92, 246, 0.86));
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.09);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.24);
}

.settings-switch-form.is-saving .switch-field,
.switch-field:has(.toggle-switch input:disabled) {
  opacity: 0.72;
  cursor: wait;
}

.settings-switch-form.is-saving .toggle-slider::after {
  background: var(--text-secondary);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-line input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

.inline-form input {
  width: auto;
  min-width: 150px;
}

.modal-overlay,
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.modal-overlay.active:not([hidden]) {
  display: grid;
  place-items: center;
  padding: 22px;
}

#taskCreateModal.modal-overlay.active:not([hidden]) {
  z-index: 500;
  padding: 32px 48px;
  place-items: center;
}

.drawer-overlay.active:not([hidden]) {
  display: block;
}

.modal {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-header,
.modal-footer,
.drawer-header,
.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-footer,
.drawer-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-body,
.drawer-body {
  padding: 20px;
}

#importModal.modal-overlay.active:not([hidden]) {
  padding: 24px;
  place-items: center;
}

.import-logs-modal {
  width: min(1120px, calc(100vw - 48px));
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.import-logs-modal .modal-header,
.import-logs-modal .modal-footer {
  flex: 0 0 auto;
}

.import-logs-modal .modal-body {
  min-height: 0;
  display: grid;
  gap: 16px;
  overflow: hidden;
}

.import-logs-modal .dropzone {
  min-height: 180px;
}

.import-progress {
  padding: 14px 16px;
  border: 1px solid rgba(45, 212, 191, 0.24);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.1), rgba(139, 92, 246, 0.12)),
    rgba(255, 255, 255, 0.025);
}

.import-progress-top,
.import-progress-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.import-progress-top strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.import-progress-top span {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 900;
}

.import-progress-track {
  height: 10px;
  margin: 10px 0 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(8, 10, 22, 0.42);
}

.import-progress-track span {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--brand-hover));
  box-shadow: 0 0 18px rgba(45, 212, 191, 0.28);
  transition: width 180ms ease;
}

.import-preview-wrap {
  max-height: min(46vh, 420px);
  margin-top: 0;
  overflow: auto;
}

.import-preview-errors {
  padding: 14px 16px;
  border: 1px solid rgba(239, 107, 91, 0.34);
  border-radius: 10px;
  color: #ffb4aa;
  background: linear-gradient(135deg, rgba(239, 107, 91, 0.16), rgba(239, 107, 91, 0.08));
}

.import-preview-errors-title {
  color: #ffcbc5;
  font-weight: 900;
}

.import-preview-errors-copy {
  margin-top: 4px;
  color: rgba(255, 203, 197, 0.82);
  font-size: 13px;
  font-weight: 700;
}

.import-preview-errors ul {
  max-height: 170px;
  margin: 10px 0 0;
  padding-left: 18px;
  overflow: auto;
}

.import-preview-errors li {
  margin: 4px 0;
  line-height: 1.45;
}

#previewTable {
  min-width: 980px;
}

#previewTable th,
#previewTable td {
  white-space: nowrap;
}

#previewTable thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

@media (max-width: 760px) {
  #importModal.modal-overlay.active:not([hidden]) {
    padding: 12px;
  }

  .import-logs-modal {
    width: min(100%, calc(100vw - 24px));
    max-height: 92vh;
  }

  .import-logs-modal .dropzone {
    min-height: 150px;
    padding: 22px 14px;
  }

  .import-preview-wrap {
    max-height: 42vh;
  }
}

.dashboard-action-modal {
  width: min(460px, 100%);
}

.modal-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.modal-action-grid .button {
  min-height: 72px;
  justify-content: flex-start;
  padding: 16px;
}

.modal-action-grid .button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

@media (max-width: 520px) {
  .modal-action-grid {
    grid-template-columns: 1fr;
  }
}

.modal-close {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  font-size: 22px;
}

.drawer {
  position: fixed;
  top: 0;
  right: -510px;
  z-index: 201;
  width: min(500px, 100%);
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: right 0.24s ease;
}

.drawer.open {
  right: 0;
}

.drawer.user-detail-drawer {
  right: -730px;
  width: min(720px, 100%);
}

.drawer.user-detail-drawer.open {
  right: 0;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
}

.task-create-modal {
  width: min(1560px, calc(100vw - 96px));
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.task-create-modal .modal-header {
  flex: 0 0 auto;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.02);
}

.task-create-modal .modal-header h2 {
  margin: 0;
  font-size: 21px;
}

.task-create-modal .modal-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.task-create-form {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.task-create-form .modal-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.task-create-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(340px, 1.15fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.task-form-section {
  min-width: 0;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.task-form-section-main,
.task-form-section-auto {
  grid-row: span 2;
}

.task-form-section-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.task-form-section-head > span {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid rgba(139, 92, 246, 0.32);
  background: rgba(139, 92, 246, 0.14);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.task-form-section-head h3 {
  margin: 0;
  font-size: 15px;
}

.task-form-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.task-form-row {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.task-form-row > label,
.task-create-form input,
.task-create-form select,
.task-create-form textarea {
  min-width: 0;
}

.task-form-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.task-create-form textarea {
  min-height: 82px;
}

.task-create-form .task-title-field input {
  min-height: 44px;
  font-weight: 850;
}

.task-create-footer {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.02);
}

.dropzone {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 34px 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--panel-3);
  text-align: center;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: rgba(139, 92, 246, 0.7);
  background: rgba(139, 92, 246, 0.08);
}

.dropzone-icon {
  color: var(--brand-hover);
  font-size: 34px;
}

.dropzone-text {
  color: var(--text-secondary);
  font-weight: 800;
}

.dropzone-hint {
  color: var(--muted);
  font-size: 12px;
}

.searchable-select {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-3);
}

.searchable-select-search {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.searchable-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.searchable-select-item:hover {
  background: rgba(139, 92, 246, 0.08);
}

.searchable-select-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  accent-color: var(--brand);
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--brand-hover);
  font-size: 24px;
}

.empty-state h3 {
  color: var(--text-secondary);
  font-size: 15px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card .brand {
  margin-bottom: 24px;
}

.forced-password-page {
  background:
    radial-gradient(circle at 18% 8%, rgba(139, 92, 246, 0.18), transparent 32%),
    radial-gradient(circle at 82% 92%, rgba(45, 212, 191, 0.1), transparent 30%),
    var(--bg);
}

.forced-password-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.forced-password-card {
  width: min(560px, 100%);
  padding: 30px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(32, 32, 54, 0.98), rgba(23, 23, 41, 0.98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.forced-password-header,
.forced-password-brand,
.forced-password-footer {
  display: flex;
  align-items: center;
}

.forced-password-header {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.forced-password-brand {
  gap: 10px;
  color: var(--text);
}

.forced-password-brand strong {
  font-size: 15px;
  font-weight: 800;
}

.forced-password-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(243, 199, 79, 0.28);
  border-radius: var(--radius-lg);
  background: rgba(243, 199, 79, 0.07);
}

.forced-password-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(243, 199, 79, 0.14);
  color: var(--amber);
}

.forced-password-icon svg {
  width: 25px;
  height: 25px;
}

.forced-password-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.forced-password-notice h1 {
  color: var(--text);
  font-size: 24px;
  line-height: 1.25;
}

.forced-password-notice p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.forced-password-account {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.forced-password-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #6366f1);
  color: #fff;
  font-weight: 800;
}

.forced-password-account > span:last-child {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 8px;
  flex: 1;
}

.forced-password-account small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.forced-password-account strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forced-password-account em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.forced-password-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.forced-password-form label {
  display: grid;
  gap: 7px;
}

.forced-password-form label > small {
  color: var(--muted);
  font-size: 11px;
}

.forced-password-form button {
  width: 100%;
  margin-top: 4px;
}

.forced-password-footer {
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.forced-password-footer a {
  flex: 0 0 auto;
}

@media (max-width: 560px) {
  .forced-password-wrap {
    align-items: start;
    padding: 16px 12px;
  }

  .forced-password-card {
    padding: 20px 16px;
  }

  .forced-password-header {
    margin-bottom: 20px;
  }

  .forced-password-notice {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }

  .forced-password-notice h1 {
    font-size: 21px;
  }

  .forced-password-icon {
    width: 42px;
    height: 42px;
  }

  .forced-password-account > span:last-child {
    display: block;
  }

  .forced-password-account em {
    display: block;
    margin-top: 2px;
  }
}

.muted { color: var(--muted) !important; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-center { text-align: center; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.mt-0 { margin-top: 0 !important; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.hidden { display: none !important; }
.section-danger { border-left: 3px solid var(--red); }

.pet-bulk-toolbar,
.recent-log-bulk-toolbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.recent-log-bulk-toolbar {
  margin: 14px 0;
}

.recent-log-bulk-toolbar.is-selecting-all {
  border-color: rgba(45, 212, 191, 0.42);
}

.recent-log-select-all-scope {
  white-space: nowrap;
}

.recent-log-bulk-toolbar .journey-bulk-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.recent-log-select-all-scope.is-active {
  border-color: rgba(45, 212, 191, 0.6);
  color: var(--text);
  background: rgba(45, 212, 191, 0.16);
}

.recent-log-table-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  accent-color: var(--brand);
}

#recentLogTable th:first-child,
#recentLogTable td:first-child {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.pet-profile-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.pet-profile-table-wrap th,
.pet-profile-table-wrap td {
  white-space: nowrap;
}

.pet-wide-modal {
  width: min(980px, 100%);
}

.bulk-field-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 850;
}

.bulk-field-toggle input[type="checkbox"],
.pet-profile-table-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  accent-color: var(--brand);
}

button.danger-link,
.button.danger-link {
  color: var(--red);
  border-color: rgba(239, 107, 91, 0.32);
}

body:has(.logs-entry-page) .content {
  max-width: none;
  margin: 0;
  padding: 28px 30px 56px;
}

body:has(.logs-entry-page) .page-heading,
.logs-entry-page {
  width: min(840px, 100%);
}

body:has(.logs-entry-page) .page-heading {
  margin-bottom: 28px;
}

body:has(.logs-entry-page) .page-heading h1 {
  font-size: 29px;
  line-height: 1.1;
}

body:has(.logs-entry-page) .page-subtitle {
  color: var(--text-secondary);
}

.logs-entry-form {
  display: grid;
  gap: 20px;
}

.logs-tabs {
  display: flex;
  align-items: flex-end;
  gap: 30px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.logs-tabs::-webkit-scrollbar {
  display: none;
}

.logs-tab {
  position: relative;
  min-height: 46px;
  padding: 0 3px 13px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 14px;
  font-weight: 900;
}

.logs-tab:hover {
  color: var(--text);
  background: transparent;
  filter: none;
}

.logs-tab.is-active {
  color: var(--text);
}

.logs-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--green);
}

.logs-card {
  display: grid;
  gap: 20px;
  padding: 24px 22px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: none;
}

.logs-pane[hidden] {
  display: none;
}

.logs-field {
  display: grid;
  gap: 10px;
}

.logs-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.logs-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.logs-label,
.logs-label-row > span:first-child {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.1;
  text-transform: uppercase;
}

.logs-label-row > span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.logs-label-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.logs-pet-list-button {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 11px;
  white-space: nowrap;
}

.logs-field.is-required > .logs-label::after,
.logs-field.is-required > .logs-label-row::after {
  content: "*";
  color: var(--red);
  font-weight: 900;
}

.pet-token-combobox {
  position: relative;
  z-index: 1;
}

.pet-token-combobox.is-searching {
  z-index: 40;
}

.pet-token-box {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
}

.pet-token-list {
  display: contents;
}

.pet-token {
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.pet-token button {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.pet-token button:hover {
  color: var(--red);
  background: transparent;
  filter: none;
}

.pet-token-input {
  flex: 1 1 180px;
  min-width: 150px;
  min-height: 31px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.pet-token-input:focus {
  border: 0;
  box-shadow: none;
}

.pet-suggestion-row {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 45;
  max-height: min(260px, 46vh);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 7px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-3);
  box-shadow: var(--shadow);
}

.pet-suggestion {
  min-height: 34px;
  padding: 4px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
}

.pet-suggestion:hover {
  color: var(--text);
  border-color: rgba(85, 214, 168, 0.35);
  background: rgba(85, 214, 168, 0.08);
  filter: none;
}

.logs-pet-picker-modal {
  width: min(760px, 100%);
}

.logs-pet-picker-modal .modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.logs-pet-picker-modal .modal-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.logs-pet-picker-modal .modal-header strong {
  color: var(--green);
}

.logs-pet-picker-body {
  display: grid;
  gap: 14px;
}

.logs-pet-picker-search {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  background: var(--input);
}

.logs-pet-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}

.logs-pet-picker-item {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
}

.logs-pet-picker-item:hover {
  color: var(--text);
  border-color: rgba(85, 214, 168, 0.35);
  background: rgba(85, 214, 168, 0.08);
  filter: none;
}

.logs-pet-picker-item.is-selected {
  border-color: rgba(85, 214, 168, 0.72);
  background: rgba(85, 214, 168, 0.2);
  color: var(--green);
}

.logs-pet-picker-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--input);
}

.logs-warning,
.logs-muted-line,
.logs-footer p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.logs-warning {
  color: var(--amber);
}

.logs-warning::before,
.logs-muted-line .dot {
  content: "";
  width: 6px;
  height: 6px;
  display: inline-block;
  margin-right: 6px;
  border-radius: 999px;
  background: currentColor;
  vertical-align: 1px;
}

.logs-muted-line strong,
.logs-footer strong {
  color: var(--green);
}

.journey-mini {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
}

.journey-mini span {
  width: 20px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.journey-mini .is-amber {
  background: var(--amber);
}

.journey-mini .is-green {
  background: var(--green);
}

.journey-mini em {
  margin-left: 6px;
  font-style: normal;
}

.journey-mini b {
  font-weight: 800;
}

.checklist-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
}

.checklist-group {
  border-bottom: 1px solid rgba(120, 120, 170, 0.14);
}

.checklist-group:last-child {
  border-bottom: 0;
}

.checklist-group summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 14px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.checklist-group summary::-webkit-details-marker {
  display: none;
}

.checklist-group summary::before {
  content: "›";
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform var(--transition);
}

.checklist-group[open] summary::before {
  transform: rotate(90deg);
}

.checklist-group summary span {
  margin-right: auto;
}

.checklist-group summary strong {
  min-width: 42px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  text-align: center;
}

.checklist-group-body {
  display: grid;
}

.checklist-row {
  min-height: 46px;
  display: grid;
  grid-template-columns: 26px 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(120, 120, 170, 0.14);
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

.checklist-row:last-child {
  border-bottom: 0;
}

.checklist-row:hover {
  background: rgba(255, 255, 255, 0.035);
}

.checklist-row input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  accent-color: var(--green);
}

.checklist-index {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.checklist-row.is-done {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.026);
}

.checklist-row.is-done .checklist-index,
.checklist-row.is-done .checklist-text {
  color: var(--muted);
  opacity: 0.74;
}

.checklist-row.is-done .checklist-text {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(132, 144, 173, 0.78);
}

.checklist-complete-badge {
  width: 22px;
  height: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(45, 212, 191, 0.48);
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.14);
  color: var(--green);
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
}

.checklist-row.is-done .checklist-complete-badge {
  display: inline-flex;
}

[data-milestone-select] option.is-completed {
  color: var(--green);
  font-weight: 800;
}

.checklist-row.is-inactive {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
}

.checklist-row.is-inactive .checklist-text {
  opacity: 0.72;
}

.logs-inactive-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 8px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  line-height: 1;
}

.logs-entry-page option[data-is-active="0"],
.logs-entry-page option[data-period-is-active="0"] {
  color: var(--muted);
}

.logs-empty-line {
  padding: 16px;
  color: var(--muted);
}

.logs-entry-page textarea {
  min-height: 64px;
  border-radius: 8px;
  background: var(--panel-3);
}

.quantity-shell {
  position: relative;
}

.quantity-shell input[type="number"] {
  padding-right: 76px;
}

.logs-entry-page input[type="number"] {
  -moz-appearance: textfield;
}

.logs-entry-page input[type="number"]::-webkit-outer-spin-button,
.logs-entry-page input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.quantity-shell span {
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--muted);
  font-size: 12px;
  transform: translateY(-50%);
}

.yield-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.yield-stat {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-3);
}

.yield-stat span {
  color: var(--text-secondary);
  font-size: 12px;
}

.yield-stat strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  font-weight: 900;
}

.yield-stat.is-delta {
  border-color: rgba(243, 199, 79, 0.78);
}

.yield-stat.is-delta span,
.yield-stat.is-delta strong {
  color: var(--amber);
}

.logs-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.logs-footer p {
  max-width: 560px;
}

.logs-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.logs-actions .button {
  min-width: 72px;
}

.logs-actions .logs-submit {
  min-width: 126px;
  color: #071019;
  background: var(--green);
  border-color: rgba(85, 214, 168, 0.4);
}

@media (max-width: 900px) {
  body:has(.logs-entry-page) .app-topbar {
    display: flex;
  }

  body:has(.logs-entry-page) .content {
    padding: 24px 14px 40px;
  }

  body:has(.logs-entry-page) .page-heading,
  .logs-entry-page {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .logs-tabs {
    gap: 18px;
  }

  .logs-card {
    padding: 18px 14px;
  }

  .logs-two-col,
  .yield-stat-grid {
    grid-template-columns: 1fr;
  }

  .logs-label-row,
  .logs-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .logs-label-actions {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .logs-pet-list-button {
    width: 100%;
    justify-content: center;
  }

  .logs-actions,
  .logs-actions .button {
    width: 100%;
  }

  .pet-suggestion-row {
    grid-template-columns: 1fr;
    max-height: min(300px, 52vh);
  }

  .pet-suggestion {
    min-height: 42px;
    padding: 8px 11px;
  }

  .logs-pet-picker-overlay.active:not([hidden]) {
    padding: 12px;
  }

  .logs-pet-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .logs-pet-picker-item {
    min-height: 42px;
  }
}

@media (max-width: 420px) {
  .logs-pet-picker-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1320px) {
  .dashboard-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-page .dashboard-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-page .dashboard-filter {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .rank-row {
    grid-template-columns: 42px minmax(180px, 1fr) 70px minmax(250px, 1.2fr);
  }

  .rank-award {
    grid-column: 4;
    justify-self: start;
  }
}

@media (max-width: 1280px) {
  #taskCreateModal.modal-overlay.active:not([hidden]) {
    padding: 24px;
  }

  .task-create-modal {
    width: min(100%, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
  }

  .task-form-row-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .task-create-grid {
    grid-template-columns: 1fr;
  }

  .task-form-section-main,
  .task-form-section-auto {
    grid-row: auto;
  }

  .span-7,
  .span-5,
  .span-8,
  .span-4,
  .span-3 {
    grid-column: span 12;
  }

  .dashboard-grid,
  .pet-layout,
  .logs-layout {
    grid-template-columns: 1fr;
  }

  .grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .task-create-modal {
    width: min(100%, calc(100vw - 20px));
    max-height: calc(100vh - 20px);
  }

  .task-create-modal .modal-header,
  .task-create-form .modal-body,
  .task-create-footer {
    padding: 14px;
  }

  .task-form-row,
  .task-form-row-3 {
    grid-template-columns: 1fr;
  }

  .task-create-footer,
  .task-create-footer .button,
  .task-create-footer button {
    width: 100%;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    padding: 22px 15px;
  }

  .brand > div,
  .nav-section,
  .nav-label,
  .sidebar-points-copy {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .app-topbar {
    display: flex;
    height: auto;
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }

  .topbar-search {
    width: 100%;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .profile-dropdown {
    right: 0;
    width: min(320px, calc(100vw - 28px));
  }

  .content {
    padding: 24px 14px 40px;
  }

  .ops-hero,
  .leaderboard-hero {
    flex-direction: column;
  }

  .hero-actions,
  .leaderboard-controls {
    justify-content: flex-start;
  }

  .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-page .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-page .dashboard-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-page .dashboard-filter-actions,
  .dashboard-page .dashboard-filter-actions .button {
    width: 100%;
  }

  .rank-row {
    grid-template-columns: 38px minmax(0, 1fr) 64px;
  }

  .rank-bars,
  .rank-award {
    grid-column: 2 / -1;
  }

  .form-grid,
  .grid.cols-2,
  .grid.cols-3,
  .compact-form,
  .settings-switch-grid,
  .user-summary-card {
    grid-template-columns: 1fr;
  }

  .profile-hero,
  .user-admin-head,
  .user-admin-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .timeline-diff-row {
    grid-template-columns: 1fr;
  }

  .timeline-diff-arrow {
    min-height: 20px;
    transform: rotate(90deg);
  }

  .custom-field-tabs {
    width: 100%;
    flex-wrap: wrap;
  }

  .custom-field-tabs .tab-btn {
    flex: 1 1 120px;
    justify-content: center;
  }

  .journey-hero,
  .journey-node-header,
  .journey-checklist-item {
    flex-direction: column;
  }

  .journey-bulk-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  #journeyBulkToolbar {
    left: 0;
    right: 0;
    max-height: 46vh;
    overflow-y: auto;
    padding: 12px 14px;
    border-radius: 10px 10px 0 0;
  }

  .app-shell:has(.sidebar:hover) #journeyBulkToolbar,
  .app-shell:has(.sidebar:focus-within) #journeyBulkToolbar {
    left: 0;
  }

  body.has-journey-bulk-selection .content {
    padding-bottom: 168px;
  }

  .journey-bulk-actions {
    justify-content: flex-start;
  }

  .journey-meta,
  .journey-node-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .journey-collapse summary {
    width: 100%;
    justify-content: center;
  }

  .journey-action-details,
  .journey-action-details summary,
  .journey-action-form,
  .journey-action-btn {
    width: 100%;
  }

  .journey-inline-form {
    width: 100%;
  }

  .profile-meta {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .kanban-board {
    grid-template-columns: minmax(260px, 1fr);
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .search-shell kbd,
  .topbar-time {
    display: none;
  }

  .profile-trigger-text {
    display: none;
  }

  .profile-trigger {
    padding: 3px;
  }

  .reset-form,
  .inline-form {
    width: 100%;
  }

  .inline-form input,
  .inline-form button {
    width: 100%;
  }

  .dashboard-kpis,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .dashboard-page .dashboard-kpis,
  .dashboard-page .dashboard-filter {
    grid-template-columns: 1fr;
  }

  .status-summary-grid {
    grid-template-columns: 1fr;
  }

  .journey-period-card {
    padding: 12px;
  }

  .journey-milestone-list,
  .journey-checklist-list {
    padding-left: 10px;
  }

  .dashboard-page .dashboard-kpi-trigger {
    min-height: 96px;
  }

  .dashboard-modal-metric {
    display: grid;
    gap: 6px;
  }

  .panel,
  .card {
    padding: 16px;
  }

  .ops-kpi {
    min-height: 88px;
  }

  .page-heading h1,
  .ops-hero h1,
  .leaderboard-hero h1 {
    font-size: 24px;
  }

  .rank-row {
    padding: 18px 8px;
  }

  .rank-bars label {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  th,
  td {
    padding: 10px 12px;
  }
}

/* PET detail profile log layout */
body:has(.pet-profile-log-page) .content {
  max-width: none;
  margin: 0;
  padding: 22px clamp(18px, 2vw, 32px) 56px;
}

.pet-profile-log-page {
  width: 100%;
  display: grid;
  gap: 18px;
  min-width: 0;
}

.pet-profile-log-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.pet-profile-breadcrumb {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.pet-profile-breadcrumb strong {
  color: var(--text-secondary);
}

.pet-profile-log-title h1 {
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
  font-weight: 900;
}

.pet-profile-log-title p {
  color: var(--muted);
  font-size: 12px;
}

.pet-profile-title-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pet-profile-summary,
.pet-log-panel,
.pet-profile-chart-panel,
.pet-kpi-card,
.pet-health-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(32, 32, 54, 0.94), rgba(20, 22, 38, 0.96));
  box-shadow: var(--shadow-soft);
}

.pet-profile-summary {
  padding: 18px 18px 20px;
}

.pet-profile-summary-top {
  display: grid;
  grid-template-columns: minmax(340px, 1.4fr) minmax(420px, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 4px 0 20px;
  border-bottom: 1px solid var(--line);
}

.pet-profile-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.pet-profile-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #46d7f3 0%, #7c5cff 100%);
  color: #08101d;
  font-size: 22px;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(89, 111, 255, 0.24);
}

.pet-profile-copy {
  min-width: 0;
}

.pet-profile-copy h2 {
  color: var(--text);
  font-size: 21px;
  line-height: 1.12;
  font-weight: 900;
}

.pet-profile-copy p {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

.pet-profile-copy strong {
  color: var(--text);
}

.pet-profile-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 26px;
}

.pet-profile-metrics span,
.pet-profile-actions > span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.pet-profile-metrics strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}

.pet-profile-metrics .is-accent {
  color: var(--cyan);
}

.pet-profile-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  min-width: 210px;
}

.pet-profile-menu,
.pet-row-actions {
  position: relative;
}

.pet-profile-action-select,
.pet-toolbar-btn,
.pet-icon-button,
.pet-density-controls button,
.pet-table-footer button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  box-shadow: none;
  font-size: 12px;
  font-weight: 800;
}

.pet-profile-action-select {
  min-width: 136px;
  padding: 0 12px;
}

.pet-profile-action-select svg,
.pet-toolbar-btn svg,
.pet-icon-button svg,
.pet-density-controls svg {
  width: 16px;
  height: 16px;
}

.pet-profile-menu-list,
.pet-row-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  min-width: 150px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #18182a;
  box-shadow: var(--shadow);
}

.pet-profile-menu-list a,
.pet-profile-menu-list button,
.pet-row-menu a {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  text-align: left;
  font-size: 12px;
  font-weight: 750;
}

.pet-profile-menu-list a:hover,
.pet-profile-menu-list button:hover,
.pet-row-menu a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  filter: none;
}

.pet-icon-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.pet-profile-stepper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0;
  padding-top: 22px;
}

.pet-profile-step {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  min-width: 0;
}

.pet-profile-step-line {
  position: absolute;
  left: 42px;
  right: 14px;
  top: 18px;
  height: 2px;
  border-top: 1px dashed var(--line-strong);
}

.pet-profile-step:last-child .pet-profile-step-line {
  display: none;
}

.pet-profile-step-dot {
  position: relative;
  z-index: 1;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 5px solid rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  background: var(--panel-3);
  color: #071019;
  font-size: 16px;
  font-weight: 950;
  box-shadow: inset 0 0 0 2px var(--line-strong);
}

.pet-profile-step.is-done .pet-profile-step-dot,
.pet-profile-step.is-done .pet-profile-step-line {
  border-color: rgba(45, 212, 191, 0.2);
  background: var(--cyan);
}

.pet-profile-step.is-current .pet-profile-step-dot {
  border-color: rgba(85, 100, 255, 0.3);
  background: var(--panel-3);
  box-shadow: inset 0 0 0 3px #5268ff, 0 0 0 4px rgba(82, 104, 255, 0.14);
}

.pet-profile-step.is-current .pet-profile-step-dot::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #5268ff;
}

.pet-profile-step strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.pet-profile-step small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.pet-profile-step.is-done small,
.pet-profile-step.is-done strong {
  color: var(--text-secondary);
}

.pet-profile-step.is-current strong {
  color: #8aa1ff;
}

.pet-profile-step em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.pet-profile-step.is-done em {
  color: var(--amber);
}

.pet-profile-step.is-current em {
  color: var(--cyan);
}

.pet-profile-step-bar {
  display: block;
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.pet-profile-step-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
}

.pet-profile-step.is-done .pet-profile-step-bar span {
  background: var(--amber);
}

.pet-profile-step.is-pending .pet-profile-step-bar span {
  background: var(--muted);
}

.pet-kpi-board {
  display: grid;
  grid-template-columns:
    minmax(140px, 0.9fr)
    minmax(140px, 0.9fr)
    minmax(260px, 1.45fr)
    minmax(170px, 1fr)
    minmax(250px, 1.4fr);
  gap: 12px;
  margin-bottom: 14px;
}

.pet-kpi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: 122px;
  padding: 15px 16px;
  overflow: hidden;
}

.pet-kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--cyan);
}

.pet-kpi-score.is-yield::before { background: var(--amber); }
.pet-kpi-score.is-log::before { background: #7dd3fc; }
.pet-kpi-score.is-inactive::before { background: var(--cyan); }
.pet-kpi-gauge.is-yield-gauge::before { background: #2dd4bf; }
.pet-kpi-gauge.is-log-gauge::before { background: #7dd3fc; }

.pet-kpi-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pet-kpi-value {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  font-weight: 950;
}

.pet-kpi-card > small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pet-kpi-gauge {
  min-height: 166px;
}

.pet-kpi-gauge-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pet-kpi-gauge-head small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-align: right;
}

.pet-kpi-gauge-body {
  position: relative;
  height: 82px;
  margin-top: 8px;
}

.pet-kpi-gauge-body canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.pet-kpi-gauge-center {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.pet-kpi-gauge-center strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  font-weight: 950;
}

.pet-kpi-gauge-center span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pet-kpi-gauge-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.pet-kpi-gauge-stats.is-single {
  grid-template-columns: 1fr;
}

.pet-kpi-gauge-stats div {
  min-width: 0;
}

.pet-kpi-gauge-stats span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.pet-kpi-gauge-stats strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 950;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pet-mini-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.pet-mini-badges b {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 850;
}

.pet-profile-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pet-profile-chart-panel {
  min-width: 0;
  padding: 16px 18px 12px;
}

.pet-profile-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pet-profile-panel-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.pet-profile-panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.pet-profile-chart-wrap {
  height: 210px;
  min-width: 0;
}

.pet-profile-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.pet-log-panel {
  overflow: hidden;
}

.pet-log-toolbar {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.pet-log-search,
.pet-filter-control {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(17, 19, 34, 0.72);
  color: var(--muted);
}

.pet-log-search svg,
.pet-date-control svg {
  width: 16px;
  height: 16px;
}

.pet-log-search input,
.pet-filter-control input,
.pet-filter-control select {
  min-width: 0;
  width: 100%;
  height: 32px;
  min-height: 32px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text-secondary);
  box-shadow: none;
  font-size: 12px;
}

.pet-filter-control span {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.pet-date-control {
  min-width: 142px;
}

.pet-log-toolbar .pet-filter-control {
  grid-column: span 2;
}

.pet-date-range {
  grid-column: span 4;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.pet-date-range > span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.pet-date-segments {
  display: flex;
  min-height: 38px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(17, 19, 34, 0.72);
}

.pet-date-segments label {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
  text-align: center;
}

.pet-date-segments input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.pet-date-segments label:has(input:checked) {
  background: rgba(139, 92, 246, 0.22);
  color: var(--text);
}

.pet-log-toolbar .pet-toolbar-btn {
  grid-column: span 1;
}

.pet-toolbar-btn {
  padding: 0 12px;
  white-space: nowrap;
}

.pet-toolbar-btn:hover,
.pet-icon-button:hover,
.pet-density-controls button:hover,
.pet-table-footer button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  filter: none;
}

.pet-toolbar-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.pet-toolbar-btn.is-primary {
  border-color: rgba(139, 92, 246, 0.55);
  background: linear-gradient(135deg, #5b5cf6, #7b58f5);
  color: #ffffff;
}

.pet-toolbar-btn.is-export {
  color: var(--text);
}

.pet-table-meta,
.pet-table-footer {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.pet-table-meta strong {
  color: var(--text-secondary);
  font-weight: 850;
}

.pet-density-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pet-density-controls button,
.pet-table-footer button,
.pet-table-footer a {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.pet-density-controls button.is-active,
.pet-table-footer button.is-active,
.pet-table-footer a.is-active {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.18);
  color: var(--text);
}

.pet-log-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.pet-log-table {
  min-width: 1480px;
  border-collapse: collapse;
}

.pet-log-table th,
.pet-log-table td {
  height: 38px;
  padding: 6px 16px;
  border-right: 1px solid rgba(120, 120, 170, 0.14);
  border-bottom: 1px solid rgba(120, 120, 170, 0.14);
  white-space: nowrap;
  vertical-align: middle;
}

.pet-log-table th:last-child,
.pet-log-table td:last-child {
  border-right: 0;
}

.pet-log-table th {
  color: var(--text-secondary);
  background: rgba(63, 62, 105, 0.46);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}

.pet-log-table td {
  color: var(--text-secondary);
  font-size: 13px;
}

.pet-log-table.is-comfortable th,
.pet-log-table.is-comfortable td {
  height: 48px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.pet-log-table tr:hover td {
  background: rgba(139, 92, 246, 0.06);
}

.pet-table-pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.pet-table-pill.is-green { color: var(--green); }
.pet-table-pill.is-blue { color: #6fa8ff; }
.pet-table-pill.is-amber { color: var(--amber); }
.pet-table-pill.is-red { color: var(--red); }
.pet-table-pill.is-purple { color: #a88bff; }

.pet-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pet-row-menu {
  top: calc(100% + 6px);
  min-width: 118px;
}

.pet-table-empty {
  height: 96px !important;
  text-align: center;
  color: var(--muted) !important;
}

.pet-table-footer nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pet-table-footer a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font-weight: 800;
  text-decoration: none;
}

.pet-table-footer a:hover {
  border-color: rgba(139, 92, 246, 0.45);
  color: var(--text);
}

.pet-page-ellipsis {
  min-width: 18px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 1280px) {
  .pet-profile-summary-top {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .pet-profile-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pet-profile-actions {
    justify-content: flex-start;
  }

  .pet-log-toolbar {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .pet-log-search {
    grid-column: 1 / -1;
  }

  .pet-kpi-board,
  .pet-health-grid,
  .pet-health-grid-secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pet-profile-chart-grid {
    grid-template-columns: 1fr;
  }

  .pet-log-toolbar .pet-filter-control,
  .pet-date-range {
    grid-column: span 3;
  }

  .pet-log-toolbar .pet-toolbar-btn {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .pet-profile-log-title,
  .pet-profile-title-actions,
  .pet-profile-actions,
  .pet-table-meta,
  .pet-table-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .pet-profile-title-actions .pet-toolbar-btn,
  .pet-profile-actions .pet-profile-action-select,
  .pet-profile-actions .pet-icon-button,
  .pet-log-toolbar .pet-toolbar-btn {
    width: 100%;
  }

  .pet-profile-metrics,
  .pet-kpi-board,
  .pet-health-grid,
  .pet-health-grid-secondary,
  .pet-log-toolbar {
    grid-template-columns: 1fr;
  }

  .pet-kpi-gauge-body {
    height: 92px;
  }

  .pet-log-toolbar .pet-filter-control,
  .pet-date-range,
  .pet-log-toolbar .pet-toolbar-btn {
    grid-column: 1 / -1;
  }

  .pet-date-segments {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
  }

  .pet-date-segments label {
    min-height: 34px;
  }

  .pet-profile-stepper {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .pet-profile-step-line {
    display: none;
  }

  .pet-profile-chart-wrap {
    height: 190px;
  }
}

/* Dashboard overview v2 */
.dashboard-overview-page {
  display: grid;
  gap: 18px;
}

.dashboard-overview-page .dashboard-hero {
  margin-bottom: 0;
}

.dashboard-filter-pro {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px 12px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(32, 32, 54, 0.94), rgba(18, 22, 40, 0.96));
  box-shadow: var(--shadow-soft);
}

.dashboard-filter-field,
.dashboard-filter-pro label,
.dashboard-pet-filter {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.dashboard-filter-field {
  grid-column: span 2;
}

.dashboard-filter-pro label span,
.dashboard-pet-filter > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-filter-pro input,
.dashboard-filter-pro select {
  width: 100%;
  min-height: 38px;
  border-color: rgba(128, 144, 190, 0.28);
  border-radius: 8px;
  background: rgba(12, 15, 30, 0.62);
}

.dashboard-pet-filter {
  grid-column: span 4;
  position: relative;
}

.dashboard-pet-token-box {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 5px 8px;
  border: 1px solid rgba(128, 144, 190, 0.28);
  border-radius: 8px;
  background: rgba(12, 15, 30, 0.62);
}

.dashboard-pet-token-box input {
  min-width: 110px;
  flex: 1 1 120px;
  min-height: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.dashboard-pet-tokens {
  display: contents;
}

.dashboard-pet-token {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 7px;
  border: 1px solid rgba(45, 212, 191, 0.28);
  border-radius: 7px;
  background: rgba(45, 212, 191, 0.1);
  color: var(--text);
  font-size: 12px;
}

.dashboard-pet-token button {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  box-shadow: none;
  line-height: 1;
}

.dashboard-pet-filter small {
  color: var(--muted);
  font-size: 11px;
}

.dashboard-pet-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 3px);
  z-index: 25;
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.dashboard-pet-suggestions button {
  min-height: 30px;
  justify-content: flex-start;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  font-size: 12px;
  text-align: left;
}

.dashboard-pet-suggestions button:hover {
  background: rgba(139, 92, 246, 0.14);
  color: var(--text);
}

.dashboard-filter-buttons {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  padding-top: 2px;
}

.dashboard-filter-buttons .button svg,
.dashboard-actions .button svg {
  width: 16px !important;
  height: 16px !important;
}

.dashboard-section {
  display: grid;
  gap: 13px;
}

.dashboard-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.dashboard-section-head span {
  min-width: 28px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--amber);
  color: #071019;
  font-size: 12px;
  font-weight: 950;
}

.dashboard-section:nth-of-type(3) .dashboard-section-head span {
  background: var(--green);
}

.dashboard-section:nth-of-type(4) .dashboard-section-head span {
  background: var(--blue);
}

.dashboard-section-head h2 {
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 900;
}

.dashboard-section-head i {
  height: 1px;
  flex: 1;
  background: var(--line);
}

.dashboard-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-kpi-strip.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-scorecard {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 16px 18px;
  border: 1px solid rgba(130, 143, 190, 0.22);
  border-left: 4px solid var(--cyan);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(31, 36, 62, 0.92), rgba(18, 22, 42, 0.94));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.dashboard-scorecard.is-wide {
  border-left-color: var(--amber);
}

.dashboard-scorecard.is-danger {
  border-left-color: var(--red);
}

.dashboard-scorecard.is-warn {
  border-left-color: var(--amber);
}

.dashboard-scorecard.is-good {
  border-left-color: var(--green);
}

.dashboard-scorecard span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 850;
  text-transform: uppercase;
}

.dashboard-scorecard strong {
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  font-weight: 950;
}

.dashboard-scorecard strong em {
  margin-left: 3px;
  color: var(--muted);
  font-size: 16px;
  font-style: normal;
}

.dashboard-scorecard small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.dashboard-scorecard-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dashboard-scorecard-head > span {
  min-width: 0;
}

.dashboard-segmented.compact {
  min-height: 28px;
  flex: 0 0 auto;
}

.dashboard-segmented.compact button {
  min-height: 22px;
  padding: 0 7px;
  font-size: 11px;
}

.dashboard-inactive-scorecard {
  align-content: stretch;
}

.dashboard-health-gauge-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 18px;
}

.dashboard-health-gauge-card {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.dashboard-health-gauge-card + .dashboard-health-gauge-card {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.dashboard-health-gauge-body {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding-inline: 6px;
}

.dashboard-yield-overview {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.dashboard-yield-overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.dashboard-yield-overview-head h2 {
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 900;
}

.dashboard-yield-overview-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-yield-overview > .dashboard-yield-overview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
}

.dashboard-yield-overview > .dashboard-yield-overview-head > i {
  min-width: 1px;
}

.dashboard-yield-summary {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 3px;
  text-align: center;
}

.dashboard-yield-summary span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  font-weight: 850;
  text-transform: uppercase;
}

.dashboard-yield-summary strong {
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  font-weight: 950;
}

.dashboard-yield-summary small {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-yield-overview-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.dashboard-yield-gauge-pair {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.dashboard-yield-gauge-card {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 14px;
}

.dashboard-yield-gauge-card + .dashboard-yield-gauge-card {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.dashboard-yield-gauge-head {
  min-width: 0;
}

.dashboard-yield-gauge {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding-inline: 6px;
}

.dashboard-yield-gauge-chart {
  width: min(100%, 300px);
  height: 170px;
  position: relative;
}

.dashboard-yield-gauge-chart canvas {
  width: 100% !important;
  height: 100% !important;
}

.dashboard-yield-gauge-readout {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.dashboard-yield-gauge-readout strong {
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  font-weight: 950;
}

.dashboard-yield-gauge-readout small {
  max-width: 280px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-mini-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-mini-kpis div {
  min-height: 62px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
}

.dashboard-mini-kpis span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-mini-kpis strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  font-weight: 900;
}

.dashboard-chart-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-chart-grid .span-12 { grid-column: span 12; }
.dashboard-chart-grid .span-7 { grid-column: span 7; }
.dashboard-chart-grid .span-5 { grid-column: span 5; }

.dashboard-panel {
  min-width: 0;
}

.dashboard-panel .panel-header {
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.dashboard-panel .panel-header > div:first-child {
  min-width: 0;
}

.dashboard-panel-segmented {
  flex: 0 0 auto;
}

.dashboard-segmented {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
}

.dashboard-segmented button {
  min-height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
  font-weight: 850;
}

.dashboard-segmented button.active {
  background: rgba(139, 92, 246, 0.2);
  color: var(--text);
}

.dashboard-pet-picker-modal {
  width: min(820px, 100%);
}

.dashboard-pet-picker-body {
  display: grid;
  gap: 12px;
}

.dashboard-pet-picker-search {
  width: 100%;
  min-height: 40px;
}

.dashboard-pet-picker-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-pet-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  max-height: min(460px, 56vh);
  overflow-y: auto;
}

.dashboard-pet-picker-grid button {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  box-shadow: none;
  font-size: 12px;
  font-weight: 850;
}

.dashboard-pet-picker-grid button:hover,
.dashboard-pet-picker-grid button.is-selected {
  border-color: rgba(45, 212, 191, 0.5);
  background: rgba(45, 212, 191, 0.14);
  color: var(--text);
}

@media (max-width: 1320px) {
  .dashboard-filter-pro {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .dashboard-filter-field {
    grid-column: span 3;
  }

  .dashboard-pet-filter {
    grid-column: span 6;
  }

  .dashboard-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-yield-overview-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .dashboard-chart-grid .span-7,
  .dashboard-chart-grid .span-5 {
    grid-column: span 12;
  }
}

@media (max-width: 900px) {
  .leaderboard-board-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-board,
  .leaderboard-board.is-wide {
    grid-column: 1 / -1;
  }

  .leaderboard-board-head,
  .leaderboard-board-subhead {
    flex-direction: column;
  }

  .leaderboard-board-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .leaderboard-board-row {
    grid-template-columns: 48px minmax(200px, 1fr) minmax(110px, 0.5fr);
  }

  .leaderboard-top-row {
    grid-template-columns: 48px minmax(200px, 1fr) minmax(110px, 0.5fr);
  }

  .leaderboard-board-mini,
  .leaderboard-board-status,
  .leaderboard-top-mini,
  .leaderboard-top-status {
    grid-column: 2 / -1;
  }

  .leaderboard-board-status,
  .leaderboard-top-status {
    justify-content: flex-start;
  }

  .leaderboard-chart-wrap {
    height: 260px;
  }

  .leaderboard-chart-wrap.is-top10 {
    height: 360px;
  }

  .leaderboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaderboard-toolbar,
  .leaderboard-v2-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .leaderboard-mode-tabs,
  .leaderboard-period-tabs,
  .leaderboard-global-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .leaderboard-global-filter {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .leaderboard-global-filter > span {
    padding-left: 4px;
  }

  .dashboard-filter-pro {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .dashboard-filter-field {
    grid-column: span 6;
  }

  .dashboard-pet-filter,
  .dashboard-filter-buttons {
    grid-column: 1 / -1;
  }

  .dashboard-filter-buttons {
    justify-content: flex-start;
  }

  .dashboard-yield-overview-body {
    grid-template-columns: 1fr;
  }

  .dashboard-yield-gauge-pair {
    grid-template-columns: 1fr;
  }

  .dashboard-yield-gauge-card + .dashboard-yield-gauge-card {
    padding-left: 0;
    padding-top: 18px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .dashboard-health-gauge-panel {
    grid-template-columns: 1fr;
  }

  .dashboard-health-gauge-card + .dashboard-health-gauge-card {
    padding-left: 0;
    padding-top: 18px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .leaderboard-board {
    padding: 16px 14px;
  }

  .leaderboard-board-row {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
  }

  .leaderboard-top-row {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
  }

  .leaderboard-board-primary,
  .leaderboard-board-mini,
  .leaderboard-board-status,
  .leaderboard-top-primary,
  .leaderboard-top-mini,
  .leaderboard-top-status {
    grid-column: 2 / -1;
  }

  .leaderboard-board-mini,
  .leaderboard-top-mini {
    grid-template-columns: 1fr;
  }

  .leaderboard-board-rank,
  .leaderboard-top-rank {
    font-size: 16px;
  }

  .leaderboard-board-primary strong,
  .leaderboard-top-primary strong {
    font-size: 22px;
  }

  .leaderboard-chart-wrap {
    height: 250px;
  }

  .leaderboard-chart-wrap.is-top10 {
    height: 340px;
  }

  .leaderboard-kpis {
    grid-template-columns: 1fr;
  }

  .leaderboard-controls,
  .leaderboard-controls select {
    width: 100%;
  }

  .leaderboard-global-filter {
    padding: 8px;
  }

  .leaderboard-global-tabs a,
  .leaderboard-mixed-mode {
    flex: 1 0 auto;
  }

  .leaderboard-kpi {
    min-height: 92px;
  }

  .leaderboard-kpi strong {
    font-size: 24px;
  }

  .dashboard-kpi-strip,
  .dashboard-kpi-strip.cols-2,
  .dashboard-mini-kpis {
    grid-template-columns: 1fr;
  }

  .dashboard-yield-overview-head {
    flex-direction: column;
  }

  .dashboard-yield-overview > .dashboard-yield-overview-head {
    grid-template-columns: 1fr;
  }

  .dashboard-yield-overview > .dashboard-yield-overview-head > i {
    display: none;
  }

  .dashboard-yield-summary {
    justify-items: start;
    text-align: left;
  }

  .dashboard-yield-overview-head .dashboard-segmented {
    width: 100%;
  }

  .dashboard-yield-overview-head .dashboard-segmented button {
    flex: 1;
  }

  .dashboard-yield-summary strong {
    font-size: 34px;
  }

  .dashboard-yield-gauge-chart {
    height: 150px;
  }

  .dashboard-scorecard-head {
    flex-direction: column;
  }

  .dashboard-scorecard-head .dashboard-segmented {
    width: 100%;
  }

  .dashboard-scorecard-head .dashboard-segmented button {
    flex: 1;
  }

  .dashboard-health-gauge-panel {
    padding: 16px;
  }

  .dashboard-health-gauge-card .dashboard-yield-overview-head {
    align-items: stretch;
  }

  .dashboard-health-gauge-card .dashboard-yield-overview-head .dashboard-segmented {
    width: 100%;
  }

  .dashboard-health-gauge-card .dashboard-yield-overview-head .dashboard-segmented button {
    flex: 1;
  }

  .dashboard-filter-pro {
    grid-template-columns: 1fr;
  }

  .dashboard-filter-field,
  .dashboard-pet-filter {
    grid-column: 1 / -1;
  }

  .dashboard-filter-buttons,
  .dashboard-filter-buttons .button {
    width: 100%;
  }

  .dashboard-section-head h2 {
    font-size: 16px;
  }

  .dashboard-panel-segmented {
    width: 100%;
  }

  .dashboard-panel-segmented button {
    flex: 1;
  }

  .dashboard-scorecard {
    min-height: 96px;
  }

  .dashboard-scorecard strong {
    font-size: 26px;
  }

  .dashboard-pet-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body:has(.pet-profile-log-page) .content {
    padding-inline: 12px;
  }

  .pet-profile-log-title,
  .pet-profile-copy p,
  .pet-profile-actions,
  .pet-table-meta,
  .pet-table-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .pet-profile-metrics,
  .pet-log-toolbar {
    grid-template-columns: 1fr;
  }

  .pet-profile-stepper {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .pet-profile-step-line {
    display: none;
  }
}

/* PET overview refresh */
.pets-overview-page {
  display: grid;
  gap: 16px;
}

.pets-overview-page .pets-hero {
  margin-bottom: 0;
}

.pets-actions .button {
  white-space: nowrap;
}

.pets-action-menu {
  position: relative;
  display: inline-flex;
}

.pets-action-menu-toggle svg {
  width: 15px;
  height: 15px;
}

.pets-action-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  min-width: 160px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #18182a;
  box-shadow: var(--shadow);
}

.pets-action-menu-list a,
.pets-action-menu-list button {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  text-align: left;
  font-size: 12px;
  font-weight: 800;
}

.pets-action-menu-list a:hover,
.pets-action-menu-list button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  filter: none;
}

.pets-score-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.pets-scorecard {
  min-height: 158px;
  display: grid;
  align-content: start;
  gap: 7px;
  position: relative;
  padding: 14px 16px;
  border: 1px solid rgba(130, 143, 190, 0.24);
  border-left: 4px solid var(--pets-card-accent, var(--muted));
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(31, 36, 62, 0.92), rgba(18, 22, 42, 0.94));
  color: inherit;
  box-shadow: var(--shadow-soft);
  text-align: left;
  overflow: hidden;
}

.pets-scorecard.is-clickable {
  cursor: pointer;
}

.pets-scorecard.is-clickable:hover,
.pets-scorecard.is-clickable:focus-visible,
.pets-scorecard.active {
  border-color: rgba(139, 92, 246, 0.48);
  border-left-color: var(--pets-card-accent, rgba(139, 92, 246, 0.48));
  background: linear-gradient(145deg, rgba(37, 40, 68, 0.98), rgba(24, 28, 48, 0.98));
  outline: none;
  filter: none;
}

.pets-scorecard.is-total { border-left-color: var(--blue); }
.pets-scorecard.is-total { align-content: center; }
.pets-scorecard.is-amber { border-left-color: var(--amber); }
.pets-scorecard.is-green { border-left-color: var(--green); }
.pets-scorecard.is-violet { border-left-color: var(--brand); }
.pets-scorecard.is-gold { border-left-color: var(--amber); }
.pets-scorecard.is-rose { border-left-color: var(--red); }

.pets-scorecard span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
  text-transform: uppercase;
}

.pets-scorecard span i {
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.pets-scorecard.active span i {
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

.pets-scorecard strong {
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  font-weight: 950;
}

.pets-scorecard small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.pets-scorecard .pets-status-preview {
  min-width: 0;
  min-height: 58px;
  display: grid;
  gap: 5px;
  margin-top: 4px;
  text-transform: none;
}

.pets-scorecard .pets-status-pet {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(42px, 44%);
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid rgba(130, 143, 190, 0.2);
  border-radius: 6px;
  background: rgba(8, 11, 24, 0.32);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.1;
  text-transform: none;
}

.pets-status-pet em,
.pets-status-pet b {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pets-status-pet em {
  color: var(--text);
  font-weight: 950;
}

.pets-status-pet b {
  justify-self: end;
  max-width: 100%;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.pets-scorecard .pets-status-more,
.pets-scorecard .pets-status-empty {
  display: block;
  padding: 5px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  text-transform: none;
}

.pets-scorecard .pets-status-more {
  color: var(--cyan);
}

.pets-scorecard .pets-milestone-preview {
  min-width: 0;
  min-height: 78px;
  display: grid;
  gap: 6px;
  margin-top: 4px;
  text-transform: none;
}

.pets-scorecard .pets-milestone-stack {
  width: 100%;
  height: 10px;
  display: flex;
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(130, 143, 190, 0.22);
  border-radius: 3px;
  background: rgba(8, 11, 24, 0.42);
}

.pets-scorecard .pets-milestone-stack span {
  display: block;
  min-width: 2px;
  height: 100%;
  flex: 0 0 auto;
}

.pets-scorecard .pets-milestone-list {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.pets-scorecard .pets-milestone-item {
  min-width: 0;
  width: 100%;
  height: 24px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) minmax(24px, auto) minmax(34px, auto);
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border: 1px solid rgba(130, 143, 190, 0.18);
  border-radius: 5px;
  background: rgba(8, 11, 24, 0.28);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.pets-scorecard .pets-milestone-item:hover,
.pets-scorecard .pets-milestone-item:focus-visible {
  border-color: rgba(45, 212, 191, 0.34);
  background: rgba(45, 212, 191, 0.08);
  outline: none;
}

.pets-scorecard .pets-milestone-dot {
  width: 7px;
  height: 7px;
  display: block;
  border-radius: 99px;
}

.pets-scorecard .pets-milestone-item em,
.pets-scorecard .pets-milestone-item b,
.pets-scorecard .pets-milestone-item small {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-style: normal;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.pets-scorecard .pets-milestone-item em {
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
}

.pets-scorecard .pets-milestone-item b {
  justify-self: end;
  color: var(--text);
  font-size: 10px;
  font-weight: 950;
}

.pets-scorecard .pets-milestone-item small {
  justify-self: end;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

/* PET status cards redesign */
.pets-score-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.pets-scorecard {
  min-width: 0;
  min-height: 196px;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: stretch;
  gap: 12px;
  padding: 14px;
  border-left-width: 3px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(33, 38, 66, 0.94), rgba(20, 24, 45, 0.98));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.pets-scorecard.is-clickable:hover,
.pets-scorecard.is-clickable:focus-visible,
.pets-scorecard.active {
  transform: translateY(-1px);
  border-color: rgba(130, 143, 190, 0.38);
  border-left-color: var(--pets-card-accent, rgba(130, 143, 190, 0.38));
  background:
    linear-gradient(180deg, rgba(38, 43, 75, 0.98), rgba(23, 27, 50, 0.98));
}

.pets-scorecard.is-total {
  grid-template-rows: auto auto;
  align-content: center;
  gap: 14px;
  padding: 18px;
}

.pets-score-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pets-score-label {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.pets-score-check {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 1px solid rgba(130, 143, 190, 0.42);
  border-radius: 4px;
  background: rgba(8, 11, 24, 0.22);
}

.pets-scorecard.active .pets-score-check {
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

.pets-score-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.pets-score-main strong {
  color: var(--text);
  font-size: 30px;
  line-height: 0.95;
  font-weight: 950;
  letter-spacing: 0;
}

.pets-score-main small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.pets-scorecard .pets-milestone-preview {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 9px;
  margin-top: 0;
  text-transform: none;
}

.pets-scorecard .pets-milestone-stack {
  height: 12px;
  gap: 2px;
  padding: 1px;
  border: 1px solid rgba(130, 143, 190, 0.18);
  border-radius: 5px;
  background: rgba(8, 11, 24, 0.46);
}

.pets-scorecard .pets-milestone-stack span {
  min-width: 3px;
  border-radius: 3px;
}

.pets-scorecard .pets-milestone-list {
  display: grid;
  gap: 6px;
}

.pets-scorecard .pets-milestone-item {
  height: 28px;
  grid-template-columns: 8px minmax(0, 1fr) minmax(28px, auto) minmax(42px, auto);
  gap: 7px;
  padding: 5px 7px;
  border-color: rgba(130, 143, 190, 0.16);
  border-radius: 6px;
  background: rgba(8, 11, 24, 0.22);
  cursor: pointer;
  text-decoration: none;
}

.pets-scorecard .pets-milestone-preview.is-dominant .pets-milestone-item {
  height: 34px;
  background: rgba(45, 212, 191, 0.07);
}

.pets-scorecard .pets-milestone-item:hover,
.pets-scorecard .pets-milestone-item:focus-visible {
  border-color: rgba(45, 212, 191, 0.44);
  background: rgba(45, 212, 191, 0.1);
  transform: translateY(-1px);
}

.pets-scorecard .pets-milestone-dot {
  width: 7px;
  height: 7px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.035);
}

.pets-scorecard .pets-milestone-item em {
  font-size: 10.5px;
  font-weight: 900;
}

.pets-scorecard .pets-milestone-item b {
  font-size: 10.5px;
}

.pets-scorecard .pets-milestone-item small {
  color: var(--text-secondary);
  font-size: 9.5px;
}

.pets-scorecard .pets-status-more {
  padding: 2px 0 0;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  text-align: left;
}

.pets-scorecard .pets-status-empty {
  min-height: 58px;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px dashed rgba(130, 143, 190, 0.22);
  border-radius: 7px;
  background: rgba(8, 11, 24, 0.16);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
}

.pets-milestone-modal {
  width: min(720px, 100%);
}

.pets-milestone-modal .modal-header h2 {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 1.15;
}

.pets-milestone-modal-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.pets-milestone-modal-stats span {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(130, 143, 190, 0.2);
  border-radius: 7px;
  background: rgba(8, 11, 24, 0.28);
}

.pets-milestone-modal-stats em {
  color: var(--text);
  font-size: 24px;
  font-style: normal;
  font-weight: 950;
  line-height: 1;
}

.pets-milestone-modal-stats b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.pets-milestone-modal-list {
  max-height: min(54vh, 420px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.pets-milestone-modal-pet {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(130, 143, 190, 0.18);
  border-radius: 6px;
  background: rgba(8, 11, 24, 0.26);
  color: inherit;
  text-decoration: none;
}

.pets-milestone-modal-pet:hover,
.pets-milestone-modal-pet:focus-visible {
  border-color: rgba(45, 212, 191, 0.34);
  background: rgba(45, 212, 191, 0.08);
  outline: none;
}

.pets-milestone-modal-pet strong,
.pets-milestone-modal-pet span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pets-milestone-modal-pet strong {
  color: var(--text);
  font-size: 13px;
}

.pets-milestone-modal-pet span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pets-milestone-hovercard {
  position: fixed;
  z-index: 260;
  width: min(320px, calc(100vw - 24px));
  max-height: min(430px, calc(100vh - 24px));
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(130, 143, 190, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(31, 36, 62, 0.98), rgba(14, 17, 34, 0.99));
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(255, 255, 255, 0.025) inset;
  color: var(--text);
  opacity: 0;
  pointer-events: auto;
  transform: translateY(3px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.pets-milestone-hovercard[hidden] {
  display: none;
}

.pets-milestone-hovercard.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.pets-milestone-hovercard-head {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(130, 143, 190, 0.16);
}

.pets-milestone-hovercard-head strong,
.pets-milestone-hovercard-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pets-milestone-hovercard-head strong {
  font-size: 14px;
  font-weight: 950;
  line-height: 1.15;
}

.pets-milestone-hovercard-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pets-milestone-hovercard-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pets-milestone-hovercard-stats span {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid rgba(130, 143, 190, 0.17);
  border-radius: 7px;
  background: rgba(8, 11, 24, 0.28);
}

.pets-milestone-hovercard-stats em {
  color: var(--text);
  font-size: 20px;
  font-style: normal;
  font-weight: 950;
  line-height: 1;
}

.pets-milestone-hovercard-stats b {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.pets-milestone-hovercard-detail {
  min-height: 0;
  display: grid;
  gap: 10px;
}

.pets-milestone-hovercard-detail[hidden],
.pets-milestone-hovercard-list[hidden] {
  display: none;
}

.pets-milestone-hovercard-list {
  max-height: 280px;
  display: grid;
  gap: 6px;
  overflow: auto;
  padding-right: 3px;
}

.pets-milestone-hovercard-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) minmax(36px, auto) minmax(48px, auto);
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid rgba(130, 143, 190, 0.16);
  border-radius: 6px;
  background: rgba(8, 11, 24, 0.24);
  color: inherit;
  text-decoration: none;
}

a.pets-milestone-hovercard-row {
  cursor: pointer;
}

a.pets-milestone-hovercard-row:hover,
a.pets-milestone-hovercard-row:focus-visible {
  border-color: rgba(94, 234, 212, 0.34);
  background: rgba(94, 234, 212, 0.09);
  outline: none;
}

.pets-milestone-hovercard-row .pets-milestone-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.035);
}

.pets-milestone-hovercard-row strong,
.pets-milestone-hovercard-row b,
.pets-milestone-hovercard-row small {
  min-width: 0;
  overflow: hidden;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pets-milestone-hovercard-row strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
}

.pets-milestone-hovercard-row b {
  justify-self: end;
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
}

.pets-milestone-hovercard-row small {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.pets-milestone-hovercard-pets {
  max-height: 280px;
  display: grid;
  gap: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 3px;
}

.pets-milestone-hovercard-pet {
  min-width: 0;
  min-height: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(72px, 42%);
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid rgba(130, 143, 190, 0.16);
  border-radius: 6px;
  background: rgba(8, 11, 24, 0.24);
  color: var(--text);
  text-decoration: none;
}

.pets-milestone-hovercard-pet:hover,
.pets-milestone-hovercard-pet:focus-visible {
  border-color: rgba(45, 212, 191, 0.42);
  background: rgba(45, 212, 191, 0.09);
  outline: none;
}

.pets-milestone-hovercard-pet strong,
.pets-milestone-hovercard-pet span {
  min-width: 0;
  overflow: hidden;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pets-milestone-hovercard-pet strong {
  font-size: 11px;
  font-weight: 950;
}

.pets-milestone-hovercard-pet span {
  justify-self: end;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.pets-gauge-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.pets-gauge-card {
  min-width: 0;
  min-height: 220px;
  display: grid;
  grid-template-rows: auto minmax(96px, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(130, 143, 190, 0.24);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(31, 36, 62, 0.94), rgba(18, 22, 42, 0.96));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.pets-gauge-head {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.pets-gauge-head h2 {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 900;
  text-transform: uppercase;
}

.pets-gauge-modes {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pets-gauge-modes button {
  min-height: 26px;
  padding: 5px 9px;
  border: 1px solid rgba(128, 144, 190, 0.24);
  border-radius: 999px;
  background: rgba(12, 15, 30, 0.52);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 850;
  cursor: pointer;
}

.pets-gauge-modes button:hover,
.pets-gauge-modes button:focus-visible,
.pets-gauge-modes button.active {
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.12);
  color: var(--text);
  outline: none;
}

.pets-gauge-chart {
  min-width: 0;
  width: 100%;
  height: 116px;
  align-self: center;
  position: relative;
}

.pets-gauge-chart canvas {
  width: 100% !important;
  height: 100% !important;
}

.pets-gauge-readout {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.pets-gauge-readout strong {
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  font-weight: 950;
}

.pets-gauge-readout small {
  max-width: 100%;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.pets-filter-bar {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(32, 32, 54, 0.94), rgba(18, 22, 40, 0.96));
  box-shadow: var(--shadow-soft);
}

.pets-filter-bar label {
  min-width: 0;
  display: grid;
  grid-column: span 2;
  gap: 7px;
}

.pets-filter-bar label:first-child,
.pets-filter-bar label:last-of-type {
  grid-column: span 3;
}

.pets-filter-bar span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
}

.pets-filter-bar input,
.pets-filter-bar select {
  width: 100%;
  min-height: 38px;
  border-color: rgba(128, 144, 190, 0.28);
  border-radius: 8px;
  background: rgba(12, 15, 30, 0.62);
}

.pets-filter-bar .button {
  min-height: 38px;
  justify-self: start;
}

.pets-filter-bar [data-pets-filter-reset],
.pets-filter-bar [data-recent-log-filter-reset] {
  grid-column: 11 / -1;
  justify-self: end;
}

.pets-recent-log-filter-bar {
  margin-bottom: 12px;
  box-shadow: none;
}

.pets-recent-log-filter-bar label,
.pets-recent-log-filter-bar label:first-child,
.pets-recent-log-filter-bar label:last-of-type {
  grid-column: span 3;
}

.pets-recent-log-filter-bar [data-recent-log-filter-reset] {
  grid-column: 10 / -1;
}

.pets-insight-row {
  display: grid;
  grid-template-columns: minmax(280px, 0.34fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.pets-worker-chart-panel,
.pets-attention-panel {
  min-width: 0;
}

.pets-chart-box {
  height: 190px;
  position: relative;
}

.pets-chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.pets-attention-table-wrap {
  max-height: 300px;
  overflow: auto;
}

.pets-attention-table {
  width: 100%;
  border-collapse: collapse;
}

.pets-attention-table th,
.pets-attention-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.pets-attention-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.pets-attention-table tr:last-child td {
  border-bottom: 0;
}

.pets-recent-logs-panel {
  min-width: 0;
}

.pets-recent-logs-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.pets-recent-logs-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.pets-table-panel {
  min-width: 0;
}

.pets-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.pets-table-row td {
  vertical-align: middle;
}

.pet-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.12);
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.pet-status-pill.status-khoi_tao {
  background: rgba(243, 199, 79, 0.14);
  color: var(--amber);
}

.pet-status-pill.status-nuoi {
  background: rgba(85, 214, 168, 0.13);
  color: var(--green);
}

.pet-status-pill.status-add_material {
  background: rgba(139, 92, 246, 0.16);
  color: var(--brand-hover);
}

.pet-status-pill.status-khai_thac {
  background: rgba(243, 199, 79, 0.14);
  color: var(--amber);
}

.pet-status-pill.status-chua_benh {
  background: rgba(239, 107, 91, 0.14);
  color: var(--red);
}

#petBulkToolbar,
#recentLogBulkToolbar {
  position: fixed;
  left: calc(var(--sidebar-collapsed-width) + 24px);
  right: 24px;
  bottom: 0;
  z-index: 180;
  margin: 0;
  padding: 12px 20px;
  border: 1px solid rgba(140, 140, 190, 0.38);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.28), rgba(45, 212, 191, 0.16)),
    rgba(32, 32, 54, 0.96);
  box-shadow: 0 -16px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.app-shell:has(.sidebar:hover) #petBulkToolbar,
.app-shell:has(.sidebar:focus-within) #petBulkToolbar,
.app-shell:has(.sidebar:hover) #recentLogBulkToolbar,
.app-shell:has(.sidebar:focus-within) #recentLogBulkToolbar {
  left: calc(var(--sidebar-expanded-width) + 24px);
}

body.has-pet-bulk-selection .content,
body.has-recent-log-bulk-selection .content {
  padding-bottom: 132px;
}

#petBulkToolbar > div:first-child,
#recentLogBulkToolbar > div:first-child {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

#petBulkToolbar strong,
#recentLogBulkToolbar strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

#petBulkToolbar span,
#recentLogBulkToolbar span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 1320px) {
  .pets-score-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pets-filter-bar label,
  .pets-filter-bar label:first-child,
  .pets-filter-bar label:last-of-type {
    grid-column: span 4;
  }

  .pets-insight-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .pets-gauge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pets-score-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pets-filter-bar label,
  .pets-filter-bar label:first-child,
  .pets-filter-bar label:last-of-type {
    grid-column: span 6;
  }

  #petBulkToolbar,
  #recentLogBulkToolbar {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .pets-score-grid,
  .pets-gauge-grid,
  .pets-filter-bar {
    grid-template-columns: 1fr;
  }

  .pets-milestone-modal-stats,
  .pets-milestone-modal-list {
    grid-template-columns: 1fr;
  }

  .pets-recent-logs-panel .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .pets-recent-logs-actions {
    justify-content: flex-start;
  }

  .pets-filter-bar label,
  .pets-filter-bar label:first-child,
  .pets-filter-bar label:last-of-type {
    grid-column: 1 / -1;
  }

  .pets-filter-bar [data-pets-filter-reset],
  .pets-filter-bar [data-recent-log-filter-reset] {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .pets-filter-bar .button,
  .pets-actions .button,
  .pets-actions .pets-action-menu {
    width: 100%;
  }

  .pets-action-menu-list {
    left: 0;
    right: 0;
  }

  #petBulkToolbar,
  #recentLogBulkToolbar {
    left: 0;
    right: 0;
    max-height: 46vh;
    overflow-y: auto;
    padding: 12px 14px;
  }

  .app-shell:has(.sidebar:hover) #petBulkToolbar,
  .app-shell:has(.sidebar:focus-within) #petBulkToolbar,
  .app-shell:has(.sidebar:hover) #recentLogBulkToolbar,
  .app-shell:has(.sidebar:focus-within) #recentLogBulkToolbar {
    left: 0;
  }

  body.has-pet-bulk-selection .content,
  body.has-recent-log-bulk-selection .content {
    padding-bottom: 168px;
  }
}

/* Leaderboard redesign */
body:has(.leaderboard-redesign) .content {
  max-width: none;
  padding: 24px clamp(18px, 2.4vw, 42px) 48px;
}

.leaderboard-redesign {
  --lb-bg: rgba(11, 17, 32, 0.72);
  --lb-panel: rgba(18, 26, 48, 0.86);
  --lb-line: rgba(130, 143, 190, 0.24);
  --lb-line-soft: rgba(130, 143, 190, 0.14);
  --lb-text: #f7f8ff;
  --lb-muted: #9aa6c7;
  --lb-purple: #8b5cf6;
  --lb-blue: #4f8cff;
  --lb-cyan: #35c9c8;
  --lb-yellow: #ffd166;
  --lb-pink: #ec5b9b;
  color: var(--lb-text);
}

.leaderboard-redesign-shell {
  display: grid;
  gap: 18px;
  padding: clamp(22px, 2vw, 34px);
  border: 1px solid var(--lb-line);
  border-radius: 12px;
  background:
    radial-gradient(circle at 12% 0%, rgba(139, 92, 246, 0.16), transparent 28%),
    radial-gradient(circle at 100% 26%, rgba(53, 201, 200, 0.08), transparent 28%),
    linear-gradient(145deg, rgba(13, 19, 36, 0.98), rgba(12, 18, 33, 0.96));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.leaderboard-redesign-head,
.leaderboard-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.leaderboard-redesign-head h1 {
  color: var(--lb-text);
  font-size: 28px;
  line-height: 1.05;
  font-weight: 950;
}

.leaderboard-redesign-head p,
.leaderboard-card-head p {
  margin-top: 7px;
  color: var(--lb-muted);
  font-size: 13px;
}

.leaderboard-scope-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.08);
  color: #5eead4;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.leaderboard-scope-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5eead4;
  box-shadow: 0 0 16px rgba(94, 234, 212, 0.8);
}

.leaderboard-redesign-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 0.9fr) minmax(300px, 1fr);
  gap: 16px 24px;
  align-items: end;
}

.leaderboard-control-field select,
.leaderboard-static-filter {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  padding: 0 15px;
  border: 1px solid var(--lb-line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.76);
  color: var(--lb-text);
  font-size: 13px;
  font-weight: 800;
}

.leaderboard-control-group {
  display: grid;
  gap: 7px;
}

.leaderboard-control-group > span {
  color: var(--lb-muted);
  font-size: 12px;
  font-weight: 850;
}

.leaderboard-segmented {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--lb-line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.76);
  overflow-x: auto;
}

.leaderboard-segmented a {
  min-width: 96px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--lb-muted);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.leaderboard-segmented a:hover {
  color: var(--lb-text);
  background: rgba(255, 255, 255, 0.05);
}

.leaderboard-segmented a.active {
  color: #ffffff;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  box-shadow: 0 12px 28px rgba(124, 58, 237, 0.32);
}

.leaderboard-advanced-filter {
  margin-top: 12px;
  border: 1px solid var(--lb-line);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.58);
}

.leaderboard-advanced-filter > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  color: var(--lb-text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  list-style: none;
}

.leaderboard-advanced-filter > summary::-webkit-details-marker {
  display: none;
}

.leaderboard-advanced-filter > summary::before {
  content: '＋';
  color: var(--primary);
  font-size: 15px;
}

.leaderboard-advanced-filter[open] > summary::before {
  content: '−';
}

.leaderboard-advanced-filter > summary small {
  margin-left: auto;
  color: var(--lb-muted);
  font-size: 11px;
}

.leaderboard-advanced-filter-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 0 13px 13px;
  border-top: 1px solid var(--lb-line);
}

.leaderboard-advanced-filter-form label {
  display: grid;
  gap: 6px;
  padding-top: 12px;
}

.leaderboard-advanced-filter-form label > span {
  color: var(--lb-muted);
  font-size: 11px;
  font-weight: 800;
}

.leaderboard-advanced-filter-form input[type='date'] {
  min-height: 42px;
  border-color: var(--lb-line);
  background: rgba(15, 23, 42, 0.76);
}

.leaderboard-advanced-filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 12px;
}

.leaderboard-kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.leaderboard-kpi-card {
  min-width: 0;
  min-height: 132px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  padding: 18px 16px;
  border: 1px solid var(--lb-line);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(31, 42, 73, 0.72), rgba(16, 24, 44, 0.92)),
    radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.07), transparent 34%);
}

.leaderboard-kpi-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 950;
  background: linear-gradient(135deg, var(--lb-purple), #6d5dfc);
}

.leaderboard-kpi-icon svg {
  width: 20px;
  height: 20px;
}

.leaderboard-kpi-card.is-logs .leaderboard-kpi-icon { background: linear-gradient(135deg, var(--lb-blue), #155ac9); }
.leaderboard-kpi-card.is-harvest .leaderboard-kpi-icon { background: linear-gradient(135deg, var(--lb-cyan), #147b86); }
.leaderboard-kpi-card.is-treatment .leaderboard-kpi-icon { background: linear-gradient(135deg, var(--lb-pink), #9f315f); }
.leaderboard-kpi-card.is-inactive .leaderboard-kpi-icon { background: linear-gradient(135deg, #7c5df8, #392c76); }

.leaderboard-kpi-card h2 {
  color: var(--lb-text);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 900;
}

.leaderboard-kpi-card strong {
  display: block;
  margin-top: 10px;
  color: var(--lb-text);
  font-size: 24px;
  line-height: 1;
  font-weight: 950;
}

.leaderboard-kpi-card small {
  display: block;
  margin-top: 7px;
  color: var(--lb-muted);
  font-size: 12px;
}

.leaderboard-delta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 11px;
  color: var(--lb-muted);
  font-size: 12px;
  font-weight: 800;
}

.leaderboard-delta.is-up { color: #34d399; }
.leaderboard-delta.is-down { color: #fb7185; }

.leaderboard-redesign-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--lb-line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 0% 0%, rgba(79, 140, 255, 0.12), transparent 34%),
    linear-gradient(145deg, rgba(22, 31, 57, 0.86), rgba(15, 23, 42, 0.94));
}

.leaderboard-card-head {
  margin-bottom: 14px;
}

.leaderboard-card-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--lb-text);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 950;
}

.leaderboard-heading-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.16);
  color: #a78bfa;
}

.leaderboard-heading-icon svg {
  width: 17px;
  height: 17px;
}

.leaderboard-heading-icon.is-trophy {
  background: rgba(255, 209, 102, 0.14);
  color: var(--lb-yellow);
}

.leaderboard-heading-icon.is-logs {
  background: rgba(79, 140, 255, 0.14);
  color: var(--lb-blue);
}

.leaderboard-heading-icon.is-harvest {
  background: rgba(53, 201, 200, 0.14);
  color: var(--lb-cyan);
}

.leaderboard-heading-icon.is-treatment {
  background: rgba(236, 91, 155, 0.14);
  color: var(--lb-pink);
}

.leaderboard-main-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.85fr) minmax(0, 1.55fr);
  gap: 28px;
  align-items: stretch;
}

.leaderboard-chart-panel,
.leaderboard-mini-chart {
  min-width: 0;
  position: relative;
  height: 320px;
}

.leaderboard-chart-panel canvas,
.leaderboard-mini-chart canvas,
.leaderboard-donut-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.leaderboard-axis-label {
  display: block;
  margin-bottom: 4px;
  color: var(--lb-muted);
  font-size: 11px;
  font-weight: 800;
}

.leaderboard-rank-table {
  min-width: 0;
  overflow-x: auto;
}

.leaderboard-table-head,
.leaderboard-table-row {
  display: grid;
  grid-template-columns: 56px minmax(220px, 1.25fr) minmax(140px, 0.9fr) minmax(110px, 0.6fr) minmax(82px, 0.44fr) minmax(104px, 0.5fr) minmax(150px, 0.8fr);
  gap: 16px;
  align-items: center;
  min-width: 960px;
}

.leaderboard-table-head {
  padding-bottom: 12px;
  color: var(--lb-muted);
  font-size: 11px;
  font-weight: 900;
}

.leaderboard-table-row {
  min-height: 48px;
  padding: 10px 0;
  border-top: 1px solid var(--lb-line-soft);
  color: #dbe2ff;
  font-size: 12px;
}

.leaderboard-table-row strong {
  color: var(--lb-text);
  font-size: 14px;
  font-weight: 900;
}

.leaderboard-rank-badge {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(130, 143, 190, 0.18);
  color: #dbe2ff;
  font-size: 12px;
  font-style: normal;
  font-weight: 950;
}

.leaderboard-rank-badge.is-gold { background: linear-gradient(135deg, #facc15, #f59e0b); color: #1f1300; }
.leaderboard-rank-badge.is-silver { background: linear-gradient(135deg, #e5e7eb, #94a3b8); color: #111827; }
.leaderboard-rank-badge.is-bronze { background: linear-gradient(135deg, #d97706, #92400e); color: #fff7ed; }

.leaderboard-person-cell {
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
}

.leaderboard-avatar {
  grid-row: span 2;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.22);
  color: #c4b5fd;
  font-size: 11px;
  font-style: normal;
  font-weight: 950;
}

.leaderboard-person-cell b,
.leaderboard-mini-list b,
.leaderboard-share-list b {
  min-width: 0;
  overflow: hidden;
  color: var(--lb-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-person-cell small {
  min-width: 0;
  overflow: hidden;
  color: var(--lb-muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-status-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.leaderboard-status-list span:not(.badge) {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--lb-line);
  border-radius: 999px;
  color: var(--lb-muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 10px;
  font-weight: 850;
}

.leaderboard-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.leaderboard-small-card-body,
.leaderboard-donut-body {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(150px, 0.8fr);
  gap: 20px;
  align-items: center;
}

.leaderboard-mini-chart {
  height: 280px;
}

.leaderboard-mini-list,
.leaderboard-share-list {
  display: grid;
  gap: 0;
  min-width: 0;
}

.leaderboard-mini-list > div,
.leaderboard-share-list > div,
.leaderboard-mini-list p,
.leaderboard-share-list p {
  display: grid;
  gap: 10px;
  align-items: center;
}

.leaderboard-mini-list > div,
.leaderboard-mini-list p {
  grid-template-columns: minmax(0, 1fr) minmax(56px, auto);
}

.leaderboard-share-list > div,
.leaderboard-share-list p {
  grid-template-columns: minmax(0, 1fr) 44px 56px;
}

.leaderboard-mini-list > div,
.leaderboard-share-list > div {
  padding-bottom: 9px;
  color: var(--lb-muted);
  font-size: 11px;
  font-weight: 900;
}

.leaderboard-mini-list p,
.leaderboard-share-list p {
  min-height: 38px;
  margin: 0;
  border-top: 1px solid var(--lb-line-soft);
  color: #dbe2ff;
  font-size: 12px;
}

.leaderboard-mini-list b {
  display: flex;
  align-items: center;
  gap: 9px;
}

.leaderboard-mini-list .leaderboard-rank-badge {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.leaderboard-donut-wrap {
  position: relative;
  width: min(100%, 220px);
  height: 220px;
  justify-self: center;
}

.leaderboard-donut-wrap strong {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  color: var(--lb-text);
  font-size: 30px;
  line-height: 1;
  font-weight: 950;
}

.leaderboard-donut-wrap strong span {
  margin-top: 5px;
  color: var(--lb-muted);
  font-size: 12px;
  font-weight: 900;
}

.leaderboard-share-list b {
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-share-list b i {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  background: var(--lb-purple);
}

.leaderboard-share-list p:nth-of-type(1) b i { background: var(--lb-purple); }
.leaderboard-share-list p:nth-of-type(2) b i { background: var(--lb-blue); }
.leaderboard-share-list p:nth-of-type(3) b i { background: var(--lb-cyan); }
.leaderboard-share-list p:nth-of-type(4) b i { background: var(--lb-yellow); }
.leaderboard-share-list p:nth-of-type(5) b i { background: var(--lb-pink); }
.leaderboard-share-list p:nth-of-type(6) b i { background: #64748b; }

.leaderboard-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed var(--lb-line);
  border-radius: 8px;
  color: var(--lb-muted);
  text-align: center;
}

.leaderboard-empty-detail {
  display: grid;
  justify-items: center;
  gap: 7px;
  text-align: center;
}

.leaderboard-empty-detail strong {
  color: var(--text);
}

.leaderboard-empty-detail small,
.leaderboard-empty-detail span {
  color: var(--muted);
}

.leaderboard-empty-detail nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 5px;
}

.leaderboard-empty-detail a {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1240px) {
  .leaderboard-redesign-controls,
  .leaderboard-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaderboard-control-field {
    grid-column: 1 / -1;
  }

  .leaderboard-main-grid,
  .leaderboard-small-card-body,
  .leaderboard-donut-body {
    grid-template-columns: 1fr;
  }

  .leaderboard-chart-panel {
    height: 320px;
  }
}

@media (max-width: 900px) {
  body:has(.leaderboard-redesign) .content {
    padding-inline: 14px;
  }

  .leaderboard-redesign-shell {
    padding: 20px 14px;
  }

  .leaderboard-redesign-head,
  .leaderboard-card-head {
    flex-direction: column;
  }

  .leaderboard-redesign-controls,
  .leaderboard-kpi-strip,
  .leaderboard-card-grid,
  .leaderboard-advanced-filter-form {
    grid-template-columns: 1fr;
  }

  .leaderboard-advanced-filter-actions {
    padding-top: 0;
  }

  .leaderboard-scope-pill,
  .leaderboard-segmented,
  .leaderboard-control-field select,
  .leaderboard-static-filter {
    width: 100%;
  }

  .leaderboard-segmented a {
    flex: 1;
    min-width: max-content;
  }

  .leaderboard-kpi-card {
    min-height: 112px;
  }
}

@media (max-width: 560px) {
  .leaderboard-redesign-head h1 {
    font-size: 24px;
  }

  .leaderboard-chart-panel {
    height: 260px;
  }

  .leaderboard-mini-chart {
    height: 220px;
  }

  .leaderboard-donut-wrap {
    height: 190px;
  }
}

.leaderboard-overall-card {
  margin-bottom: 18px;
}

.leaderboard-overall-card .leaderboard-card-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.leaderboard-period-pill {
  flex: 0 0 auto;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--panel-3);
  font-size: 11px;
  font-weight: 800;
}

.leaderboard-overall-groups {
  display: grid;
  gap: 18px;
}

.leaderboard-overall-group {
  min-width: 0;
}

.leaderboard-overall-group h3 {
  margin: 14px 0 0;
  color: var(--text);
  font-size: 14px;
}

.leaderboard-overall-body {
  display: grid;
  grid-template-columns: minmax(320px, 1.35fr) minmax(260px, 0.65fr);
  gap: 22px;
  align-items: center;
  min-width: 0;
}

.leaderboard-overall-chart {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  height: 310px;
  margin-top: 12px;
}

.leaderboard-overall-chart-canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.leaderboard-overall-chart-canvas canvas {
  width: 100% !important;
  height: 100% !important;
}

.leaderboard-overall-stats {
  min-width: 0;
  max-height: 286px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: rgba(154, 166, 199, 0.38) transparent;
}

.leaderboard-overall-stat-head,
.leaderboard-overall-stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(86px, auto);
  gap: 16px;
  align-items: center;
}

.leaderboard-overall-stat-head {
  padding-bottom: 10px;
  color: var(--lb-muted);
  font-size: 11px;
  font-weight: 900;
}

.leaderboard-overall-stat-row {
  min-height: 42px;
  margin: 0;
  padding: 10px 0;
  border-top: 1px solid var(--lb-line-soft);
  color: #dbe2ff;
  font-size: 12px;
}

.leaderboard-overall-stat-row b {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.leaderboard-overall-stat-row b span {
  min-width: 0;
  overflow: hidden;
  color: var(--lb-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-overall-stat-row > span {
  color: #dbeafe;
  font-weight: 900;
  white-space: nowrap;
}

.leaderboard-overall-stats .leaderboard-rank-badge {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  font-size: 10px;
}

@media (max-width: 700px) {
  .leaderboard-overall-card .leaderboard-card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .leaderboard-overall-body {
    grid-template-columns: 1fr;
  }

  .leaderboard-overall-chart {
    height: 250px;
  }

  .leaderboard-overall-stats {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}
