/* file: app.css
   what: IT Hub — Apps analytics chrome (topbar + toolbar + На основі + cards)
*/

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  font-optical-sizing: auto;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-optical-sizing: auto;
}

[data-theme="light"] body {
  background: linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
}

[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(110, 168, 255, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(167, 139, 250, 0.14), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(52, 211, 153, 0.08), transparent 50%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
}

a { color: inherit; }

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.muted { color: var(--muted); }

.app {
  max-width: 100%;
  min-height: 100vh;
  padding: 20px 20px 28px;
}

/* ——— Topbar ——— */
.topbar {
  --topbar-block-height: 58px;
  --topbar-theme-width: 44px;
  --topbar-gap: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand actions";
  align-items: center;
  column-gap: var(--topbar-gap);
  row-gap: var(--topbar-gap);
  margin-bottom: var(--topbar-gap);
}

.topbar > .brand { grid-area: brand; }
.topbar > .topbar-right { grid-area: actions; }

.topbar .platform-switcher,
.topbar .refresh-panel,
.topbar .btn-theme-toggle {
  height: var(--topbar-block-height);
  min-height: var(--topbar-block-height);
  max-height: var(--topbar-block-height);
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--topbar-gap);
  min-width: 0;
}

.platform-switcher {
  position: relative;
  flex-shrink: 0;
  align-self: center;
}

.platform-switcher .view-switcher-btn {
  min-width: 6.5rem;
  flex: 1 1 0;
  font-size: 0.82rem;
  position: relative;
}

.brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand p {
  margin: 2px 0 0;
  font-size: clamp(0.72rem, 1.6vw, 0.82rem);
  color: var(--muted);
}

.topbar-right {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: var(--topbar-gap);
  flex-shrink: 0;
  min-width: 0;
  height: var(--topbar-block-height);
}

.topbar-actions {
  display: flex;
  align-items: stretch;
  gap: var(--topbar-gap);
  min-width: 0;
  height: 100%;
}

/* Refresh / import — match sion-hub theme-layout-kpi + controls */
.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--mint-a12);
  border-color: var(--mint-a35);
  color: var(--mint);
}

.btn-refresh:hover {
  background: var(--mint-a20);
  border-color: var(--mint-a50);
  color: var(--chip-ok-border);
}

.btn-refresh.loading .refresh-icon,
.btn-refresh.is-spinning .refresh-icon {
  display: inline-block;
  animation: refresh-spin 0.8s linear infinite;
}

.btn-refresh.success {
  background: var(--mint-a32);
  border-color: var(--mint-glow);
  color: var(--chip-ok-bg);
  box-shadow: 0 0 24px var(--mint-a35);
  animation: refresh-success-pulse 0.55s ease-out 2;
}

.btn-refresh.success .refresh-icon {
  animation: refresh-check-pop 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.btn-refresh:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

@keyframes refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes refresh-success-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 var(--mint-a55); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 10px transparent; }
  100% { transform: scale(1); box-shadow: 0 0 16px var(--mint-a25); }
}

@keyframes refresh-check-pop {
  0% { transform: scale(0.4) rotate(-120deg); opacity: 0; }
  65% { transform: scale(1.25) rotate(0deg); opacity: 1; }
  100% { transform: scale(1); }
}

.refresh-panel {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.refresh-panel .btn-refresh {
  width: auto;
  min-width: 44px;
  justify-content: center;
  align-self: stretch;
  border: none;
  border-radius: 0;
  padding: 0 14px;
  box-shadow: none;
  background: var(--mint-a14);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 500;
  transform: none;
}

.refresh-panel .btn-refresh .refresh-icon {
  font-size: calc(1.35rem - 5px);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.refresh-panel .btn-refresh:hover {
  background: var(--mint-a24);
  transform: none;
}

.refresh-panel .btn-refresh.success {
  border-radius: 0;
}

.refresh-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--success-a18);
  pointer-events: none;
}

.refresh-progress[hidden] {
  display: none !important;
}

.refresh-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--success-text-soft);
  transition: width 0.35s ease;
}

.refresh-progress.is-indeterminate .refresh-progress-bar {
  width: 32%;
  transition: none;
  animation: refresh-progress-slide 1.1s ease-in-out infinite;
}

@keyframes refresh-progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(420%); }
}

[data-theme="dark"] .refresh-progress-bar {
  background: var(--success);
}

.refresh-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  padding: 0 10px;
  background: var(--surface-2);
  border-top: none;
  min-width: 0;
}

.refresh-meta-label {
  font-size: 0.56rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  line-height: 1.2;
}

.refresh-meta-time {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  white-space: nowrap;
}

.refresh-meta-time.error { color: var(--danger-text); }

[data-theme="light"] .refresh-panel .btn-refresh {
  background: var(--success-a10);
  color: var(--success-text-soft);
}

