:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-rgb: 248, 250, 252;
  --panel: #ffffff;
  --panel-rgb: 255, 255, 255;
  --panel-2: #f1f5f9;
  --panel-2-rgb: 241, 245, 249;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-rgb: 15, 23, 42;
  --text-strong: #0b1224;
  --muted: #475569;
  --muted-2: #334155;
  --accent: #22d3ee;
  --accent-strong: #06b6d4;
  --accent-contrast: #001018;
  --accent-text: #0284c7;
  --accent-text-strong: #0ea5e9;
  --highlight-rgb: 15, 23, 42;
  --shadow-elev-1: 0 10px 30px rgba(15,23,42,.12);
  --shadow-elev-2: 0 14px 36px rgba(15,23,42,.18);
  --admin-grid-gap: 16px;
  --admin-card-gap: 16px;
  --admin-card-min: 240px;
  --admin-card-min-compact: 220px;
  --admin-card-min-narrow: 180px;
  --admin-sidebar-end-gap: 28px;
  --btn-bg: linear-gradient(90deg, #2563eb, #3b82f6);
  --btn-bg-hover: linear-gradient(90deg, #1d4ed8, #2563eb);
  --btn-fg: #ffffff;
  --module-bg: #eff6ff;
  --module-header-bg: #dbeafe;
  --module-border: #3b82f6;
  --module-shadow: 0 18px 36px rgba(37,99,235,.18);
  --module-accent: #2563eb;
  --module-outline: rgba(37,99,235,.28);
  --dash-tile-bg: #eff6ff;
  --dash-card-bg: #dbeafe;
  --dash-pane-bg: #eff6ff;
  --dash-border: #3b82f6;
  --dash-shadow: 0 16px 30px rgba(37,99,235,.18);
  --tone-info-bg: rgba(59,130,246,.12);
  --tone-info-text: #1d4ed8;
  --tone-info-border: rgba(59,130,246,.28);
  --tone-success-bg: rgba(16,185,129,.12);
  --tone-success-text: #047857;
  --tone-success-border: rgba(16,185,129,.32);
  --tone-warning-bg: rgba(245,158,11,.13);
  --tone-warning-text: #92400e;
  --tone-warning-border: rgba(245,158,11,.34);
  --tone-danger-bg: rgba(239,68,68,.12);
  --tone-danger-text: #b91c1c;
  --tone-danger-border: rgba(239,68,68,.32);
  --status-overdue-bg: rgba(220,38,38,.14);
  --status-overdue-text: #b91c1c;
  --status-overdue-border: rgba(220,38,38,.45);
  --mahn-overdue-bg: rgba(220,38,38,.14);
  --mahn-overdue-text: #b91c1c;
  --mahn-overdue-border: rgba(220,38,38,.45);
  --mahn-stage-3-bg: rgba(220,38,38,.18);
  --mahn-stage-3-text: #b91c1c;
  --mahn-stage-3-border: rgba(220,38,38,.55);
  --mahn-stage-4-bg: rgba(185,28,28,.22);
  --mahn-stage-4-text: #991b1b;
  --mahn-stage-4-border: rgba(185,28,28,.6);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --bg-rgb: 15, 23, 42;
  --panel: #111827;
  --panel-rgb: 17, 24, 39;
  --panel-2: #0b1224;
  --panel-2-rgb: 11, 18, 36;
  --border: #1f2937;
  --border-strong: #334155;
  --text: #e5e7eb;
  --text-rgb: 229, 231, 235;
  --text-strong: #e2e8f0;
  --muted: #94a3b8;
  --muted-2: #cbd5e1;
  --accent: #22d3ee;
  --accent-strong: #06b6d4;
  --accent-contrast: #001018;
  --accent-text: #67e8f9;
  --accent-text-strong: #e0f2fe;
  --highlight-rgb: 255, 255, 255;
  --shadow-elev-1: 0 10px 30px rgba(0,0,0,.25);
  --shadow-elev-2: 0 14px 36px rgba(0,0,0,.32);
  --btn-bg: linear-gradient(90deg, #06b6d4, #22d3ee);
  --btn-bg-hover: linear-gradient(90deg, #0ea5e9, #38bdf8);
  --btn-fg: #001018;
  --module-bg: var(--panel-2);
  --module-header-bg: var(--panel);
  --module-border: var(--border);
  --module-shadow: 0 14px 30px rgba(0,0,0,.34);
  --module-accent: #22d3ee;
  --module-outline: rgba(34,211,238,.18);
  --dash-tile-bg: var(--panel-2);
  --dash-card-bg: var(--panel-2);
  --dash-pane-bg: var(--panel-2);
  --dash-border: var(--border);
  --dash-shadow: var(--shadow-elev-1);
  --tone-info-bg: rgba(59,130,246,.14);
  --tone-info-text: rgb(147 197 253);
  --tone-info-border: rgba(96,165,250,.38);
  --tone-success-bg: rgba(16,185,129,.14);
  --tone-success-text: rgb(167 243 208);
  --tone-success-border: rgba(52,211,153,.42);
  --tone-warning-bg: rgba(245,158,11,.16);
  --tone-warning-text: #fde68a;
  --tone-warning-border: rgba(251,191,36,.46);
  --tone-danger-bg: rgba(239,68,68,.14);
  --tone-danger-text: rgb(254 202 202);
  --tone-danger-border: rgba(248,113,113,.42);
  --status-overdue-bg: rgba(239,68,68,.18);
  --status-overdue-text: rgb(254 202 202);
  --status-overdue-border: rgba(248,113,113,.45);
  --mahn-overdue-bg: rgba(239,68,68,.18);
  --mahn-overdue-text: rgb(254 202 202);
  --mahn-overdue-border: rgba(248,113,113,.45);
  --mahn-stage-3-bg: rgba(239,68,68,.2);
  --mahn-stage-3-text: #fca5a5;
  --mahn-stage-3-border: rgba(239,68,68,.5);
  --mahn-stage-4-bg: rgba(185,28,28,.25);
  --mahn-stage-4-text: rgb(254 202 202);
  --mahn-stage-4-border: rgba(248,113,113,.55);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    color-scheme: light;
    --bg: #f8fafc;
    --bg-rgb: 248, 250, 252;
    --panel: #ffffff;
    --panel-rgb: 255, 255, 255;
    --panel-2: #f1f5f9;
    --panel-2-rgb: 241, 245, 249;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-rgb: 15, 23, 42;
    --text-strong: #0b1224;
    --muted: #475569;
    --muted-2: #334155;
    --accent: #22d3ee;
    --accent-strong: #06b6d4;
    --accent-contrast: #001018;
    --accent-text: #0284c7;
    --accent-text-strong: #0ea5e9;
    --highlight-rgb: 15, 23, 42;
    --shadow-elev-1: 0 10px 30px rgba(15,23,42,.12);
    --shadow-elev-2: 0 14px 36px rgba(15,23,42,.18);
    --btn-bg: linear-gradient(90deg, #2563eb, #3b82f6);
    --btn-bg-hover: linear-gradient(90deg, #1d4ed8, #2563eb);
    --btn-fg: #ffffff;
    --module-bg: #eff6ff;
    --module-header-bg: #dbeafe;
    --module-border: #3b82f6;
    --module-shadow: 0 18px 36px rgba(37,99,235,.18);
    --module-accent: #2563eb;
    --module-outline: rgba(37,99,235,.28);
    --dash-tile-bg: #eff6ff;
    --dash-card-bg: #dbeafe;
    --dash-pane-bg: #eff6ff;
    --dash-border: #3b82f6;
    --dash-shadow: 0 16px 30px rgba(37,99,235,.18);
    --tone-info-bg: rgba(59,130,246,.12);
    --tone-info-text: #1d4ed8;
    --tone-info-border: rgba(59,130,246,.28);
    --tone-success-bg: rgba(16,185,129,.12);
    --tone-success-text: #047857;
    --tone-success-border: rgba(16,185,129,.32);
    --tone-warning-bg: rgba(245,158,11,.13);
    --tone-warning-text: #92400e;
    --tone-warning-border: rgba(245,158,11,.34);
    --tone-danger-bg: rgba(239,68,68,.12);
    --tone-danger-text: #b91c1c;
    --tone-danger-border: rgba(239,68,68,.32);
    --status-overdue-bg: rgba(220,38,38,.14);
    --status-overdue-text: #b91c1c;
    --status-overdue-border: rgba(220,38,38,.45);
    --mahn-overdue-bg: rgba(220,38,38,.14);
    --mahn-overdue-text: #b91c1c;
    --mahn-overdue-border: rgba(220,38,38,.45);
    --mahn-stage-3-bg: rgba(220,38,38,.18);
    --mahn-stage-3-text: #b91c1c;
    --mahn-stage-3-border: rgba(220,38,38,.55);
    --mahn-stage-4-bg: rgba(185,28,28,.22);
    --mahn-stage-4-text: #991b1b;
    --mahn-stage-4-border: rgba(185,28,28,.6);
  }
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #0f172a;
    --bg-rgb: 15, 23, 42;
    --panel: #111827;
    --panel-rgb: 17, 24, 39;
    --panel-2: #0b1224;
    --panel-2-rgb: 11, 18, 36;
    --border: #1f2937;
    --border-strong: #334155;
    --text: #e5e7eb;
    --text-rgb: 229, 231, 235;
    --text-strong: #e2e8f0;
    --muted: #94a3b8;
    --muted-2: #cbd5e1;
    --accent: #22d3ee;
    --accent-strong: #06b6d4;
    --accent-contrast: #001018;
    --accent-text: #67e8f9;
    --accent-text-strong: #e0f2fe;
    --highlight-rgb: 255, 255, 255;
    --shadow-elev-1: 0 10px 30px rgba(0,0,0,.25);
    --shadow-elev-2: 0 14px 36px rgba(0,0,0,.32);
    --btn-bg: linear-gradient(90deg, #06b6d4, #22d3ee);
    --btn-bg-hover: linear-gradient(90deg, #0ea5e9, #38bdf8);
    --btn-fg: #001018;
    --module-bg: var(--panel-2);
    --module-header-bg: var(--panel);
    --module-border: var(--border);
    --module-shadow: 0 14px 30px rgba(0,0,0,.34);
    --module-accent: #22d3ee;
    --module-outline: rgba(34,211,238,.18);
    --dash-tile-bg: var(--panel-2);
    --dash-card-bg: var(--panel-2);
    --dash-pane-bg: var(--panel-2);
    --dash-border: var(--border);
    --dash-shadow: var(--shadow-elev-1);
    --tone-info-bg: rgba(59,130,246,.14);
    --tone-info-text: rgb(147 197 253);
    --tone-info-border: rgba(96,165,250,.38);
    --tone-success-bg: rgba(16,185,129,.14);
    --tone-success-text: rgb(167 243 208);
    --tone-success-border: rgba(52,211,153,.42);
    --tone-warning-bg: rgba(245,158,11,.16);
    --tone-warning-text: #fde68a;
    --tone-warning-border: rgba(251,191,36,.46);
    --tone-danger-bg: rgba(239,68,68,.14);
    --tone-danger-text: rgb(254 202 202);
    --tone-danger-border: rgba(248,113,113,.42);
    --status-overdue-bg: rgba(239,68,68,.18);
    --status-overdue-text: rgb(254 202 202);
    --status-overdue-border: rgba(248,113,113,.45);
    --mahn-overdue-bg: rgba(239,68,68,.18);
    --mahn-overdue-text: rgb(254 202 202);
    --mahn-overdue-border: rgba(248,113,113,.45);
    --mahn-stage-3-bg: rgba(239,68,68,.2);
    --mahn-stage-3-text: #fca5a5;
    --mahn-stage-3-border: rgba(239,68,68,.5);
    --mahn-stage-4-bg: rgba(185,28,28,.25);
    --mahn-stage-4-text: rgb(254 202 202);
    --mahn-stage-4-border: rgba(248,113,113,.55);
  }
}

:root {
  --body-bg: var(--bg);
  --body-fg: var(--text);
  --body-quiet-color: var(--muted);
  --body-medium-color: var(--text);
  --body-loud-color: var(--text-strong);
  --header-bg: var(--panel);
  --header-color: var(--text);
  --header-link-color: var(--text);
  --breadcrumbs-bg: var(--panel-2);
  --breadcrumbs-fg: var(--muted);
  --breadcrumbs-link-fg: var(--accent-text);
  --link-fg: var(--accent-text);
  --link-hover-color: var(--accent-text-strong);
  --link-selected-fg: var(--accent-text-strong);
  --border-color: var(--border);
  --hairline-color: var(--border);
  --button-bg: var(--btn-bg);
  --button-hover-bg: var(--btn-bg-hover);
  --default-button-bg: var(--btn-bg);
  --default-button-hover-bg: var(--btn-bg-hover);
  --button-fg: var(--btn-fg);
  --object-tools-bg: var(--btn-bg);
  --object-tools-hover-bg: var(--btn-bg-hover);
  --object-tools-fg: var(--btn-fg);
}

body, html { background: var(--bg); color: var(--text); }

#header {
  position: relative;
  z-index: 1000;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 10px 12px;
  flex-wrap: wrap;
  height: auto !important;
  min-height: 0;
  overflow: visible;
  background: linear-gradient(180deg, rgba(var(--highlight-rgb),.03), rgba(var(--highlight-rgb),.01));
  border-bottom: 0;
}
#header h1, #header a:link, #header a:visited { color: var(--text); }
#branding {
  flex: 0 1 auto;
  min-width: 0;
  position: relative;
  z-index: 1001;
}
#user-tools {
  order: 3;
  margin-left: 0;
  position: relative;
  z-index: 1001;
}
#site-name {
  margin: 0;
}
#site-name .planwork-admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 0;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  pointer-events: auto;
}
#site-name .planwork-admin-link:hover {
  transform: translateY(-1px);
  border-color: transparent;
}
#site-name .planwork-admin-logo {
  height: 30px;
}

