:root {
  --data-page-bg: var(--holxn-page-bg, #f4f7f5);
  --data-surface: var(--holxn-surface, #ffffff);
  --data-border: var(--holxn-border, rgba(38, 65, 56, .14));
  --data-ink: var(--holxn-text, #17251f);
}

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--data-ink);
  background: var(--data-page-bg);
}

#app-container {
  width: min(100% - 2rem, 1240px);
  margin: 0 auto !important;
  padding-block: clamp(2rem, 6vw, 4.5rem);
}

#header-title {
  margin-bottom: 1.25rem !important;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 650;
  letter-spacing: -.035em;
}

#login-form > .d-flex {
  width: min(100%, 34rem);
  margin-inline: auto;
  padding: .75rem;
  background: var(--data-surface);
  border: 1px solid var(--data-border);
  border-radius: 1rem;
}

#login-form input {
  min-width: 0;
  min-height: 2.75rem;
  padding: .6rem .8rem;
  color: var(--data-ink);
  background: var(--data-surface);
  border: 1px solid var(--data-border);
  border-radius: .7rem;
}

#login-form input::placeholder { color: var(--bs-secondary-color, #6c757d); }

#login-form .btn { min-height: 2.75rem; }

#data-section > .d-flex {
  gap: .75rem;
  align-items: center;
  justify-content: space-between !important;
  padding: .75rem;
  background: var(--data-surface);
  border: 1px solid var(--data-border);
  border-radius: 1rem;
}

#data-container {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: .85rem;
  margin: 1rem 0 0 !important;
}

#data-container > * { width: auto; max-width: none; }

#data-container .card {
  height: 100%;
  color: inherit;
  background: var(--data-surface);
  border-color: var(--data-border);
  border-radius: 1rem;
  overflow: hidden;
}

.factor-block {
  min-width: 0;
  border-color: var(--data-border) !important;
  border-radius: .7rem !important;
}

/* Give the refresh interval its own quiet settings-control hierarchy. */
.data-refresh-control {
  flex: 0 0 auto;
  width: auto;
  min-height: 2.5rem;
  padding: .25rem;
  gap: .25rem;
  align-items: center;
  background: var(--holxn-surface-muted, var(--data-page-bg));
  border: 1px solid var(--data-border);
  border-radius: .8rem;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.data-refresh-control:focus-within {
  border-color: var(--holxn-brand);
  box-shadow: var(--holxn-focus);
}

.data-refresh-control .data-refresh-label {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: .25rem .35rem .25rem .55rem;
  color: var(--holxn-muted, #64756e);
  background: transparent !important;
  border: 0 !important;
  font-size: .8125rem;
  font-weight: 650;
  letter-spacing: .01em;
  line-height: 1;
  white-space: nowrap;
}

.data-refresh-control .form-select {
  width: auto;
  min-width: 6.5rem;
  min-height: 2rem;
  padding: .3rem 2rem .3rem .65rem;
  color: var(--data-ink);
  background-color: var(--data-surface) !important;
  border: 1px solid var(--data-border);
  border-radius: .6rem !important;
  font-size: .875rem;
  line-height: 1.2;
  box-shadow: none;
}

.data-refresh-control .form-select:focus {
  border-color: var(--holxn-brand) !important;
  box-shadow: none !important;
}

/* Keep the PT/site filter buttons on one measured control rail. */
#data-section .btn-group > .btn {
  height: 2.5rem;
  min-height: 2.5rem;
  padding-block: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  box-shadow: none !important;
}

#data-section .btn-group > .btn:focus-visible {
  box-shadow: var(--holxn-focus) !important;
}

#data-section .btn-group > .logout-btn {
  color: #a62f3c !important;
  background: rgba(220, 53, 69, .08) !important;
  border-color: rgba(220, 53, 69, .36) !important;
}

html[data-bs-theme="dark"] #data-section .btn-group > .logout-btn {
  color: #ffb6bf !important;
  background: rgba(220, 53, 69, .18) !important;
  border-color: rgba(255, 150, 160, .42) !important;
}



@media (max-width: 767.98px) {
  #app-container { width: min(100% - 1.25rem, 1240px); padding-block: 1.25rem 4rem; }
  #data-section > .d-flex { align-items: stretch; flex-direction: column; }
  #data-section .btn-group { width: 100%; display: grid; grid-auto-flow: dense; }
  .data-display-pt #data-section .btn-group { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .data-display-site #data-section .btn-group { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #data-section .btn-group > .btn { height: 2.75rem; min-height: 2.75rem; min-width: 0; padding-inline: .3rem; }
  #data-section > .d-flex > .data-refresh-control { width: auto !important; align-self: flex-end; }
  #data-container { grid-template-columns: 1fr; }
  #login-form > .d-flex { gap: .5rem; }
  #login-form input { width: 100%; max-width: none !important; }
  #login-form .btn { margin-left: 0 !important; white-space: nowrap; }
}

html[data-bs-theme="dark"] .data-display .value-green { color: #75d6aa; }
html[data-bs-theme="dark"] .data-display .value-red { color: #ff939d; }
html[data-bs-theme="dark"] .data-display .bg-red {
  color: #ffd9dd;
  background: #4d282d !important;
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