[data-theme="light"] .refresh-panel .btn-refresh:hover {
  background: var(--success-a16);
  color: var(--success-deep);
}

.btn-theme-toggle {
  width: var(--topbar-theme-width);
  min-width: var(--topbar-theme-width);
  height: var(--topbar-block-height);
  padding: 0;
  align-self: stretch;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text-2);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn-theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .app { padding: 16px 16px 24px; }
}

@media (max-width: 640px) {
  .app { padding: 12px 12px 20px; }
  .topbar {
    grid-template-columns: 1fr;
    grid-template-areas: "brand" "actions";
  }
  .topbar-right {
    width: 100%;
    height: auto;
  }
  .topbar-actions { width: 100%; }
  .refresh-panel { flex: 1 1 auto; }
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.period-actions .btn:hover {
  transform: none;
}

.btn-featured {
  background: linear-gradient(135deg, var(--bar-a18) 0%, var(--violet-a18) 100%);
  border-color: var(--bar-a35);
  color: var(--text);
}

.btn-featured:hover {
  border-color: var(--bar-a45);
  color: var(--text);
  filter: brightness(1.04);
}

.period-actions .btn-featured {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.period-actions .btn-featured:hover {
  filter: brightness(1.06);
  color: var(--on-accent);
}

.btn-ghost {
  background: transparent;
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toggle-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.toggle-btn.active,
.toggle-btn.open {
  background: var(--bar-a16);
  border-color: var(--bar-a45);
  color: var(--accent);
}

.toggle-btn-icon {
  display: inline-flex;
  flex-shrink: 0;
  opacity: 0.9;
}

#periodTriggerLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(280px, 55vw);
}

.period-wrap { position: relative; }

.period-menu {
  position: fixed;
  z-index: 100;
  display: none;
  width: min(320px, calc(100vw - 16px));
  padding: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.period-menu.open {
  display: block;
}

.period-section-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

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

.period-preset {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.period-preset:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.period-preset.active {
  background: var(--bar-a16);
  border-color: var(--bar-a45);
  color: var(--accent);
}

.period-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.period-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.period-field label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.period-field input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  outline: none;
  color-scheme: light dark;
  cursor: pointer;
}

.period-field input[type="date"]:focus {
  border-color: var(--bar-a45);
  box-shadow: 0 0 0 2px var(--bar-a12);
}

.period-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.period-actions .btn {
  min-width: 0;
  padding: 6px 11px;
  font-size: 0.74rem;
  white-space: nowrap;
}

/* ——— Page shell (Apps / iOS analytics) ——— */
.analytics-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.analytics-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.analytics-toolbar-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.analytics-select-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  min-height: 32px;
  box-sizing: border-box;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.analytics-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b93a7' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")
    no-repeat right center;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  min-width: 140px;
  max-width: min(240px, 42vw);
  padding: 0 18px 0 0;
  line-height: 1.2;
}

.analytics-select option {
  background: var(--bg-1);
  color: var(--text);
  font-weight: 500;
}

.btn-time-period-trigger {
  min-height: 32px;
  padding: 6px 12px;
  box-sizing: border-box;
}

.btn-time-period-trigger.active,
.btn-time-period-trigger.open {
  background: var(--bar-a16);
  border-color: var(--bar-a45);
  color: var(--accent);
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}


.analytics-shell > .analytics-summary,
.analytics-shell > .analytics-mode-bar,
.analytics-shell > .analytics-view-root {
  grid-column: 1 / -1;
}

.analytics-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  min-width: 0;
  align-items: stretch;
}

@media (max-width: 1100px) {
  .analytics-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .analytics-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.analytics-summary-item {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 10px 12px;
  min-height: 72px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white-a02);
  min-width: 0;
  box-sizing: border-box;
}

.analytics-summary-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 14px;
}

.analytics-summary-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.2;
}

.analytics-summary-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

.analytics-summary-value.accent { color: var(--accent); }
.analytics-summary-value.success { color: var(--success); }
.analytics-summary-value.purple { color: var(--purple); }
.analytics-summary-value.cyan { color: var(--chart-cyan); }
.analytics-summary-value.warning { color: var(--hot); }
.analytics-summary-value.orange { color: var(--warning-bright); }

[data-theme="light"] .analytics-summary-value.cyan { color: var(--chart-cyan-deep); }
[data-theme="light"] .analytics-summary-value.orange { color: var(--warning); }

/* Apps/Design period KPI: compact text-2 value, may wrap */
.analytics-summary-value.period {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-2);
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  font-variant-numeric: normal;
}

.analytics-mode-bar {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  min-width: 0;
  width: 100%;
}

.analytics-based-on {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  width: 100%;
  max-width: 100%;
  min-height: 32px;
  height: auto;
  padding: 4px 6px 4px 12px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--white-a02);
  box-shadow: none;
}