.admin-nav-global {
  position: relative;
  z-index: 1001;
  order: 2;
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: 0;
}
.admin-nav-global a { color: var(--accent); text-decoration: none; }
.admin-menu-toggle {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 38px;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-strong);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
}
.admin-menu-toggle > * {
  pointer-events: none;
}
.admin-menu-toggle:hover,
.admin-menu-toggle:focus-visible {
  border-color: var(--border-strong);
  background: rgba(var(--highlight-rgb),.08);
}
.admin-menu-toggle:focus-visible {
  outline: 2px solid rgba(34,211,238,.45);
  outline-offset: 2px;
}
.admin-menu-toggle__icon {
  position: relative;
  width: 18px;
  height: 14px;
  flex: 0 0 auto;
}
.admin-menu-toggle__icon::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 6px 0 currentColor, 0 12px 0 currentColor;
}
.admin-menu-toggle__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 22px 48px rgba(0,0,0,.26);
  z-index: 1002;
}
.admin-menu-panel[hidden] {
  display: none !important;
}
.admin-menu-links {
  display: grid;
  gap: 4px;
}
.admin-menu-links a {
  display: flex;
  align-items: center;
  min-height: 40px;
  max-width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-strong) !important;
  font-weight: 800;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-menu-links a:hover,
.admin-menu-links a:focus-visible {
  background: rgba(var(--highlight-rgb),.08);
  color: var(--accent-text-strong) !important;
}
.admin-nav-global.is-open .admin-menu-toggle {
  border-color: rgba(34,211,238,.55);
  background: rgba(34,211,238,.12);
}
.admin-header-alerts {
  order: 20;
  flex: 1 0 100%;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.admin-header-alerts--demo {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 2147483647;
  display: flex;
  justify-content: flex-start;
  flex: 0 0 auto;
  width: min(390px, calc(100vw - 36px));
  padding: 0;
  pointer-events: none;
}
.admin-header-alerts .messagelist {
  margin: 0;
}

/* Admin notices */
ul.messagelist,
div.messagelist {
  display: grid !important;
  gap: 10px !important;
  width: min(780px, calc(100vw - 40px));
  max-width: 100%;
  margin: 14px clamp(16px, 3vw, 36px) 6px auto !important;
  padding: 0 !important;
  list-style: none !important;
  box-sizing: border-box;
}
.admin-header-alerts .messagelist {
  width: min(980px, 100%);
  margin: 0 auto !important;
}
ul.messagelist li,
div.messagelist > div {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 42px;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 11px 14px 11px 42px !important;
  border: 1px solid var(--tone-info-border) !important;
  border-radius: 14px !important;
  background: linear-gradient(180deg, rgba(var(--highlight-rgb), .035), rgba(var(--highlight-rgb), 0)), var(--tone-info-bg) !important;
  background-image: none !important;
  color: var(--tone-info-text) !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .10);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
  transition:
    opacity .24s ease,
    transform .24s ease,
    margin .24s ease,
    padding .24s ease,
    min-height .24s ease,
    max-height .24s ease;
}
ul.messagelist li.is-dismissing {
  max-height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-width: 0 !important;
  opacity: 0;
  transform: translateY(-6px);
  overflow: hidden;
}
ul.messagelist li::before,
div.messagelist > div::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 16px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(var(--highlight-rgb), .08);
}
ul.messagelist li.success,
div.messagelist > div.success {
  border-color: var(--tone-success-border) !important;
  background: linear-gradient(180deg, rgba(var(--highlight-rgb), .035), rgba(var(--highlight-rgb), 0)), var(--tone-success-bg) !important;
  color: var(--tone-success-text) !important;
}
ul.messagelist li.warning,
div.messagelist > div.warning {
  border-color: var(--tone-warning-border) !important;
  background: linear-gradient(180deg, rgba(var(--highlight-rgb), .035), rgba(var(--highlight-rgb), 0)), var(--tone-warning-bg) !important;
  color: var(--tone-warning-text) !important;
}
ul.messagelist li.error,
div.messagelist > div.error {
  border-color: var(--tone-danger-border) !important;
  background: linear-gradient(180deg, rgba(var(--highlight-rgb), .035), rgba(var(--highlight-rgb), 0)), var(--tone-danger-bg) !important;
  color: var(--tone-danger-text) !important;
}
ul.messagelist a,
div.messagelist a {
  color: inherit !important;
  font-weight: 850;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
@media (max-width: 720px) {
  ul.messagelist,
  div.messagelist {
    width: auto;
    margin: 10px 12px 4px !important;
  }
  ul.messagelist li,
  div.messagelist > div {
    padding: 10px 12px 10px 36px !important;
    border-radius: 12px !important;
    font-size: 13px;
  }
  ul.messagelist li::before,
  div.messagelist > div::before {
    left: 15px;
    top: 15px;
  }
}
.schema-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
.schema-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}
.schema-pill--public {
  color: #166534;
  background: rgba(34, 197, 94, .14);
  border-color: rgba(34, 197, 94, .35);
}
.schema-pill--demo {
  color: #9a3412;
  background: rgba(251, 146, 60, .2);
  border-color: rgba(251, 146, 60, .4);
}
.schema-switch-btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.schema-switch-btn:hover {
  border-color: var(--border-strong);
}
.lang-switcher { display: inline-flex; align-items: center; }
.profile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  width: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  flex: 0 0 auto;
}
.profile-link:hover {
  border-color: var(--border-strong);
  color: var(--text-strong);
}
.profile-link svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}
.lang-switcher select {
  padding: 6px 24px 6px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
.theme-switcher .theme-option {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.theme-switcher .theme-option.active {
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
}
.theme-switcher .theme-option:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--text-rgb), .25);
}

div.breadcrumbs { background: var(--panel-2); border-bottom: 1px solid var(--border); color: var(--muted); }

