/*
  Intruder-Watch – App Theme Foundation
  Increment 0: light/dark tokens, global component theming and header toggle.
*/

:root,
html[data-theme="light"]{
  --iw-sidebar-width: 220px;
  --iw-bg:#F6F7FB;
  --iw-panel:#FFFFFF;
  --iw-card:#FFFFFF;
  --iw-card-2:#F3F5FA;
  --iw-text:#1B2231;
  --iw-muted:#515B6C;
  --iw-muted-2:#778193;
  --iw-border:rgba(16,24,40,0.10);
  --iw-border-2:rgba(16,24,40,0.14);
  --iw-radius:14px;

  --iw-shadow-sm: 0 1px 2px rgba(16,24,40,0.06), 0 6px 18px rgba(16,24,40,0.06);
  --iw-focus: 0 0 0 .25rem rgba(33,86,214,0.18);

  --iw-link:#2156D6;
  --iw-link-hover:#163FA8;
  --iw-surface-hover:rgba(16,24,40,0.04);
  --iw-surface-hover-2:rgba(16,24,40,0.06);
  --iw-nav-active-bg:rgba(33,86,214,0.10);
  --iw-nav-active-border:rgba(33,86,214,0.22);
  --iw-input-bg:rgba(16,24,40,0.04);
  --iw-input-bg-focus:rgba(16,24,40,0.07);
  --iw-placeholder:rgba(27,34,49,0.42);
  --iw-page-link-bg:rgba(16,24,40,0.04);
  --iw-page-link-active-bg:rgba(79,127,184,0.35);
  --iw-page-link-active-border:rgba(79,127,184,0.45);
  --iw-table-head-bg:rgba(16,24,40,0.03);
  --iw-backdrop:rgba(10,14,24,0.55);
  --iw-theme-toggle-bg:rgba(16,24,40,0.04);
  --iw-theme-toggle-border:rgba(16,24,40,0.10);
  --iw-theme-toggle-hover:rgba(16,24,40,0.08);
  --iw-info-accent:linear-gradient(135deg, rgba(79,127,184,.15), rgba(90,162,125,.10));
}

html[data-theme="dark"]{
  --iw-sidebar-width: 220px;
  --iw-bg:#000000;
  --iw-panel:#0A0F16;
  --iw-card:#101722;
  --iw-card-2:#0C131D;
  --iw-text:#ECF2FF;
  --iw-muted:#C3CEE0;
  --iw-muted-2:#93A0B7;
  --iw-border:rgba(236,242,255,0.10);
  --iw-border-2:rgba(236,242,255,0.18);
  --iw-radius:14px;

  --iw-shadow-sm: 0 1px 2px rgba(0,0,0,0.45), 0 12px 28px rgba(0,0,0,0.32);
  --iw-focus: 0 0 0 .25rem rgba(117,167,255,0.22);

  --iw-link:#8FB6FF;
  --iw-link-hover:#BED3FF;
  --iw-surface-hover:rgba(236,242,255,0.05);
  --iw-surface-hover-2:rgba(236,242,255,0.08);
  --iw-nav-active-bg:rgba(117,167,255,0.16);
  --iw-nav-active-border:rgba(117,167,255,0.26);
  --iw-input-bg:rgba(236,242,255,0.05);
  --iw-input-bg-focus:rgba(236,242,255,0.08);
  --iw-placeholder:rgba(236,242,255,0.46);
  --iw-page-link-bg:rgba(236,242,255,0.05);
  --iw-page-link-active-bg:rgba(117,167,255,0.28);
  --iw-page-link-active-border:rgba(117,167,255,0.35);
  --iw-table-head-bg:rgba(236,242,255,0.04);
  --iw-backdrop:rgba(0,0,0,0.72);
  --iw-theme-toggle-bg:rgba(236,242,255,0.05);
  --iw-theme-toggle-border:rgba(236,242,255,0.14);
  --iw-theme-toggle-hover:rgba(236,242,255,0.10);
  --iw-info-accent:linear-gradient(135deg, rgba(117,167,255,.18), rgba(90,162,125,.12));
}

