.ds-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  font-family: var(--font-sans);
}
.ds-toolbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.ds-toolbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.ds-chip-btn {
  all: unset;
  box-sizing: border-box;
  padding: 6px var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-200);
  color: var(--ink-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.ds-chip-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}
.ds-chip-btn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}
.ds-chip-btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.ds-tool-menu {
  position: relative;
  display: inline-block;
}
.ds-tool-btn {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-200);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.ds-tool-btn:hover {
  border-color: var(--border-strong);
}
.ds-tool-btn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}
.ds-tool-btn svg {
  width: 15px;
  height: 15px;
  color: var(--primary);
  flex: none;
}
.ds-tool-pop {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 20;
  min-width: 190px;
  background: var(--surface-200);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ds-tool-pop.is-form {
  gap: var(--space-2);
  padding: var(--space-3);
  min-width: 210px;
}
.ds-tool-pop-label {
  color: var(--ink-muted);
}
.ds-tool-opt {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
}
.ds-tool-opt:hover {
  background: var(--surface-300);
}
.ds-tool-opt.is-active {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
}
.ds-tool-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--primary);
  font-weight: 700;
}
.ds-tool-pop.is-form .ds-branch-limit-input {
  width: 100%;
}
.ds-tool-pop.is-form .ds-branch-send {
  display: block;
  text-align: center;
}

.ds-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.ds-stat-card {
  background: var(--surface-200);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  min-width: 240px;
  font-family: var(--font-sans);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.ds-stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.ds-stat-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.ds-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--primary-subtle);
  color: var(--primary);
}
.ds-stat-icon svg {
  width: 18px;
  height: 18px;
}
.ds-stat-label {
  color: var(--ink-secondary);
}
.ds-stat-value {
  color: var(--ink);
  margin-bottom: var(--space-3);
}
.ds-stat-bottom {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.ds-stat-deltalabel {
  color: var(--ink-muted);
}
.ds-stat-trend {
  margin-left: auto;
  flex: none;
}

.ds-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}
.ds-chip svg {
  width: 12px;
  height: 12px;
}
.ds-chip-success {
  background: var(--success-subtle);
  color: var(--success);
}
.ds-chip-danger {
  background: var(--danger-subtle);
  color: var(--danger);
}
.ds-chip-sm {
  padding: 1px 6px;
}