.module, .app-{{ app_label }} {
  background: linear-gradient(180deg, rgba(var(--highlight-rgb),.04), rgba(var(--highlight-rgb),0)), var(--module-bg);
  border: 2px solid var(--module-border);
  border-top: 3px solid var(--module-accent);
  border-radius: 12px;
  box-shadow: 0 0 0 2px var(--module-outline), var(--module-shadow);
  color: var(--text);
  overflow: hidden;
}
.module caption, .module h2 {
  background: var(--module-header-bg);
  color: var(--text-strong);
  border-bottom: 1px solid var(--module-border);
}
.module caption a.section,
.module caption a.section:visited,
.module h2 a {
  color: var(--text-strong);
}
.module caption a.section:hover,
.module h2 a:hover {
  color: var(--accent-text-strong);
}
.module table { background: transparent; }
.module th, .module td {
  color: var(--text);
  background: transparent;
}
.module th a, .module td a {
  color: var(--accent-text);
}
.module th a:hover, .module td a:hover {
  color: var(--accent-text-strong);
}

/* Dashboard */
.dashboard { display: grid; gap: 16px; }
.nav-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--admin-card-min-compact)), 1fr));
  gap: var(--admin-card-gap);
  align-items: stretch;
}
.tile {
  display: grid;
  align-content: start;
  gap: 6px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-elev-1);
  transition: transform .08s ease, border-color .2s;
}
.tile:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.tile-icon { font-size: 22px; }
.tile-title { font-weight: 700; overflow-wrap: anywhere; }
.tile-sub { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow-elev-1); }
.card-title { color: var(--muted); font-size: 12px; letter-spacing: .02em; margin-bottom: 6px; text-transform: uppercase; }
.card-value { font-size: 28px; font-weight: 700; }

#adminOverviewDashboard.dashboard {
  padding: 30px 0 34px;
  gap: 36px;
}

.dashboard-section {
  display: grid;
  gap: 18px;
  padding: 0 0 36px;
}

.dashboard-section:last-child {
  padding-bottom: 0;
}

.dashboard-section__title {
  margin: 0;
  color: var(--text-strong);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
}

#content #adminOverviewDashboard .dashboard-section__grid.nav-tiles,
#content #adminOverviewDashboard .dashboard-section__grid.cards {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 290px)) !important;
  justify-content: start;
  margin: 0 !important;
  gap: 44px !important;
}

#adminOverviewDashboard .tile {
  min-height: 78px;
  padding: 12px 16px;
  border-color: var(--dash-border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(var(--highlight-rgb), .04), rgba(var(--highlight-rgb), 0)), var(--dash-tile-bg);
  box-shadow: var(--dash-shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

#adminOverviewDashboard .tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elev-2);
  border-color: var(--border-strong);
}

#adminOverviewDashboard .tile-icon {
  color: var(--accent-text);
  font-size: 17px;
  line-height: 1;
}

#adminOverviewDashboard .tile-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

#adminOverviewDashboard .tile-sub {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

#adminOverviewDashboard .card {
  padding: 12px 14px;
  border-color: var(--dash-border);
  background: linear-gradient(180deg, rgba(var(--highlight-rgb), .03), rgba(var(--highlight-rgb), 0)), var(--dash-card-bg);
  box-shadow: var(--dash-shadow);
}

.panes { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pane { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.pane-title { color: var(--muted); font-size: 12px; text-transform: uppercase; margin-bottom: 8px; }

#content .dashboard,
#content .module-shell,
#content .csp-shell,
#content .acc-wrap,
#content .bmd-shell,
#content .ma-wrap,
#content .mitl-page,
#content .pay-shell,
#content .pe-shell,
#content .pi-shell,
#content .az-wrap {
  min-width: 0;
  max-width: 100%;
}

#content .cards,
#content .panes,
#content .module-flow,
#content .scenario-grid,
#content .signal-grid,
#content .csp-quick-grid,
#content .csp-kpi-grid,
#content .csp-modules,
#content .bmd-grid,
#content .bmd-kpis,
#content .pay-grid,
#content .pay-stats,
#content .rech-cards,
#content .rech-export-grid,
#content .az-stats,
#content .az-export-grid,
#content .ma-card-grid,
#content .acc-cards {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--admin-card-min)), 1fr)) !important;
  gap: var(--admin-card-gap) !important;
  align-items: stretch;
}

#content .nav-tiles {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 290px)) !important;
  justify-content: start !important;
  gap: clamp(22px, 2.4vw, 44px) !important;
  align-items: stretch;
}

#content .nav-tiles > .tile {
  min-height: 78px !important;
  padding: 12px 16px !important;
  border: 1px solid var(--dash-border) !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, rgba(var(--highlight-rgb), .04), rgba(var(--highlight-rgb), 0)), var(--dash-tile-bg) !important;
  box-shadow: var(--dash-shadow) !important;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease !important;
}

#content .nav-tiles > .tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elev-2) !important;
  border-color: var(--border-strong) !important;
}

#content .nav-tiles > .tile .tile-icon {
  color: var(--accent-text);
  font-size: 17px;
  line-height: 1;
}

#content .nav-tiles > .tile .tile-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

#content .nav-tiles > .tile .tile-sub {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

#content .tile,
#content .card,
#content .pane,
#content .module-card,
#content .cluster,
#content .action-cluster,
#content .module-flow-step,
#content .scenario,
#content .signal,
#content .csp-block,
#content .csp-step,
#content .csp-module,
#content .bmd-panel,
#content .pay-panel,
#content .pay-stat,
#content .az-stat,
#content .acc-card {
  min-width: 0 !important;
  max-width: 100%;
}

#content .tile {
  width: 100%;
  align-content: start;
}

#content .tile-title,
#content .tile-sub,
#content .module-card,
#content .cluster,
#content .action-cluster,
#content .module-flow-step,
#content .scenario,
#content .signal,
#content .csp-block,
#content .csp-step,
#content .csp-module,
#content .card,
#content .pane {
  overflow-wrap: anywhere;
}

/* Optional sticky pane for preview */
.pane.sticky { position: sticky; top: 10px; height: fit-content; }
.tags { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tags li { display: flex; justify-content: space-between; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; }
.tag { color: var(--text); font-size: 12px; }
.tag-count { color: var(--accent); font-weight: 700; }

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.list li { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px; }
.row-top { display: flex; gap: 10px; justify-content: space-between; color: var(--muted); font-size: 12px; }
.row-main { display: flex; gap: 10px; align-items: center; }
.row-main .text { color: var(--text); font-size: 13px; }

.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.app { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.app-title { font-weight: 700; margin-bottom: 8px; }
.models { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.models li { display: flex; justify-content: space-between; }
.models a { color: var(--text); text-decoration: none; }
.models a.add { color: var(--accent); }

/* Tables / forms */
table { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
thead th { background: var(--panel-2); color: var(--muted); }
tbody tr { transition: background .08s ease, transform .06s ease; }
tbody tr:hover { background: rgba(var(--highlight-rgb),.03); }
tr:nth-child(odd) { background: rgba(var(--highlight-rgb),.01); }
.object-tools { margin-bottom: 10px; }
.object-tools a { background: var(--btn-bg); color: var(--btn-fg) !important; border: none; border-radius: 10px; padding: 8px 12px; font-weight: 700; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.object-tools a:hover { background: var(--btn-bg-hover); }
/* User admin change submenu */
body.app-auth.model-user.change-form .user-change-subnav {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(var(--highlight-rgb), .04), rgba(var(--highlight-rgb), 0)), var(--panel-2);
  box-shadow: var(--shadow-elev-1);
}
body.app-auth.model-user.change-form .user-change-subnav__group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
body.app-auth.model-user.change-form .user-change-subnav__label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 6px;
}
body.app-auth.model-user.change-form .user-change-subnav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  transition: transform .08s ease, border-color .12s ease, background .12s ease;
}
body.app-auth.model-user.change-form .user-change-subnav__link:hover {
  border-color: var(--border-strong);
  background: var(--panel);
  transform: translateY(-1px);
}
body.app-auth.model-user.change-form .user-change-subnav__link.is-active {
  border-color: transparent;
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: 0 10px 24px rgba(0,0,0,.24);
}
body.app-auth.model-user.change-form .user-change-subnav__link--danger {
  color: #b91c1c;
  border-color: rgba(220, 38, 38, .35);
  background: rgba(220, 38, 38, .06);
}
body.app-auth.model-user.change-form .user-change-subnav__link--danger:hover {
  border-color: rgba(220, 38, 38, .5);
  background: rgba(220, 38, 38, .12);
}
@media (max-width: 780px) {
  body.app-auth.model-user.change-form .user-change-subnav {
    padding: 10px;
    border-radius: 12px;
  }
  body.app-auth.model-user.change-form .user-change-subnav__group {
    align-items: flex-start;
  }
  body.app-auth.model-user.change-form .user-change-subnav__label {
    width: 100%;
    margin: 0 0 2px;
  }
}
.button, input[type=submit], .submit-row input { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.button.default, .submit-row input.default { background: var(--btn-bg); color: var(--btn-fg); border: none; }
.button.default:hover, .submit-row input.default:hover { background: var(--btn-bg-hover); }
.submit-row { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.aligned label { color: var(--muted); }
input, select, textarea { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px !important; }
select { padding: 8px; }
input[type="text"], input[type="number"], input[type="email"], input[type="password"] { padding: 10px 12px; }
.breadcrumbs { display:none; }
.paginator { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; }
.actions { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; }
.searchbar, #changelist-search { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px; }
.searchbar input, #changelist-search input { padding: 8px 10px; border-radius: 8px; }
/* Focus ring + accent */
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--border-strong); box-shadow: 0 0 0 2px rgba(34,211,238,.25); }
#planer-form input[type=radio], #planer-form input[type=checkbox] { accent-color: var(--accent); }

/* Rechnung list table polish */
body.app-planung.model-rechnung.change-list .results{
  border:1px solid var(--border);
  border-radius:16px;
  background:linear-gradient(180deg, rgba(var(--highlight-rgb),.02), rgba(var(--highlight-rgb),0));
  box-shadow:0 12px 30px rgba(0,0,0,.25);
  overflow:hidden;
}
body.app-planung.model-rechnung.change-list #result_list{
  border:none;
  border-radius:0;
  border-collapse:separate;
  border-spacing:0;
}
body.app-planung.model-rechnung.change-list #result_list thead th{
  background:linear-gradient(180deg, rgba(var(--highlight-rgb),.05), rgba(var(--highlight-rgb),0));
  color:var(--muted);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.05em;
  border-bottom:1px solid var(--border);
}
body.app-planung.model-rechnung.change-list #result_list thead th .text a,
body.app-planung.model-rechnung.change-list #result_list thead th .text span{
  color:var(--muted);
  text-decoration:none;
}
body.app-planung.model-rechnung.change-list #result_list thead th .text a:hover{
  color:var(--text-strong);
}
body.app-planung.model-rechnung.change-list #result_list tbody td,
body.app-planung.model-rechnung.change-list #result_list tbody th{
  border-bottom:1px solid var(--border);
  font-size:13px;
  padding:10px 10px;
}
body.app-planung.model-rechnung.change-list #result_list tbody tr{
  background: var(--panel);
}
body.app-planung.model-rechnung.change-list #result_list tbody tr:nth-child(odd){
  background: var(--panel-2);
}
body.app-planung.model-rechnung.change-list #result_list tbody tr:hover{
  background:linear-gradient(90deg, rgba(6,182,212,.12), rgba(34,211,238,.04));
}
body.app-planung.model-rechnung.change-list #result_list .action-checkbox-column,
body.app-planung.model-rechnung.change-list #result_list .action-checkbox{
  width:34px;
}
body.app-planung.model-rechnung.change-list #result_list .field-nummer a{
  color: var(--accent-text-strong);
  font-weight:800;
  text-decoration:none;
}
body.app-planung.model-rechnung.change-list #result_list .field-nummer a:hover{
  color: var(--accent-text);
}
body.app-planung.model-rechnung.change-list #result_list .field-status{
  font-weight:700;
  color:var(--text-strong);
}
body.app-planung.model-rechnung.change-list #result_list .field-pdf_link a{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(34,211,238,.12);
  color: var(--accent-text);
  font-weight:700;
  text-decoration:none;
}
body.app-planung.model-rechnung.change-list #result_list .field-pdf_link a:hover{
  border-color:#22d3ee;
  background:rgba(34,211,238,.22);
}
body.app-planung.model-rechnung.change-list #result_list .action-select,
body.app-planung.model-rechnung.change-list #result_list #action-toggle{
  accent-color:var(--accent);
}