html{ height:100%; color-scheme: light; }
html[data-theme="dark"]{ color-scheme: dark; }
body{ min-height:100%; }
html, body{ height:100%; }
body.iw-app{
  background: var(--iw-bg);
  color: var(--iw-text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  font-size: 15.5px;
  line-height: 1.45;
}

@media (min-width: 992px){
  body.iw-app{ font-size: 15.75px; }
}

a{ color:var(--iw-link); }
a:hover{ color:var(--iw-link-hover); }

.iw-shell{ min-height: 100vh; display:flex; }
.iw-sidebar{
  width: var(--iw-sidebar-width);
  background: linear-gradient(180deg, var(--iw-panel), var(--iw-card-2));
  border-right: 1px solid var(--iw-border);
  padding: 14px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.iw-brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 8px 10px 8px 10px;
  border-bottom: none;
  margin-bottom: 6px;
}
.iw-brand img{ height: 34px; width:auto; display:block; }
.iw-brand .iw-brand-title{ font-weight: 650; letter-spacing: .2px; font-size: 0.98rem; }
.iw-brand .iw-brand-sub{ font-size:.82rem; color: var(--iw-muted-2); margin-top:2px; }

.iw-nav{ display:flex; flex-direction:column; gap:4px; padding: 4px 4px; }
.iw-nav a,
.iw-nav-item{
  white-space: nowrap;
  display:flex;
  align-items:center;
  gap:10px;
  padding: 8px 10px;
  border-radius: 12px;
  text-decoration:none;
  color: var(--iw-muted);
  border: 1px solid transparent;
  position: relative;
}
.iw-nav a:hover,
.iw-nav-item:hover{ background: var(--iw-surface-hover); color: var(--iw-text); }

.iw-nav a.is-active,
.iw-nav-item.is-active{
  background: var(--iw-nav-active-bg);
  border-color: var(--iw-nav-active-border);
  color: var(--iw-text);
}

.iw-nav a.is-active::before,
.iw-nav-item.is-active::before{
  content:"";
  position:absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--iw-link);
  opacity: .9;
}
.iw-nav .iw-ico,
.iw-nav-item .iw-ico{
  width: 22px;
  height: 22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: var(--iw-muted);
}
.iw-nav a.is-active .iw-ico,
.iw-nav-item.is-active .iw-ico{ color: var(--iw-link); }

.iw-nav-section{ margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--iw-border); }

.iw-main{ flex:1; display:flex; flex-direction:column; min-width: 0; }


/* Mobile hamburger button (clean, bold lines, no frame) */
.iw-hamburger-btn{
  border: 0 !important;
  background: transparent !important;
  padding: 6px 10px;
  margin-top: -6px;
  line-height: 1;
  box-shadow: none !important;
}
.iw-hamburger-btn:focus{ outline: none; box-shadow: none !important; }
.iw-hamburger{
  display:inline-flex;
  flex-direction:column;
  justify-content:center;
  gap: 4px;
}
.iw-hamburger > span{
  display:block;
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--iw-text);
  opacity: 0.95;
}
/* Tap feedback without "stuck" focus look */
.iw-hamburger-btn:active .iw-hamburger > span{ opacity: 0.65; }

.iw-topbar{
  background: var(--iw-panel);
  border-bottom: 1px solid var(--iw-border);
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 1030;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}
.iw-topbar .iw-page-title{
  font-weight: 600;
  letter-spacing: .15px;
  color: var(--iw-muted);
  font-size: 1.05rem;
  opacity: .92;
}
.iw-topbar .iw-user{
  display:flex;
  align-items:center;
  gap:10px;
  color: var(--iw-muted);
  font-size: .92rem;
  flex-shrink: 0;
}
.iw-user-greeting{
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  line-height: 1.2;
}
.iw-user-greeting-label{
  margin-right: .25em;
}
.iw-user-greeting strong{
  display: inline-block;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  color: var(--iw-text);
  font-weight: 700;
}
.iw-account-menu-button{
  white-space: nowrap;
}

