:root { --app-bg: #f4f6f8; }
body { background: var(--app-bg); color: #17202a; }
.navbar-brand { letter-spacing: -.02em; }
.card { border-radius: 1rem; }
.metric-card { background:#fff; border-radius:1rem; padding:1.2rem; box-shadow:0 .125rem .5rem rgba(0,0,0,.05); height:100%; }
.metric-label { color:#6c757d; font-size:.85rem; margin-bottom:.25rem; }
.metric-value { font-size:1.65rem; font-weight:600; letter-spacing:-.03em; }
.metric-value.smallish { font-size:1.1rem; padding-top:.35rem; }
.state-flow { display:flex; align-items:center; gap:.65rem; flex-wrap:wrap; }
.state-step { background:#f8f9fa; border:1px solid #e9ecef; border-radius:.8rem; padding:.7rem .9rem; display:flex; flex-direction:column; min-width:120px; }
.state-step span { color:#6c757d; font-size:.8rem; }
@media (max-width: 575.98px) {
  .state-flow > .bi-arrow-right { transform:rotate(90deg); }
  .state-flow { flex-direction:column; align-items:stretch; }
  .state-step { width:100%; }
}

.metric-card.compact { box-shadow:none; background:#f8f9fa; padding:.9rem; }
.metric-card.compact .metric-value { font-size:1.2rem; }
.phase-flow { display:flex; align-items:center; gap:.55rem; }
.phase-step { flex:1; min-width:0; border:1px solid #dee2e6; background:#f8f9fa; border-radius:.8rem; padding:.7rem; transition:.2s ease; }
.phase-step strong { display:block; font-size:.85rem; }
.phase-step span { display:block; font-size:.75rem; color:#6c757d; margin-top:.15rem; }
.phase-step.active { background:var(--bs-success); border-color:var(--bs-success); color:#fff; box-shadow:0 0 0 .2rem rgba(25,135,84,.18); }
.phase-step.active span { color:rgba(255,255,255,.8); }
.border-dashed { border:1px dashed #adb5bd !important; box-shadow:none !important; }
@media (max-width: 575.98px) {
  .phase-flow { flex-direction:column; align-items:stretch; }
  .phase-flow > .bi-arrow-right { transform:rotate(90deg); align-self:center; }
}

[data-bs-theme="dark"] body {
  background: #0f1115;
  color: var(--bs-body-color);
}
[data-bs-theme="dark"] .metric-card {
  background: #171a21;
  color: var(--bs-body-color);
}
[data-bs-theme="dark"] .metric-card.compact,
[data-bs-theme="dark"] .phase-step,
[data-bs-theme="dark"] .state-step {
  background: #1d2129;
  border-color: #303640;
  color: var(--bs-body-color);
}
[data-bs-theme="dark"] .phase-step span,
[data-bs-theme="dark"] .state-step span,
[data-bs-theme="dark"] .metric-label {
  color: #9ba4b0;
}
[data-bs-theme="dark"] .card {
  --bs-card-bg: #171a21;
}


[data-bs-theme="dark"] .phase-step.active {
  background: var(--bs-success);
  border-color: var(--bs-success);
  color: #fff;
  box-shadow: 0 0 0 .2rem rgba(25,135,84,.22);
}
[data-bs-theme="dark"] .phase-step.active span {
  color: rgba(255,255,255,.82);
}

.phase-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.phase-check {
  display: none;
  color: var(--bs-success);
}
.phase-step.completed {
  border-color: rgba(25,135,84,.55);
}
.phase-step.completed .phase-check {
  display: inline-block;
}
.phase-step.active .phase-check {
  display: none;
}
[data-bs-theme="dark"] .phase-step.completed {
  border-color: rgba(25,135,84,.65);
  background: rgba(25,135,84,.08);
}
.info-btn {
  line-height: 1;
  text-decoration: none;
}


.settings-section {
  scroll-margin-top: 1.25rem;
}
.settings-menu .nav-link {
  white-space: nowrap;
}
html {
  scroll-behavior: smooth;
}


.global-save-indicator {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1090;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 .25rem 1rem rgba(0,0,0,.18);
  color: var(--bs-secondary-color);
  font-size: 1.15rem;
  opacity: 0;
  transform: translateY(.4rem) scale(.94);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease, color .16s ease;
}
.global-save-indicator.visible {
  opacity: .92;
  transform: translateY(0) scale(1);
}
.global-save-indicator.saving {
  color: var(--bs-secondary-color);
}
.global-save-indicator.saved {
  color: var(--bs-success);
}
.global-save-indicator.error {
  color: var(--bs-danger);
}


.live-status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.operation-visual,
.poll-status {
  display: flex;
  align-items: center;
  gap: .9rem;
}
.operation-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  background: #eef2f6;
  border: 1px solid #dde3ea;
  color: #495057;
  flex-shrink: 0;
}
.operation-icon.op-washing {
  background: rgba(13,110,253,.12);
  color: var(--bs-primary);
  border-color: rgba(13,110,253,.25);
}
.operation-icon.op-finished {
  background: rgba(25,135,84,.12);
  color: var(--bs-success);
  border-color: rgba(25,135,84,.28);
}
.operation-icon.op-standby {
  background: rgba(13,202,240,.12);
  color: #0aa2c0;
  border-color: rgba(13,202,240,.25);
}
.operation-icon.op-off {
  background: rgba(108,117,125,.12);
  color: #6c757d;
  border-color: rgba(108,117,125,.25);
}
.operation-label {
  font-weight: 700;
  letter-spacing: -.02em;
}
.spin-icon {
  display: inline-block;
  animation: wm-spin 1.1s linear infinite;
}
@keyframes wm-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.poll-ring {
  --progress: 0%;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 999px;
  background:
    conic-gradient(var(--bs-success) var(--progress), rgba(25,135,84,.14) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.poll-ring-inner {
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .05rem;
  font-size: .78rem;
  font-weight: 700;
}
.poll-caption {
  font-size: .95rem;
}

@media (max-width: 575.98px) {
  .live-status-strip {
    flex-direction: column;
    align-items: stretch;
  }
  .poll-status {
    justify-content: space-between;
  }
}

[data-bs-theme="dark"] .operation-icon {
  background: #1d2129;
  border-color: #303640;
  color: var(--bs-body-color);
}
[data-bs-theme="dark"] .operation-icon.op-washing {
  background: rgba(13,110,253,.16);
  border-color: rgba(13,110,253,.32);
  color: #6ea8fe;
}
[data-bs-theme="dark"] .operation-icon.op-finished {
  background: rgba(25,135,84,.18);
  border-color: rgba(25,135,84,.35);
  color: #75b798;
}
[data-bs-theme="dark"] .operation-icon.op-standby {
  background: rgba(13,202,240,.18);
  border-color: rgba(13,202,240,.35);
  color: #6edff6;
}
[data-bs-theme="dark"] .operation-icon.op-off {
  background: rgba(108,117,125,.18);
  border-color: rgba(108,117,125,.35);
  color: #adb5bd;
}
[data-bs-theme="dark"] .poll-ring-inner {
  background: #171a21;
  border-color: #303640;
  color: var(--bs-body-color);
}


/* v1.3 compact live status */
.card-live-meta {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-shrink: 0;
}
.compact-state {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.operation-icon-mini {
  width: 1.8rem;
  height: 1.8rem;
  font-size: .85rem;
}
.compact-poll {
  display: flex;
  align-items: center;
  gap: .25rem;
  color: var(--bs-secondary-color);
  font-size: .72rem;
}
.run-timer {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.run-timer .bi {
  font-size: .8rem;
  color: var(--bs-secondary-color);
}
.run-timer-value {
  font-weight: 600;
}
.poll-ring-mini {
  width: 1.8rem;
  height: 1.8rem;
}
.poll-ring-inner-mini {
  width: 1.25rem;
  height: 1.25rem;
  font-size: .58rem;
  border: 0;
}
@media (max-width: 575.98px) {
  .card-live-meta {
    gap: .35rem;
  }
}

.access-ip-diagnostic {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  padding:.8rem 1rem;
  border:1px solid var(--bs-border-color);
  border-radius:.8rem;
  background:var(--bs-tertiary-bg);
}


.volume-control {
  display: grid;
  grid-template-columns: auto minmax(110px, 1fr) auto auto;
  align-items: center;
  gap: .55rem;
  min-height: 2.4rem;
}
.volume-icon {
  color: var(--bs-secondary-color);
  font-size: 1rem;
}
.volume-value {
  min-width: 2.8rem;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: .9rem;
}
.volume-slider {
  --volume-pct: 0%;
  height: 1.4rem;
  margin: 0;
}
.volume-slider::-webkit-slider-runnable-track {
  height: .38rem;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--bs-primary) 0,
    var(--bs-primary) var(--volume-pct),
    var(--bs-secondary-bg) var(--volume-pct),
    var(--bs-secondary-bg) 100%
  );
}
.volume-slider::-moz-range-track {
  height: .38rem;
  border-radius: 999px;
  background: var(--bs-secondary-bg);
}
.volume-slider::-moz-range-progress {
  height: .38rem;
  border-radius: 999px;
  background: var(--bs-primary);
}
.volume-slider::-webkit-slider-thumb {
  margin-top: -.32rem;
}
@media (max-width: 575.98px) {
  .volume-control {
    grid-template-columns: auto minmax(90px, 1fr) auto auto;
  }
}


/* v1.6.1 segmented notification toggle */
.notify-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
  max-width: 760px;
}
.notify-mode-option {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 4.25rem;
  padding: .8rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .85rem;
  background: var(--bs-tertiary-bg);
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.notify-mode-option > i {
  font-size: 1.25rem;
  color: var(--bs-secondary-color);
}
.notify-mode-option span {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.notify-mode-option small {
  margin-top: .2rem;
  color: var(--bs-secondary-color);
}
.btn-check:checked + .notify-mode-option {
  border-color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), .1);
  box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .12);
}
.btn-check:checked + .notify-mode-option > i {
  color: var(--bs-primary);
}
.btn-check:focus-visible + .notify-mode-option {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}
.notify-mode-option:hover {
  transform: translateY(-1px);
}
.poll-ring {
  transition: background .1s linear;
}
@media (max-width: 575.98px) {
  .notify-mode-toggle {
    grid-template-columns: 1fr;
  }
}


/* v1.6.3: ruimte voor ANTIKREUK zonder afbreken */
.phase-step-wide {
  flex: 1.25;
  min-width: 112px;
}
.phase-step-wide span {
  white-space: nowrap;
}
@media (max-width: 575.98px) {
  .phase-step-wide {
    width: 100%;
    min-width: 0;
  }
  .phase-step-wide span {
    white-space: normal;
  }
}


/* iOS / PWA improvements */
.main-safe-area {
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}
.footer-safe-area {
  padding-bottom: max(.75rem, env(safe-area-inset-bottom));
}

/* Smooth momentum scrolling for tables on iOS */
.table-responsive {
  -webkit-overflow-scrolling: touch;
}

/* Tap highlight removal for interactive elements */
.btn, .nav-link, .dropdown-item, .navbar-toggler {
  -webkit-tap-highlight-color: transparent;
}

/* Ensure all buttons have a minimum 44px touch target (Apple HIG) */
.btn {
  min-height: 2.75rem;
}
.btn-sm {
  min-height: 2rem;
}

/* Mobile cycle cards — shown on small screens instead of tables */
.cycle-card-mobile {
  background: var(--bs-card-bg, #fff);
  border: 1px solid var(--bs-border-color);
  border-radius: .85rem;
  padding: .9rem 1rem;
}
.cycle-card-mobile + .cycle-card-mobile {
  margin-top: .5rem;
}
.cycle-card-mobile .cycle-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .9rem;
  font-size: .82rem;
  color: var(--bs-secondary-color);
  margin-top: .45rem;
}
.cycle-card-mobile .cycle-meta span {
  display: flex;
  align-items: center;
  gap: .25rem;
}
[data-bs-theme="dark"] .cycle-card-mobile {
  background: #171a21;
  border-color: #303640;
}

/* Fix input zoom on iOS: inputs must be >= 16px */
@supports (-webkit-touch-callout: none) {
  input, select, textarea {
    font-size: max(1rem, 16px) !important;
  }
}
