html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: #f5f5f5;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ── Header ────────────────────────────────────────────────── */
.bdp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #ffffff;
  border-bottom: 1px solid #00ace9;
  height: 48px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.bdp-logo {
  width: 100px;
  height: auto;
  flex-shrink: 0;
}

.bdp-product {
  font-size: 10px;
  font-weight: 600;
  color: #888888;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-left: 1px solid #dddddd;
  padding-left: 8px;
  line-height: 1;
}

/* ── Main layout ───────────────────────────────────────────── */
.bdp-main {
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
  background: #f5f5f5;
  min-height: calc(100vh - 48px);
  box-sizing: border-box;
}

/* ── Cards ─────────────────────────────────────────────────── */
.bdp-card {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Section labels (CUSTOMER, LOCATION, QUERY TYPE, etc.) ── */
.bdp-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #888888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

/* Card section headings (QUERY BUILDER, OUTPUT FORMAT) */
.bdp-card-heading {
  font-size: 10px;
  font-weight: 600;
  color: #888888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 4px 0;
}

/* ── Inputs & selects ──────────────────────────────────────── */
.bdp-input {
  width: 100%;
  box-sizing: border-box;
}

/* ── Field group (label + input pair within a card section) ── */
.bdp-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Auth: welcome text ────────────────────────────────────── */
.bdp-welcome-text {
  font-size: 13px;
  font-weight: 400;
  color: #1d1d1b;
  margin: 0;
  line-height: 1.5;
}

/* ── Microsoft sign-in button ──────────────────────────────── */
.bdp-ms-signin {
  width: 100%;
  height: 40px;
  background: #ffffff;
  border: 1px solid #8c8c8c;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #1d1d1b;
  box-sizing: border-box;
  transition: background-color 80ms ease;
}

.bdp-ms-signin:hover {
  background: #f3f3f3;
}

.bdp-ms-signin:active {
  background: #e8e8e8;
}

.bdp-ms-signin:focus-visible {
  outline: 2px solid #00ace9;
  outline-offset: 2px;
}

/* ── Auth logged-in row ────────────────────────────────────── */
.bdp-auth-logged-in-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Sign out stealth link */
#logoutButton {
  font-size: 12px;
  color: #605e5c;
  cursor: pointer;
}

#logoutButton:hover {
  text-decoration: underline;
}

/* ── Status text ───────────────────────────────────────────── */
.bdp-status {
  font-size: 12px;
  margin: 0;
  min-height: 16px;
  color: #323130;
  line-height: 1.4;
}

/* ── Info text (read-only display, e.g. location in GETASSETNAMES) */
.bdp-info-text {
  font-size: 12px;
  color: #888888;
  margin: 0;
}

/* ── Show-timestamp toggle row ─────────────────────────────── */
.bdp-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #1d1d1b;
}

/* ── Multi-asset rows ──────────────────────────────────────── */
.bdp-asset-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bdp-asset-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bdp-asset-row > fluent-combobox {
  flex: 1;
  min-width: 0;
}

.bdp-remove-asset-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: white;
  color: #888888;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bdp-remove-asset-btn:hover {
  background: #fef0f0;
  border-color: #e30613;
  color: #e30613;
}

.bdp-add-asset-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
  background: transparent;
  border: none;
  color: #00ace9;
  font-size: 12px;
  font-weight: 600;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  cursor: pointer;
  padding: 0;
}

.bdp-add-asset-btn:hover {
  text-decoration: underline;
}

/* ── Output format tiles ───────────────────────────────────── */
.bdp-tile-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.bdp-tile-row.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.bdp-tile {
  width: 52px;
  height: 52px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 10px;
  color: #888888;
  transition: border-color 120ms ease, background-color 120ms ease;
  flex-shrink: 0;
}

.bdp-tile:hover {
  border-color: #00ace9;
  background: rgba(0, 172, 233, 0.04);
}