/* Login */
body.login { background: var(--bg); }

/* Chips and mini calendar */
.chip { display:inline-block; padding:6px 10px; margin:4px; border:1px solid var(--border); border-radius:999px; background:var(--bg); cursor:pointer; }
.chip input { margin-right:6px; }
.chip-list { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 8px; box-shadow: inset 0 2px 8px rgba(0,0,0,.25); margin-top: 6px; }

.mini-cal-wrap { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:12px; }
.mini-cal { background:var(--panel-2); border:1px solid var(--border); border-radius:12px; padding:8px; }
.mini-cal .title { text-align:center; font-weight:700; margin-bottom:6px; }
.mini-cal .grid { display:grid; grid-template-columns: repeat(7, 1fr); gap:4px; }
.mini-cal .dow { color: var(--muted); font-size:11px; text-align:center; }
.mini-cal .day { height:28px; border-radius:6px; text-align:center; line-height:28px; font-size:12px; border:1px solid transparent; }
.mini-cal .day.dim { color:#6b7280; }
.mini-cal .day.has-plan { background: rgba(34,211,238,.15); border-color:#22d3ee; color:#e6fbff; font-weight:700; }
.calendar-embed { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: 12px; background:var(--panel-2); }
.calendar-embed-controls .select { min-width: 120px; }

/* Utilities for the planning view */
.page-title { margin: 0 0 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.w-full { width: 100%; }
.w-90 { width: 90px; }
.min-140 { min-width: 140px; }
.scroll-area { max-height: 220px; overflow: auto; }
.nice-submit { margin-top: 12px; display: flex; gap: 8px; align-items: center; }
.span-2 { grid-column: 1 / -1; }

/* Constrain planning form width so fields aren’t overly long */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 520px)); gap: 12px; justify-content: start; }
.form-grid > div { min-width: 0; }
.form-grid .select { width: 100%; max-width: 520px; }
.form-grid .chip-list { width: 100%; max-width: 520px; }
/* Objekt field gets full grid width */
.field-objekt .select { max-width: none; }

/* Sections & hints */
.section { grid-column: 1 / -1; display: grid; gap: 6px; }
.section-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.step { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:999px; background: var(--btn-bg); color: var(--btn-fg); font-weight:900; box-shadow: 0 4px 12px rgba(0,0,0,.25); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }

/* Inline group rows */
.row-split { display:grid; grid-template-columns: 1fr auto; gap:8px; align-items:center; }

/* Fancy radios/checkboxes already styled through .seg-item */

/* Segmented toggles (JS adds .seg-item and .active on labels) */
.seg-item { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; user-select: none; transition: border-color .2s, background .2s, transform .06s; }
.seg-item:hover { border-color: var(--border-strong); }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.seg-item.active { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; font-weight: 700; }
.weekday-toggle { display: flex; gap: 6px; flex-wrap: wrap; }

/* Hide advanced blocks by default to prevent FOUC; JS toggles them */
.modus-series-only, .intervall-weekly, .intervall-daily, .intervall-monthly-date, .intervall-monthly-weekday { display: none; }
.pane-toolbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; gap:12px; flex-wrap:wrap; }

