/* code/assets/style.css */

/* =========================
   Design Tokens (Website)
   ========================= */
:root {
  --default-font: "Roboto", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --heading-font: "Montserrat", sans-serif;
  --nav-font: "Open Sans", sans-serif;

  --background-color: #ffffff;
  --surface-color: #ffffff;
  --light-background: #f7fbfa;

  --default-color: #47484B;
  --heading-color: #1f2d1f;

  --accent-color: #70B646;
  --accent-color-dark: #4F973A;

  --border-color: rgba(71, 72, 75, 0.18);
  --shadow: 0 10px 24px rgba(31, 45, 31, 0.08);

  --radius: 14px;
  --muted-color: rgba(71, 72, 75, 0.72);
  --focus-ring: 0 0 0 3px rgba(112, 182, 70, 0.18);
}

/* =========================
   Dark Theme Overrides
   (set via html/body data-theme)
   ========================= */
[data-theme="dark"] {
  --background-color: #0b0f0c;
  --surface-color: #121814;

  --default-color: #e7ecea;
  --heading-color: #ffffff;
  --muted-color: rgba(231, 236, 234, 0.72);

  --border-color: rgba(231, 236, 234, 0.14);
  --shadow: 0 10px 26px rgba(0,0,0,0.38);
  --focus-ring: 0 0 0 3px rgba(112, 182, 70, 0.25);
}

/* =========================
   Base
   ========================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  background: var(--background-color);
  color: var(--default-color);
  font-family: var(--default-font);
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 {
  color: var(--heading-color);
  font-family: var(--heading-font);
  margin-top: 0;
}

/* =========================
   Layout
   ========================= */
.nds-container {
  width: min(100%, 1200px);
  margin: 0 auto;
  padding: 16px;
  min-width: 0;
  overflow-x: hidden;
}

.nds-subtitle {
  opacity: 0.82;
  color: var(--muted-color);
}

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

.nds-section-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--heading-color);
}

/* =========================
   Cards / KPI
   ========================= */
.nds-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.nds-card.padded {
  padding: 12px;
}

.nds-kpi-title {
  font-size: 12px;
  opacity: 0.85;
  color: var(--muted-color);
}

.nds-kpi-value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--heading-color);
}

/* =========================
   Filter Bar
   ========================= */
.nds-filterbar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: end;
}

/* =========================
   Topbar + Theme Switch
   ========================= */
.nds-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.nds-brand-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(112,182,70,0.13), transparent 55%),
    radial-gradient(120% 120% at 100% 100%, rgba(79,151,58,0.10), transparent 55%),
    var(--surface-color);
}

.nds-brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nds-brand-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.55);
  box-shadow: 0 8px 20px rgba(31,45,31,0.10);
  padding: 8px;
}

[data-theme="dark"] .nds-brand-logo {
  background: rgba(18,24,20,0.85);
}

.nds-brand-copy {
  min-width: 0;
}

.nds-brand-title {
  margin: 0;
  line-height: 1.2;
}

.nds-brand-subtitle {
  margin-top: 3px;
  margin-bottom: 0;
}

.nds-theme-switch {
  display: flex;
  gap: 10px;
  align-items: center;
}

.nds-brand-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nds-theme-label {
  font-size: 12px;
  opacity: 0.85;
  color: var(--muted-color);
}

/* Turn Dash checklist into a toggle */
.nds-switch input[type="checkbox"] {
  appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  position: relative;
  outline: none;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: rgba(71,72,75,0.12);
  transition: all 0.2s ease;
}

.nds-switch input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--surface-color);
  transition: all 0.2s ease;
  box-shadow: 0 8px 16px rgba(0,0,0,0.18);
}

.nds-switch input[type="checkbox"]:checked {
  background: rgba(112,182,70,0.35);
  border-color: rgba(112,182,70,0.65);
}

.nds-switch input[type="checkbox"]:checked::after {
  left: 21px;
  background: var(--accent-color);
}

