/* PTW dashboard — shared shell (matches PermitTrendChart / ex-dash-trend). */

.ptw-overview-page {
  gap: 1.6rem;
}

.ptw-dash-shell {
  --ptw-dash-muted: #64748b;
  --ptw-dash-text: var(--swi-text, #0f172a);
  --ptw-dash-border: var(--swi-border, #e2e8f0);
  --ptw-dash-subtle: var(--swi-surface-muted, #f8fafc);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  height: 100%;
  min-height: 22rem;
  padding: 1.15rem 1.3rem 1.25rem;
  border-radius: 16px;
  border: none;
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 40px rgba(15, 23, 42, 0.07);
  box-sizing: border-box;
}

:root[data-theme="dark"] .ptw-dash-shell {
  background: linear-gradient(165deg, #1e2430 0%, #171c26 55%, #12161e 100%);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.2),
    0 12px 40px rgba(0, 0, 0, 0.35);
}

.ptw-dash-shell__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.ptw-dash-shell__intro {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1 1 auto;
}

.ptw-dash-shell__eyebrow {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ptw-dash-muted);
}

.ptw-dash-shell__title {
  margin: 0;
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ptw-dash-text);
  line-height: 1.2;
}

.ptw-dash-shell__desc {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--ptw-dash-muted);
}

.ptw-dash-shell__metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  flex-shrink: 0;
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--ptw-dash-border);
}

:root[data-theme="dark"] .ptw-dash-shell__metric {
  background: rgba(255, 255, 255, 0.04);
}

.ptw-dash-shell__metric strong {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ptw-dash-text);
}

.ptw-dash-shell__metric span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ptw-dash-muted);
}

.ptw-dash-shell__body {
  flex: 1 1 auto;
  min-height: 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ptw-dash-shell__actions,
.ptw-dash-shell__head-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.8rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.ptw-dash-activity-v2__toolbar {
  display: none;
}

.ptw-dash-shell--clickable {
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.ptw-dash-shell--clickable:hover,
.ptw-dash-shell--clickable:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.08),
    0 16px 48px rgba(15, 23, 42, 0.1);
  outline: none;
}

.ptw-dash-shell--clickable:focus-visible {
  outline: 2px solid var(--portal-accent, #c41e2d);
  outline-offset: 2px;
}

/* Welcome banner */
.ptw-dash-welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, 0.85fr);
  gap: 1.15rem;
  padding: 1.2rem 1.35rem;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 48%, #f1f5f9 100%);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 10px 32px rgba(15, 23, 42, 0.06);
  border: 1px solid color-mix(in srgb, var(--portal-accent, #c41e2d) 12%, var(--swi-border));
}

:root[data-theme="dark"] .ptw-dash-welcome {
  background: linear-gradient(135deg, #1e2430 0%, #171c26 60%, #12161e 100%);
}

.ptw-dash-welcome__main {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.ptw-dash-welcome__date {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--portal-accent, #c41e2d);
}

.ptw-dash-welcome__title {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--swi-text);
}

.ptw-dash-welcome__lead {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--swi-text-secondary);
  max-width: 56ch;
}

.ptw-dash-welcome__lead strong {
  color: var(--swi-text);
}

.ptw-dash-welcome__cta {
  align-self: flex-start;
  margin-top: 0.35rem;
}

.ptw-dash-welcome__aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--portal-accent, #c41e2d) 6%, var(--swi-surface));
  border: 1px solid color-mix(in srgb, var(--portal-accent, #c41e2d) 22%, var(--swi-border));
}

.ptw-dash-welcome__aside--clickable {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.ptw-dash-welcome__aside--clickable:hover,
.ptw-dash-welcome__aside--clickable:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--portal-accent) 12%, transparent);
  outline: none;
}

.ptw-dash-welcome__aside-badge {
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, #2d9d6b 18%, transparent);
  color: #1f7a52;
}

.ptw-dash-welcome__aside strong {
  font-size: 1rem;
  color: var(--swi-text);
}

.ptw-dash-welcome__aside-meta {
  font-size: 0.8rem;
  color: var(--swi-text-secondary);
}

/* Section grouping */
.ptw-dash-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ptw-dash-section__label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--swi-text-secondary);
}

.ptw-dash-charts-grid,
.ptw-dash-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.ptw-dash-charts-grid > *,
.ptw-dash-bottom-grid > * {
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

/* Bar chart inside shell */
.ptw-dash-bar-chart__canvas-wrap {
  flex: 1 1 auto;
  width: 100%;
  min-height: 240px;
  display: flex;
  align-items: center;
  overflow-x: auto;
}

.ptw-dash-bar-chart__empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  margin: 0;
  padding: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ptw-dash-muted);
  text-align: center;
}

.ptw-dash-bar-chart__empty-action {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  width: 100%;
  margin: 0;
  padding: 1rem;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ptw-dash-muted);
  text-align: center;
  cursor: pointer;
}

.ptw-dash-bar-chart__empty-action:hover {
  color: var(--portal-accent);
}