[data-theme="light"] .analytics-based-on {
  background: var(--surface-solid);
  border-color: var(--border-strong);
}

.analytics-based-on-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.view-switcher {
  display: inline-flex;
  align-items: stretch;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 4px;
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.analytics-based-on .view-switcher {
  box-shadow: none;
  border: none;
  background: transparent;
  padding: 0;
  gap: 2px;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: wrap;
  overflow: visible;
  max-width: none;
}

.view-switcher-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: calc(var(--radius-sm) - 4px);
  padding: 0 14px;
  font: inherit;
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  min-height: 28px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.view-switcher-btn[hidden] {
  display: none !important;
}

.analytics-based-on .view-switcher-btn {
  padding: 4px 8px;
  font-size: 0.7rem;
  line-height: 1;
  border-radius: var(--radius-pill);
  height: auto;
  min-height: 0;
}

.view-switcher-btn:hover { color: var(--text); }

.view-switcher-btn.active {
  background: var(--bar-a20);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--bar-a25);
}

.analytics-based-on .view-switcher-btn.active {
  box-shadow: none;
}

.analytics-view-root {
  min-width: 0;
  width: 100%;
}

/* ——— Cards ——— */

.analytics-card {
  grid-column: span 6;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 14px 12px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: visible;
}

.analytics-card.span-full { grid-column: 1 / -1; }

.analytics-grid--wait {
  align-items: start;
}

.analytics-grid--wait .analytics-card--wait-people,
.analytics-grid--wait .analytics-card--wait-labels {
  grid-column: span 6;
  align-self: start;
}

.analytics-grid--requests {
  align-items: start;
}

.analytics-grid--requests .analytics-card--form-units {
  grid-column: 1 / -1;
  align-self: start;
  max-width: 720px;
}

.chart-wrap--form-units {
  flex: 0 0 auto;
  height: 280px;
  min-height: 280px;
  margin-top: 6px;
}

.chart-wrap--wait {
  flex: 0 0 auto;
  /* Match 10 horizontal bars: 48 + 10 * 34 (see sizeHorizontalChart) */
  height: 388px;
  min-height: 388px;
  margin-top: 6px;
}

.analytics-card--wait-people .wait-error,
.analytics-card--wait-labels .wait-error {
  color: var(--danger);
}

@media (max-width: 900px) {
  .analytics-card { grid-column: 1 / -1; }
}

.analytics-card-head {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.analytics-card-head:has(.metric-info-tip:hover),
.analytics-card-head:has(.metric-info-tip:focus-within) {
  z-index: 40;
}

.analytics-card-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-2);
}

.analytics-card-head-main {
  flex: 1;
  min-width: 0;
}

.analytics-card-head > .metric-info-tip {
  margin-left: 4px;
  align-self: flex-start;
  margin-top: 1px;
}

.analytics-card-sub {
  margin: 3px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
  max-width: 52ch;
}

/* Match sion-hub metric-info-tip */
.metric-info-tip {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.metric-info-tip:hover,
.metric-info-tip:focus-within {
  z-index: 50;
}

.metric-info-tip-i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid var(--console-btn-border);
  font-size: 0.58rem;
  font-weight: 600;
  font-style: normal;
  font-family: var(--font);
  color: var(--slate-track);
  cursor: help;
  line-height: 1;
  background: var(--slate-fill-faint);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.metric-info-tip:hover .metric-info-tip-i,
.metric-info-tip:focus-within .metric-info-tip-i {
  color: var(--accent);
  border-color: var(--bar-a50);
  background: var(--bar-a12);
  transform: scale(1.05);
}

.metric-info-tip-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: -2px;
  width: max-content;
  max-width: 248px;
  padding: 8px 10px;
  font-size: 0.66rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-2);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  box-shadow: 0 8px 24px var(--ink-a12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
  pointer-events: none;
  z-index: 60;
  white-space: normal;
}

.metric-info-tip:hover .metric-info-tip-popup,
.metric-info-tip:focus-within .metric-info-tip-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 228px;
  min-width: 0;
  flex: 1 1 auto;
  margin-top: 14px;
  overflow: visible;
}

.chart-wrap.tall {
  min-height: 280px;
  flex: 0 0 auto;
  height: 280px;
}

.chart-wrap--avg-type {
  min-height: 280px;
  flex: 0 0 auto;
}

.analytics-card--avg-type .analytics-empty-text {
  padding: 28px 8px;
  text-align: center;
}

.chart-wrap.donut {
  min-height: 228px;
}

@media (max-width: 720px) {
  .chart-wrap.donut {
    min-height: 260px;
  }
}

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

.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lb-head,
.lb-row {
  display: grid;
  grid-template-columns: minmax(6.5rem, 8.75rem) minmax(0, 1fr) 4.6rem 4.4rem;
  gap: 10px 8px;
  align-items: center;
  width: 100%;
}