/* App index favorites */
.fav-wrap { background:var(--panel-2); border:1px solid var(--border); border-radius:12px; padding:12px; margin-bottom:12px; }
.fav-title { display:flex; align-items:center; gap:8px; font-weight:700; margin:0 0 6px }
.fav-list { display:grid; gap:8px }
.fav-list a { display:flex; justify-content:space-between; align-items:center; gap:10px; text-decoration:none; color:var(--text); border:1px solid var(--border); border-radius:10px; padding:8px 10px; background:var(--bg) }
.fav-star { cursor:pointer; font-size:16px; }
.fav-star.on { color:#fbbf24 }
.star-toggle { cursor:pointer; font-size:14px; margin-left:6px }
.shortcuts-list { display:grid; gap:8px }
.shortcuts-list.drop-ready { border:1px dashed #22d3ee; border-radius:12px; padding:8px; background:rgba(34,211,238,.08); }
.shortcuts-list .fav-item{ display:flex; align-items:center; justify-content:space-between; gap:8px; border:1px solid var(--border); border-radius:10px; background:var(--panel-2); padding:8px 10px }
.shortcuts-list .fav-item a{ color:var(--text); text-decoration:none }
.shortcuts-list .fav-item .add{ color:#22d3ee; font-weight:700 }
.shortcuts-list .fav-item.drag-over{ outline:2px dashed var(--border-strong) }
.shortcuts-list .fav-item.flash{ animation:favFlash .9s ease; }
@keyframes favFlash { 0%{ box-shadow:0 0 0 0 rgba(34,211,238,.6); } 100%{ box-shadow:0 0 0 12px rgba(34,211,238,0); } }

/* Admin nav sidebar */
.admin-sidebar-shell { display: contents; }
.toggle-nav-sidebar { background:var(--panel); border:2px solid var(--accent-text); color:var(--accent-text); border-radius:999px; box-shadow:0 10px 22px rgba(15,23,42,.16); width:36px; height:36px; flex:0 0 36px; display:inline-grid; place-items:center; padding:0; cursor:pointer; transition:background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease, color .16s ease; }
.toggle-nav-sidebar:hover, .toggle-nav-sidebar:focus { background:var(--panel-2); border-color:var(--accent-text-strong); box-shadow:0 12px 26px rgba(15,23,42,.2); }
.toggle-nav-sidebar::before { content:''; width:9px; height:9px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(-45deg); margin-left:-3px; transition:transform .18s ease, margin .18s ease; }
.main.shifted .toggle-nav-sidebar::before { transform:rotate(135deg); margin-left:4px; }
.main > .admin-sidebar-shell ~ .content,
.main.shifted > .admin-sidebar-shell ~ .content {
  max-width: none;
  min-width: 0;
}
.nav-panel { background:var(--panel); border:1px solid var(--border); border-radius:0 14px 14px 0; padding:12px; box-shadow:0 14px 34px rgba(15,23,42,.14); }
.nav-panel__inner { display:grid; gap:10px; padding-bottom:var(--admin-sidebar-end-gap); }
.nav-panel__header { display:grid; gap:5px; }
.nav-panel__meta { display:flex; justify-content:center; align-items:flex-start; gap:16px; }
.nav-panel__timeblock { display:grid; gap:2px; text-align:left; }
.nav-panel__titleline { display:flex; justify-content:center; align-items:baseline; gap:6px; }
.nav-panel__eyebrow { font-size:10px; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); }
.nav-panel__title { font-weight:800; font-size:13px; }
.nav-panel__date { text-align:left; display:grid; gap:2px; }
.nav-panel__date-label { font-size:9px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.nav-panel__date-value { font-size:11px; font-weight:700; color:var(--text-strong); }
.nav-panel__time { display:inline-flex; align-items:center; gap:3px; font-size:11px; font-weight:700; color:var(--text-strong); font-variant-numeric: tabular-nums; }
.time-slot { position:relative; display:inline-block; min-width:2ch; height:1.2em; overflow:hidden; }
.time-slot-val { position:absolute; left:0; top:0; width:100%; height:1.2em; line-height:1.2em; display:flex; align-items:center; justify-content:center; }
.time-sep { opacity:.65; }
.time-slot.is-animating .time-slot-val.current { animation: timeSlideOut .45s ease forwards; }
.time-slot.is-animating .time-slot-val.next { animation: timeSlideIn .45s ease forwards; }
@keyframes timeSlideIn {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}
@keyframes timeSlideOut {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .time-slot.is-animating .time-slot-val.current,
  .time-slot.is-animating .time-slot-val.next { animation: none; transform: translateY(0); }
}
.nav-panel__quick { display:grid; grid-template-columns:1fr; gap:6px; justify-items:center; }
.nav-panel__quick a { display:flex; align-items:center; justify-content:center; width:min(100%, 150px); gap:8px; padding:7px 9px; border-radius:9px; border:1px solid var(--border); background:var(--btn-bg); color: var(--btn-fg); text-decoration:none; font-size:12px; font-weight:800; box-shadow:0 10px 22px rgba(0,0,0,.24); transition:transform .08s ease, box-shadow .12s ease; }
.nav-panel__quick a:hover { background: var(--btn-bg-hover); transform:translateY(-1px); box-shadow:0 16px 34px rgba(0,0,0,.34); }
.nav-panel__modules { display:grid; gap:10px; }
.sidebar-tiles { display:grid; gap:9px; justify-items:start; padding-bottom:2px; }
.sidebar-tiles.drop-ready { outline:1px dashed #22d3ee; outline-offset:4px; }
.sidebar-tiles .tile { width:min(100%, 188px); grid-template-columns:26px minmax(0,1fr); align-items:center; gap:8px; padding:7px 9px; box-shadow:0 12px 28px rgba(0,0,0,.28); cursor:grab; }
.sidebar-tiles .tile:active { cursor:grabbing; }
.sortable-ghost { opacity:0.45; }
.sortable-chosen { box-shadow:0 0 0 2px rgba(34,211,238,.35); }
.tile-placeholder { border:1px dashed #22d3ee; border-radius:12px; background:rgba(34,211,238,.08); min-height:42px; }
.tile-drag-ghost { position:fixed; z-index:3000; pointer-events:none; opacity:0.92; transform:translateZ(0); }
body.tile-dragging { user-select:none; }
.tile--mini .tile-icon { width:26px; height:26px; display:grid; place-items:center; background:var(--bg); border-radius:8px; border:1px solid var(--border); font-size:13px; box-shadow:inset 0 1px 0 rgba(var(--highlight-rgb),.04); }
.tile--mini .tile-title { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; line-height:1.2; }
.tile--mini .tile-sub { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10px; line-height:1.25; }
.nav-panel__filter { display:flex; align-items:center; gap:8px; padding:8px 10px; border-radius:12px; border:1px solid var(--border); background:var(--bg); }
.nav-icon { width:14px; height:14px; border:2px solid var(--border-strong); border-radius:999px; position:relative; }
.nav-icon::after { content:''; position:absolute; width:7px; height:2px; background:var(--border-strong); transform:rotate(45deg); right:-6px; bottom:-2px; border-radius:2px; }
#nav-filter { border:none; background:transparent; color:var(--text); width:100%; padding:4px 0; }
#nav-filter:focus { outline:none; box-shadow:none; }
#nav-filter.no-results { background:rgba(239,68,68,.12); border-radius:8px; padding:6px 8px; }
.nav-panel__apps { display:grid; gap:12px; }
#nav-sidebar .module { background:var(--bg); border:1px solid var(--border); border-radius:12px; padding:8px 8px 10px; box-shadow: inset 0 1px 0 rgba(var(--highlight-rgb),.02), 0 12px 30px rgba(0,0,0,.26); }
#nav-sidebar .module caption a { color:var(--muted); text-decoration:none; font-weight:700; }
#nav-sidebar .module.current-app caption a { color: var(--accent-text-strong); }
#nav-sidebar .module caption { padding:0 0 6px; color:var(--muted); font-size:12px; letter-spacing:.02em; text-transform:uppercase; }
#nav-sidebar table { border-spacing:0; width:100%; }
#nav-sidebar tbody tr { display:flex; align-items:center; justify-content:space-between; gap:10px; border:1px solid transparent; border-radius:10px; padding:8px 10px; transition:border-color .12s ease, background .12s ease, transform .06s ease; white-space:nowrap; }
#nav-sidebar tbody tr:hover { background:rgba(var(--highlight-rgb),.03); border-color:var(--border); transform:translateX(2px); }
#nav-sidebar tbody tr.current-model { background:linear-gradient(90deg, rgba(6,182,212,.25), rgba(34,211,238,.12)); border-color:#22d3ee3d; box-shadow:0 10px 24px rgba(0,0,0,.3); }
#nav-sidebar th[scope=row] a { color:var(--text); font-weight:700; text-decoration:none; white-space:nowrap; }
#nav-sidebar .current-model th[scope=row] a { color: var(--accent-text-strong); }
#nav-sidebar td a { color: var(--accent-text); font-size:12px; font-weight:700; text-decoration:none; white-space:nowrap; }
#nav-sidebar .addlink { padding:5px 8px; border-radius:8px; border:1px solid var(--border); background:rgba(34,211,238,.14); }
#nav-sidebar .module table thead,
#nav-sidebar .module table td:nth-child(n+2) { display:none; }
#nav-sidebar .module table tbody tr { justify-content:flex-start; gap:8px; }
#nav-sidebar .module.current-app { border-color:#22d3ee3d; box-shadow:0 12px 28px rgba(0,0,0,.28); }
#nav-sidebar .app-planung { display:none; }
.nav-panel__favs { border-top:1px solid var(--border); padding-top:10px; margin-top:2px; }
.nav-panel #favListSidebar { margin-top:6px; }
#nav-sidebar #favListSidebar > a { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; border-radius:10px; border:1px solid var(--border); background:var(--bg); color:var(--text); text-decoration:none; box-shadow: inset 0 1px 0 rgba(var(--highlight-rgb),.02); }
body.fav-drop-mode #favListSidebar { outline:1px dashed #22d3ee; outline-offset:4px; }
#nav-sidebar.drop-ready { border-color:#22d3ee; box-shadow:0 0 0 2px rgba(34,211,238,.3); }
#favRemoveHint { position:fixed; bottom:16px; left:50%; transform:translateX(-50%); background:var(--panel-2); border:1px dashed #ef4444; color:#fecdd3; padding:10px 14px; border-radius:12px; box-shadow:0 12px 30px rgba(0,0,0,.3); display:none; z-index:2000; }
#favRemoveHint.show { display:flex; align-items:center; gap:8px; }

/* Rechnung status pills + legend */
.status-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  letter-spacing:.03em;
  text-transform:uppercase;
  white-space:nowrap;
  border:1px solid transparent;
}
.status-open{ background:rgba(249,115,22,.18); color:#f59e0b; border-color:rgba(249,115,22,.4); }
.status-overdue{ background:var(--status-overdue-bg); color:var(--status-overdue-text); border-color:var(--status-overdue-border); }
.status-paid{ background:rgba(16,185,129,.18); color:#34d399; border-color:rgba(16,185,129,.45); }
.status-cancelled{ background:rgba(148,163,184,.15); color:var(--muted); border-color:rgba(148,163,184,.4); }

.status-legend{
  margin-top:12px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.status-legend .legend-title{
  color:var(--muted);
  font-size:12px;
  letter-spacing:.05em;
  text-transform:uppercase;
}
.status-legend .legend-item{
  display:flex;
  align-items:center;
  gap:8px;
  background:var(--panel-2);
  border:1px solid var(--border);
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  color:var(--text);
}

/* Mahnwesen status pills */
.mahn-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  letter-spacing:.03em;
  text-transform:uppercase;
  white-space:nowrap;
  border:1px solid transparent;
}
.mahn-ok{ background:rgba(34,211,238,.12); color: var(--accent-text); border-color:rgba(34,211,238,.35); }
.mahn-overdue{ background:var(--mahn-overdue-bg); color:var(--mahn-overdue-text); border-color:var(--mahn-overdue-border); }
.mahn-stage-1{ background:rgba(245,158,11,.18); color:#f59e0b; border-color:rgba(245,158,11,.45); }
.mahn-stage-2{ background:rgba(249,115,22,.2); color:#fb923c; border-color:rgba(249,115,22,.45); }
.mahn-stage-3{ background:var(--mahn-stage-3-bg); color:var(--mahn-stage-3-text); border-color:var(--mahn-stage-3-border); }
.mahn-stage-4{ background:var(--mahn-stage-4-bg); color:var(--mahn-stage-4-text); border-color:var(--mahn-stage-4-border); }
.mahn-paid{ background:rgba(16,185,129,.18); color:#34d399; border-color:rgba(16,185,129,.45); }
.mahn-cancelled{ background:rgba(148,163,184,.15); color:var(--muted); border-color:rgba(148,163,184,.4); }
.mahn-unknown{ background:rgba(148,163,184,.12); color:var(--muted-2); border-color:rgba(148,163,184,.3); }

/* Delete confirmation dialogs */
body.delete-confirmation #content{
  max-width: 900px;
  margin: 14px auto 0;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  display: grid;
  gap: 10px;
}
body.delete-confirmation #content h1{
  margin: 0 0 2px;
  font-size: 20px;
}
body.delete-confirmation #content > p{
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(var(--bg-rgb),.65);
  color: var(--text);
}
body.delete-confirmation #content h2{
  margin: 8px 0 0;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
body.delete-confirmation #content > ul,
body.delete-confirmation #deleted-objects{
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(var(--bg-rgb),.6);
  display: grid;
  gap: 4px;
}
body.delete-confirmation #deleted-objects{
  max-height: 320px;
  overflow: auto;
}
body.delete-confirmation #content ul ul{
  margin: 6px 0 0 16px;
  padding: 0;
  border: none;
  background: transparent;
  display: grid;
  gap: 4px;
}
body.delete-confirmation #content li{
  color: var(--text);
}
body.delete-confirmation form > div{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
body.delete-confirmation input[type="submit"]{
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: none;
  font-weight: 700;
}
body.delete-confirmation #content > .clear{
  display: none;
}
@media (max-width: 720px){
  body.delete-confirmation #content{
    margin: 10px 0 0;
    border-radius: 14px;
  }
}

/* Popup windows + subdialogs (selectors, date/time widgets) */
body.popup{
  background: var(--bg);
  color: var(--text);
}
body.popup #container{
  background: transparent;
}
body.popup #content{
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
}
body.popup #header{
  background: linear-gradient(180deg, rgba(var(--highlight-rgb),.03), rgba(var(--highlight-rgb),.01));
  border-bottom: 1px solid var(--border);
}
body.popup .module{
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
body.popup .submit-row{
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.selector select{
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.selector-available-title,
.selector-chosen-title{
  background: var(--panel-2);
  color: var(--text-strong);
  border: 1px solid var(--border);
}
.selector-available-title{
  color: var(--muted);
}
.selector .selector-filter{
  background: var(--panel);
  color: var(--muted);
  border-color: var(--border);
}
.selector ul.selector-chooser,
.stacked ul.selector-chooser{
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.selector-chosen .list-footer-display{
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-color: var(--border);
}
.selector-chosen .list-footer-display__clear{
  color: var(--accent-text);
}
.selector-chooseall,
.selector-clearall{
  color: var(--muted);
}
.selector-chooseall:hover,
.selector-clearall:hover{
  color: var(--accent-text);
}

.calendarbox,
.clockbox{
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 30px rgba(0,0,0,.2);
}
.calendar table{
  background: transparent;
}
.calendar caption,
.calendarbox h2{
  background: var(--panel-2);
  color: var(--text-strong);
  border-bottom: 1px solid var(--border);
}
.calendar th{
  background: var(--panel-2);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.calendar td{
  border-top: 1px solid var(--border);
}
.calendar td.nonday{
  background: rgba(var(--highlight-rgb),.04);
}
.calendar td.selected a{
  background: var(--btn-bg);
  color: var(--btn-fg);
}
.calendar td a,
.timelist a{
  color: var(--text);
}
.calendar td a:focus,
.timelist a:focus,
.calendar td a:hover,
.timelist a:hover{
  background: rgba(34,211,238,.18);
  color: var(--text);
}
.calendar td a:active,
.timelist a:active{
  background: rgba(34,211,238,.3);
  color: var(--text);
}
.calendar-shortcuts{
  background: var(--panel);
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.calendar-cancel{
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  color: var(--text);
}
.calendar-cancel a{
  color: var(--text);
}
.calendarnav{
  color: var(--muted);
}
.calendarnav a:link,
.calendarnav a:visited,
.calendarnav a:focus,
.calendarnav a:hover{
  color: var(--muted);
}

.demo-mode-admin-banner{
  display:grid;
  grid-template-columns:auto minmax(0, 1fr);
  align-items:center;
  gap:9px;
  width:100%;
  max-width:100%;
  margin-left:0;
  padding:8px 12px 8px 9px;
  border-radius:16px;
  border:1px solid rgba(245,158,11,.42);
  background:linear-gradient(135deg, rgba(245,158,11,.15), rgba(14,165,233,.07)), var(--panel);
  color:var(--text);
  font-weight:700;
  line-height:1.25;
  box-shadow:0 12px 30px rgba(15,23,42,.12), inset 0 1px 0 rgba(var(--highlight-rgb),.05);
}
.demo-mode-admin-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  border-radius:10px;
  background:rgba(245,158,11,.18);
  color:#b45309;
  font-size:13px;
  font-weight:950;
  letter-spacing:0;
  box-shadow:inset 0 0 0 1px rgba(245,158,11,.28);
}
.demo-mode-admin-badge{
  display:none;
  align-items:center;
  min-height:24px;
  padding:3px 9px;
  border-radius:999px;
  background:rgba(245,158,11,.14);
  color:#92400e;
  font-size:11px;
  font-weight:900;
  letter-spacing:.04em;
  text-transform:uppercase;
  white-space:nowrap;
}
.demo-mode-admin-text{
  min-width:0;
  overflow-wrap:anywhere;
  white-space:normal;
  color:var(--text-strong);
  font-size:13px;
}

.demo-mode-page{
  max-width:880px;
  margin:0 auto;
}

.demo-mode-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:24px;
  padding:28px;
  box-shadow:var(--shadow-elev-1);
}

.demo-mode-kicker{
  margin:0 0 10px;
  text-transform:uppercase;
  letter-spacing:.18em;
  color:var(--accent-text);
  font-size:12px;
  font-weight:800;
}

.demo-mode-card h1{
  margin:0 0 12px;
}

.demo-mode-copy{
  max-width:62ch;
  color:var(--muted);
  margin:0 0 20px;
}

.demo-mode-status-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:14px;
  margin:0 0 20px;
}

.demo-mode-status-box{
  background:var(--panel-2);
  border:1px solid var(--border);
  border-radius:18px;
  padding:16px;
}

.demo-mode-status-label{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin-bottom:6px;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.demo-mode-status-value{
  font-size:18px;
  color:var(--text-strong);
}

.demo-mode-note{
  margin:0 0 20px;
  padding:14px 16px;
  border-radius:16px;
  background:rgba(34,211,238,.12);
  border:1px solid rgba(34,211,238,.25);
  color:var(--text);
}

.demo-mode-note--warn{
  background:rgba(245,158,11,.14);
  border-color:rgba(245,158,11,.38);
  color:#b45309;
}

.demo-mode-note--active{
  background:rgba(245,158,11,.14);
  border-color:rgba(245,158,11,.38);
  color:#b45309;
}

.demo-mode-actions{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:center;
}

.demo-mode-actions form{
  margin:0;
}

/* Small-screen admin foundation */
#container,
.main,
#content,
#content-main,
#changelist,
#changelist-form,
.changelist-form-container,
.module,
.results {
  min-width: 0;
  box-sizing: border-box;
}

#content,
#content-main {
  width: 100%;
  max-width: 100%;
}

#content-main > *,
.dashboard > *,
.module-shell > *,
.results,
.inline-group,
.submit-row,
.object-tools {
  max-width: 100%;
}

body.change-list .results {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
}

body.change-list .results table,
body.change-list #result_list {
  min-width: max(100%, 720px);
  width: 100%;
}

/* Shared fixed right-side change-list filter rail */
:root {
  --planwork-filter-rail-width: var(--admin-sidebar-rail, 40px);
  --planwork-filter-button-size: 40px;
  --planwork-filter-panel-width: clamp(230px, 22vw, 280px);
  --planwork-filter-gap: 22px;
  --planwork-filter-edge: max(12px, env(safe-area-inset-right));
  --planwork-filter-top: var(--admin-sidebar-top, 86px);
  --planwork-filter-bottom: var(--admin-sidebar-bottom, 14px);
  --planwork-filter-reserve-open: calc(var(--planwork-filter-panel-width) + var(--planwork-filter-gap));
  --planwork-filter-reserve-closed: calc(var(--planwork-filter-button-size) + var(--planwork-filter-edge) + 8px);
}

body.change-list.planwork-filter-rail-active #content,
body.change-list.planwork-filter-rail-active #content-main,
body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

body.change-list.planwork-filter-rail-active #content-main {
  padding-right: 0 !important;
}

body.change-list.planwork-filter-rail-active #changelist.filtered.planwork-filter-rail-ready {
  position: relative;
  margin-right: 0 !important;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-form,
body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready .changelist-form-container {
  min-width: 0;
  width: 100% !important;
  margin-right: 0 !important;
}

@media (min-width: 761px) {
  body.change-list.planwork-filter-rail-active:not(.planwork-filter-collapsed) #content {
    padding-right: var(--planwork-filter-reserve-open) !important;
  }

  body.change-list.planwork-filter-rail-active.planwork-filter-collapsed #content {
    padding-right: var(--planwork-filter-reserve-closed) !important;
  }
}