.ptw-dash-bar-chart__grid-line {
  stroke: color-mix(in srgb, var(--swi-border) 80%, transparent);
  stroke-width: 1;
}

.ptw-dash-bar-chart__y-label,
.ptw-dash-bar-chart__x-label,
.ptw-dash-bar-chart__value-label {
  fill: var(--ptw-dash-muted);
  font-size: 11px;
  font-weight: 600;
}

.ptw-dash-bar-chart__value-label {
  fill: var(--ptw-dash-text);
  font-size: 12px;
  font-weight: 700;
}

/* Recent activity */
.ptw-dash-activity-v2 {
  height: 66%;

}

.ptw-dash-activity-v2__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ptw-dash-activity-v2__list::-webkit-scrollbar {
  display: none;
}

.ptw-dash-activity-v2__item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--ptw-dash-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

:root[data-theme="dark"] .ptw-dash-activity-v2__item {
  background: rgba(255, 255, 255, 0.03);
}

.ptw-dash-activity-v2__item:hover,
.ptw-dash-activity-v2__item:focus-visible {
  border-color: color-mix(in srgb, var(--portal-accent) 30%, var(--ptw-dash-border));
  background: color-mix(in srgb, var(--portal-accent) 5%, rgba(255, 255, 255, 0.65));
  transform: translateX(2px);
  outline: none;
}

.ptw-dash-activity-v2__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--portal-accent, #c41e2d);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--portal-accent) 18%, transparent);
}

.ptw-dash-activity-v2__main {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
  flex: 1;
}

.ptw-dash-activity-v2__main strong {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--swi-text);
}

.ptw-dash-activity-v2__main span {
  font-size: 0.75rem;
  color: var(--swi-text-secondary);
}

.ptw-dash-activity-v2__badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
}

.ptw-dash-activity-v2__badge--active {
  background: color-mix(in srgb, #2d9d6b 16%, transparent);
  color: #1f7a52;
}

.ptw-dash-activity-v2__badge--closed,
.ptw-dash-activity-v2__badge--expired {
  background: color-mix(in srgb, #c0392b 12%, transparent);
  color: #c0392b;
}

.ptw-dash-activity-v2__badge--draft {
  background: var(--swi-surface-muted);
  color: var(--swi-text-secondary);
  border: 1px solid var(--swi-border);
}

.ptw-dash-activity-v2__loading,
.ptw-dash-activity-v2__empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  margin: 0;
  font-size: 0.875rem;
  color: var(--swi-text-secondary);
}

.ptw-dash-activity-v2__empty {
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.ptw-dash-activity-v2__empty:hover {
  color: var(--portal-accent);
}

.ptw-dash-activity-v2__view-all {
  font-size: 0.8rem;
  font-weight: 600;
}

/* Quick actions */
.ptw-dash-quick {
  height: 66%;
}

.ptw-dash-quick__grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1 1 auto;
  min-height: 240px;
}

.ptw-dash-quick__action {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  flex: 1 1 0;
  min-height: 4.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--ptw-dash-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

:root[data-theme="dark"] .ptw-dash-quick__action {
  background: rgba(255, 255, 255, 0.04);
}

.ptw-dash-quick__action:hover,
.ptw-dash-quick__action:focus-visible {
  border-color: color-mix(in srgb, var(--portal-accent) 35%, var(--ptw-dash-border));
  background: color-mix(in srgb, var(--portal-accent) 6%, rgba(255, 255, 255, 0.72));
  transform: translateX(3px);
  outline: none;
}

.ptw-dash-quick__action--primary {
  border-color: color-mix(in srgb, var(--portal-accent) 35%, var(--ptw-dash-border));
  background: color-mix(in srgb, var(--portal-accent) 8%, rgba(255, 255, 255, 0.85));
}

.ptw-dash-quick__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--portal-accent) 10%, var(--swi-surface));
  color: var(--portal-accent);
  border: 1px solid color-mix(in srgb, var(--portal-accent) 20%, var(--swi-border));
}

.ptw-dash-quick__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.ptw-dash-quick__text strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--swi-text);
}

.ptw-dash-quick__text span {
  font-size: 0.78rem;
  color: var(--swi-text-secondary);
  line-height: 1.35;
}

.ptw-dash-quick__arrow {
  color: var(--swi-text-secondary);
  opacity: 0.55;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.ptw-dash-quick__action:hover .ptw-dash-quick__arrow,
.ptw-dash-quick__action:focus-visible .ptw-dash-quick__arrow {
  transform: translateX(3px);
  opacity: 1;
  color: var(--portal-accent);
}

@media (max-width: 1100px) {
  .ptw-dash-welcome {
    grid-template-columns: 1fr;
  }

  .ptw-dash-charts-grid,
  .ptw-dash-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ptw-dash-shell {
    min-height: 18rem;
    padding: 0.9rem 1rem;
  }

  .ptw-dash-shell__title {
    letter-spacing: 0.04em;
  }
}