.lb-head {
  padding: 2px 8px 6px;
}

.lb-head-spacer { min-width: 0; }

.lb-th {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  line-height: 1;
}

.lb-th:hover,
.lb-th.is-active {
  color: var(--accent);
}

.lb-th-label {
  white-space: nowrap;
}

.sort-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: calc(var(--radius-2xs) + 1px);
  font-size: 0.65rem;
  color: var(--muted);
  background: var(--white-a04);
  transition: all 0.15s;
  flex-shrink: 0;
}

.sort-badge.on {
  background: var(--bar-a20);
  color: var(--accent);
}

.lb-row {
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.lb-row:hover { background: var(--surface-2); border-color: var(--border); }

.lb-row--static {
  cursor: default;
}

.lb-row--static:hover {
  background: transparent;
  border-color: transparent;
}

.lb-row.is-selected {
  border-color: var(--bar-a45);
  background: var(--bar-a10);
  box-shadow: inset 0 0 0 1px var(--bar-a25);
}

.analytics-card--closers,
.analytics-card--themes,
.analytics-card--spaces,
.analytics-card--issue-types,
.analytics-card--label-dev {
  overflow: visible;
}

.analytics-card--label-dev {
  align-self: start;
}

.chart-wrap--label-dev {
  min-height: 220px;
  flex: 0 0 auto;
  margin-top: 8px;
}

/* Dev: labels sits beside people+issue-type and fills their combined height */
@media (min-width: 901px) {
  .analytics-grid:has(.analytics-card--issue-types) .analytics-card--labels {
    grid-row: span 2;
    align-self: stretch;
  }

  .analytics-grid:has(.analytics-card--issue-types) .analytics-card--labels .leaderboard {
    flex: 1 1 auto;
    min-height: 0;
  }
}

/* Issue-type card keeps content height; row 2 grows with it, labels follows */
.analytics-card--issue-types {
  align-self: start;
  justify-content: flex-start;
}

.issue-type-body {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
  gap: 14px 18px;
  align-items: center;
  margin-top: 4px;
  min-width: 0;
}

.analytics-card--issue-types .chart-wrap.donut {
  flex: 0 0 auto;
  width: 100%;
  height: 168px;
  min-height: 168px;
  max-height: 168px;
  margin-top: 0;
  cursor: pointer;
}

.issue-type-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.issue-type-legend > li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.issue-type-legend-item {
  display: grid;
  grid-template-columns: 10px minmax(4.5rem, 1fr) 2.4rem 2.6rem minmax(3.8rem, auto);
  gap: 8px 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  background: var(--white-a02);
  border: 1px solid var(--border);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.issue-type-legend-item:hover {
  border-color: var(--bar-a45);
  background: var(--bar-a08, var(--white-a04));
}

.issue-type-legend-item.is-selected {
  border-color: var(--bar-a45);
  background: var(--bar-a10);
  box-shadow: inset 0 0 0 1px var(--bar-a25);
}

.issue-type-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.issue-type-legend-name {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--text-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-type-legend-count {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.issue-type-legend-pct {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.issue-type-legend-hours {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.issue-type-legend-hours.is-empty {
  opacity: 0.45;
}

@media (max-width: 720px) {
  .issue-type-body {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .analytics-card--issue-types .chart-wrap.donut {
    height: 160px;
    min-height: 160px;
    max-height: 160px;
    max-width: 220px;
    margin-inline: auto;
  }
}

.analytics-card--themes .lb-head,
.analytics-card--themes .lb-row {
  grid-template-columns: minmax(11rem, 17rem) minmax(0, 1fr) 4.6rem 4.4rem;
}

.analytics-card--spaces .lb-head,
.analytics-card--spaces .lb-row {
  grid-template-columns: minmax(7.5rem, 11rem) minmax(0, 1fr) 4.6rem 4.4rem;
}

.analytics-card--themes .lb-name {
  white-space: normal;
  line-height: 1.25;
  text-overflow: unset;
  overflow: visible;
}

.lb-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  text-align: right;
  line-height: 1.2;
}

.lb-meta {
  font-size: 0.72rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
  min-width: 0;
}

.lb-meta-done {
  color: var(--text-2);
  font-weight: 650;
}

.lb-meta-hours {
  color: var(--muted);
  font-weight: 500;
}

.lb-bar {
  height: 16px;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.lb-bar--empty {
  opacity: 0.35;
  height: 16px;
  background: var(--slate-fill-faint);
  border-radius: 0 6px 6px 0;
}

.lb-bar > span {
  display: block;
  height: 100%;
  border-radius: 0 6px 6px 0;
  background: var(--accent-bar);
  opacity: 0.88;
  min-width: 0;
}

.lb-bar > span.lb-bar-fill--0 { background: var(--accent-bar); }
.lb-bar > span.lb-bar-fill--1 { background: var(--chart-series-violet); }
.lb-bar > span.lb-bar-fill--2 { background: var(--success-mint); }
.lb-bar > span.lb-bar-fill--3 { background: var(--chart-cyan); }
.lb-bar > span.lb-bar-fill--4 { background: var(--chart-orange); }
.lb-bar > span.lb-bar-fill--5 { background: var(--chart-pink); }
.lb-bar > span.lb-bar-fill--6 { background: var(--chart-teal); }
.lb-bar > span.lb-bar-fill--7 { background: var(--warning-bright); }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 650;
  border: 1px solid var(--chip-info-border);
  background: var(--chip-info-bg);
  color: var(--chip-info-fg);
}

.chip.space-STO {
  background: var(--chip-info-bg);
  color: var(--chip-info-fg);
  border-color: var(--chip-info-border);
}

.chip.space-TGGP {
  background: var(--chip-violet-bg);
  color: var(--chip-violet-fg);
  border-color: var(--chip-violet-border);
}

.chip.space-IOSDEV {
  background: var(--chip-ok-bg);
  color: var(--chip-ok-fg);
  border-color: var(--chip-ok-border);
}

.chip.space-empty,
.chip.space-- {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--border-solid);
}

.analytics-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  gap: 12px;
}

.analytics-empty-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-2);
}

.analytics-empty-text {
  margin: 0;
  max-width: 38ch;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.view-loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: dashboard-loading-spin 0.7s linear infinite;
}

@keyframes dashboard-loading-spin {
  to { transform: rotate(360deg); }
}

.period-preset:focus-visible,
.view-switcher-btn:focus-visible,
.toggle-btn:focus-visible,
.cw-week-btn:focus-visible,
.btn:focus-visible,
.btn-refresh:focus-visible,
.btn-theme-toggle:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

.issue-key {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--info);
  text-decoration: none;
}

.issue-key:hover { text-decoration: underline; }

/* Clockwork week grid — sion-hub Design Clockwork chrome */
.cw-card.analytics-card {
  height: auto !important;
  min-height: 0 !important;
  align-self: start;
  justify-self: start;
  grid-column: 1 / -1;
  width: 75vw;
  max-width: 100%;
  box-sizing: border-box;
}

.cw-card-head.analytics-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
}