/* =========================
   Tabs (Dash robust)
   Make sure your dcc.Tabs has className="nds-tabs-container"
   ========================= */
.nds-tabs-container {
  border-bottom: 1px solid var(--border-color);
  background: transparent;
}

/* Works across Dash versions */
.nds-tabs-container .tab,
.nds-tabs-container .dash-tab {
  padding: 10px 14px !important;
  font-family: var(--nav-font);
  border: none !important;
  background: transparent !important;
  color: var(--default-color) !important;
}

.nds-tabs-container .tab--selected,
.nds-tabs-container .dash-tab--selected {
  color: var(--heading-color) !important;
  border-bottom: 3px solid var(--accent-color) !important;
  font-weight: 700 !important;
  background: transparent !important;
}

/* =========================
   Dash Radix Dropdown (new)
   Your HTML shows: button.dash-dropdown, spans dash-dropdown-*
   ========================= */
.dash-dropdown-wrapper {
  width: 100%;
}

button.dash-dropdown {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--default-color);
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: none;
}

button.dash-dropdown:hover {
  border-color: rgba(112, 182, 70, 0.55);
}

button.dash-dropdown:focus,
button.dash-dropdown:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: rgba(112, 182, 70, 0.85);
}

.dash-dropdown-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.dash-dropdown-value {
  color: var(--default-color);
}

/* Placeholder (your HTML shows: .dash-dropdown-placeholder) */
.dash-dropdown-placeholder {
  color: var(--muted-color) !important;
}

/* Icon inherits currentColor; ensure it's visible */
.dash-dropdown-trigger-icon {
  color: var(--muted-color);
}

/* The dropdown menu is rendered in a portal; style generically */
[data-theme="dark"] [role="listbox"],
[data-theme="dark"] [data-radix-popper-content-wrapper] {
  color: var(--default-color);
}

/* Try common Radix menu containers */
[data-theme="dark"] [data-radix-popper-content-wrapper] > * {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow) !important;
  border-radius: 10px !important;
}

/* Menu items (best-effort selectors) */
[data-theme="dark"] [role="option"] {
  color: var(--default-color) !important;
}

[data-theme="dark"] [role="option"][data-highlighted],
[data-theme="dark"] [role="option"]:hover {
  background: rgba(112, 182, 70, 0.14) !important;
}

/* =========================
   DateRangePicker (Dash)
   ========================= */
.DateRangePickerInput__withBorder {
  border-radius: 10px !important;
  border: 1px solid var(--border-color) !important;
  background: var(--surface-color) !important;
}

.DateInput_input {
  border-radius: 10px !important;
  background: var(--surface-color) !important;
  color: var(--default-color) !important;
}

.DateInput_input::placeholder {
  color: var(--muted-color) !important;
}

.DateInput_input__focused {
  border-bottom: 2px solid var(--accent-color) !important;
}

/* Calendar popover */
.CalendarDay__default {
  background: var(--surface-color) !important;
  border-color: var(--border-color) !important;
  color: var(--default-color) !important;
}

.CalendarDay__selected,
.CalendarDay__selected_span {
  background: rgba(112,182,70,0.25) !important;
  border-color: rgba(112,182,70,0.35) !important;
}

.CalendarDay__hovered_span {
  background: rgba(112,182,70,0.14) !important;
  border-color: rgba(112,182,70,0.22) !important;
}

/* =========================
   RadioItems / Checklist labels
   ========================= */
label {
  color: var(--default-color);
}

/* =========================
   DataTable
   ========================= */
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner {
  border-radius: 10px;
  background: var(--surface-color) !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}

.dash-table-container,
.dash-table-container .dash-spreadsheet-container,
.dash-table-container .dash-spreadsheet-inner,
.dash-table-container table {
  max-width: 100% !important;
  min-width: 0 !important;
  width: 100% !important;
}

.dash-table-container .dash-spreadsheet-container,
.dash-table-container .dash-spreadsheet,
.dash-table-container .dash-spreadsheet-inner,
.dash-table-container .cell-table {
  overflow-x: hidden !important;
}