@media (max-width: 760px) {
  body.change-list.planwork-filter-rail-active {
    --planwork-filter-panel-width: min(320px, calc(100vw - 56px));
  }

  body.change-list.planwork-filter-rail-active.planwork-filter-collapsed #content {
    padding-right: var(--planwork-filter-reserve-closed) !important;
  }

  body.change-list.planwork-filter-rail-active:not(.planwork-filter-collapsed) #content {
    padding-right: 0 !important;
  }
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail {
  position: fixed !important;
  inset: var(--planwork-filter-top) var(--planwork-filter-edge) var(--planwork-filter-bottom) auto !important;
  z-index: 10000;
  box-sizing: border-box;
  display: block !important;
  width: var(--planwork-filter-panel-width) !important;
  min-width: 0 !important;
  max-width: var(--planwork-filter-panel-width) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none;
}

body.change-list.planwork-filter-rail-active #changelist-filter.planwork-filter-rail::before,
body.change-list.planwork-filter-rail-active #changelist-filter.planwork-filter-rail::after {
  content: none !important;
  display: none !important;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 54px 12px 14px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--panel-2);
  box-shadow: 0 18px 42px rgba(15,23,42,.18);
  pointer-events: auto;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body::-webkit-scrollbar {
  width: 8px;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body::-webkit-scrollbar-thumb {
  background: rgba(var(--highlight-rgb), .18);
  border-radius: 999px;
}

body.change-list.planwork-filter-rail-active #changelist-filter .planwork-filter-toggle {
  position: fixed !important;
  top: calc(var(--planwork-filter-top) + 18px) !important;
  right: var(--planwork-filter-edge) !important;
  left: auto !important;
  z-index: 10020;
  width: var(--planwork-filter-button-size);
  height: var(--planwork-filter-button-size);
  border: 2px solid var(--accent-text);
  border-radius: 999px;
  background: var(--panel);
  color: var(--accent-text);
  display: inline-grid !important;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(15,23,42,.22);
  pointer-events: auto;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease, color .16s ease;
}

body.change-list.planwork-filter-rail-active #changelist-filter .planwork-filter-toggle:hover,
body.change-list.planwork-filter-rail-active #changelist-filter .planwork-filter-toggle:focus {
  background: var(--panel-2);
  border-color: var(--accent-text-strong);
  box-shadow: 0 14px 30px rgba(15,23,42,.24);
}

body.change-list.planwork-filter-rail-active #changelist-filter .planwork-filter-toggle:focus-visible {
  outline: 2px solid var(--accent-text-strong);
  outline-offset: 3px;
}

body.change-list.planwork-filter-rail-active #changelist-filter .planwork-filter-toggle::before {
  content: '';
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  margin-left: -3px;
  transition: transform .18s ease, margin .18s ease;
}

html body.change-list.planwork-filter-collapsed #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail {
  inset: var(--planwork-filter-top) var(--planwork-filter-edge) auto auto !important;
  width: var(--planwork-filter-button-size) !important;
  min-width: var(--planwork-filter-button-size) !important;
  max-width: var(--planwork-filter-button-size) !important;
  height: var(--planwork-filter-button-size) !important;
  min-height: var(--planwork-filter-button-size) !important;
  max-height: var(--planwork-filter-button-size) !important;
  padding: 0 !important;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  pointer-events: none !important;
}

