/* ============================================
   Straddle Dashboard — Demo Layout
   All values from design.md token scales.
   Spacing: 1, 4, 7, 8, 11, 12, 16, 20, 24, 28, 32
   Radius: 2, 4, 6, 8, 12, 22, 9999, 50%
   Type: see hierarchy table in design.md §3
   ============================================ */

.dash {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: 100vh;
}

/* ── Sidebar: bg-panel with scoped surface tokens ── */
.dash-sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition:
    background-color var(--duration-panel) var(--ease-out),
    border-color var(--duration-panel) var(--ease-out);
}

/* Rescope: sidebar uses bg-panel, so use bg-panel-ctx tokens from styles.css */
[data-theme="dark"] .dash-sidebar {
  --surface-02: oklch(0.268 0.037 227.49);
  --surface-03: oklch(0.276 0.037 227.2);
  --surface-05: oklch(0.294 0.036 226.71);
}
[data-theme="light"] .dash-sidebar {
  --surface-02: oklch(0.939 0.009 227.78);
  --surface-03: oklch(0.933 0.009 227.69);
  --surface-05: oklch(0.919 0.01 227.51);
}

.dash-sidebar-top {
  padding: 16px;                          /* spacing: 16 */
  border-bottom: 1px solid var(--border-subtle);
}

/* Nav — Caption: 13px/500 Satoshi */
.dash-nav {
  flex: 1;
  padding: 8px;                           /* spacing: 8 */
  display: flex;
  flex-direction: column;
  gap: 1px;                               /* spacing: 1 */
}

.dash-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;                       /* spacing: 7 (optical), 8 */
  border-radius: 4px;                     /* radius: standard */
  font-size: 13px;                        /* Caption: 13px */
  font-weight: 500;                       /* Caption: 500 */
  line-height: 1.5;                       /* Caption: 1.50 */
  color: var(--text-tertiary);
  text-decoration: none;
  transition:
    background-color var(--duration-hover) var(--ease-out),
    color var(--duration-hover) var(--ease-out);
}

/* Kbd — Code Micro: 9px/600, Source Code Pro, 2.5px tracking */
.dash-nav-item kbd {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2.5px;
  line-height: 2.67;
  color: var(--text-quaternary);
  opacity: 0;
  transition: opacity var(--duration-hover) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .dash-nav-item:hover {
    color: var(--text-secondary);
    background: var(--surface-02);
  }
  .dash-nav-item:hover kbd { opacity: 1; }
}

.dash-nav-item.active {
  background: var(--surface-05);
  color: var(--text-primary);
}

/* ── Sidebar footer ── */
.dash-sidebar-bottom {
  padding: 12px 16px;                     /* spacing: 12, 16 */
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Env — Data Micro: JetBrains Mono 11px/500, 0.5px tracking */
.dash-env {
  display: flex;
  align-items: center;
  gap: 8px;                               /* spacing: 8 */
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-quaternary);
}

.dash-env-dot {
  width: 8px;                             /* spacing: 8 */
  height: 8px;
  border-radius: 50%;                     /* radius: circle */
  background: var(--status-warning);
}

.dash-sidebar-actions {
  display: flex;
  gap: 4px;                               /* spacing: 4 */
  align-items: center;
}

/* DS link — Code Micro: 9px/600 Source Code Pro */
.dash-ds-link {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2.5px;
  line-height: 2.67;
  text-transform: uppercase;
  color: var(--text-quaternary);
  text-decoration: none;
  padding: 4px 8px;                       /* spacing: 4, 8 */
  border-radius: 2px;                     /* radius: micro */
  border: 1px solid var(--border-subtle);
  transition: color var(--duration-hover) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .dash-ds-link:hover { color: var(--text-secondary); }
}

/* ── Main ── */
.dash-main {
  padding: 32px;                          /* spacing: 32 */
  overflow-y: auto;
}

/* ── Header ── */
.dash-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;                              /* spacing: 16 */
}

.dash-header .heading-1 { margin-top: 8px; } /* spacing: 8 */

.dash-header-actions {
  display: flex;
  gap: 8px;                               /* spacing: 8 */
  flex-shrink: 0;
}