.ds-branch-note {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-6);
}
.ds-branch-note-label {
  color: var(--ink-secondary);
  font-weight: 700;
}
.ds-branch-note-hint {
  color: var(--ink-muted);
}
.ds-branch-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-6);
}
.ds-branch-note + .ds-branch-list {
  margin-top: var(--space-3);
}
.ds-branch-row {
  background: var(--surface-200);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  font-family: var(--font-sans);
  transition: box-shadow 0.15s ease;
}
.ds-branch-row.is-expanded {
  box-shadow: var(--shadow-md);
}
.ds-branch-header {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-5) var(--space-4);
  cursor: pointer;
  border-radius: var(--radius-md);
}
.ds-branch-header:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: -3px;
}
.ds-branch-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.ds-branch-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--primary-subtle);
  color: var(--primary);
}
.ds-branch-icon svg {
  width: 16px;
  height: 16px;
}
.ds-branch-name {
  color: var(--ink);
  flex: none;
  min-width: 140px;
}
.ds-branch-top-end {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}
.ds-branch-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.ds-branch-limit-input {
  box-sizing: border-box;
  width: 104px;
  padding: 5px var(--space-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-100);
  color: var(--ink);
  font-family: var(--font-sans);
}
.ds-branch-limit-input:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
  border-color: var(--primary);
}
.ds-branch-send {
  all: unset;
  box-sizing: border-box;
  padding: 6px var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  cursor: pointer;
}
.ds-branch-send:hover {
  background: var(--primary-strong);
}
.ds-branch-send:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}
.ds-branch-send.is-sent {
  background: var(--success);
}
.ds-branch-figures {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}
.ds-branch-figure {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 108px;
}
.ds-branch-figure-label {
  color: var(--ink-muted);
}
.ds-branch-figure-value {
  color: var(--ink);
}
.ds-branch-progress {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.ds-progress-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ds-progress-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.ds-progress-side {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ds-progress-side.align-right {
  align-items: flex-end;
  text-align: right;
}
.ds-progress-label {
  color: var(--ink-muted);
}
.ds-progress-value {
  color: var(--ink);
}
.ds-progress-pct {
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.ds-progress-pct.is-tax {
  color: var(--secondary);
}
.ds-progress-track {
  position: relative;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--primary-subtle);
  overflow: hidden;
}
.ds-progress-track.is-tax {
  background: var(--secondary-subtle);
}
.ds-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.15s ease;
}
.ds-progress-fill.is-tax {
  background: var(--secondary);
}
.ds-progress-side-head {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ds-progress-side.align-right .ds-progress-side-head {
  justify-content: flex-end;
}
.ds-progress-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex: none;
}
.ds-progress-swatch.is-fill {
  background: var(--primary);
}
.ds-progress-swatch.is-fill.is-tax {
  background: var(--secondary);
}
.ds-progress-swatch.is-track {
  background: var(--primary-subtle);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.ds-progress-swatch.is-track.is-tax {
  background: var(--secondary-subtle);
  box-shadow: inset 0 0 0 1px var(--secondary);
}

.ds-branch-pace {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ds-pace-head {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}
.ds-pace-limit-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  color: var(--ink-muted);
  pointer-events: none;
}
.ds-pace-limit-label.is-over {
  color: var(--danger);
  font-weight: 700;
}
.ds-pace-label {
  color: var(--ink-secondary);
}
.ds-pace-pct {
  color: var(--danger);
  font-weight: 700;
}
.ds-pace-track {
  position: relative;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--danger-subtle);
  overflow: hidden;
}
.ds-pace-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--danger);
  opacity: 0.5;
}
.ds-pace-fill.is-over {
  opacity: 1;
}
.ds-pace-limit {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--surface-100);
  box-shadow: 0 0 0 0.5px rgba(15, 23, 42, 0.18);
}
.ds-pace-foot {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}
.ds-pace-end {
  color: var(--ink-muted);
}
.ds-pace-end.align-right {
  text-align: right;
}
.ds-branch-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  margin-left: auto;
  border-radius: var(--radius-full);
  color: var(--ink-secondary);
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.ds-branch-chevron svg {
  width: 16px;
  height: 16px;
}
.is-expanded .ds-branch-chevron {
  transform: rotate(180deg);
  background: var(--surface-300);
  color: var(--primary);
}
.ds-branch-detail {
  background: var(--surface-300);
  border-top: 1px solid var(--border);
  padding: var(--space-4) var(--space-4) var(--space-4) calc(28px + var(--space-3) + var(--space-4));
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.ds-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-6);
}
.ds-detail-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}
.ds-branch-hourly {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.ds-branch-hourly-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.ds-branch-hourly-title {
  color: var(--ink-secondary);
  font-weight: 700;
}
.ds-branch-hourly-legend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}
.ds-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-muted);
}
.ds-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 0;
  border-radius: 2px;
}
.ds-legend-swatch.is-actual {
  border-top: 2px solid var(--primary);
}
.ds-legend-swatch.is-proj {
  border-top: 2px dashed var(--ink-muted);
}
.ds-detail-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}
.ds-detail-label {
  color: var(--ink-secondary);
}
.ds-detail-value {
  color: var(--ink);
  font-weight: 600;
}