html body.change-list.planwork-filter-collapsed #changelist.planwork-filter-rail-ready #changelist-filter > :not(.planwork-filter-toggle) {
  display: none !important;
}

html body.change-list.planwork-filter-collapsed #changelist.planwork-filter-rail-ready #changelist-filter .planwork-filter-toggle {
  top: calc(var(--planwork-filter-top) + 18px) !important;
  right: var(--planwork-filter-edge) !important;
  left: auto !important;
  background: var(--btn-bg);
  border-color: var(--panel);
  color: var(--btn-fg);
  box-shadow: 0 14px 30px rgba(37,99,235,.28), 0 0 0 4px rgba(37,99,235,.12);
  transform: none;
}

html body.change-list.planwork-filter-collapsed #changelist.planwork-filter-rail-ready #changelist-filter .planwork-filter-body {
  display: none !important;
}

html body.change-list.planwork-filter-collapsed #changelist.planwork-filter-rail-ready #changelist-filter .planwork-filter-toggle::before {
  transform: rotate(135deg);
  margin-left: 4px;
}

html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active .mitl-shell.filtered {
  grid-template-columns: minmax(0,1fr) !important;
  gap: 18px !important;
}

html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active .mitl-main {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active .mitl-main > *,
html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active .mitl-detail-stage,
html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active .mitl-table-stage,
html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active .changelist-form-container,
html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active #changelist-form {
  box-sizing: border-box;
  min-width: 0 !important;
  width: 100%;
  max-width: 100%;
}

html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active .mitl-table-stage .results {
  box-sizing: border-box;
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
}

html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active .mitl-sidebar {
  grid-column: 1;
  grid-row: 1;
  width: 0 !important;
  min-width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  overflow: visible !important;
  pointer-events: none;
  position: static !important;
}

html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active .mitl-filter-card {
  display: block !important;
  width: 0 !important;
  min-width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  pointer-events: none;
}

html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active .mitl-filter-card > :not(#changelist-filter) {
  display: none !important;
}

html body.app-planung.model-mitarbeiter.change-list.planwork-filter-rail-active #changelist-filter {
  pointer-events: none;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body > h2,
body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body #changelist-filter-header {
  display: none !important;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body #changelist-filter-extra-actions,
body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body .logfilter,
body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body details {
  box-sizing: border-box;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 10px !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  background: rgba(var(--highlight-rgb), .035) !important;
  box-shadow: inset 0 1px 0 rgba(var(--highlight-rgb), .02);
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body details[open] {
  border-color: var(--border-strong) !important;
  background: rgba(var(--highlight-rgb), .055) !important;
  box-shadow: inset 0 1px 0 rgba(var(--highlight-rgb), .02), 0 10px 24px rgba(15,23,42,.08) !important;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body .logfilter-title,
body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body summary,
body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body h3 {
  min-width: 0;
  margin: 0 !important;
  color: var(--text-strong) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1.25;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body summary {
  cursor: pointer;
  list-style: none;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: transparent !important;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body summary::-webkit-details-marker {
  display: none;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body ul {
  list-style: none !important;
  margin: 8px 0 0 !important;
  padding: 0 !important;
  display: grid !important;
  gap: 6px !important;
  background: transparent !important;
  max-height: none;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body li {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body li a,
body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body #changelist-filter-extra-actions a {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: var(--text) !important;
  text-decoration: none !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body li a:hover,
body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body #changelist-filter-extra-actions a:hover {
  border-color: var(--border) !important;
  background: rgba(var(--highlight-rgb), .03) !important;
  color: var(--text-strong) !important;
}

body.change-list.planwork-filter-rail-active #changelist.planwork-filter-rail-ready #changelist-filter.planwork-filter-rail .planwork-filter-body li.selected a {
  border-color: rgba(14,165,233,.35) !important;
  background: rgba(14,165,233,.12) !important;
  color: var(--accent-text-strong) !important;
  font-weight: 800 !important;
}

body.change-list #result_list th,
body.change-list #result_list td {
  max-width: 34ch;
}

.object-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.object-tools li {
  margin: 0;
}

.object-tools a,
.button,
input[type=submit],
.submit-row input {
  box-sizing: border-box;
  max-width: 100%;
  white-space: normal;
  text-align: center;
  overflow-wrap: anywhere;
}

.submit-row,
.bmd-actions,
.bmd-submit,
.csp-hero-actions,
.csp-step-actions,
.csp-actions,
.analysis-actions,
.az-actions,
.az-sort,
.az-modal-actions,
.aze-actions,
.acc-actions,
.dr-actions,
.dr-selected-actions,
.inv-actions,
.inv-actions-row,
.ma-actions,
.ma-filter-actions,
.pay-actions,
.pe-actions,
.pi-actions,
.mitf-rfid-actions,
.module-hero-actions,
.angebot-actions,
.obj-actions,
.kund-actions,
.kund-row-actions,
.cp-actions,
.pg-actions,
.ft-actions,
.restore-actions,
.demo-mode-actions,
.rechf-inline-actions,
.mitl-finder-actions,
.mitl-card-top-actions,
.mitl-detail-actions,
.org-stage-actions {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  flex-wrap: wrap;
}

#content button,
#content .button,
#content [class$="-btn"],
#content [class*="-btn "],
#content [class$="-action"],
#content [class*="-action "],
#content .object-tools a,
#content .submit-row input,
#content .submit-row a {
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
}

input,
select,
textarea,
.related-widget-wrapper {
  max-width: 100%;
  box-sizing: border-box;
}

.related-widget-wrapper {
  min-width: 0;
}

/* UI hygiene guardrails for dense admin forms and inline tables. */
#content form,
#content fieldset,
#content .module,
#content .aligned,
#content .inline-group,
#content .tabular,
#content .tabular table,
#content .tabular tbody,
#content .tabular tr,
#content .tabular th,
#content .tabular td,
#content .form-row,
#content .fieldBox {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

#content .tabular td,
#content .tabular th,
#content .readonly,
#content .help,
#content .errorlist,
#content .object-tools a,
#content .submit-row input,
#content .submit-row a.deletelink,
#content .button {
  overflow-wrap: anywhere;
}

#content .submit-row {
  position: static;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1320px) {
  body.change-form #content .tabular table {
    width: 100%;
  }

  body.change-form #content .tabular input:not([type="checkbox"]):not([type="radio"]),
  body.change-form #content .tabular select,
  body.change-form #content .tabular textarea {
    min-width: 0;
    max-width: 100%;
  }

  body.change-form #content .submit-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: stretch;
  }
}

/* Admin sidebar shell: the navigation rail is collapsible at every viewport. */
:root {
  --admin-sidebar-rail: 40px;
  --admin-sidebar-width: clamp(210px, 20vw, 230px);
  --admin-sidebar-current-width: var(--admin-sidebar-rail);
  --admin-sidebar-top: 86px;
  --admin-sidebar-bottom: 14px;
  --admin-sidebar-end-gap: 34px;
  --admin-header-clearance: clamp(18px, 1.8vw, 30px);
}

.main {
  --admin-sidebar-current-width: var(--admin-sidebar-rail);
  display: grid !important;
  grid-template-columns: var(--admin-sidebar-current-width) minmax(0, 1fr);
  align-items: start;
  column-gap: var(--admin-grid-gap, 32px);
  margin-top: var(--admin-header-clearance);
  position: relative;
  transition: grid-template-columns .22s ease;
}

.main.shifted {
  --admin-sidebar-current-width: var(--admin-sidebar-width);
}

.main > .admin-sidebar-shell {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  display: block;
  position: sticky;
  top: var(--admin-sidebar-top);
  z-index: 70;
  width: var(--admin-sidebar-current-width);
  height: calc(100vh - var(--admin-sidebar-top) - var(--admin-sidebar-bottom));
  min-height: 340px;
  overflow: visible;
  background: var(--panel);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transition: width .22s ease;
}

.main > .admin-sidebar-shell > #nav-sidebar {
  flex: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  left: auto !important;
  right: auto !important;
}

.main.shifted > .admin-sidebar-shell {
  background: var(--panel);
}

.main > .content {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  max-width: none;
  min-width: 0;
  flex: none;
}

.main > .admin-sidebar-shell ~ .content,
.main.shifted > .admin-sidebar-shell ~ .content {
  max-width: none;
}

.main > #favRemoveHint {
  grid-column: 1 / -1;
  grid-row: 1;
}

#nav-sidebar.nav-panel {
  position: relative;
  inset: auto;
  z-index: 1;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-padding-bottom: var(--admin-sidebar-end-gap);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 14px 12px 0 14px;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
  transform: none;
  pointer-events: none;
  transition: opacity .14s ease, visibility .14s ease;
}

.main.shifted #nav-sidebar.nav-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#nav-sidebar.nav-panel::-webkit-scrollbar {
  width: 8px;
}

#nav-sidebar.nav-panel::-webkit-scrollbar-thumb {
  background: rgba(var(--highlight-rgb), .18);
  border-radius: 999px;
}

#nav-sidebar .nav-panel__header {
  padding-right: 0;
}

#nav-sidebar .nav-panel__inner {
  width: 100%;
  min-width: 0;
  gap: 12px;
  padding-bottom: var(--admin-sidebar-end-gap);
}

#toggle-nav-sidebar {
  position: absolute;
  top: 50%;
  right: -24px;
  z-index: 500;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(15,23,42,.2);
  transform: translateY(-50%);
}

.main.shifted #toggle-nav-sidebar {
  right: -24px;
  background: var(--panel-2);
}

.main:not(.shifted) #toggle-nav-sidebar {
  left: auto;
  right: -28px;
  width: 40px;
  height: 40px;
  background: var(--btn-bg);
  border-color: var(--panel);
  color: var(--btn-fg);
  box-shadow: 0 14px 30px rgba(37,99,235,.28), 0 0 0 4px rgba(37,99,235,.12);
}

.main:not(.shifted) #toggle-nav-sidebar:hover,
.main:not(.shifted) #toggle-nav-sidebar:focus {
  background: var(--btn-bg-hover);
  border-color: var(--panel);
  box-shadow: 0 16px 34px rgba(37,99,235,.34), 0 0 0 5px rgba(37,99,235,.16);
}

