:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --fg-muted: #666;
  --border: #e0e0e0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --card-bg: #fafafa;
  --error: #dc2626;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--fg);
  background-color: var(--bg);
  padding: 2rem 1rem;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

header {
  margin-bottom: 2rem;
}

h1 {
  font-size: 2.25rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.subtitle {
  color: var(--fg-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.breadcrumb {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  margin: 0 0.5rem;
}

.page-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.left-panel {
  width: 360px;
  max-width: 100%;
}

@media (min-width: 1100px) {
  .left-panel {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
}

@media (max-width: 1100px) {
  .page-layout {
    grid-template-columns: 1fr;
  }
  
  .left-panel {
    width: 100%;
  }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-card {
  padding: 1.25rem;
  margin-bottom: 0;
}

.card h2 {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
}

.form-field {
  margin-bottom: 1.25rem;
}

.form-field label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
  font-weight: 500;
}

.form-field .hint {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}

.form-field input,
.form-field select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.9rem;
  font-family: inherit;
}

.form-field input:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-field .error {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 0.35rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.9rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group .error {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.actions {
  margin-bottom: 1.5rem;
}

.actions > button {
  width: 100%;
  margin-bottom: 0.75rem;
}

.actions-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.param-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.param-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.param-section h3 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--fg);
}

.section-hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 1rem;
  font-style: italic;
}

.statusbar {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #111;
}

.statusbar--ok {
  border-color: #d1fae5;
  background: #ecfdf5;
  color: #065f46;
}

.statusbar--err {
  border-color: #fee2e2;
  background: #fef2f2;
  color: #991b1b;
  white-space: pre-wrap;
}

.status-indicator {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--card-bg);
  border-radius: 3px;
  border-left: 3px solid var(--primary);
}

.buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}


button {
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: white;
  border-radius: 3px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: var(--primary-hover);
}

button.secondary {
  background: transparent;
  color: var(--primary);
}

button.secondary:hover {
  background: var(--card-bg);
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 1100px) {
  .charts-grid {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
}

.chart-card--wide {
  grid-column: 1 / -1;
}

.chart-card {
  padding: 1.25rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chart-card h2 {
  margin: 0;
}

.mini-toggle {
  font-size: 0.85rem;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.mini-toggle input[type="checkbox"] {
  cursor: pointer;
}

.cum-wrap {
  margin-top: 10px;
  display: none;
}

.cum-wrap.is-on {
  display: block;
}

#chartRevenueCum {
  width: 100%;
  height: 110px;
  max-height: 110px;
}

.cum-title {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 6px;
}

.chart-wrapper {
  position: relative;
  width: 100%;
}

.chart-wrapper canvas {
  width: 100%;
  max-width: 100%;
  height: 240px;
  display: block;
}

.chart-card--wide .chart-wrapper canvas {
  height: 300px;
}

.chart-wrapper-sparkline canvas {
  height: 110px;
}

.kpi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.kpi-table th,
.kpi-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.kpi-table th {
  text-align: left;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--card-bg);
}

.kpi-table td {
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.kpi-table td:last-child {
  text-align: right;
}

.kpi-table tr:last-child td {
  border-bottom: none;
}

.kpi-tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}

@media (max-width: 1100px) {
  .kpi-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.kpi-tile {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
}

.kpi-tile .label,
.kpi-tile-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}

.kpi-tile .value,
.kpi-tile-value {
  font-size: 18px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}


.card-header {
  margin-bottom: 1rem;
}

.card-header h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 500;
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.4;
}

.number {
  font-variant-numeric: tabular-nums;
}


.checkbox-group {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.checkbox-group label {
  margin: 0;
  font-size: 0.9rem;
  cursor: pointer;
}