.cw-week-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.cw-week-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-width: 7.5rem;
  text-align: center;
}

.cw-week-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.cw-week-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.cw-week-btn:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.cw-grid-wrap {
  margin-top: 10px;
  min-width: 0;
}

.cw-scroll {
  container-type: inline-size;
  container-name: cw;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(62vh, 560px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  -webkit-overflow-scrolling: touch;
  --cw-name-w: calc(100cqw - 4.2rem - 7 * 3.6rem);
}

.cw-table {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font);
  font-size: 0.78rem;
  table-layout: fixed;
}

.cw-table th,
.cw-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
  background: var(--surface-solid);
}

.cw-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface-solid));
}

.cw-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  font-weight: 700;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface-solid));
  border-top: 1px solid var(--border-strong);
}

.cw-sticky {
  position: sticky;
  z-index: 2;
}

.cw-user-name,
.cw-issue-name {
  left: 0;
  width: var(--cw-name-w);
  min-width: var(--cw-name-w);
  max-width: var(--cw-name-w);
  z-index: 4;
  text-align: left;
  overflow: hidden;
}

.cw-total {
  left: var(--cw-name-w);
  width: 4.2rem;
  min-width: 4.2rem;
  max-width: 4.2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  z-index: 4;
  overflow: hidden;
}

.cw-table thead .cw-user-name,
.cw-table thead .cw-total,
.cw-table tfoot .cw-user-name,
.cw-table tfoot .cw-total {
  z-index: 5;
}

.cw-day {
  width: 3.6rem;
  min-width: 3.6rem;
  max-width: 3.6rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.cw-day.is-pickable {
  cursor: pointer;
}

.cw-day.is-pickable:hover:not(.is-selected) {
  box-shadow: inset 0 0 0 1px var(--accent-ring);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-solid));
}

.cw-day.is-weekend,
.cw-day.is-out {
  background: color-mix(in srgb, var(--muted) 6%, var(--surface-solid));
}

.cw-table .cw-day.is-selected,
.cw-user-row.is-open > td.cw-day.is-selected,
.cw-user-row:hover > td.cw-day.is-selected,
.cw-user-row.is-stripe > td.cw-day.is-selected,
.cw-issue-row > td.cw-day.is-selected {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: color-mix(in srgb, var(--accent) 24%, var(--surface-solid));
  position: relative;
  z-index: 2;
}

.cw-table tbody .cw-total[data-cw-total-person] {
  cursor: pointer;
}

.cw-issue-empty {
  color: var(--muted);
  font-weight: 500;
  font-family: var(--font);
}