.bdp-tile.selected {
  border: 2px solid #00ace9;
  background: rgba(0, 172, 233, 0.08);
  color: #1d1d1b;
  transition: border-color 80ms ease-out, background-color 80ms ease-out;
}

.bdp-tile:focus-visible {
  outline: 2px solid #00ace9;
  outline-offset: 2px;
}

/* ── Format mode disabled notice ───────────────────────────── */
.bdp-format-notice {
  font-size: 10px;
  color: #888888;
  font-style: italic;
  margin: 0;
}

/* ── Datetime input (flatpickr target) ────────────────────── */
.bdp-datetime-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #1d1d1b;
  background: white;
  cursor: pointer;
  outline: none;
}

.bdp-datetime-input:focus,
.bdp-datetime-input.active {
  border-color: #00ace9;
}

/* ── Flatpickr brand theme overrides ──────────────────────── */
.flatpickr-calendar {
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.flatpickr-months .flatpickr-month,
.flatpickr-time {
  background: #ffffff;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
  background: #00ace9;
  border-color: #00ace9;
}

.flatpickr-day:hover,
.flatpickr-day:focus {
  background: rgba(0, 172, 233, 0.1);
  border-color: rgba(0, 172, 233, 0.3);
}

.flatpickr-day.today {
  border-color: #00ace9;
}

.flatpickr-day.today:hover {
  background: rgba(0, 172, 233, 0.15);
}

/* ── OK / Cancel buttons inside the flatpickr calendar popup ── */
.bdp-fp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 4px 8px 8px;
}

.bdp-fp-cancel {
  padding: 4px 10px;
  background: transparent;
  color: #605e5c;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.bdp-fp-cancel:hover {
  background: #f3f3f3;
}

.bdp-fp-ok {
  padding: 4px 10px;
  background: #00ace9;
  color: white;
  border: none;
  border-radius: 4px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.bdp-fp-ok:hover {
  background: #0099d0;
}

/* ── Server display row ─────────────────────────────────────── */
.bdp-server-display-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bdp-server-host {
  font-size: 13px;
  color: #1d1d1b;
  font-weight: 500;
  word-break: break-all;
}

.bdp-server-change-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: #00ace9;
  font-size: 12px;
  font-weight: 600;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  cursor: pointer;
  padding: 0;
}

.bdp-server-change-btn:hover {
  text-decoration: underline;
}

/* ── Insert actions row ────────────────────────────────────── */
.bdp-insert-row {
  display: flex;
  gap: 8px;
}

.bdp-insert-row fluent-button {
  flex: 1;
}

/* Active mode indicator — left border on the active insert button */
.bdp-insert-mode-formula #insertFormulaBtn {
  border-left: 3px solid #00ace9;
}

.bdp-insert-mode-paste #pasteDataBtn {
  border-left: 3px solid #00ace9;
}

/* Disabled buttons */
fluent-button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Auth dialog pages (authLaunch.html, redirectPage.html) ── */
.bdp-dialog-body {
  margin: 0;
  padding: 0;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.bdp-dialog-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  max-width: 300px;
  width: 100%;
}

.bdp-dialog-logo {
  width: 160px;
  height: auto;
}

.bdp-dialog-heading {
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1b;
  margin: 0;
  text-align: center;
  line-height: 1.3;
}

.bdp-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e0e0e0;
  border-top-color: #00ace9;
  border-radius: 50%;
  animation: bdp-spin 0.8s linear infinite;
}

@keyframes bdp-spin {
  to { transform: rotate(360deg); }
}

.bdp-dialog-text {
  font-size: 13px;
  color: #605e5c;
  margin: 0;
  text-align: center;
}

/* ── Focus ring (all interactive elements) ─────────────────── */
:focus-visible {
  outline: 2px solid #00ace9;
  outline-offset: 2px;
}

/* ── Query builder min-height (prevent layout jump on switch) ─ */
#queryBuilderFields {
  min-height: 180px;
}