/* Centered, optional index.php header message (desktop only)
   Shown via markup with d-none d-lg-flex. */
.iw-topbar-center{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--iw-muted);
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw;
  pointer-events: none;
}

.iw-topbar-alert{
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  max-width: 100%;
  padding: .45rem .8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}
.iw-topbar-alert strong,
.iw-topbar-alert span{
  overflow: hidden;
  text-overflow: ellipsis;
}
.iw-topbar-alert--warn{
  background: rgba(255, 193, 7, .12);
  border-color: rgba(255, 193, 7, .26);
  color: #8a5b00;
}
.iw-topbar-alert--critical{
  background: rgba(220, 53, 69, .12);
  border-color: rgba(220, 53, 69, .24);
  color: #a61d2d;
}
html[data-theme="dark"] .iw-topbar-alert--warn{
  background: rgba(255, 193, 7, .12);
  border-color: rgba(255, 193, 7, .24);
  color: #ffd36b;
}
html[data-theme="dark"] .iw-topbar-alert--critical{
  background: rgba(220, 53, 69, .16);
  border-color: rgba(220, 53, 69, .30);
  color: #ff9eaa;
}
.iw-heart{ color:#ff4d4d; font-size:.92em; margin-left:.2rem; }

.iw-content{ padding: 18px 18px 10px 18px; }

@media (min-width: 992px){
  .iw-content{ padding: 22px 22px 14px 22px; }
  .iw-topbar .iw-page-title{ font-size: 1.26rem; }
}

footer.iw-footer{
  color: var(--iw-muted-2);
  padding: 16px 18px 18px 18px;
  font-size: .9rem;
}

/* Bootstrap overrides */
body.iw-app .card{
  background: var(--iw-card);
  border-color: var(--iw-border);
  border-radius: var(--iw-radius);
  box-shadow: var(--iw-shadow-sm);
  color: var(--iw-text);
}
body.iw-app .card-header{
  background: transparent;
  border-bottom-color: var(--iw-border);
  color: var(--iw-text);
}

body.iw-app .form-control,
body.iw-app .form-select{
  background: var(--iw-input-bg);
  border-color: var(--iw-border);
  color: var(--iw-text);
}
body.iw-app .form-control:focus,
body.iw-app .form-select:focus{
  border-color: rgba(79,127,184,0.55);
  box-shadow: var(--iw-focus);
  background: var(--iw-input-bg-focus);
  color: var(--iw-text);
}
body.iw-app .form-control::placeholder,
body.iw-app .form-select::placeholder,
body.iw-app textarea::placeholder{ color: var(--iw-placeholder); }
body.iw-app .input-group-text{
  background: var(--iw-input-bg);
  border-color: var(--iw-border);
  color: var(--iw-muted);
}

/* Tables + DataTables */
body.iw-app .table{
  color: var(--iw-text);
  --bs-table-color: var(--iw-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--iw-border);
}
body.iw-app .table thead th{
  font-size: .82rem;
  font-weight: 650;
  color: var(--iw-muted-2);
  letter-spacing: .18px;
}
body.iw-app .table> :not(caption) > * > *{
  color: var(--iw-text);
  background-color: var(--bs-table-bg);
  border-color: var(--iw-border);
}
body.iw-app .table-striped{
  --bs-table-striped-color: var(--iw-text);
  --bs-table-striped-bg: rgba(16,24,40,0.025);
}
html[data-theme="dark"] body.iw-app .table-striped{
  --bs-table-striped-color: var(--iw-text);
  --bs-table-striped-bg: rgba(236,242,255,0.03);
}
body.iw-app .table-hover{
  --bs-table-hover-color: var(--iw-text);
  --bs-table-hover-bg: rgba(16,24,40,0.05);
}
html[data-theme="dark"] body.iw-app .table-hover{
  --bs-table-hover-color: var(--iw-text);
  --bs-table-hover-bg: rgba(236,242,255,0.05);
}
body.iw-app .table-hover tbody tr:hover{ background: rgba(16,24,40,0.05); }
body.iw-app .dataTables_wrapper .dataTables_length,
body.iw-app .dataTables_wrapper .dataTables_filter,
body.iw-app .dataTables_wrapper .dataTables_info,
body.iw-app .dataTables_wrapper .dataTables_paginate{ color: var(--iw-muted) !important; }
body.iw-app .page-link{
  background: var(--iw-page-link-bg);
  border-color: var(--iw-border);
  color: var(--iw-muted);
}
body.iw-app .page-link:hover{ background: var(--iw-surface-hover); color: var(--iw-text); }
body.iw-app .page-item.active .page-link{
  background: var(--iw-page-link-active-bg);
  border-color: var(--iw-page-link-active-border);
  color: var(--iw-text);
}

/* Modals */
body.iw-app .modal-content{
  background: var(--iw-card);
  border-color: var(--iw-border);
  border-radius: 18px;
  color: var(--iw-text);
}
body.iw-app .modal-header{ border-bottom-color: var(--iw-border); }
body.iw-app .modal-footer{ border-top-color: var(--iw-border); }

/* Small screens: use offcanvas menu */
@media (max-width: 991.98px){
  .iw-sidebar{ display:none; }
  .iw-content{ padding: 14px 12px 10px 12px; }
}


/* Utility overrides often used in pages */
body.iw-app .bg-white{ background: rgba(16,24,40,0.04) !important; }
body.iw-app .shadow-sm{ box-shadow: var(--iw-shadow-sm) !important; }
body.iw-app .text-dark{ color: var(--iw-text) !important; }

/* Profiling: map cards */
body.iw-app .map-card{
  background: var(--iw-card) !important;
  border-color: var(--iw-border) !important;
  box-shadow: var(--iw-shadow-sm) !important;
}
body.iw-app .map-meta .coord{ color: var(--iw-muted-2) !important; }

/* Offcanvas close button visibility */
body.iw-app .btn-close-white{ filter: invert(1) grayscale(100%); opacity: .9; }

/* Help keep nested filter boxes calmer */
body.iw-app .border.rounded-3{
  border-color: var(--iw-border) !important;
}


/* Logbuch page overrides (existing inline styles are light; override for dark) */
body.iw-app .dt-scroll-head,
body.iw-app .dataTables_scrollHead{
  background: var(--iw-panel) !important;
  border-bottom: 1px solid var(--iw-border) !important;
}
body.iw-app .dt-scroll-head thead th,
body.iw-app .dataTables_scrollHead thead th{
  background: var(--iw-table-head-bg) !important;
  color: var(--iw-text) !important;
}

/* Desktop logbook: make the sticky column header a clear, theme-aware toolbar.
   The selectors are intentionally more specific than index.php's legacy rules
   that remove the old separator/shadow. Sorting markup and behaviour stay untouched. */
@media (min-width: 992px){
  html[data-theme="light"] body.iw-app #logTable_wrapper .dt-scroll-head,
  html[data-theme="light"] body.iw-app #logTable_wrapper .dataTables_scrollHead{
    background: #e6edf5 !important;
    border-bottom: 1px solid rgba(49,95,150,.22) !important;
    box-shadow: 0 2px 6px rgba(16,24,40,.10) !important;
  }
  html[data-theme="light"] body.iw-app #logTable_wrapper .dt-scroll-head thead th,
  html[data-theme="light"] body.iw-app #logTable_wrapper .dataTables_scrollHead thead th{
    background: #e6edf5 !important;
    color: #315f96 !important;
    border-bottom: 0 !important;
  }
  html[data-theme="light"] body.iw-app #logTable_wrapper .dt-scroll-head thead th .dt-column-title,
  html[data-theme="light"] body.iw-app #logTable_wrapper .dataTables_scrollHead thead th .dt-column-title{
    font-weight: 700 !important;
  }

  html[data-theme="dark"] body.iw-app #logTable_wrapper .dt-scroll-head,
  html[data-theme="dark"] body.iw-app #logTable_wrapper .dataTables_scrollHead{
    background: #162131 !important;
    border-bottom: 1px solid rgba(143,182,255,.24) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.42) !important;
  }
  html[data-theme="dark"] body.iw-app #logTable_wrapper .dt-scroll-head thead th,
  html[data-theme="dark"] body.iw-app #logTable_wrapper .dataTables_scrollHead thead th{
    background: #162131 !important;
    color: #ECF2FF !important;
    border-bottom: 0 !important;
  }
  html[data-theme="dark"] body.iw-app #logTable_wrapper .dt-scroll-head thead th .dt-column-title,
  html[data-theme="dark"] body.iw-app #logTable_wrapper .dataTables_scrollHead thead th .dt-column-title{
    font-weight: 700 !important;
  }
}