.main:not(.shifted) #toggle-nav-sidebar::before {
  width: 11px;
  height: 11px;
  border-width: 3px;
  margin-left: -4px;
}

#nav-sidebar .nav-panel__quick a,
#nav-sidebar .sidebar-tiles .tile,
#nav-sidebar .module {
  box-shadow: none;
}

#nav-sidebar .nav-panel__quick a {
  background: var(--panel-2);
  color: var(--accent-text);
  border-color: var(--border);
}

#nav-sidebar .nav-panel__quick a:hover {
  background: rgba(34,211,238,.1);
  color: var(--accent-text-strong);
  transform: none;
  box-shadow: none;
}

#nav-sidebar .sidebar-tiles .tile,
#nav-sidebar .module,
#nav-sidebar #favListSidebar > a {
  background: var(--panel-2);
  border-color: var(--border);
}

#nav-sidebar .sidebar-tiles,
#nav-sidebar .nav-panel__apps,
#nav-sidebar #favListSidebar {
  gap: 10px;
}

#nav-sidebar .nav-panel__modules,
#nav-sidebar .nav-panel__favs {
  padding-bottom: 2px;
}

#nav-sidebar tbody tr.current-model {
  box-shadow: none;
}

.main > .content .cards,
.main > .content .panes {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--admin-card-min)), 1fr)) !important;
  gap: var(--admin-card-gap) !important;
  align-items: stretch;
}

.main > .content .nav-tiles {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 290px)) !important;
  justify-content: start !important;
  gap: clamp(22px, 2.4vw, 44px) !important;
  align-items: stretch;
}

.main > .content .tile,
.main > .content .card,
.main > .content .pane,
.main > .content .module-card,
.main > .content .cluster {
  min-width: 0 !important;
  max-width: 100%;
}

.main > .content .tile {
  width: 100%;
}

.main > .content .tile-title,
.main > .content .tile-sub {
  overflow-wrap: anywhere;
}

body.login .main,
body.popup .main,
body.rechf-kalk-full .main,
body.mit-print-mode .main {
  display: block !important;
  margin-top: 0;
}

body.login .main > .content,
body.popup .main > .content,
body.rechf-kalk-full .main > .content,
body.mit-print-mode .main > .content {
  grid-column: auto;
  grid-row: auto;
}

@media (max-width: 1600px) {
  :root {
    --admin-sidebar-rail: 40px;
    --admin-sidebar-width: clamp(210px, 20vw, 230px);
    --admin-sidebar-current-width: var(--admin-sidebar-rail);
    --admin-sidebar-top: 78px;
    --admin-sidebar-bottom: 14px;
    --admin-grid-gap: 16px;
    --admin-card-gap: 16px;
    --admin-card-min: var(--admin-card-min-compact);
    --admin-sidebar-end-gap: 34px;
    --admin-header-clearance: clamp(16px, 1.6vw, 24px);
  }

  #header {
    gap: 8px 12px;
    min-height: 0;
    padding: 10px 16px;
  }

  #branding {
    flex: 0 1 auto;
    min-width: 0;
  }

  #user-tools {
    margin-left: 0;
  }

  #site-name .planwork-admin-link {
    padding: 6px 10px;
  }

  #site-name .planwork-admin-logo {
    height: 26px;
  }

  .admin-nav-global {
    order: 2;
    width: auto;
    flex: 0 1 auto;
    margin-left: auto;
    gap: 8px;
    justify-content: flex-end;
  }

  .admin-nav-global .lang-switcher {
    display: none;
  }

  .demo-mode-admin-banner {
    grid-template-columns:auto minmax(0, 1fr);
    border-radius: 12px;
  }

  .demo-mode-admin-text {
    white-space: normal;
  }
}

@media (max-width: 760px) {
  :root {
    --admin-sidebar-rail: 36px;
    --admin-sidebar-width: min(280px, 72vw);
    --admin-sidebar-top: 70px;
    --admin-card-min: var(--admin-card-min-narrow);
    --admin-card-gap: 14px;
    --admin-sidebar-end-gap: 40px;
    --admin-header-clearance: 14px;
  }

  .main > .admin-sidebar-shell {
    min-height: 300px;
  }

  #nav-sidebar.nav-panel {
    padding: 12px 10px 0 12px;
  }

  #nav-sidebar .nav-panel__meta,
  #nav-sidebar .nav-panel__titleline {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  #nav-sidebar .nav-panel__date {
    text-align: left;
  }

  #nav-sidebar .nav-panel__quick {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1600px), (max-height: 820px) {
  #content {
    padding: 14px 16px;
  }

  body .dashboard,
  body .module-shell,
  body .bmd-shell,
  body .ma-wrap,
  body .mitl-page,
  body .pay-shell,
  body .pe-shell,
  body .pi-shell {
    gap: var(--admin-grid-gap) !important;
  }

  body #content .nav-tiles {
    gap: clamp(20px, 2vw, 34px) !important;
  }

  body .tile,
  body .card,
  body .pane,
  body .cluster,
  body .module-card,
  body .bmd-panel,
  body .ma-card,
  body .kund-card,
  body .kund-row,
  body .mitl-titlebar,
  body .module-hero,
  body .ma-hero {
    padding: 12px !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 20px rgba(0,0,0,.16) !important;
  }

  #content h1 {
    font-size: 20px;
    line-height: 1.15;
  }
}

@media (max-width: 1180px) {
  body .cards,
  body .panes,
  body .apps,
  body .kund-grid,
  body .ma-grid,
  body .bmd-grid,
  body .bmd-kpis,
  body .pay-grid,
  body .pay-stats,
  body .rech-cards,
  body .az-stats,
  body .acc-cards,
  body .demo-mode-status-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--admin-card-min)), 1fr)) !important;
    gap: var(--admin-card-gap) !important;
  }

  body #content .nav-tiles {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 290px)) !important;
    justify-content: start !important;
    gap: clamp(18px, 2vw, 28px) !important;
  }

  body .tile,
  body .card {
    min-width: 0 !important;
  }

  body .module-hero,
  body .module-grid,
  body .planner-grid-main,
  body .set-grid,
  body .rpv-grid,
  body .obj-grid,
  body .dr-grid,
  body .pe-layout,
  body .pi-layout,
  body .pay-layout,
  body .ma-hero {
    grid-template-columns: 1fr !important;
  }

  body .module-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body .form-grid,
  body .grid-2,
  body .planner-grid-fields,
  body .series-range,
  body .hours-list,
  body .scenario-grid,
  body .ma-filter-grid,
  body .ma-card-grid,
  body .az-export-grid,
  body .rech-export-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--admin-card-min)), 1fr)) !important;
    gap: var(--admin-card-gap) !important;
  }

  body.change-list #changelist {
    display: grid !important;
    gap: 12px;
  }

  body.change-list #changelist.filtered #changelist-form {
    width: 100% !important;
    margin-right: 0 !important;
  }

  body.change-list .results {
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  body.change-list .results table,
  body.change-list #result_list {
    min-width: max(100%, 720px) !important;
  }

  body.change-list:not(.planwork-filter-rail-active) #changelist-filter {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  body.change-list #changelist-filter details,
  body.change-list #changelist-filter .logfilter {
    min-width: min(220px, 100%) !important;
  }

  body.change-list #toolbar,
  body.change-list .actions,
  body.change-list .paginator {
    max-width: 100%;
    overflow-x: auto;
  }
}

@media (max-width: 900px) {
  #content {
    padding: 12px;
  }

  .aligned .form-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px;
  }

  .aligned label {
    width: auto !important;
    padding: 0 !important;
    float: none !important;
  }

  .aligned .form-row > div,
  .aligned .form-row .flex-container,
  .aligned .readonly,
  .aligned p.help,
  .related-widget-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
  }

  body.change-form #content .aligned input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
  body.change-form #content .aligned textarea,
  body.change-form #content .aligned select {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .submit-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  #header {
    padding: 8px 10px;
    align-items: center;
  }

  #content {
    padding: 10px;
  }

  #branding {
    flex: 1 1 auto;
    max-width: calc(100vw - 116px);
  }

  #site-name .planwork-admin-link {
    max-width: 100%;
    padding: 5px 8px;
    box-sizing: border-box;
  }

  #site-name .planwork-admin-logo {
    max-width: 100%;
    height: 24px;
    object-fit: contain;
  }

  .admin-nav-global {
    flex: 0 0 auto;
    margin-left: 0;
    gap: 6px 8px;
  }

  #user-tools {
    flex: 1 0 100%;
    display: flex;
    justify-content: flex-end;
    max-width: 100%;
  }

  .admin-menu-toggle {
    min-width: 38px;
    padding: 8px 10px;
  }

  .admin-menu-toggle__label {
    display: none;
  }

  .lang-switcher select {
    max-width: 94px;
  }

  .theme-switcher .theme-option {
    padding: 6px 8px;
  }

  .theme-switcher {
    max-width: 100%;
    box-sizing: border-box;
  }

  body .cards,
  body .panes,
  body .apps,
  body .module-flow,
  body .kund-grid,
  body .ma-grid,
  body .bmd-grid,
  body .bmd-kpis,
  body .pay-grid,
  body .pay-stats,
  body .rech-cards,
  body .az-stats,
  body .acc-cards {
    grid-template-columns: 1fr !important;
  }

  body #content .nav-tiles {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .object-tools {
    justify-content: stretch;
  }

  .object-tools li,
  .object-tools a,
  #content .submit-row input,
  #content .submit-row a.deletelink,
  #content .submit-row .button {
    width: 100%;
  }

  body.change-list .results table,
  body.change-list #result_list {
    min-width: max(100%, 640px);
  }
}

@media (max-width: 420px) {
  #branding {
    max-width: calc(100vw - 104px);
  }

  #site-name .planwork-admin-logo {
    height: 22px;
  }

  .profile-link {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }

  .theme-switcher {
    gap: 2px;
    padding: 3px;
  }

  .theme-switcher .theme-option {
    padding: 6px 7px;
    font-size: 10px;
  }
}