.cw-day-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1.15;
}

.cw-day-stack .cw-day-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.cw-day-stack .cw-day-wd {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.cw-user-row.is-stripe > td {
  background: color-mix(in srgb, var(--accent) 3%, var(--surface-solid));
}

.cw-user-row:hover > td {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-solid));
}

.cw-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cw-expand {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.cw-expand:hover .cw-name {
  color: var(--accent);
}

.cw-user-row {
  cursor: pointer;
}

.cw-user-row.is-open > td {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.cw-week-btn--ghost {
  opacity: 0.85;
  font-size: 0.68rem;
  padding: 0 8px;
}

.cw-issue-row > td {
  background: color-mix(in srgb, var(--accent) 2%, var(--surface-2));
  font-size: 0.74rem;
}

.cw-issue-line {
  display: block;
  min-width: 0;
  max-width: 100%;
  padding-left: 1.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

.cw-issue-key {
  display: inline;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

a.cw-issue-key:hover {
  text-decoration: underline;
}

.cw-issue-label {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.64rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.cw-issue-caption {
  font-family: var(--font);
  font-weight: 500;
  color: var(--text-2);
}

.cw-avatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: var(--radius-pill);
  background: var(--accent-fill);
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.cw-user-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.cw-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  color: var(--text);
}

.cw-issues {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
}

.cw-hours {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-weight: 600;
  white-space: nowrap;
}

.cw-hours--hot {
  color: var(--accent);
  font-weight: 600;
}

.cw-zero {
  color: var(--muted);
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}

.cw-empty-cell {
  text-align: center !important;
  color: var(--muted);
  padding: 28px 12px !important;
}

/* ——— Theme drilldown (Apps Rejects / Design Jira panel) ——— */
.analytics-card--themes {
  overflow: visible;
}

.dev-apps-panel {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--white-a02);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dev-apps-panel[hidden] {
  display: none !important;
}

.dev-apps-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.dev-apps-panel-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dev-apps-panel-title-count {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.dev-apps-panel-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.dev-apps-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 3px 6px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}

.dev-apps-sort-btn:hover {
  color: var(--text-2);
  background: var(--white-a04);
}

.dev-apps-sort-btn.is-active {
  color: var(--accent);
  background: var(--bar-a10);
}

.dev-apps-panel-apps {
  max-height: 180px;
  overflow-y: auto;
  padding: 0 10px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--white-a15) transparent;
}

.dev-apps-panel-apps:empty {
  display: none;
  padding: 0;
}

.dev-apps-panel-empty {
  padding: 10px 2px 4px;
  font-size: 0.68rem;
  color: var(--muted);
}

.dev-apps-panel-app {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
}

.dev-apps-panel-app:last-child {
  border-bottom: none;
}

.dev-apps-panel-app-main {
  min-width: 0;
  flex: 1 1 auto;
}

.dev-apps-panel-app-name {
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}

.dev-apps-panel-app-name .link {
  color: var(--info);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.72rem;
  text-decoration: none;
  margin-right: 6px;
}

.dev-apps-panel-app-name .link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.dev-apps-panel-app-summary {
  font-weight: 500;
  color: var(--text);
}

.dev-apps-panel-app-sub {
  margin-top: 2px;
  font-size: 0.65rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  line-height: 1.35;
}

.dev-apps-panel-app-dot {
  color: var(--muted);
  opacity: 0.75;
  flex-shrink: 0;
}

.dev-apps-panel-app-sub .chip {
  padding: 1px 5px;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  border-radius: var(--radius-pill);
}

.dev-apps-panel-app-meta {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 5.6rem 3.6rem;
  gap: 6px;
  align-items: baseline;
  justify-items: end;
  padding-top: 1px;
}

/* Запити: no hours column — keep date flush to the right edge */
.dev-apps-panel-app-meta--date-only {
  grid-template-columns: auto;
  min-width: 5.6rem;
}

.dev-apps-panel-app-date,
.dev-apps-panel-app-hours {
  font-size: 0.62rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-family: var(--mono);
  line-height: 1.35;
}

/* Localhost-only debug console (sion-hub style) */
.debug-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 1200;
  width: min(340px, calc(100vw - 24px));
  height: 320px;
  max-height: min(42vh, 360px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--ink-a92);
  color: var(--border-solid);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.35;
  box-shadow: 0 10px 30px var(--overlay-scrim-mid);
}

.debug-panel[hidden] {
  display: none !important;
}

.debug-panel--collapsed {
  width: max-content;
  max-width: calc(100vw - 24px);
  height: auto;
  max-height: none;
}

.debug-panel--collapsed .debug-panel__body {
  display: none;
}

.debug-panel--collapsed .debug-panel__head {
  gap: 10px;
}

.debug-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.62rem;
  flex: 0 0 auto;
}

.debug-panel__actions {
  display: flex;
  gap: 4px;
}

.debug-panel__btn {
  border: 1px solid var(--console-btn-border);
  background: transparent;
  color: var(--border-solid);
  border-radius: calc(var(--radius-xs) - 2px);
  min-width: 24px;
  height: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 5px;
  font-size: 0.62rem;
}

.debug-panel__btn:hover {
  border-color: var(--console-btn-border-hover);
  background: var(--console-btn-bg-hover);
}

.debug-panel__body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  color: var(--surface-2);
}