.dash-table-container .cell-table,
.dash-table-container table {
  table-layout: fixed !important;
}

.dash-table-container .dash-header,
.dash-table-container .dash-cell {
  background: var(--surface-color) !important;
  color: var(--default-color) !important;
  border-color: var(--border-color) !important;
  min-width: 72px !important;
  max-width: 180px !important;
  width: auto !important;
  white-space: normal !important;
  overflow: hidden !important;
  text-overflow: ellipsis;
  overflow-wrap: anywhere !important;
  word-break: break-word;
  line-height: 1.25;
}

.dash-table-container .dash-header {
  color: var(--heading-color) !important;
}

.dash-table-container .dash-cell.focused {
  box-shadow: var(--focus-ring) !important;
}

.dash-table-container .show-hide {
  display: none !important;
}

/* =========================
   Dash DateRangePicker (Radix) - dash-datepicker*
   ========================= */

/* Wrapper / button-like container */
.dash-datepicker-input-wrapper {
  width: 100% !important;
  border-radius: 10px !important;
  border: 1px solid var(--border-color) !important;
  background: var(--surface-color) !important;
  padding: 8px 10px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

/* Focus ring (when any child input is focused) */
.dash-datepicker-input-wrapper:focus-within {
  border-color: rgba(112, 182, 70, 0.85) !important;
  box-shadow: var(--focus-ring) !important;
}

/* The two text inputs */
.dash-datepicker-input {
  background: transparent !important;
  color: var(--default-color) !important;
  border: none !important;
  outline: none !important;
  font-family: var(--default-font) !important;
  font-size: 14px !important;
}

/* Placeholders */
.dash-datepicker-input::placeholder {
  color: var(--muted-color) !important;
}

/* Icons (arrow + caret) */
.dash-datepicker-range-arrow,
.dash-datepicker-caret-icon {
  color: var(--muted-color) !important;
}

/* Make sure svg inherits */
.dash-datepicker-range-arrow path,
.dash-datepicker-caret-icon path {
  fill: currentColor !important;
}

/* =========================
   Popup (Radix portal)
   ========================= */

/* The popup container is rendered in a portal, so target Radix wrapper */
[data-theme="dark"] [data-radix-popper-content-wrapper] {
  color: var(--default-color);
}

/* The direct child tends to be the actual calendar container */
[data-theme="dark"] [data-radix-popper-content-wrapper] > * {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow) !important;
  border-radius: 12px !important;
}

/* If calendar uses buttons / grid cells */
[data-theme="dark"] [data-radix-popper-content-wrapper] button {
  color: var(--default-color) !important;
}

/* Hover / selected states (best effort) */
[data-theme="dark"] [data-radix-popper-content-wrapper] button:hover {
  background: rgba(112, 182, 70, 0.14) !important;
}

[data-theme="dark"] [data-radix-popper-content-wrapper] button[aria-selected="true"],
[data-theme="dark"] [data-radix-popper-content-wrapper] [data-selected="true"] {
  background: rgba(112, 182, 70, 0.26) !important;
  border-color: rgba(112, 182, 70, 0.35) !important;
}

/* =========================
   Dash "Year" input (Radix) - dash-input*
   ========================= */

.dash-input-container.dash-input {
  border-radius: 10px !important;
  border: 1px solid var(--border-color) !important;
  background: var(--surface-color) !important;
  overflow: hidden !important;
  display: inline-flex !important;
  align-items: stretch !important;
}

.dash-input-element {
  background: transparent !important;
  color: var(--default-color) !important;
  border: none !important;
  outline: none !important;
  padding: 8px 10px !important;
  font-family: var(--default-font) !important;
  font-size: 14px !important;
  width: 90px !important;
}

/* remove native spinners (optional) */
.dash-input-element::-webkit-outer-spin-button,
.dash-input-element::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.dash-input-element[type="number"] {
  -moz-appearance: textfield;
}