.ds-trend-card {
  background: var(--surface-200);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5) var(--space-6) var(--space-4);
  margin-top: var(--space-6);
  font-family: var(--font-sans);
}
.ds-trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.ds-trend-heading {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.ds-trend-title {
  color: var(--ink);
}
.ds-trend-back {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}
.ds-trend-back:hover {
  background: var(--primary-subtle);
}
.ds-trend-active.is-clickable {
  cursor: pointer;
}
.ds-trend-xaxis .ds-trend-xlabel.is-active {
  color: var(--primary);
  font-weight: 700;
}
.ds-trend-gran {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface-300);
  color: var(--ink-secondary);
}
.ds-trend-chart {
  position: relative;
  width: 100%;
}
.ds-trend-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.ds-trend-xaxis {
  position: relative;
  height: 14px;
  margin-top: 2px;
}
.ds-trend-xaxis .ds-trend-xlabel {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  color: var(--ink-muted);
}
.ds-trend-xaxis .ds-trend-xlabel.is-first {
  transform: translateX(0);
}
.ds-trend-xaxis .ds-trend-xlabel.is-last {
  transform: translateX(-100%);
}
.ds-trend-tip {
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  background: var(--ink);
  border-radius: var(--radius-sm);
  padding: 4px var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 1px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  z-index: 5;
}
.ds-trend-tip .ds-trend-tip-label {
  color: var(--surface-300);
}
.ds-trend-tip .ds-trend-tip-value {
  color: var(--surface-100);
}
.ds-trend-tip .ds-trend-tip-row {
  color: var(--surface-100);
}
.ds-trend-tip .ds-trend-tip-row.is-diff {
  margin-top: 2px;
  font-weight: 700;
  color: var(--surface-100);
}
.ds-trend-stack {
  display: flex;
  flex-direction: column;
}
.ds-trend-head-right {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.ds-trend-legend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}
.ds-legend-swatch.is-actual.is-tax {
  border-top-color: var(--secondary);
}

.ds-dashboard-panel {
  background: var(--surface-100);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  font-family: var(--font-sans);
}
.ds-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}
.ds-panel-heading {
  min-width: 200px;
}
.ds-panel-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.ds-panel-title {
  color: var(--ink);
  margin: 0 0 4px;
}
.ds-panel-subtitle {
  color: var(--ink-muted);
  margin: 0;
}

.ds-mode {
  position: relative;
  display: inline-block;
  font-family: var(--font-sans);
}
.ds-mode-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 20;
  background: var(--surface-200);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  width: 168px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ds-mode-option {
  all: unset;
  box-sizing: border-box;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
}
.ds-mode-option:hover {
  background: var(--surface-300);
}
.ds-mode-option.is-active {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
}

.ds-daterange {
  position: relative;
  display: inline-block;
  font-family: var(--font-sans);
}
.ds-dr-trigger {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-200);
  color: var(--ink);
  cursor: pointer;
}
.ds-dr-trigger:hover {
  border-color: var(--border-strong);
}
.ds-dr-trigger:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}
.ds-dr-trigger svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
  flex: none;
}
.ds-dr-trigger-label {
  white-space: nowrap;
}
.ds-dr-popover {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 20;
  background: var(--surface-200);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-4);
  width: 288px;
}
.ds-dr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.ds-dr-nav {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  color: var(--ink-secondary);
  cursor: pointer;
}
.ds-dr-nav:hover {
  background: var(--surface-300);
  color: var(--primary);
}
.ds-dr-nav svg {
  width: 16px;
  height: 16px;
}
.ds-dr-title {
  all: unset;
  box-sizing: border-box;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}
.ds-dr-title:hover {
  background: var(--primary-subtle);
  color: var(--primary);
}
.ds-dr-title.is-top {
  cursor: default;
}
.ds-dr-title.is-top:hover {
  background: none;
  color: var(--ink);
}
.ds-dr-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: var(--space-1);
}
.ds-dr-weekday {
  text-align: center;
  color: var(--ink-muted);
}
.ds-dr-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.ds-dr-day {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border-radius: var(--radius-full);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.ds-dr-day:hover {
  background: var(--surface-300);
}
.ds-dr-day.is-outside {
  color: var(--ink-muted);
}
.ds-dr-day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--primary);
}
.ds-dr-day.is-range {
  background: var(--primary-subtle);
  border-radius: 0;
}
.ds-dr-day.is-start {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-full) 0 0 var(--radius-full);
}
.ds-dr-day.is-end {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}
.ds-dr-day.is-start.is-end {
  border-radius: var(--radius-full);
}
.ds-dr-grid-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}
.ds-dr-cell {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
}
.ds-dr-cell:hover {
  background: var(--surface-300);
}
.ds-dr-cell.is-current {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
}