body.iw-app .ac-menu{
  background: var(--iw-card) !important;
  border-color: var(--iw-border) !important;
  box-shadow: var(--iw-shadow-sm) !important;
}
body.iw-app .ac-menu .list-group-item{ color: var(--iw-text) !important; }
body.iw-app .ac-menu .list-group-item:hover,
body.iw-app .ac-menu .list-group-item.active{ background: rgba(79,127,184,0.18) !important; }

body.iw-app #entryModal .modal-content{
  background: var(--iw-card) !important;
  border-color: var(--iw-border) !important;
}
body.iw-app #entryModal .modal-title,
body.iw-app #entryModal .form-label{ color: var(--iw-text) !important; }
body.iw-app #entryModal .form-control,
body.iw-app #entryModal .form-select{
  background: var(--iw-surface-hover) !important;
  border-color: var(--iw-border) !important;
  color: var(--iw-text) !important;
}
body.iw-app #entryModal .form-control:focus,
body.iw-app #entryModal .form-select:focus{
  border-color: rgba(79,127,184,0.55) !important;
  box-shadow: var(--iw-focus) !important;
}

body.iw-app #entryModal .iw-static-field{
  min-height: calc(1.5em + .75rem + 2px);
  padding: .375rem 0;
  color: var(--iw-text) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
}
body.iw-app #entryModal .iw-static-field:empty::before{
  content: "–";
  color: var(--iw-muted-2);
}