/* stepper buttons */
.dash-input-stepper {
  border: none !important;
  background: rgba(71,72,75,0.10) !important;
  color: var(--default-color) !important;
  width: 20px !important;
  cursor: pointer !important;
}

.dash-input-stepper:hover {
  background: rgba(112,182,70,0.14) !important;
}

.dash-input-container.dash-input:focus-within {
  border-color: rgba(112, 182, 70, 0.85) !important;
  box-shadow: var(--focus-ring) !important;
}


/* =========================
   Dash DatePicker calendar cells - dash-datepicker-calendar-*
   ========================= */

/* Make default day numbers light in dark mode */
[data-theme="dark"] td.dash-datepicker-calendar-date-inside,
[data-theme="dark"] td.dash-datepicker-calendar-date-inside span {
  color: var(--default-color) !important;
}

/* also cover "outside month" days if present */
[data-theme="dark"] td.dash-datepicker-calendar-date-outside,
[data-theme="dark"] td.dash-datepicker-calendar-date-outside span {
  color: rgba(231,236,234,0.45) !important;
}

/* hover */
[data-theme="dark"] td.dash-datepicker-calendar-date-inside:hover {
  background: rgba(112,182,70,0.14) !important;
}

/* selected (best effort: depends on classnames in your build) */
[data-theme="dark"] td[aria-selected="true"],
[data-theme="dark"] td[aria-selected="true"] span {
  color: var(--heading-color) !important;
}

/* if Dash marks selected with an extra class */
[data-theme="dark"] td.dash-datepicker-calendar-date-selected,
[data-theme="dark"] td.dash-datepicker-calendar-date-selected span {
  color: var(--heading-color) !important;
  background: rgba(112,182,70,0.26) !important;
}

.nds-btn{
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--default-color);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--nav-font);
  font-size: 12px;
}
.nds-btn:hover{
  border-color: rgba(112,182,70,0.65);
}
[data-theme="dark"] .nds-btn{
  background: var(--surface-color);
  color: var(--default-color);
}

.nds-btn-secondary {
  background: transparent;
}

.nds-logout-form {
  margin: 0;
}

/* =========================
   Login
   ========================= */
.nds-login-body {
  margin: 0;
  min-height: 100vh;
  background: #f7fbfa;
  color: #47484B;
  font-family: var(--default-font);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    linear-gradient(135deg, rgba(112, 182, 70, 0.16), transparent 40%),
    #f7fbfa;
}

.login-panel {
  width: min(100%, 390px);
  background: #ffffff;
  border: 1px solid rgba(71, 72, 75, 0.14);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 18px 42px rgba(31, 45, 31, 0.10);
}

.login-logo {
  width: 178px;
  height: auto;
  margin-bottom: 22px;
}

.login-panel h1 {
  margin-bottom: 4px;
  font-size: 28px;
  line-height: 1.18;
  color: #1f2d1f;
}

.login-subtitle {
  margin: 0;
  color: rgba(71, 72, 75, 0.72);
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.login-form label {
  display: grid;
  gap: 6px;
  font-weight: 650;
  color: #1f2d1f;
}

.login-form input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(71, 72, 75, 0.26);
  border-radius: 6px;
  padding: 11px 12px;
  background: #ffffff;
  color: #1f2d1f;
}

.login-form input:focus {
  outline: 3px solid rgba(112, 182, 70, 0.22);
  border-color: #70B646;
}

.login-form button {
  border: 0;
  border-radius: 6px;
  padding: 11px 14px;
  background: #70B646;
  color: #ffffff;
  cursor: pointer;
  font-weight: 750;
}

.login-form button:hover {
  background: #4F973A;
}

.form-error {
  margin: 0;
  color: #a63a2d;
  font-weight: 650;
}

/* =========================
   Demo Startseite
   ========================= */
.nds-start-page {
  display: grid;
  gap: 18px;
}

.nds-start-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding: 12px 0 0;
}