/* ——— PM personal drawer (sion-hub pattern) ——— */

.pm-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  height: var(--topbar-block-height);
  min-height: var(--topbar-block-height);
  max-height: var(--topbar-block-height);
  padding: 0 10px;
  flex-shrink: 0;
  min-width: 42px;
}

.pm-fab__icon {
  font-size: 1rem;
  line-height: 1;
}

.pm-drawer[hidden] {
  display: none !important;
}

body.pm-drawer-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
  overscroll-behavior: none;
}

html:has(body.pm-drawer-open) {
  overflow: hidden;
  overscroll-behavior: none;
}

.pm-drawer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  overscroll-behavior: none;
}

.pm-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-scrim);
  backdrop-filter: blur(2px);
  overscroll-behavior: none;
  touch-action: none;
}

body.pm-drawer-open .pm-drawer__backdrop {
  display: none;
}

.pm-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(82vw, 920px);
  max-width: 100%;
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 0.84rem;
  animation: pm-drawer-in 180ms ease-out;
}

/* Full-screen personal dashboard (same as sion-hub) */
body.pm-drawer-open .pm-drawer__panel {
  left: 0;
  width: 100%;
  max-width: 100%;
  box-shadow: none;
  animation: none;
}

@keyframes pm-drawer-in {
  from { transform: translateX(18px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}

.pm-drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-solid);
  flex-shrink: 0;
}

.pm-drawer__head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pm-drawer__title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-2);
}

.pm-drawer__sub {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.pm-drawer__close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.pm-drawer__close:hover {
  border-color: var(--accent);
  color: var(--text);
}

.pm-drawer__workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 22%);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

.pm-drawer__workspace.pm-console-collapsed {
  grid-template-columns: minmax(0, 1fr) auto;
}

.pm-drawer__main {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 14px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: transparent;
  color: var(--text);
}

.pm-section__head {
  margin-bottom: 10px;
}

.pm-section__title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-2);
}

.pm-section__lead {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
  font-weight: 400;
}

.pm-card__title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-2);
}

.pm-card__hint {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

.pm-flow {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pm-flow__step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  position: relative;
}

.pm-flow__step > .metric-info-tip {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
}

.pm-flow__num {
  width: 28px;
  height: 28px;
  border-radius: calc(var(--radius-sm) - 2px);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--accent-ring);
  margin-top: 2px;
}

.pm-flow__body {
  min-width: 0;
  padding-right: 20px;
}

.pm-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: flex-end;
}

.pm-actions-row .btn {
  padding: 8px 14px;
  font-size: 0.8rem;
}

.pm-actions-row .btn.is-loading,
.pm-drawer .btn.is-loading,
#pmConfirmOk.is-loading {
  cursor: wait;
  opacity: 0.75;
  min-width: 7.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

@keyframes pm-btn-spin {
  to { transform: rotate(360deg); }
}

.pm-actions-row .btn.is-loading::before,
.pm-drawer .btn.is-loading::before,
#pmConfirmOk.is-loading::before {
  content: "";
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  margin-right: 0.4rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: pm-btn-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.pm-actions-row .btn[hidden] {
  display: none !important;
}

.pm-result {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  max-height: 240px;
  overflow: auto;
}

.pm-result[hidden] {
  display: none !important;
}

.pm-result.pm-result--error {
  color: var(--console-error);
}

.pm-result.pm-result--ui {
  white-space: normal;
  max-height: min(420px, 55vh);
  overflow: auto;
}

.pm-result a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pm-result a:hover {
  color: var(--accent);
  opacity: 0.9;
}

.pm-result-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.pm-issue-table {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 640px;
  overflow-x: auto;
}

.pm-issue-row {
  display: grid;
  grid-template-columns:
    7.5rem
    minmax(10rem, 1.6fr)
    minmax(7.5rem, 0.85fr)
    minmax(7.5rem, 0.85fr)
    minmax(8.5rem, 1fr);
  gap: 8px 12px;
  align-items: start;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}