/* ── Metrics strip ── */
.dash-metrics {
  display: flex;
  align-items: baseline;
  padding: 16px 0;                        /* spacing: 16 */
  margin-top: 24px;                       /* spacing: 24 */
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.dash-metric {
  display: flex;
  align-items: baseline;
  gap: 8px;                               /* spacing: 8 */
  padding: 0 20px;                        /* spacing: 20 */
}

.dash-metric:first-child { padding-left: 0; }

/* Metric label — Data Micro: JetBrains Mono 11px/500, 0.5px */
.dash-metric-label {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-quaternary);
}

/* Metric value — Data Small: JetBrains Mono 13px/500 */
.dash-metric-value {
  font-family: var(--font-data);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Fractional part — Data Micro: 11px/500 */
.dash-metric-frac {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.dash-metric-error { color: var(--status-error); }

.dash-metric-sep {
  width: 1px;                             /* spacing: 1 */
  height: 16px;                           /* spacing: 16 */
  background: var(--border-subtle);
  flex-shrink: 0;
}

/* ── Filters ── */
.dash-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;                              /* spacing: 12 */
  margin-top: 16px;                       /* spacing: 16 */
}

.dash-filter-pills {
  display: flex;
  gap: 4px;                               /* spacing: 4 */
}

.dash-filter-pills .btn-pill.active {
  background: var(--surface-05);
  border-color: var(--border-standard);
  color: var(--text-primary);
}

/* Search input override — Caption: 13px Satoshi */
.dash-filter-search .input-text {
  font-size: 13px;
  padding: 7px 12px;                      /* spacing: 7 (optical), 12 */
  width: 200px;
}

/* ── Table ── */
.dash-main .table-wrap { margin-top: 12px; } /* spacing: 12 */

/* Neutral badge for Returned status */
.badge-status.neutral {
  color: var(--text-tertiary);
  background: var(--surface-03);
}

/* ── Table footer — Data Micro: 11px/500 ── */
.dash-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;                        /* spacing: 12 */
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.5px;
  color: var(--text-quaternary);
}

.dash-pagination {
  display: flex;
  gap: 4px;                               /* spacing: 4 */
}

/* ── Delight: Nav accent bar ── */
.dash-nav-item { position: relative; }

.dash-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;                             /* matches accent-underline border width */
  height: 12px;                           /* spacing: 12 */
  border-radius: 1px;                     /* spacing: 1 */
  background: var(--accent-functional);
}

/* ── Delight: Promoted volume metric ── */
/* Data Body: JetBrains Mono 16px/400, tabular-nums */
.dash-metric-value.promoted {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
}

/* ── Delight: Row interactivity ── */
.dash-main .tr > .td:last-child { position: relative; }

@media (hover: hover) and (pointer: fine) {
  .dash-main .tr { cursor: pointer; }

  .dash-main .tr > .td:last-child::after {
    content: '\203A';                     /* single right-pointing guillemet */
    position: absolute;
    right: 16px;                          /* spacing: 16 */
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-data);
    font-size: 16px;
    color: var(--text-quaternary);
    opacity: 0;
    transition: opacity var(--duration-hover) var(--ease-out);
  }

  .dash-main .tr:hover > .td:last-child::after { opacity: 1; }
}

/* ── Delight: Copy transaction ID ── */
.td-id { position: relative; }

@media (hover: hover) and (pointer: fine) {
  .td-id { cursor: copy; }
}

.td-id.copied::after {
  content: 'COPIED';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 9px;                         /* Code Micro */
  font-weight: 600;
  letter-spacing: 2.5px;
  color: var(--status-success);
  pointer-events: none;
  animation: mount var(--duration-reveal) var(--ease-out) both;
}

/* ── Delight: Env dot liveness pulse ── */
@keyframes liveness {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.dash-env-dot {
  animation: liveness 3s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .dash-env-dot { animation: none; }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .dash-sidebar { display: none; }
  .dash-main { padding: 20px; }           /* spacing: 20 */
  .dash-metrics { flex-wrap: wrap; gap: 12px; } /* spacing: 12 */
  .dash-metric-sep { display: none; }
  .dash-metric { padding: 0; }
  .dash-header { flex-direction: column; align-items: flex-start; }
  .dash-filters { flex-direction: column; align-items: flex-start; }
  .dash-filter-search .input-text { width: 100%; }
}