.nds-eyebrow {
  color: var(--accent-color-dark);
  font-family: var(--nav-font);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nds-start-title {
  margin: 3px 0 6px;
  font-size: 30px;
  line-height: 1.15;
}

.nds-start-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.nds-start-kpi {
  min-height: 104px;
}

.nds-start-kpi-sub {
  margin-top: 4px;
  color: var(--muted-color);
  font-size: 12px;
}

.nds-start-section {
  padding-top: 6px;
}

.nds-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.nds-action-card {
  --action-accent: var(--accent-color);
  --action-soft: rgba(112, 182, 70, 0.14);
  min-height: 220px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 12px;
  border-left: 5px solid var(--action-accent);
  padding: 20px !important;
}

.nds-action-card--customer {
  --action-accent: #70B646;
  --action-soft: rgba(112, 182, 70, 0.14);
}

.nds-action-card--wine {
  --action-accent: #8B1E1E;
  --action-soft: rgba(139, 30, 30, 0.12);
}

.nds-action-card--measure {
  --action-accent: #B98A24;
  --action-soft: rgba(185, 138, 36, 0.14);
}

.nds-action-card--direct {
  --action-accent: #2E86C1;
  --action-soft: rgba(46, 134, 193, 0.12);
}

.nds-action-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nds-action-marker {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--action-soft);
}

.nds-action-marker::after {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 999px;
  background: var(--action-accent);
}

.nds-action-eyebrow {
  color: var(--action-accent);
  font-size: 12px;
  font-weight: 800;
}

.nds-action-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.22;
}

.nds-action-metric {
  color: var(--heading-color);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.18;
}

.nds-action-detail {
  color: var(--muted-color);
  font-size: 13px;
  line-height: 1.45;
}

.nds-action-button {
  width: fit-content;
  background: var(--heading-color);
  color: #ffffff;
  border-color: transparent;
  font-weight: 750;
}

.nds-action-button:hover {
  background: var(--action-accent);
  color: #ffffff;
  border-color: transparent;
}

[data-theme="dark"] .nds-action-button {
  background: #ffffff;
  color: #1f2d1f;
}

/* =========================
   Einfache Cockpit-Seiten
   ========================= */
.nds-simple-page,
.nds-analysis-page {
  display: grid;
  gap: 18px;
}

.nds-simple-header,
.nds-analysis-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-top: 8px;
}

.nds-simple-title,
.nds-analysis-title {
  margin: 3px 0 0;
  font-size: 30px;
  line-height: 1.14;
}

.nds-simple-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(280px, 0.88fr);
  gap: 18px;
  align-items: stretch;
}

.nds-simple-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.nds-simple-mini-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.nds-simple-spotlight {
  --simple-accent: var(--accent-color);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  border-left: 5px solid var(--simple-accent);
  padding: 22px !important;
}

.nds-simple-spotlight--customer,
.nds-simple-metric--customer {
  --simple-accent: #70B646;
}

.nds-simple-spotlight--wine,
.nds-simple-metric--wine {
  --simple-accent: #8B1E1E;
}

.nds-simple-spotlight--measure,
.nds-simple-metric--measure {
  --simple-accent: #B98A24;
}

.nds-simple-metric--direct {
  --simple-accent: #2E86C1;
}

