:root {
  --bg: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --primary: #2eb36e;
  --primary-contrast: #ffffff;
  --border: #e5e7eb;
  --badge: #5ace96;
  --warn-bg: #fffbeb;
  --warn-fg: #7c2d12;
  --warn-border: #f59e0b;
}

/* Utility: toggle visibility from JS */
.is-hidden { display: none !important; }
[hidden] { display: none !important; }

.server-message-section {
  margin-top: 10px;
}

.server-message {
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-fg);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
}

/* --- Host warning message --- */
.host-warning {
  color: #b91c1c;
  font-size: 12px;
  margin-top: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--fg);
}

.container { padding: 16px; min-width: 320px; }
header {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
  -ms-flex-pack: justify;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
h1 { font-size: 16px; margin: 0; }
.badge { font-size: 12px; background: var(--badge); color: var(--primary-contrast); padding: 4px 8px; border-radius: 999px; }

.controls {
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 8px;
}

.controls label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }

.controls select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  line-height: 1.5;
}

.controls .row {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: row;
  flex-direction: row;
  gap: 8px;
  margin-top: 8px;
}

.controls button {
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.controls .primary { background: var(--primary); color: var(--primary-contrast); border: 1px solid var(--primary); }

.controls button:disabled,
.controls button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  background: #f9fafb;
  color: var(--muted);
  border-color: var(--border);
}

.filters { margin-top: 14px; }
.filters h2 { font-size: 14px; margin: 0 0 6px 0; }
.filters .hint { font-size: 12px; color: var(--muted); margin: 0 0 8px 0; }

.filtersHost {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  gap: 8px;
}

.filter-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}

.filter-header {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -ms-flex-align: center;
  align-items: center;
  gap: 8px;
}

.filter-title { font-size: 13px; font-weight: 600; margin: 0; }

.dropdown { position: relative; }

.dropdown-toggle {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.dropdown-menu {
  position: relative; /* static flow for taskpane, avoids overflow issues */
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.search-box {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
}

.select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.items {
  max-height: 180px; /* scroll for long lists */
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
}

.item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  font-size: 13px;
}

.notes { font-size: 12px; color: var(--muted); margin-top: 10px; }
code { background: #f3f4f6; padding: 2px 4px; border-radius: 4px; }

button.pumping {
  background-color: var(--muted);
  color: var(--primary-contrast);
}

/* Dataset search */
.dataset-search { margin: 8px 0 6px 0; }

.dataset-search input[type="search"]#datasetSearch {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
}

.dataset-search input[type="search"]#datasetSearch:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); /* primary focus ring */
}

/* Optionally hide the native clear 'X' on some browsers if undesired */
.dataset-search input[type="search"]::-ms-clear,
.dataset-search input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

/* Screen reader only label */
.sr-only {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  border: 0; padding: 0; margin: 0;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px 0;
  border-bottom: 1px solid var(--border);
}
.tab-button {
  appearance: none;
  background: transparent;
  border: none;
  padding: 8px 10px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}
.tab-button:hover { color: var(--fg); }
.tab-button.active {
  color: var(--fg);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-panel { display: block; }
.tab-panel.active { display: block; } /* explicit for clarity */

/* --- Range filters (dual-range slider & readouts) --- */
.range-field { margin-top: 10px; }
.range-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.range-readout {
  margin-top: 6px;
  font-size: 12px;
  color: var(--fg);
}

.range-numbers {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: row;
  flex-direction: row;
  gap: 8px;
  margin-top: 8px;
}
.range-numbers input[type="number"] {
  -ms-flex: 1 1 0;
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

/* Dual range slider */
.drs {
  position: relative;
  height: 28px;
  margin: 6px 0 2px;
}

.drs-track {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  border-radius: 9999px;
  background: var(--border); /* track */
}

.drs-fill {
  position: absolute;
  top: 0; height: 100%;
  background: var(--primary); /* active fill uses theme color */
  border-radius: 9999px;
}

.drs-handle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,.12);
  cursor: pointer;
}

.drs-handle:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37,99,235,.2);
}

/* --- Fiscal Alignment (Concentric Picker) --- */
.fa-wrap { width: 100%; margin: 8px 0 14px 0; }
.fa-panel { background:#fff; border-radius:8px; border:1px solid var(--border, #e5e7eb); padding:10px; }
.fa-stack { display:flex; -ms-flex-direction:column; flex-direction:column; gap:10px; }
.fa-visual, .fa-dash { width:100%; }
.fa-visual svg { width:100%; height:auto; max-width:520px; display:block; margin:0 auto; }
.fa-title { font-size:14px; font-weight:600; margin:0 0 6px 0; }
.fa-status { font-size:12px; line-height:1.5; }
.fa-status strong { font-weight:700; }
.fa-btn { padding:6px 10px; border-radius:6px; border:1px solid var(--border, #ccc); background:#fff; cursor:pointer; }
.fa-outline { stroke:#111; stroke-width:3; fill:none; pointer-events:none; }
.fa-hidden { display:none; }
.fa-ring-text, .fa-month-text {
  font-size: 12px; font-weight:700; fill:#fff; paint-order: stroke; stroke: rgba(0,0,0,0.35); stroke-width: 2px;
}
.fa-q1 { stroke:#2563eb; } .fa-q2 { stroke:#059669; } .fa-q3 { stroke:#f59e0b; } .fa-q4 { stroke:#ef4444; }
.fa-h1 { stroke:#7c3aed; } .fa-h2 { stroke:#0ea5e9; }
.fa-m1 { stroke:#2563eb; } .fa-m2 { stroke:#059669; } .fa-m3 { stroke:#f59e0b; } .fa-m4 { stroke:#ef4444; }