body.iw-app .hscroll-top{
  background: var(--iw-table-head-bg) !important;
  border-bottom: 1px solid var(--iw-border) !important;
}

.offcanvas.iw-nav-offcanvas{ width: var(--iw-sidebar-width); }

/* Gemeinsame Handy-/Tablet-Navigation: nicht die gesamte Seite verdecken.
   Ausschließlich das Hamburger-Menü #iwNav, keine Meldungs-/Logbuch-Details. */
@media (max-width: 991.98px){
  #iwNav.offcanvas{
    --bs-offcanvas-width: min(288px, calc(100vw - 56px));
  }
  #iwNav .iw-nav-item{
    min-height: 48px;
    padding: 10px 12px;
    gap: 12px;
    font-size: 17px;
    line-height: 1.35;
  }
  #iwNav .iw-nav-item .iw-ico{
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
  }
  #iwNav .iw-nav-item .iw-ico svg{
    width: 24px;
    height: 24px;
  }
}

input[type=range]{accent-color:var(--bs-primary);}
input[type=range]::-webkit-slider-thumb{background:var(--bs-primary);}
input[type=range]::-moz-range-thumb{background:var(--bs-primary);}


/* ---- Logbuch: Audio/Video Player – Primary-Akzent wie Play-Button ---- */
/* Standard */
audio, video { accent-color: var(--bs-primary) !important; }

/* WebKit (Chrome/Safari): versuche Volume/Timestamp an Primary zu koppeln */
audio::-webkit-media-controls-timeline,
audio::-webkit-media-controls-volume-slider,
audio::-webkit-media-controls-volume-slider-container,
video::-webkit-media-controls-timeline,
video::-webkit-media-controls-volume-slider,
video::-webkit-media-controls-volume-slider-container {
  accent-color: var(--bs-primary) !important;
}