.nds-simple-spotlight-label,
.nds-simple-metric-label {
  color: var(--simple-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nds-simple-spotlight-value {
  color: var(--heading-color);
  font-family: var(--heading-font);
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  overflow-wrap: anywhere;
}

.nds-simple-spotlight-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.nds-simple-spotlight-sub {
  color: var(--muted-color);
  font-size: 15px;
  font-weight: 650;
}

.nds-simple-metric {
  border-left: 4px solid var(--simple-accent);
  min-height: 92px;
}

.nds-simple-metric-value {
  color: var(--heading-color);
  font-family: var(--heading-font);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.nds-simple-metric-sub {
  color: var(--muted-color);
  font-size: 12px;
  margin-top: 4px;
}

.nds-simple-chart-card {
  min-height: 386px;
}

.nds-simple-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.nds-simple-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--border-color);
}

.nds-simple-list-row:first-child {
  border-top: 0;
}

.nds-simple-list-title {
  color: var(--heading-color);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.nds-simple-list-sub {
  color: var(--muted-color);
  font-size: 12px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.nds-simple-list-value {
  color: var(--heading-color);
  font-weight: 800;
  text-align: right;
  overflow-wrap: anywhere;
}

.nds-simple-pill {
  justify-self: end;
  margin-top: 4px;
  width: fit-content;
  border-radius: 999px;
  background: rgba(112, 182, 70, 0.12);
  color: var(--heading-color);
  font-size: 11px;
  font-weight: 750;
  padding: 4px 8px;
  overflow-wrap: anywhere;
}

.nds-simple-empty {
  color: var(--muted-color);
  margin-top: 12px;
  padding: 14px 0 4px;
}

.nds-simple-detail-card {
  min-width: 0;
}

.nds-simple-detail-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.nds-simple-detail-title {
  color: var(--heading-color);
  font-family: var(--heading-font);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.nds-simple-detail-hint {
  color: var(--muted-color);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  text-align: right;
  overflow-wrap: anywhere;
}

.nds-detail-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 760px;
}

.nds-detail-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  padding: 8px 11px;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.nds-detail-switch-label:has(input:checked) {
  background: rgba(112, 182, 70, 0.14);
  border-color: rgba(112, 182, 70, 0.7);
  color: var(--heading-color);
}

.nds-detail-switch-input {
  accent-color: var(--accent-color);
}

.nds-detail-content {
  margin-top: 14px;
}

.nds-card-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:6px;
  gap: 10px;
  min-width: 0;
}

.nds-card-title{
  font-weight:700;
  color: var(--heading-color);
  min-width: 0;
  overflow-wrap: anywhere;
}

.nds-info-btn{
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--default-color);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.nds-info-btn:hover{
  border-color: rgba(112,182,70,0.65);
}

.nds-modal-backdrop{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
}

.nds-modal{
  width: min(720px, 92vw);
  max-height: 85vh;
  overflow: auto;
  background: var(--surface-color);
  color: var(--default-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

.nds-modal-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom: 8px;
}

.nds-modal-title{
  font-weight: 800;
  color: var(--heading-color);
}

.nds-modal-close{
  border: none;
  background: transparent;
  color: var(--default-color);
  font-size: 22px;
  cursor: pointer;
}

.nds-modal-section-title{
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 6px;
}

/* Global loading UX:
   - one spinner above everything (including controls)
   - soft overlay with backdrop blur
   - keep previous content visible but de-emphasized while loading */
#tab-content,
.nds-detail-content,
.nds-tab-loading-parent {
  position: relative;
  max-width: 100%;
  min-width: 0;
}

#tab-content > *,
.nds-detail-content > * {
  max-width: 100%;
  min-width: 0;
}

#tab-content [style*="display: grid"],
.nds-detail-content [style*="display: grid"],
#tab-content [style*="display:grid"],
.nds-detail-content [style*="display:grid"] {
  max-width: 100%;
  min-width: 0;
}

#tab-content [style*="display: flex"],
.nds-detail-content [style*="display: flex"],
#tab-content [style*="display:flex"],
.nds-detail-content [style*="display:flex"] {
  max-width: 100%;
  min-width: 0;
  flex-wrap: wrap !important;
}

.dash-graph,
.js-plotly-plot,
.plot-container,
.svg-container {
  max-width: 100% !important;
  min-width: 0 !important;
}

.nds-tab-loading,
.nds-tab-loading-parent .dash-spinner-container {
  position: fixed !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 4000 !important;
  pointer-events: none !important;
  background: rgba(247, 251, 250, 0.58) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.nds-tab-loading .dash-spinner,
.nds-tab-loading-parent .dash-spinner {
  position: static !important;
  transform: scale(2.2) !important;
  transform-origin: center !important;
}

/* Global guard:
   Hide all tab visuals until loading has fully settled.
   Body class is managed by assets/loading_guard.js. */
body.nds-hide-loading-content .nds-tab-loading-parent .dash-graph,
body.nds-hide-loading-content .nds-tab-loading-parent .js-plotly-plot,
body.nds-hide-loading-content .nds-tab-loading-parent .dash-table-container,
body.nds-hide-loading-content .nds-tab-loading-parent .nds-card {
  filter: blur(5px);
  opacity: 0.42;
  pointer-events: none;
  transition: opacity 0.16s ease, filter 0.16s ease;
}

[data-theme="dark"] .nds-tab-loading,
[data-theme="dark"] .nds-tab-loading-parent .dash-spinner-container {
  background: rgba(11, 15, 12, 0.58) !important;
}

/* =========================
   Admin
   ========================= */
.nds-admin-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

.nds-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.nds-admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.nds-admin-card-header .nds-card-title {
  margin-bottom: 0;
}

.nds-admin-add-row {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.nds-admin-kpis,
.nds-admin-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.nds-admin-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nds-admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nds-admin-card {
  min-width: 0;
}

.nds-admin-status {
  font-weight: 700;
  color: var(--heading-color);
}

.nds-admin-status--error {
  color: #b42318;
}

[data-theme="dark"] .nds-admin-status--error {
  color: #ffb4a8;
}

.nds-admin-status-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  color: var(--muted-color);
  font-size: 13px;
}

.nds-admin-progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(71,72,75,0.12);
  margin: 12px 0 6px;
}

.nds-admin-progress-fill {
  height: 100%;
  min-width: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-color), #2f7d69);
  transition: width 0.25s ease;
}

.nds-admin-progress-label {
  color: var(--muted-color);
  font-size: 12px;
}

.nds-admin-error {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  color: var(--default-color);
  background: rgba(180,35,24,0.06);
}

@media (max-width: 920px) {
  #tab-content [style*="grid-template-columns"],
  .nds-detail-content [style*="grid-template-columns"] {
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)) !important;
  }

  .nds-filterbar {
    grid-template-columns: 1fr 1fr;
  }
  .nds-brand-shell {
    flex-direction: column;
    align-items: flex-start;
  }
  .nds-brand-actions {
    justify-content: flex-start;
  }
  .nds-start-intro {
    flex-direction: column;
    align-items: flex-start;
  }
  .nds-start-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nds-action-grid {
    grid-template-columns: 1fr;
  }
  .nds-simple-header,
  .nds-analysis-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .nds-simple-hero-grid,
  .nds-simple-grid-2 {
    grid-template-columns: 1fr;
  }
  .nds-detail-switch {
    justify-content: flex-start;
  }
  .nds-admin-kpis,
  .nds-admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .nds-container {
    padding: 12px;
  }

  #tab-content [style*="grid-template-columns"],
  .nds-detail-content [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  #tab-content [style*="justify-content: flex-end"],
  .nds-detail-content [style*="justify-content: flex-end"] {
    justify-content: flex-start !important;
  }

  .nds-filterbar {
    grid-template-columns: 1fr;
  }
  .nds-brand-logo {
    width: 54px;
    height: 54px;
    padding: 6px;
  }
  .nds-brand-actions {
    width: 100%;
  }
  .nds-start-title {
    font-size: 25px;
  }
  .nds-start-kpi-grid,
  .nds-action-grid {
    grid-template-columns: 1fr;
  }
  .nds-simple-title,
  .nds-analysis-title {
    font-size: 25px;
  }
  .nds-simple-spotlight-value {
    font-size: 34px;
  }
  .nds-simple-list-row {
    grid-template-columns: 1fr;
  }
  .nds-simple-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .nds-simple-detail-hint {
    text-align: left;
  }
  .nds-simple-list-value {
    text-align: left;
  }
  .nds-simple-pill {
    justify-self: start;
  }
  .login-panel {
    padding: 24px;
  }
  .nds-admin-kpis,
  .nds-admin-grid {
    grid-template-columns: 1fr;
  }
}