.pm-issue-row--head {
  border-top: 0;
  padding-top: 0;
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.pm-issue-cell {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pm-issue-cell--key {
  font-weight: 600;
  white-space: nowrap;
}

.pm-issue-cell--summary {
  color: var(--text);
}

.pm-issue-cell--status,
.pm-issue-cell--assignee {
  color: var(--text-2);
}

.pm-issue-label {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 1px 6px;
  border-radius: calc(var(--radius-xs) - 2px);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text-2);
  font-size: 0.68rem;
  line-height: 1.35;
  white-space: nowrap;
}

.pm-issue-more {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.72rem;
}

@media (max-width: 900px) {
  .pm-issue-row {
    grid-template-columns: minmax(80px, auto) minmax(0, 1fr);
    grid-template-areas:
      "key summary"
      "status status"
      "assignee assignee"
      "labels labels";
  }

  .pm-issue-row--head {
    display: none;
  }

  .pm-issue-cell--key { grid-area: key; }
  .pm-issue-cell--summary { grid-area: summary; }
  .pm-issue-cell--status { grid-area: status; }
  .pm-issue-cell--assignee { grid-area: assignee; }
  .pm-issue-cell--labels { grid-area: labels; }

  .pm-issue-cell--status::before,
  .pm-issue-cell--assignee::before,
  .pm-issue-cell--labels::before {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--muted);
    margin-right: 6px;
  }

  .pm-issue-cell--status::before { content: "Status · "; }
  .pm-issue-cell--assignee::before { content: "Assignee · "; }
  .pm-issue-cell--labels::before { content: "Labels · "; }
}

/* PM side console (sion-hub) */
.pm-console {
  border-left: 1px solid var(--border);
  background: var(--console-bg);
  color: var(--console-fg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  grid-column: 2;
  grid-row: 1 / -1;
}

.pm-console--collapsed {
  width: 42px;
  min-width: 42px;
}

.pm-console--collapsed .pm-console__body {
  display: none;
}

.pm-console--collapsed .pm-console__head {
  cursor: pointer;
  border-bottom: 0;
  padding: 10px 6px;
  justify-content: center;
}

.pm-console--collapsed .pm-console__title {
  display: none;
}

.pm-console__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--console-hairline);
  flex-shrink: 0;
}

.pm-console__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.pm-console__btn {
  border: 1px solid var(--console-btn-border);
  background: transparent;
  color: var(--console-fg);
  border-radius: calc(var(--radius-xs) - 2px);
  min-width: 24px;
  height: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 5px;
  font-size: 0.62rem;
  font-family: var(--mono);
}

.pm-console__btn:hover {
  border-color: var(--console-btn-border-hover);
  background: var(--console-btn-bg-hover);
}

.pm-console__title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--console-fg);
}

.pm-console__body {
  margin: 0;
  padding: 12px;
  flex: 1;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
  background: transparent;
  color: var(--console-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pm-console__line {
  margin: 0;
  display: grid;
  grid-template-columns: 4.5em minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.pm-console__line--sep {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 1.25rem;
  margin: 2px 0;
  padding: 0;
  grid-template-columns: unset;
}

.pm-console__line--gap {
  min-height: 0.55rem;
  grid-template-columns: unset;
}

.pm-console__sep-line {
  display: block;
  width: 100%;
  height: 0;
  border: 0;
  border-top: 1px dashed var(--console-rule);
}

.pm-console__line--error .pm-console__time,
.pm-console__line--error .pm-console__msg {
  color: var(--console-error);
}

.pm-console__line--warn .pm-console__time,
.pm-console__line--warn .pm-console__msg {
  color: var(--console-warn);
}

.pm-console__msg strong {
  font-weight: 700;
  color: var(--console-fg);
}

.pm-console__time {
  color: var(--console-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pm-console__msg {
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 0;
}

.pm-console__msg a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pm-console__msg a:hover {
  color: var(--accent);
  opacity: 0.9;
}

.pm-console__body:empty::before {
  content: "Логи дій з’являться тут…";
  color: var(--console-dim);
}

.pm-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pm-confirm-modal[hidden] {
  display: none !important;
}

.pm-confirm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-scrim);
  backdrop-filter: blur(2px);
}

.pm-confirm-modal__panel {
  position: relative;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pm-confirm-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.pm-confirm-modal__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.pm-confirm-modal__sub {
  margin: 6px 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
  max-width: 42ch;
}

.pm-confirm-modal__close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
  color: var(--text-2);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.pm-confirm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 14px;
}

@media (max-width: 960px) {
  .pm-drawer__panel {
    width: 100%;
  }

  .pm-drawer__workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(160px, 28vh);
  }

  .pm-drawer__main {
    grid-column: 1;
    grid-row: 1;
  }

  .pm-console {
    grid-column: 1;
    grid-row: 2;
    border-left: 0;
    border-top: 1px solid var(--console-hairline);
  }

  .pm-drawer__workspace.pm-console-collapsed {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .pm-console--collapsed .pm-console__head {
    flex-direction: row;
    padding: 8px 12px;
    width: auto;
  }

  .pm-console--collapsed .pm-console__title {
    display: block;
  }
}