/* Fallback: Slider-Hintergründe (wird je nach Browser unterschiedlich akzeptiert) */
audio::-webkit-media-controls-volume-slider,
video::-webkit-media-controls-volume-slider {
  background-color: var(--bs-primary) !important;
}


/* --- Logbuch: Icon-Spalte maximal kompakt (Admin-Minimum ggf. 40) --- */
th.iw-icons-col, td.iw-icons-col{
  width: 40px !important;
  max-width: 40px !important;
  min-width: 40px !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.iw-icons-wrap{
  width: 40px !important;
  min-width: 40px !important;
  justify-content: flex-start !important;
  gap: 6px !important;
}
/* direkt folgende Spalte (z.B. Frequenz) näher heranholen */
th.iw-icons-col + th,
td.iw-icons-col + td{
  padding-left: 6px !important;
}
/* Subtle chips (like analyse.php) */
.iw-chip{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  padding:.15rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid rgba(0,0,0,.08);
  line-height: 1.2;
  white-space: nowrap;
}
.iw-chip--primary{ background: rgba(13,110,253,.12); color: #0a58ca; }
.iw-chip--success{ background: rgba(25,135,84,.12); color: #146c43; }
.iw-chip--warning{ background: rgba(255,193,7,.14); color: #8a6d00; }
.iw-chip--danger{ background: rgba(220,53,69,.12); color: #b02a37; }
.iw-chip--secondary{ background: rgba(108,117,125,.16); color: #495057; }
.iw-chip--light{ background: rgba(108,117,125,.10); color: rgba(0,0,0,.65); }
html[data-theme="dark"] .iw-chip--primary{ background: rgba(117,167,255,.18); color: #d6e6ff; border-color: rgba(117,167,255,.28); }
html[data-theme="dark"] .iw-chip--success{ background: rgba(25,135,84,.18); color: #b6f0cf; border-color: rgba(25,135,84,.28); }
html[data-theme="dark"] .iw-chip--warning{ background: rgba(255,193,7,.18); color: #ffe7a3; border-color: rgba(255,193,7,.28); }
html[data-theme="dark"] .iw-chip--danger{ background: rgba(220,53,69,.18); color: #ffb7bf; border-color: rgba(220,53,69,.28); }
html[data-theme="dark"] .iw-chip--secondary{ background: rgba(148,163,184,.18); color: #d9e2f2; border-color: rgba(148,163,184,.28); }
html[data-theme="dark"] .iw-chip--light{ background: rgba(236,242,255,.08); color: #d9e2f2; border-color: rgba(236,242,255,.16); }


body.iw-app .btn-light,
body.iw-app .btn-outline-light{
  background: var(--iw-card-2);
  border-color: var(--iw-border);
  color: var(--iw-text);
}
body.iw-app .btn-light:hover,
body.iw-app .btn-outline-light:hover{
  background: var(--iw-surface-hover-2);
  border-color: var(--iw-border-2);
  color: var(--iw-text);
}
body.iw-app .btn-outline-dark{
  color: var(--iw-text);
  border-color: var(--iw-border-2);
}
body.iw-app .btn-outline-dark:hover,
body.iw-app .btn-outline-dark:focus,
body.iw-app .btn-outline-dark:active{
  background: var(--iw-surface-hover-2);
  border-color: var(--iw-border-2);
  color: var(--iw-text);
}
body.iw-app .btn-outline-secondary{
  color: var(--iw-muted);
  border-color: var(--iw-border-2);
}
body.iw-app .btn-outline-secondary:hover,
body.iw-app .btn-outline-secondary:focus,
body.iw-app .btn-outline-secondary:active{
  background: var(--iw-surface-hover-2);
  border-color: var(--iw-border-2);
  color: var(--iw-text);
}
body.iw-app .form-control:disabled,
body.iw-app .form-control[readonly],
body.iw-app .form-select:disabled{
  background: var(--iw-card-2);
  border-color: var(--iw-border);
  color: var(--iw-text);
  opacity: 1;
}
body.iw-app .table-striped > tbody > tr:nth-of-type(odd) > *{
  --bs-table-accent-bg: rgba(16,24,40,0.025);
  color: var(--iw-text);
}
html[data-theme="dark"] body.iw-app .table-striped > tbody > tr:nth-of-type(odd) > *{
  --bs-table-accent-bg: rgba(236,242,255,0.03);
}
body.iw-app .nav-tabs{
  border-bottom-color: var(--iw-border);
}
body.iw-app .nav-tabs .nav-link{
  color: var(--iw-muted);
  border-color: transparent;
}
body.iw-app .nav-tabs .nav-link:hover,
body.iw-app .nav-tabs .nav-link:focus{
  color: var(--iw-text);
  border-color: transparent;
  background: var(--iw-surface-hover);
}
body.iw-app .nav-tabs .nav-link.active{
  color: var(--iw-text);
  background: var(--iw-card);
  border-color: var(--iw-border) var(--iw-border) var(--iw-card);
}
body.iw-app .bg-light,
body.iw-app .bg-light-subtle,
body.iw-app .bg-white,
body.iw-app .bg-body,
body.iw-app .bg-body-secondary,
body.iw-app .bg-body-tertiary,
body.iw-app .table-light,
body.iw-app .text-bg-light,
body.iw-app .alert-light,
body.iw-app .alert-secondary{
  color: var(--iw-text) !important;
  border-color: var(--iw-border) !important;
}
body.iw-app .bg-light,
body.iw-app .bg-light-subtle,
body.iw-app .bg-white,
body.iw-app .bg-body,
body.iw-app .bg-body-secondary,
body.iw-app .bg-body-tertiary,
body.iw-app .alert-light,
body.iw-app .alert-secondary,
body.iw-app .text-bg-light{
  background: var(--iw-card-2) !important;
}
body.iw-app .table-light{
  --bs-table-bg: var(--iw-card-2);
  --bs-table-color: var(--iw-text);
  --bs-table-border-color: var(--iw-border);
}
body.iw-app .dropdown-menu,
body.iw-app .dropdown-menu-dark,
body.iw-app .popover,
body.iw-app .tooltip-inner{
  background: var(--iw-card);
  color: var(--iw-text);
  border-color: var(--iw-border);
}
body.iw-app .dropdown-item,
body.iw-app .dropdown-header,
body.iw-app .dropdown-divider,
body.iw-app .list-group-item,
body.iw-app .text-muted,
body.iw-app .text-secondary,
body.iw-app .form-text{
  color: var(--iw-muted) !important;
}
body.iw-app .dropdown-item:hover,
body.iw-app .dropdown-item:focus,
body.iw-app .list-group-item-action:hover,
body.iw-app .list-group-item-action:focus{
  background: var(--iw-surface-hover) !important;
  color: var(--iw-text) !important;
}
body.iw-app .list-group-item{
  background: transparent;
  border-color: var(--iw-border);
}
body.iw-app .border,
body.iw-app .border-top,
body.iw-app .border-end,
body.iw-app .border-bottom,
body.iw-app .border-start{
  border-color: var(--iw-border) !important;
}
body.iw-app .offcanvas-backdrop.show,
body.iw-app .modal-backdrop.show{
  background: var(--iw-backdrop);
  opacity: 1;
}
html[data-theme="dark"] body.iw-app .btn-close,
html[data-theme="dark"] body.iw-app .btn-close-white{
  filter: invert(1) grayscale(100%);
  opacity: .9;
}

.iw-theme-toggle{
  display:inline-flex;
  align-items:center;
  gap:.45rem;
  min-height: 34px;
  padding: .35rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--iw-theme-toggle-border);
  background: var(--iw-theme-toggle-bg);
  color: var(--iw-text);
  box-shadow: none;
}
.iw-theme-toggle:hover,
.iw-theme-toggle:focus,
.iw-theme-toggle:active{
  background: var(--iw-theme-toggle-hover) !important;
  border-color: var(--iw-theme-toggle-border) !important;
  color: var(--iw-text) !important;
}
.iw-theme-toggle .iw-theme-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 18px;
  height: 18px;
}
.iw-theme-toggle .iw-theme-icon--moon,
html[data-theme="dark"] .iw-theme-toggle .iw-theme-icon--sun{ display:none; }
html[data-theme="dark"] .iw-theme-toggle .iw-theme-icon--moon{ display:inline-flex; }
.iw-theme-toggle-label{
  font-weight: 600;
  line-height: 1;
}

.iw-theme-floating{
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2100;
}

html[data-theme="dark"] body.iw-app .card{
  background: var(--iw-card);
  color: var(--iw-text);
}
html[data-theme="dark"] body.iw-app .accordion-item,
html[data-theme="dark"] body.iw-app .accordion-button{
  background: var(--iw-card);
  color: var(--iw-text);
  border-color: var(--iw-border);
}
html[data-theme="dark"] body.iw-app .accordion-button:not(.collapsed){
  background: color-mix(in srgb, var(--iw-card) 82%, var(--iw-accent) 18%);
  color: var(--iw-text);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.04);
}
html[data-theme="dark"] body.iw-app .accordion-button::after{
  filter: invert(1) grayscale(100%);
}
html[data-theme="dark"] body.iw-app .list-group-item{
  background: var(--iw-panel);
  color: var(--iw-text);
  border-color: var(--iw-border);
}
html[data-theme="dark"] body.iw-app .badge.bg-warning{
  color: #1f2329 !important;
}
html[data-theme="dark"] body.iw-app pre.bg-light,
html[data-theme="dark"] body.iw-app pre.bg-light-subtle{
  background: var(--iw-panel-soft) !important;
  color: var(--iw-text) !important;
}

.iw-admin-info-modal__content{
  border-radius: 16px;
  overflow: hidden;
}
.iw-admin-info-modal__header{
  background: var(--iw-info-accent);
}
.iw-admin-info-modal__eyebrow{ letter-spacing: .06em; }
.iw-admin-info-modal__title{ font-weight: 800; }
.iw-admin-info-modal__body{
  font-size: 1.02rem;
  line-height: 1.5;
}

#backToTop.iw-backtotop{
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 38px;
  padding-inline: .75rem;
  z-index: 1040;
}

/* Global navigation must never cover modal actions. */
body.modal-open #backToTop.iw-backtotop{
  display:none !important;
}

/* Mobile logbook: keep the labelled control reachable even while lazy loading
   keeps extending the document. It is hidden for every modal and the page gets
   extra bottom clearance while the control is visible. */
@media (max-width: 575.98px){
  #backToTop.iw-backtotop{
    position: static;
    width: calc(100% - 2rem);
    max-width: 22rem;
    min-height: 48px;
    margin: 1rem auto 0;
    padding: .65rem 1rem;
    border-radius: .65rem;
    font-size: 1rem;
    line-height: 1.2;
    z-index: auto;
  }
  body.iw-logbook-page #backToTop.iw-backtotop{
    position: fixed;
    right: .75rem;
    bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
    width: auto;
    min-width: 9.75rem;
    max-width: calc(100% - 1.5rem);
    margin: 0;
    padding: .68rem 1rem;
    z-index: 1025;
    box-shadow: 0 8px 24px rgba(15,23,42,.22);
  }
  body.iw-logbook-page.iw-backtotop-visible .iw-content{
    padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 575.98px){
  .iw-topbar .iw-user{
    gap: .4rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
    font-size: .82rem;
  }
  .iw-user-greeting strong{
    max-width: 7rem;
    font-weight: 700;
  }
  .iw-theme-toggle{ padding-inline: .6rem; }
  .iw-theme-toggle-label{ display:none; }
}
