/* Hausschrift: Inter Variable, selbst gehostet (kein externer Request, CSP-konform). */
@font-face {
  font-family: 'Inter var';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts-inter-var.woff2') format('woff2');
}

:root {
  --brand: #0060ae;
  --brand-bright: #00aeef;
  --ink: #101828;
  --muted: #5b6b7f;
  --line: #d9e2ec;
  --panel: #ffffff;
  --panel-soft: #f7fbff;
  --page: #eef6fb;
  --danger: #d7263d;
  --success: #178c4f;
  --warning: #d18800;
  --shadow: 0 20px 60px rgba(16, 24, 40, 0.12);
  --toast-bg: #101828;
  --radius: 10px;
  /* 1.0-Designtokens */
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 14px rgba(16, 24, 40, 0.06);
  --shadow-lift: 0 12px 28px rgba(7, 34, 63, 0.14);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--brand-bright) 32%, transparent);
  --glow: 0 6px 22px color-mix(in srgb, var(--brand) 30%, transparent);
  --ease-swift: cubic-bezier(0.22, 1, 0.36, 1);
  --grid-line: rgba(7, 34, 63, 0.032);
}

[data-theme="dark"] {
  --ink: #f6f8fb;
  --muted: #9fb0c3;
  --line: #24334a;
  --panel: #101a2b;
  --panel-soft: #0b1322;
  --page: #060b16;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  --toast-bg: #0060ae;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-lift: 0 14px 32px rgba(0, 0, 0, 0.45);
  --glow: 0 6px 24px color-mix(in srgb, var(--brand-bright) 22%, transparent);
  --grid-line: rgba(151, 197, 255, 0.045);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  /* Feines Raster + weiche Markenlichter: rein statische Gradients, kein Repaint-Aufwand. */
  background:
    radial-gradient(1100px 520px at 88% -10%, color-mix(in srgb, var(--brand-bright) 7%, transparent), transparent 62%),
    radial-gradient(900px 480px at -12% 108%, color-mix(in srgb, var(--brand) 8%, transparent), transparent 60%),
    repeating-linear-gradient(0deg, var(--grid-line) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 44px),
    var(--page);
  background-attachment: fixed;
  font-family: 'Inter var', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: 'cv05' 1, 'cv08' 1, 'ss01' 1;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  color: #fff;
  background: var(--brand);
}

/* Einheitliche, gut sichtbare Tastatur-Fokusringe */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* Markenverlauf auf allen Scrollbalken (wie die Aktiv-Kante der Navigation).
   Firefox kann bei Scrollbars nur Volltonfarben - dort Markenblau als Fallback. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--brand) transparent;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:vertical {
  background-image: linear-gradient(180deg, var(--brand-bright), var(--brand));
}

::-webkit-scrollbar-thumb:horizontal {
  background-image: linear-gradient(90deg, var(--brand-bright), var(--brand));
}

::-webkit-scrollbar-thumb:vertical:hover,
::-webkit-scrollbar-thumb:vertical:active {
  background-image: linear-gradient(180deg, var(--brand-bright), color-mix(in srgb, var(--brand) 80%, #000));
  border-width: 1px;
}

::-webkit-scrollbar-thumb:horizontal:hover,
::-webkit-scrollbar-thumb:horizontal:active {
  background-image: linear-gradient(90deg, var(--brand-bright), color-mix(in srgb, var(--brand) 80%, #000));
  border-width: 1px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(160deg, rgba(0, 174, 239, 0.12), transparent 40%),
    linear-gradient(340deg, rgba(0, 96, 174, 0.16), transparent 42%),
    var(--page);
}

.login-panel {
  width: min(100%, 460px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.brand-lockup,
.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-bright));
  border-radius: 6px;
  font-weight: 900;
  text-transform: uppercase;
}

.brand-mark span {
  transform: translateY(-1px);
}

.brand-logo {
  width: 46px;
  height: 54px;
  object-fit: contain;
  flex: 0 0 auto;
  transition: width 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease, visibility 220ms ease;
}

.sidebar-logo {
  width: 34px;
  height: 50px;
}

.brand-subline,
.brand-block .sidebar-label span {
  color: var(--brand-bright);
  font-size: 0.82rem;
  font-weight: 700;
  background: repeating-linear-gradient(90deg, var(--brand-bright) 0%, var(--brand) 25%, #fff 50%, var(--brand) 75%, var(--brand-bright) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  transition: filter 180ms ease;
}

.brand-subline:hover,
.brand-block .sidebar-label span:hover {
  color: transparent;
  animation: brandShine 1800ms linear infinite;
  filter: drop-shadow(0 0 8px rgba(0, 174, 239, 0.22));
}

@keyframes brandShine {
  0% { background-position: 200% center; }
  100% { background-position: 0% center; }
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.1;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.02rem;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--panel);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(0, 174, 239, 0.28);
  outline-offset: 2px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.icon-button:hover,
.nav-item:hover,
.ticket-card:hover,
.project-card:hover,
.customer-button:hover,
.doc-button:hover,
.mini-counter:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.1);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.danger-button:active,
.icon-button:active,
.nav-item:active,
.ticket-card:active,
.project-card:active,
.customer-button:active,
.doc-button:active,
.mini-counter:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
}

.primary-button {
  color: #fff;
  background: var(--brand);
}

.primary-button:hover {
  background: #004f91;
}

.secondary-button {
  color: var(--brand);
  background: rgba(0, 174, 239, 0.08);
  border-color: rgba(0, 96, 174, 0.22);
}

.ghost-button {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

.icon-button {
  width: 42px;
  padding: 0;
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
  display: inline-grid;
  place-items: center;
}

.icon-button > span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.icon-button > .icon,
.icon-button > span > .icon,
.nav-item > span:first-child > .icon {
  margin: auto;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  transition: grid-template-columns 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 84px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  padding: 22px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: hidden;
  transition: padding 280ms cubic-bezier(0.22, 1, 0.36, 1);
  contain: layout paint;
}

.sidebar .brand-block {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 42px;
  align-items: center;
  width: 100%;
}

.sidebar-toggle {
  margin-left: 0;
  justify-self: end;
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.mobile-theme-toggle {
  display: none;
}

.sidebar-toggle .icon {
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.app-shell.sidebar-collapsed .sidebar-toggle .icon {
  transform: rotate(180deg);
}

.app-shell.sidebar-collapsed .sidebar {
  padding-inline: 18px;
}

.app-shell.sidebar-collapsed .sidebar-label,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .user-card,
.app-shell.sidebar-collapsed #profileButton,
.app-shell.sidebar-collapsed #logoutButton {
  display: none;
  max-width: 0;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateX(-8px);
  overflow: hidden;
}

.app-shell.sidebar-collapsed .brand-block,
.app-shell.sidebar-collapsed .sidebar-actions {
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand-block {
  display: grid;
  grid-template-columns: 42px;
  justify-items: center;
  justify-content: center;
  gap: 0;
  min-height: 48px;
}

.app-shell.sidebar-collapsed .nav-item {
  width: 48px;
  height: 48px;
  justify-content: center;
  padding: 0;
}

.app-shell.sidebar-collapsed .nav-list {
  justify-items: center;
}

.app-shell.sidebar-collapsed .sidebar-actions {
  width: 100%;
}

.app-shell.sidebar-collapsed .sidebar .brand-mark,
.app-shell.sidebar-collapsed .sidebar .brand-logo {
  width: 0;
  opacity: 0;
  visibility: hidden;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  margin: 0 auto;
  justify-self: center;
}

.brand-block strong {
  display: block;
  margin-bottom: 2px;
}

.sidebar-label,
.nav-label,
.user-card,
#profileButton,
#logoutButton {
  max-width: 230px;
  max-height: 160px;
  transition: opacity 220ms ease, transform 260ms cubic-bezier(0.22, 1, 0.36, 1), max-width 260ms cubic-bezier(0.22, 1, 0.36, 1), max-height 260ms cubic-bezier(0.22, 1, 0.36, 1), visibility 260ms ease;
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  text-align: left;
  font-weight: 800;
}

.nav-item > span:first-child {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}

.app-shell.sidebar-collapsed .nav-item {
  grid-template-columns: 1fr;
  place-items: center;
}

.app-shell.sidebar-collapsed .nav-item > span:first-child {
  width: 48px;
  height: 48px;
}

.nav-item:hover,
.nav-item.active {
  color: var(--brand);
  background: rgba(0, 174, 239, 0.08);
  border-color: rgba(0, 96, 174, 0.16);
}

.sidebar-footer {
  display: grid;
  gap: 12px;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
}

.user-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.user-card-button {
  width: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.user-card strong,
.user-card span {
  display: block;
}

.user-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.main {
  min-width: 0;
  padding: 24px;
}

.customer-portal {
  min-height: 100vh;
  background: var(--page);
}

.customer-portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.customer-portal-header h1 {
  margin: 0;
}

.customer-portal-main {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions select {
  min-width: 230px;
}

.view {
  display: grid;
  gap: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.stat-card,
.panel,
.ticket-card,
.modal-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.05);
}

.stat-card {
  min-height: 112px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: 14px;
  overflow: visible;
}

.stat-button,
.mini-counter {
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
}

.stat-button {
  appearance: none;
}

.mini-counter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mini-counter {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.stat-card .stat-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  overflow: visible;
}

.stat-card strong {
  font-size: 1.7rem;
}

.stat-card small {
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.panel {
  padding: 16px;
}

.department-grid,
.integration-grid,
.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.department-row,
.integration-card,
.doc-card,
.customer-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-soft);
}

.department-row {
  display: grid;
  gap: 10px;
}

.department-heading,
.ticket-heading,
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-titlebar {
  margin-bottom: 14px;
}

.dept-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--brand);
}

.dept-consulting .dept-dot,
.badge.dept-consulting,
.employee-badge.dept-consulting,
.member-choice.dept-consulting,
select option.dept-consulting {
  background: #0060ae;
  color: #fff;
}

.dept-app .dept-dot,
.badge.dept-app,
.employee-badge.dept-app,
.member-choice.dept-app,
select option.dept-app {
  background: #d7263d;
  color: #fff;
}

.dept-network .dept-dot,
.badge.dept-network,
.employee-badge.dept-network,
.member-choice.dept-network,
select option.dept-network {
  background: #178c4f;
  color: #fff;
}

.dept-internal .dept-dot,
.badge.dept-internal,
.employee-badge.dept-internal,
.member-choice.dept-internal,
select option.dept-internal {
  background: #111827;
  border: 0;
  color: #fff;
}

/* QUBE66-Abteilungsfarben (Marke wird per BRAND-Umgebungsvariable gewählt) */
.dept-firewall .dept-dot,
.badge.dept-firewall,
.employee-badge.dept-firewall,
.member-choice.dept-firewall,
select option.dept-firewall {
  background: #f97316;
  color: #fff;
}

.dept-software .dept-dot,
.badge.dept-software,
.employee-badge.dept-software,
.member-choice.dept-software,
select option.dept-software {
  background: #008dcc;
  color: #fff;
}

.dept-media .dept-dot,
.badge.dept-media,
.employee-badge.dept-media,
.member-choice.dept-media,
select option.dept-media {
  background: #54a491;
  color: #fff;
}

select option[class^="dept-"],
select option[class*=" dept-"] {
  margin-block: 2px;
  padding: 8px 12px;
  border: 2px solid transparent;
  font-size: 0.88rem;
}

select option[class^="dept-"]:checked,
select option[class*=" dept-"]:checked,
select option[class^="dept-"]:hover,
select option[class*=" dept-"]:hover {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75);
}

.bar {
  height: 8px;
  overflow: hidden;
  background: rgba(102, 112, 133, 0.16);
  border-radius: 999px;
}

.bar progress {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  appearance: none;
  background: transparent;
}

.bar progress::-webkit-progress-bar {
  background: transparent;
}

.bar progress::-webkit-progress-value {
  background: var(--brand-bright);
}

.bar progress::-moz-progress-bar {
  background: var(--brand-bright);
}

.ticket-tools,
.filters,
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.75fr);
  gap: 16px;
}

.ticket-list {
  display: grid;
  gap: 12px;
  max-height: min(66vh, 760px);
  overflow: auto;
  padding-right: 4px;
}

.ticket-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  width: 100%;
}

.ticket-card.is-selected {
  border-color: var(--brand-bright);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.16);
}

.ticket-heading h3 {
  margin: 0;
}

.ticket-meta,
.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ticket-meta {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.8fr) minmax(160px, 0.8fr);
  gap: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.ticket-meta span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-right: 14px;
  margin-right: 14px;
  border-right: 1px solid var(--line);
}

.ticket-meta span:last-child {
  border-right: 0;
  margin-right: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
  flex: 0 0 auto;
}

.badge.status-open {
  background: var(--brand);
}

.badge.status-assigned {
  background: #4f46e5;
}

.badge.status-accepted {
  background: #0891b2;
}

.badge.status-in_progress {
  background: var(--warning);
}

.badge.status-waiting_customer {
  background: #7c3aed;
}

.badge.status-done {
  background: var(--success);
}

.badge.status-rejected {
  background: var(--danger);
}

.type-badge {
  background: #475467;
}

.badge.urgency-low {
  background: #64748b;
}

.badge.urgency-medium {
  background: var(--brand-bright);
}

.badge.urgency-high {
  background: var(--warning);
}

.badge.urgency-critical {
  background: var(--danger);
}

.detail-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
}

.history-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.history-item p {
  margin-bottom: 4px;
}

.history-item small,
.muted {
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 9, 20, 0.58);
  animation: modalBackdropIn 160ms ease both;
}

.modal-panel {
  width: min(100%, 760px);
  max-height: min(92vh, 900px);
  overflow: auto;
  scrollbar-gutter: stable;
  padding: 18px;
  animation: modalPanelIn 190ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal-backdrop.is-closing {
  animation: modalBackdropOut 180ms ease both;
}

.modal-backdrop.is-closing .modal-panel {
  animation: modalPanelOut 180ms ease both;
}

@keyframes modalBackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalBackdropOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes modalPanelIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalPanelOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

.modal-wide {
  width: min(100%, 1040px);
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 10px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: 360px;
  padding: 12px 14px;
  color: #fff;
  background: var(--toast-bg);
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-weight: 800;
  opacity: 0;
  pointer-events: auto;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.hiding {
  opacity: 0;
  transform: translateY(10px);
  transition-duration: 520ms;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.customer-list {
  display: grid;
  gap: 10px;
  max-height: min(66vh, 760px);
  overflow: auto;
  padding-right: 4px;
}

.customer-button,
.doc-button {
  width: 100%;
  color: var(--ink);
  text-align: left;
}

.checkbox-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.centered-checkbox {
  align-self: end;
  justify-content: center;
  min-height: 42px;
}

.ticket-detail-grid {
  align-items: end;
}

.ticket-detail-grid .maintenance-field,
.ticket-detail-grid .invoice-field,
.ticket-detail-grid .employee-field,
.form-grid .maintenance-field,
.form-grid .invoice-field,
.form-grid .employee-field {
  min-height: 67px;
}

.ticket-detail-grid .invoice-field,
.form-grid .invoice-field {
  align-self: start;
  min-height: 67px;
  padding: 25px 12px 0;
}

.ticket-detail-grid .maintenance-field,
.form-grid .maintenance-field,
.ticket-detail-grid .employee-field,
.form-grid .employee-field {
  align-self: start;
}

.ticket-detail-grid .employee-field {
  grid-column: span 2;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 auto;
}

.panel-soft-section {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

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

.zip-city-grid {
  grid-template-columns: minmax(120px, 0.38fr) minmax(240px, 1fr);
}

.customer-portal-access-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-level-section {
  padding: 0;
}

.service-level-details {
  padding: 12px;
}

.service-level-details summary {
  display: grid;
  grid-template-columns: minmax(130px, 0.5fr) minmax(220px, 1fr);
  align-items: end;
  gap: 12px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
  list-style: none;
  position: relative;
  padding-right: 28px;
}

.service-level-details summary::-webkit-details-marker {
  display: none;
}

.service-level-details summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 2px;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 160ms ease;
}

.service-level-details[open] summary::after {
  transform: translateY(-35%) rotate(225deg);
}

.service-level-select {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.service-level-select span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.service-level-select select {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
}

.service-level-grid {
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.code-block {
  white-space: pre-wrap;
  overflow: auto;
  max-height: 420px;
  padding: 12px;
  color: var(--ink);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.doc-preview {
  max-height: 62vh;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.doc-preview h2,
.doc-preview h3,
.doc-preview h4 {
  margin: 18px 0 8px;
}

.doc-preview h2:first-child,
.doc-preview h3:first-child {
  margin-top: 0;
}

.doc-preview p,
.doc-preview li {
  line-height: 1.55;
}

.doc-table-line {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.doc-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 12px 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.doc-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.doc-table th,
.doc-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.doc-table th {
  color: var(--brand);
  background: var(--panel-soft);
  font-weight: 800;
}

.doc-table td:last-child,
.doc-table th:last-child {
  border-right: 0;
}

.doc-table tbody tr:last-child td {
  border-bottom: 0;
}

.icon {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: 0 0 auto;
  overflow: visible;
}

.nowrap {
  white-space: nowrap;
}

.login-submit {
  width: 100%;
}

.dashboard-ticket-panel .ticket-list {
  margin-top: 6px;
}

.detail-section {
  margin-top: 18px;
}

.todo-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}

.todo-list {
  display: grid;
  gap: 8px;
}

.todo-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.todo-item p {
  margin-bottom: 2px;
}

.todo-item.is-done p {
  color: var(--muted);
  text-decoration: line-through;
}

.todo-check {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: transform 140ms ease, border-color 140ms ease, color 140ms ease;
}

.todo-check:hover {
  color: var(--brand-bright);
  border-color: var(--brand-bright);
  transform: translateY(-1px);
}

.todo-check:disabled {
  cursor: default;
  opacity: 0.7;
  transform: none;
}

.todo-delete {
  justify-self: end;
}

.change-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.worklog-grid {
  grid-template-columns: minmax(270px, 1.1fr) minmax(150px, 0.6fr) minmax(220px, 1.4fr);
  align-items: end;
}

.time-capture-field {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.time-capture-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.maintenance-plan {
  margin-top: -2px;
}

.maintenance-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wide-field {
  grid-column: span 2;
}

.field-hint {
  margin: 2px 0 0;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
}

.project-list {
  display: grid;
  gap: 12px;
  max-height: min(66vh, 760px);
  overflow: auto;
  padding-right: 4px;
}

.project-card {
  width: 100%;
  display: grid;
  gap: 12px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.project-card h3 {
  margin-bottom: 4px;
}

.project-tree ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.project-detail {
  display: grid;
  gap: 14px;
}

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

.project-ticket-list {
  margin-top: 12px;
}

.assigned-members,
.member-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assigned-members {
  margin-top: 4px;
}

.employee-badge,
.member-choice {
  color: #fff;
  border-radius: 7px;
  font-weight: 800;
}

.employee-badge {
  display: inline-block;
  width: min(100%, 560px);
  min-height: 32px;
  padding: 5px 10px;
  font-size: 0.82rem;
  max-width: 100%;
}

.employee-badge small,
.member-choice small {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.employee-badge strong,
.member-choice strong {
  white-space: nowrap;
}

.tag-separator {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.45);
}

.member-checkbox-grid {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.member-checkbox-grid legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.member-choice {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: min(100%, 560px);
  min-height: 38px;
  padding: 7px 9px;
  cursor: pointer;
  max-width: 100%;
  border: 2px solid transparent;
}

.member-choice:hover,
.member-choice.active,
.member-choice:focus-visible {
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.22);
}

.member-choice input {
  width: 16px;
  min-height: 16px;
}

.member-choice-text {
  display: grid;
  grid-template-columns: 150px auto 170px auto 130px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.password-input-field {
  grid-column: 1 / -1;
}

.password-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px auto;
  align-items: center;
  gap: 8px;
}

.employee-picker {
  display: grid;
  gap: 6px;
}

.employee-picker > span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.employee-picker-list {
  display: grid;
  gap: 7px;
  max-height: 244px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.employee-option {
  width: 100%;
  text-align: left;
}

.employee-option:not([class*="dept-"]) {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
}

.worklog-draft-list {
  display: grid;
  gap: 8px;
}

.worklog-draft {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.worklog-draft strong,
.worklog-draft small,
.worklog-draft p {
  display: block;
  margin: 0;
}

.worklog-draft small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.worklog-draft p {
  margin-top: 4px;
  color: var(--muted);
}

.worklog-capture-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  margin-bottom: 12px;
}

.worklog-capture-form {
  display: grid;
  grid-template-columns: 150px 140px minmax(260px, 1fr);
  gap: 12px;
  align-items: center;
}

.worklog-capture-form label {
  min-width: 0;
}

.worklog-capture-form .wide-field {
  grid-column: auto;
}

.worklog-minutes-field input {
  min-width: 0;
}

.worklog-billable-field {
  align-self: end;
  min-height: 52px;
  justify-content: center;
  padding: 0 6px;
}

.worklog-action-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.worklog-action-row > button {
  min-width: 180px;
  justify-content: center;
}

.time-capture-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.media-upload-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  gap: 12px;
  align-items: end;
}

.media-list {
  display: grid;
  gap: 10px;
}

.media-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.media-thumb {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 0;
  padding: 0;
  cursor: zoom-in;
  background: var(--panel-soft);
  overflow: hidden;
}

.media-item-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.media-file-link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.media-file-link:hover {
  text-decoration: underline;
}

.media-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 14, 24, 0.72);
  backdrop-filter: blur(3px);
}

.media-preview-panel {
  display: flex;
  flex-direction: column;
  width: min(1100px, 96vw);
  max-height: 92vh;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.media-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.media-preview-meta strong {
  display: block;
  word-break: break-word;
}

.media-preview-meta small {
  color: var(--muted);
}

.media-preview-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.media-preview-stage {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 14px;
  overflow: auto;
  background: var(--panel-soft);
}

.media-preview-content {
  max-width: 100%;
  max-height: 74vh;
  object-fit: contain;
  border-radius: 8px;
}

.media-preview-frame {
  width: 100%;
  height: 74vh;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

.media-preview-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-item a {
  color: var(--ink);
  text-decoration: none;
}

.media-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.danger-icon {
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   Arbeitszeiterfassung
   -------------------------------------------------------------------------- */

.worktime-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.worktime-user-picker {
  margin-bottom: 16px;
}

.worktime-user-picker select {
  width: 100%;
}

.worktime-account {
  border-width: 2px;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.worktime-balance {
  display: block;
  margin: 10px 0 2px;
  font-size: 2.6rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.worktime-percent {
  margin: 0 0 14px;
  color: var(--muted);
}

/* Ampelfarben des Stundenkontos:
   rot < -10 % <= orange < 0 % <= gruen < +20 % <= gelb */
.worktime-zone-critical {
  border-color: #dc2626;
  background: color-mix(in srgb, #dc2626 12%, var(--panel));
}

.worktime-zone-critical .worktime-balance { color: #b91c1c; }

.worktime-zone-warning {
  border-color: #f97316;
  background: color-mix(in srgb, #f97316 12%, var(--panel));
}

.worktime-zone-warning .worktime-balance { color: #ea580c; }

.worktime-zone-positive {
  border-color: #16a34a;
  background: color-mix(in srgb, #16a34a 12%, var(--panel));
}

.worktime-zone-positive .worktime-balance { color: #15803d; }

.worktime-zone-over {
  border-color: #eab308;
  background: color-mix(in srgb, #eab308 14%, var(--panel));
}

.worktime-zone-over .worktime-balance { color: #a16207; }

[data-theme="dark"] .worktime-zone-critical .worktime-balance { color: #f87171; }
[data-theme="dark"] .worktime-zone-warning .worktime-balance { color: #fb923c; }
[data-theme="dark"] .worktime-zone-positive .worktime-balance { color: #4ade80; }
[data-theme="dark"] .worktime-zone-over .worktime-balance { color: #facc15; }

.worktime-zone-badge {
  background: var(--panel-soft);
  color: var(--ink);
}

.worktime-gauge {
  margin-top: 4px;
}

.worktime-gauge-track {
  position: relative;
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: visible;
}

.worktime-gauge-segment {
  height: 100%;
  opacity: 0.9;
}

.worktime-gauge-segment:first-child { border-radius: 999px 0 0 999px; }
.worktime-gauge-segment:nth-last-child(2) { border-radius: 0 999px 999px 0; }
/* Skala -30 .. +30: Farbgrenzen liegen exakt auf den 10er-Schritten. */
.segment-critical { width: 33.333%; background: #dc2626; } /* -30 bis -10 */
.segment-warning { width: 16.667%; background: #f97316; }  /* -10 bis 0 */
.segment-positive { width: 16.667%; background: #16a34a; } /* 0 bis +10 */
.segment-over { width: 33.333%; background: #facc15; }     /* +10 bis +30 */

.worktime-gauge-marker {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--ink);
  box-shadow: 0 0 0 1.5px var(--panel);
  transform: translateX(-50%);
}

/* Beschriftung: sieben gleichmäßige Ticks, exakt unter den Skalenpunkten. */
.worktime-gauge-labels {
  position: relative;
  height: 16px;
  margin-top: 5px;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.worktime-gauge-labels span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.worktime-gauge-labels span:nth-child(1) { left: 0; transform: none; }
.worktime-gauge-labels span:nth-child(2) { left: 16.667%; }
.worktime-gauge-labels span:nth-child(3) { left: 33.333%; }
.worktime-gauge-labels span:nth-child(4) { left: 50%; }
.worktime-gauge-labels span:nth-child(5) { left: 66.667%; }
.worktime-gauge-labels span:nth-child(6) { left: 83.333%; }
.worktime-gauge-labels span:nth-child(7) { left: 100%; transform: translateX(-100%); }

@media (max-width: 560px) {
  /* Auf schmalen Bildschirmen nur -30, 0 und +30 beschriften (gleichmäßig). */
  .worktime-gauge-labels span:nth-child(2),
  .worktime-gauge-labels span:nth-child(3),
  .worktime-gauge-labels span:nth-child(5),
  .worktime-gauge-labels span:nth-child(6) {
    display: none;
  }
}

.worktime-account-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.worktime-account-facts > div {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.worktime-account-facts span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}

.worktime-timer-panel {
  margin-bottom: 16px;
}

.worktime-timer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin: 12px 0;
}

.worktime-timer-display {
  font-size: 2.2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.worktime-timer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.worktime-schedule-grid,
.worktime-manual-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.worktime-entry-list {
  display: grid;
  gap: 10px;
}

.worktime-entry {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.worktime-entry-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.worktime-entry-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.worktime-side {
  display: grid;
  gap: 16px;
  align-content: start;
}

.worktime-subheading {
  margin: 4px 0 0;
  font-size: 0.92rem;
}

/* Tags für die Eintragsliste */
.badge.tag-work {
  background: rgba(22, 163, 74, 0.16);
  color: #15803d;
}

.badge.tag-vacation {
  background: rgba(13, 148, 136, 0.16);
  color: #0f766e;
}

[data-theme="dark"] .badge.tag-work { color: #4ade80; }
[data-theme="dark"] .badge.tag-vacation { color: #2dd4bf; }

/* Urlaubs-Status */
.badge.vac-requested {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.badge.vac-approved {
  background: rgba(22, 163, 74, 0.16);
  color: #15803d;
}

.badge.vac-rejected {
  background: rgba(220, 38, 38, 0.14);
  color: #b91c1c;
}

[data-theme="dark"] .badge.vac-requested { color: #fbbf24; }
[data-theme="dark"] .badge.vac-approved { color: #4ade80; }
[data-theme="dark"] .badge.vac-rejected { color: #f87171; }

/* Firmenkalender */
.worktime-calendar-panel {
  margin-bottom: 16px;
}

/* Scrollbare Liste der Feier- und Brückentage */
.calendar-list {
  max-height: 420px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.calendar-day-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  font-size: 0.9rem;
}

.calendar-day-row + .calendar-day-row {
  border-top: 1px solid var(--line);
}

.calendar-day-date {
  flex: 0 0 auto;
  min-width: 128px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.calendar-day-label {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.calendar-day-row .badge {
  flex: 0 0 auto;
}

.calendar-day-row .icon-button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  flex: 0 0 auto;
}

.calendar-past-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

/* Umschalter Persoenlich/Verwaltung */
.worktime-view-toggle {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  /* Nur so breit wie nötig und mittig über dem Inhalt */
  justify-self: center;
  max-width: 100%;
  overflow-x: auto;
}

.worktime-view-toggle button {
  white-space: nowrap;
}

@media (max-width: 700px) {
  .worktime-view-toggle button {
    padding: 7px 11px;
    font-size: 0.85rem;
    gap: 6px;
  }
}

.worktime-view-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.worktime-view-toggle button:hover {
  color: var(--ink);
}

.worktime-view-toggle button.active {
  background: var(--brand);
  color: #fff;
}

.worktime-view-toggle .icon {
  width: 16px;
  height: 16px;
}

.badge.cal-holiday {
  background: rgba(2, 132, 199, 0.16);
  color: #0369a1;
}

.badge.cal-bridge {
  background: rgba(13, 148, 136, 0.16);
  color: #0f766e;
}

[data-theme="dark"] .badge.cal-holiday { color: #38bdf8; }
[data-theme="dark"] .badge.cal-bridge { color: #2dd4bf; }

.badge.tag-sick {
  background: rgba(139, 92, 246, 0.16);
  color: #6d28d9;
}

[data-theme="dark"] .badge.tag-sick { color: #a78bfa; }

/* Team-Übersicht für Führungskraefte */
.worktime-team-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.worktime-team-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) auto minmax(90px, auto) minmax(140px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.worktime-team-row:hover {
  border-color: var(--brand);
}

.worktime-team-row.is-selected {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--panel));
}

.worktime-team-name {
  display: grid;
}

.worktime-team-name small {
  color: var(--muted);
}

.worktime-team-balance {
  justify-self: end;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: var(--panel-soft);
}

.worktime-team-balance.worktime-zone-critical { background: rgba(220, 38, 38, 0.16); color: #b91c1c; }
.worktime-team-balance.worktime-zone-warning { background: rgba(249, 115, 22, 0.16); color: #ea580c; }
.worktime-team-balance.worktime-zone-positive { background: rgba(22, 163, 74, 0.16); color: #15803d; }
.worktime-team-balance.worktime-zone-over { background: rgba(234, 179, 8, 0.2); color: #a16207; }

[data-theme="dark"] .worktime-team-balance.worktime-zone-critical { color: #f87171; }
[data-theme="dark"] .worktime-team-balance.worktime-zone-warning { color: #fb923c; }
[data-theme="dark"] .worktime-team-balance.worktime-zone-positive { color: #4ade80; }
[data-theme="dark"] .worktime-team-balance.worktime-zone-over { color: #facc15; }

.worktime-team-vacation {
  justify-self: end;
  font-size: 0.86rem;
  color: var(--muted);
}

/* Export-Steuerung mit Monats-Umschalter */
.worktime-export {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.worktime-month-picker {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.worktime-month-picker strong {
  min-width: 122px;
  text-align: center;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.worktime-month-picker .icon-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
}

/* Dashboard-Widget */
.worktime-widget {
  margin-bottom: 16px;
  border-width: 2px;
}

.worktime-widget-row {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.worktime-widget-main {
  display: grid;
  min-width: 150px;
}

.worktime-widget-balance {
  font-size: 1.9rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.worktime-zone-critical .worktime-widget-balance { color: #b91c1c; }
.worktime-zone-warning .worktime-widget-balance { color: #ea580c; }
.worktime-zone-positive .worktime-widget-balance { color: #15803d; }
.worktime-zone-over .worktime-widget-balance { color: #a16207; }

[data-theme="dark"] .worktime-zone-critical .worktime-widget-balance { color: #f87171; }
[data-theme="dark"] .worktime-zone-warning .worktime-widget-balance { color: #fb923c; }
[data-theme="dark"] .worktime-zone-positive .worktime-widget-balance { color: #4ade80; }
[data-theme="dark"] .worktime-zone-over .worktime-widget-balance { color: #facc15; }

.worktime-widget-facts {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  flex: 1;
}

.worktime-widget-facts span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}



/* --------------------------------------------------------------------------
   Changelog-Popup
   -------------------------------------------------------------------------- */

.changelog-doc {
  display: grid;
  gap: 18px;
}

.changelog-release {
  position: relative;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  background: var(--panel-soft);
}

.changelog-release-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.changelog-version {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.changelog-date {
  color: var(--muted);
  font-size: 0.88rem;
}

.changelog-category {
  display: inline-block;
  margin: 12px 0 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.changelog-cat-new { background: rgba(22, 163, 74, 0.16); color: #15803d; }
.changelog-cat-fixed { background: rgba(234, 88, 12, 0.16); color: #c2410c; }
.changelog-cat-db { background: rgba(2, 132, 199, 0.16); color: #0369a1; }
.changelog-cat-improved { background: rgba(100, 116, 139, 0.18); color: #475569; }
.changelog-cat-default { background: var(--panel); color: var(--ink); }

[data-theme="dark"] .changelog-cat-new { color: #4ade80; }
[data-theme="dark"] .changelog-cat-fixed { color: #fb923c; }
[data-theme="dark"] .changelog-cat-db { color: #38bdf8; }
[data-theme="dark"] .changelog-cat-improved { color: #cbd5e1; }

.changelog-list {
  margin: 4px 0 8px;
  padding-left: 20px;
  display: grid;
  gap: 5px;
}

.changelog-list li {
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Bestaetigungsdialog (ersetzt window.confirm)
   -------------------------------------------------------------------------- */

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 14, 24, 0.66);
  backdrop-filter: blur(2px);
  animation: confirm-fade-in 0.16s ease-out;
}

.confirm-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 16px;
  width: min(440px, 94vw);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  animation: confirm-pop-in 0.18s ease-out;
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--muted);
}

.confirm-icon-danger {
  background: rgba(220, 38, 38, 0.14);
  color: #dc2626;
}

[data-theme="dark"] .confirm-icon-danger {
  color: #f87171;
}

.confirm-icon .icon {
  width: 22px;
  height: 22px;
}

.confirm-content h3 {
  margin: 2px 0 6px;
  font-size: 1.06rem;
}

.confirm-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.confirm-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@keyframes confirm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes confirm-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .confirm-backdrop,
  .confirm-panel {
    animation: none;
  }
}




.compact-button {
  width: fit-content;
  min-height: 34px;
  padding: 7px 10px;
}

.worklog-item {
  display: grid;
  gap: 10px;
}

.worklog-edit-form {
  display: grid;
  grid-template-columns: 110px auto minmax(180px, 1fr);
  gap: 10px;
  align-items: end;
}

.worklog-edit-form .modal-actions {
  grid-column: 1 / -1;
}

.status-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.status-check {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.status-check span {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-check-online span,
.server-status-online {
  color: var(--success);
}

.status-check-warn span,
.server-status-degraded {
  color: var(--warning);
}

.status-check-error span,
.server-status-offline {
  color: var(--danger);
}

.phase-add-form,
.task-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin: 10px 0 14px;
}

.phase-list {
  display: grid;
  gap: 12px;
}

.phase-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.phase-form textarea {
  min-height: 84px;
}

.compact-actions {
  justify-content: start;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}

.task-check {
  min-height: 42px;
  justify-content: center;
}

.task-done-row input[name="title"] {
  color: var(--muted);
  text-decoration: line-through;
}

.task-done {
  color: var(--muted);
  text-decoration: line-through;
}

.panel-soft-section {
  margin-top: 2px;
}

.equal-actions > button,
.equal-actions > a {
  min-width: 170px;
}

.inline-search {
  width: min(100%, 360px);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.inline-search input {
  min-width: 0;
}

.search-select {
  gap: 6px;
}

.select-search {
  min-height: 34px;
}

.reset-confirm {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.system-footnote {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 4px 2px;
}

.system-footnote span:not(:last-child)::after {
  content: "";
}

.user-admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-user-search {
  display: flex;
  margin-bottom: 12px;
}

.admin-user-search input {
  width: 100%;
}

/* Nutzerliste: scrollt bei vielen Konten; der Balken verdeckt dank
   scrollbar-gutter und Innenabstand keine Inhalte. */
.admin-user-list {
  display: grid;
  gap: 6px;
  max-height: min(62vh, 640px);
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding-right: 6px;
}

.admin-user-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms var(--ease-swift);
}

.admin-user-row:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
  transform: translateX(2px);
}

.admin-user-row.is-selected {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 7%, var(--panel));
  box-shadow: inset 3px 0 0 var(--brand);
}

.admin-user-row.is-disabled {
  opacity: 0.62;
}

.admin-user-ident {
  display: grid;
  min-width: 0;
}

.admin-user-ident strong,
.admin-user-ident small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-ident small {
  color: var(--muted);
}

.admin-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-detail-head h3 {
  margin: 0 0 2px;
}

.admin-detail-head p {
  margin: 0;
}

.admin-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.admin-fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.admin-fact-grid > div {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line);
  min-width: 0;
}

.admin-fact-grid span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-fact-grid strong {
  font-size: 1.02rem;
}

.role-presets-panel {
  grid-column: 1 / -1;
}

.role-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.role-checkboxes .checkbox-row {
  min-height: 36px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.role-checkboxes .checkbox-row:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
}

.role-checkboxes .checkbox-row:has(input:checked) {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 9%, var(--panel));
  font-weight: 700;
}

.user-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-stats {
  margin-top: 12px;
}

.top-actions {
  justify-content: start;
  margin-top: 0;
  margin-bottom: 12px;
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content-grid,
  .ticket-layout,
  .user-admin-grid {
    grid-template-columns: 1fr;
  }

  .role-presets-panel {
    grid-column: auto;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand-block {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 10px;
    width: 100%;
  }

  .mobile-theme-toggle {
    display: inline-flex;
  }

  .sidebar-toggle {
    margin-left: 0;
  }

  .app-shell:not(.sidebar-collapsed) .sidebar-toggle .icon {
    transform: rotate(90deg);
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 10px 14px;
    gap: 0;
  }

  .app-shell.sidebar-collapsed .brand-block {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    min-height: 42px;
    gap: 8px;
    justify-items: stretch;
  }

  .app-shell.sidebar-collapsed .nav-list,
  .app-shell.sidebar-collapsed .sidebar-footer,
  .app-shell.sidebar-collapsed .sidebar-label {
    display: none;
  }

  .app-shell.sidebar-collapsed .nav-label,
  .app-shell.sidebar-collapsed .user-card span,
  .app-shell.sidebar-collapsed .user-card strong {
    display: block;
  }

  .app-shell.sidebar-collapsed .sidebar .brand-mark {
    display: grid;
  }

  .app-shell.sidebar-collapsed .sidebar .brand-logo {
    display: block;
    width: 34px;
    height: 38px;
    opacity: 1;
    visibility: visible;
  }

  .app-shell.sidebar-collapsed .sidebar-toggle .icon {
    transform: rotate(0deg);
  }

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

  .sidebar-footer,
  .user-card,
  .sidebar-actions {
    width: 100%;
  }

  .sidebar-actions .icon-button {
    flex: 1 1 0;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions select {
    min-width: 0;
  }

  .ticket-tools,
  .filters,
  .form-grid,
  .customer-field-grid,
  .zip-city-grid,
  .customer-portal-access-grid,
  .service-level-grid,
  .project-form-grid,
  .todo-add-form,
  .phase-add-form,
  .task-add-form,
  .worklog-grid,
  .worklog-capture-form,
  .worklog-edit-form,
  .media-upload-form,
  .department-grid,
  .integration-grid,
  .doc-grid {
    grid-template-columns: 1fr;
  }

  .media-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .worktime-grid {
    grid-template-columns: 1fr;
  }

  .worktime-team-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .worktime-team-vacation,
  .worktime-team-balance {
    justify-self: start;
  }

  .worktime-balance {
    font-size: 2rem;
  }

  .media-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .media-preview-header {
    flex-direction: column;
  }

  .media-preview-actions {
    justify-content: flex-start;
  }

  .service-level-details summary,
  .task-row {
    grid-template-columns: 1fr;
  }

  .employee-badge,
  .member-choice-text {
    grid-template-columns: minmax(110px, 1fr) auto minmax(120px, 1fr) auto minmax(90px, 0.8fr);
  }

  .ticket-detail-grid .employee-field {
    grid-column: auto;
  }

  .password-control {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .password-control .secondary-button {
    grid-column: 1 / -1;
  }

  .wide-field {
    grid-column: auto;
  }

  .ticket-meta {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .ticket-meta span {
    border-right: 0;
    margin-right: 0;
    padding-right: 0;
  }
}

@media (max-width: 560px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .department-heading,
  .ticket-heading,
  .row-between {
    align-items: start;
    flex-direction: column;
  }
}

/* ==========================================================================
   ERP 1.0 – Design- & Motion-Layer
   Grundsätze: nur transform/opacity animieren (Compositor-freundlich),
   seriöse, kurze Bewegungen (150–500 ms), alles respektiert
   prefers-reduced-motion. Dieser Layer steht bewusst am Dateiende und
   verfeinert die Basiskomponenten.
   ========================================================================== */

/* --- Typografische Hierarchie ------------------------------------------- */

h1, h2, h3, h4 {
  letter-spacing: -0.015em;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}

[data-theme="dark"] .eyebrow {
  color: var(--brand-bright);
}

.panel h3 {
  font-size: 1.02rem;
}

.muted {
  color: var(--muted);
}

strong,
.stat-card strong,
.worktime-balance,
.worktime-timer-display {
  font-variant-numeric: tabular-nums;
}

/* --- Login: ruhige Aurora-Buehne + Glas-Panel ----------------------------- */

.login-view {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.login-view::before,
.login-view::after {
  content: '';
  position: absolute;
  z-index: -1;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}

.login-view::before {
  top: -180px;
  right: -120px;
  background: radial-gradient(circle at 30% 30%, var(--brand-bright), transparent 65%);
  animation: aurora-a 26s ease-in-out infinite alternate;
}

.login-view::after {
  bottom: -200px;
  left: -140px;
  background: radial-gradient(circle at 70% 70%, var(--brand), transparent 65%);
  animation: aurora-b 32s ease-in-out infinite alternate;
}

@keyframes aurora-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-70px, 60px, 0) scale(1.12); }
}

@keyframes aurora-b {
  from { transform: translate3d(0, 0, 0) scale(1.08); }
  to { transform: translate3d(60px, -50px, 0) scale(1); }
}

.login-panel {
  border-radius: var(--radius-lg);
  border-color: color-mix(in srgb, var(--line) 60%, transparent);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: rise-in 480ms var(--ease-swift) both;
}

.login-panel .brand-logo {
  animation: rise-in 560ms var(--ease-swift) 80ms both;
}

.login-submit {
  margin-top: 4px;
}

/* --- View-Wechsel: sanfter Auftritt mit Staffelung ------------------------ */

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view.view-anim > * {
  animation: rise-in 340ms var(--ease-swift) both;
}

.view.view-anim > *:nth-child(2) { animation-delay: 45ms; }
.view.view-anim > *:nth-child(3) { animation-delay: 90ms; }
.view.view-anim > *:nth-child(4) { animation-delay: 135ms; }
.view.view-anim > *:nth-child(5) { animation-delay: 180ms; }
.view.view-anim > *:nth-child(n+6) { animation-delay: 220ms; }

.view.view-anim .stats-grid > * {
  animation: rise-in 360ms var(--ease-swift) both;
}

.view.view-anim .stats-grid > *:nth-child(1) { animation-delay: 40ms; }
.view.view-anim .stats-grid > *:nth-child(2) { animation-delay: 80ms; }
.view.view-anim .stats-grid > *:nth-child(3) { animation-delay: 120ms; }
.view.view-anim .stats-grid > *:nth-child(4) { animation-delay: 160ms; }
.view.view-anim .stats-grid > *:nth-child(5) { animation-delay: 200ms; }
.view.view-anim .stats-grid > *:nth-child(6) { animation-delay: 240ms; }

/* --- Sidebar & Navigation -------------------------------------------------- */

.sidebar {
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 4%, var(--panel)), var(--panel) 240px);
}

.nav-item {
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand-bright), var(--brand));
  transform: scaleY(0);
  transition: transform 220ms var(--ease-swift);
}

.nav-item.active::before {
  transform: scaleY(1);
}

.nav-item .icon {
  transition: transform 200ms var(--ease-swift);
}

.nav-item:hover .icon {
  transform: translateX(2px) scale(1.06);
}

.sidebar-logo {
  transition: transform 260ms var(--ease-swift);
}

.brand-block:hover .sidebar-logo {
  transform: translateY(-2px) scale(1.04);
}

/* --- Topbar: schwebende Werkzeugleiste ------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding-top: 14px;
  padding-bottom: 14px;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

/* --- Panels & Karten -------------------------------------------------------- */

.panel,
.login-panel,
.stat-card,
.modal-panel,
.confirm-panel,
.media-preview-panel {
  border-radius: var(--radius);
}

.panel {
  box-shadow: var(--shadow-sm);
  transition: box-shadow 220ms ease, border-color 220ms ease;
}

.stat-card {
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-bright));
  opacity: 0;
  transition: opacity 220ms ease;
}

.stat-card:hover::before,
.stat-button:focus-visible::before {
  opacity: 1;
}

.stat-card strong {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.ticket-card,
.project-card,
.customer-button,
.doc-button,
.worktime-team-row {
  box-shadow: none;
  transition: transform 180ms var(--ease-swift), box-shadow 200ms ease, border-color 200ms ease, background-color 200ms ease;
}

.ticket-card:hover,
.project-card:hover,
.customer-button:hover,
.doc-button:hover {
  border-color: color-mix(in srgb, var(--brand) 38%, var(--line));
  box-shadow: var(--shadow-lift);
}

/* Lange Ticketlisten: Offscreen-Karten nicht layouten (grosser Perf-Gewinn) */
.ticket-list .ticket-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 190px;
}

/* --- Buttons ----------------------------------------------------------------- */

.primary-button {
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 62%, var(--brand-bright)));
}

.primary-button:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 88%, #000), var(--brand));
  box-shadow: var(--glow);
}

.danger-button:hover {
  box-shadow: 0 8px 22px color-mix(in srgb, var(--danger) 32%, transparent);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.ghost-button:focus-visible,
.danger-button:focus-visible,
.icon-button:focus-visible,
.nav-item:focus-visible {
  box-shadow: var(--focus-ring);
}

/* --- Formulare ----------------------------------------------------------------- */

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

input:hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--brand) 32%, var(--line));
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

label > span {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--muted);
}

/* --- Badges: praezise Micro-Typografie ---------------------------------------- */

.badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
}

/* --- Listenzeilen: ruhiges Hover-Feedback --------------------------------------- */

.customer-row,
.history-item,
.worktime-entry,
.todo-item,
.media-item,
.calendar-day-row {
  transition: background-color 160ms ease, border-color 160ms ease;
}

.history-item:hover,
.worktime-entry:hover,
.todo-item:hover,
.media-item:hover,
.calendar-day-row:hover {
  background: color-mix(in srgb, var(--brand) 4%, var(--panel));
}

.worktime-team-row:hover {
  transform: translateX(3px);
}

.worktime-team-row.is-selected {
  box-shadow: inset 3px 0 0 var(--brand);
}

/* --- Fortschritt & Stundenkonto -------------------------------------------------- */

.bar progress {
  transition: none;
}

.bar {
  position: relative;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
}

.bar progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--brand), var(--brand-bright));
  border-radius: 999px;
  transition: width 600ms var(--ease-swift);
}

.bar progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--brand), var(--brand-bright));
  border-radius: 999px;
}

.worktime-gauge-marker {
  transition: left 700ms var(--ease-swift);
}

.worktime-balance {
  animation: rise-in 420ms var(--ease-swift) both;
}

.worktime-account,
.worktime-widget {
  position: relative;
  overflow: hidden;
}

.worktime-account::after,
.worktime-widget::after {
  content: '';
  position: absolute;
  top: -60%;
  right: -18%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand-bright) 10%, transparent), transparent 70%);
  pointer-events: none;
}

/* --- Modals, Dialoge, Vorschau ----------------------------------------------------- */

.modal-backdrop,
.media-preview-backdrop,
.confirm-backdrop {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-panel,
.media-preview-panel {
  border-radius: var(--radius-lg);
  box-shadow: 0 32px 80px rgba(2, 12, 27, 0.45);
}

.modal-header .eyebrow {
  margin-bottom: 2px;
}

/* --- Toast: Statusmeldung mit Markenkante ------------------------------------------- */

.toast {
  border-left: 3px solid var(--brand-bright);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* --- Leere Zustaende ------------------------------------------------------------------ */

.empty-state {
  border: 1px dashed color-mix(in srgb, var(--muted) 34%, transparent);
  border-radius: var(--radius-sm);
  color: var(--muted);
}

/* --- Umschalter & Chips ----------------------------------------------------------------- */

.worktime-view-toggle button {
  transition: background-color 200ms ease, color 200ms ease, transform 160ms var(--ease-swift);
}

.worktime-view-toggle button:active {
  transform: scale(0.97);
}

.worktime-view-toggle {
  position: relative;
}

.worktime-view-toggle button {
  position: relative;
  z-index: 1;
}

/* Aktiver Button bleibt transparent - die gleitende Pill liefert den Hintergrund. */
.worktime-view-toggle button.active {
  background: transparent;
  color: #fff;
}

.worktime-toggle-pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--brand-bright)));
  box-shadow: var(--glow);
  /* Lange, weiche Ausklingkurve - gleitet statt zu springen. */
  transition: transform 480ms cubic-bezier(0.16, 1, 0.3, 1), width 480ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, width;
}

/* Inhaltswechsel: alter Inhalt blendet weich in Wechselrichtung aus (während
   die Daten laden), der neue gleitet von der Gegenseite ein. Die Hoehe wird
   währenddessen per min-height gehalten, damit nichts springt. */
.worktime-tab-content {
  display: grid;
  gap: 18px;
  transition: opacity 220ms ease, transform 220ms var(--ease-swift);
}

.worktime-tab-content.tab-exit-left {
  opacity: 0;
  transform: translateX(-20px);
  pointer-events: none;
}

.worktime-tab-content.tab-exit-right {
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
}

@keyframes tab-slide-right {
  from { opacity: 0; transform: translateX(26px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes tab-slide-left {
  from { opacity: 0; transform: translateX(-26px); }
  to { opacity: 1; transform: translateX(0); }
}

.worktime-tab-content.tab-enter-right {
  animation: tab-slide-right 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.worktime-tab-content.tab-enter-left {
  animation: tab-slide-left 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Beim Reiterwechsel keine zusätzliche Staffelanimation der Kinder */
.view.view-anim .worktime-tab-content > * {
  animation: none;
}

/* Der Inhalts-Host ist von der View-Staffelanimation ausgenommen - sonst
   würde rise-in nach dem Aufräumen der tab-enter-Klasse erneut starten
   und der Inhalt sichtbar "doppelt nachladen". Die :not()-Bedingungen lassen
   die eigentlichen Enter-Animationen unangetastet. */
.view.view-anim > .worktime-tab-content:not(.tab-enter-right):not(.tab-enter-left):not(.tab-enter-first) {
  animation: none;
}

/* Einmalige, sanfte Einblendung beim allerersten Aufbau des Tabs */
.worktime-tab-content.tab-enter-first {
  animation: rise-in 360ms var(--ease-swift) both;
}

/* --- Changelog-Release-Karten: Akzentkante ------------------------------------------------ */

.changelog-release {
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.changelog-release:hover {
  border-left-color: var(--brand-bright);
  box-shadow: var(--shadow-sm);
}

/* --- Reduzierte Bewegung: alles Wesentliche bleibt nutzbar -------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .login-view::before,
  .login-view::after {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* --- Kundenportal: Nav-Badge und Dashboard-Kachel ------------------------- */

.nav-count {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-bright), var(--brand));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.app-shell.sidebar-collapsed .nav-count {
  right: 4px;
  top: 6px;
  transform: none;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  font-size: 9px;
}

.portal-new-panel {
  border-left: 3px solid var(--brand);
}

.portal-new-panel h3 .badge {
  margin-left: 8px;
  vertical-align: 2px;
}

.portal-new-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.portal-new-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  background: var(--panel-soft, transparent);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
  color: inherit;
  transition: border-color 180ms var(--ease-swift), transform 180ms var(--ease-swift);
}

.portal-new-row:hover {
  border-color: var(--brand);
  transform: translateX(2px);
}

.portal-new-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

@media (max-width: 720px) {
  .portal-new-row {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .portal-new-row small {
    grid-column: 2;
  }
}

/* --- Bestätigungsdialog: Tipp-Bestätigung ---------------------------------- */

.confirm-verify {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.confirm-verify input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
}

.confirm-actions button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Nutzerverwaltung: Sonderrechte-Liste ---------------------------------- */

.perm-intro {
  margin: 2px 0 10px;
  font-size: 12.5px;
}

.perm-list {
  display: grid;
  gap: 8px;
}

.perm-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 180ms var(--ease-swift), background-color 180ms var(--ease-swift);
}

.perm-row:hover {
  border-color: var(--brand);
}

.perm-row input {
  margin-top: 2px;
}

.perm-row input[disabled] {
  cursor: not-allowed;
}

.perm-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.perm-text strong {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13.5px;
}

.perm-text small {
  color: var(--muted);
  line-height: 1.45;
}

.perm-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
  white-space: nowrap;
}

.perm-chip-locked {
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  color: var(--muted);
}

.perm-chip-effective {
  margin-right: 4px;
}

.admin-detail-effective {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

/* --- Fix-Paket: Eintragszeilen, Timer-Pause, Todos ------------------------- */

/* Eintragstitel tabellarisch ausgerichtet */
.worktime-entry-line {
  display: grid;
  grid-template-columns: 108px 136px minmax(0, 1fr) 96px auto;
  align-items: center;
  gap: 12px;
}

/* Tags nicht auf Spaltenbreite strecken - Pille passt sich dem Text an */
.worktime-entry-line .badge {
  width: max-content;
  white-space: nowrap;
  justify-self: start;
}

.worktime-entry-line .entry-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.worktime-entry-line .entry-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.worktime-entry-line .entry-minutes { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.worktime-entry-line .entry-source { justify-self: end; }

@media (max-width: 760px) {
  .worktime-entry-line { display: flex; flex-wrap: wrap; gap: 8px 12px; }
  .worktime-entry-line .entry-minutes { text-align: left; }
}

/* Notizzeile mit mehr Luft */
.worktime-entry-note {
  margin-top: 8px;
  line-height: 1.65;
}

/* Pausen-Badge: neutral statt Signalfarbe */
.timer-badge-paused {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

/* Timer-Notizfeld */
.worktime-timer-note { margin-top: 10px; display: block; }

/* Todos: echte Checkbox + Durchstreichen sofort beim Anhaken */
.todo-checkbox-label { display: inline-flex; align-items: center; padding: 4px; cursor: pointer; }
.todo-checkbox-label input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.todo-item.is-done p {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  color: var(--muted);
}

/* ArbZG-Hinweise an Eintraegen */
.labor-notice {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #b45309;
}
.labor-notice .icon { width: 14px; height: 14px; flex: none; }

/* Kundenbewertung (Portal + intern) */
.ticket-rating {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}
.ticket-rating .stars { font-size: 20px; letter-spacing: 2px; color: #f59e0b; }
.star-button {
  background: none;
  border: none;
  font-size: 22px;
  color: #f59e0b;
  cursor: pointer;
  padding: 0 2px;
  transition: transform 120ms var(--ease-swift, ease);
}
.star-button:hover { transform: scale(1.25); }
.ticket-feedback .stars { font-size: 18px; color: #f59e0b; letter-spacing: 2px; }

/* SLA-Countdown */
.sla-badge { font-variant-numeric: tabular-nums; }
.sla-ok { background: color-mix(in srgb, #15803d 14%, transparent); color: #15803d; }
.sla-warn { background: color-mix(in srgb, #b45309 16%, transparent); color: #b45309; }
.sla-over { background: color-mix(in srgb, #b91c1c 16%, transparent); color: #b91c1c; }

/* --- Team-Kalender ---------------------------------------------------------- */

.teamcal-scroll { overflow-x: auto; margin-top: 12px; scrollbar-gutter: stable; }

.teamcal-grid {
  display: grid;
  gap: 2px;
  min-width: 720px;
}

.teamcal-name {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.teamcal-name.is-self { color: var(--brand); }
.teamcal-head-corner { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.teamcal-cell {
  min-height: 30px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--muted) 7%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.teamcal-head { font-variant-numeric: tabular-nums; }
.teamcal-head small { color: var(--muted); font-size: 9.5px; }

.teamcal-cell.is-weekend { background: color-mix(in srgb, var(--muted) 16%, transparent); }
.teamcal-cell.is-holiday { background: color-mix(in srgb, #6b7280 30%, transparent); }
.teamcal-cell.is-bridge { background: color-mix(in srgb, #6b7280 20%, transparent); }
.teamcal-cell.is-today { outline: 2px solid var(--brand); outline-offset: -2px; }

.teamcal-cell.cal-vacation { background: color-mix(in srgb, #2563eb 55%, transparent); }
.teamcal-cell.cal-sick { background: color-mix(in srgb, #dc2626 50%, transparent); }
.teamcal-cell.cal-absent { background: color-mix(in srgb, #64748b 55%, transparent); }

.teamcal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.teamcal-legend i {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  vertical-align: -2px;
  margin-right: 5px;
}
.teamcal-legend .cal-vacation { background: color-mix(in srgb, #2563eb 55%, transparent); }
.teamcal-legend .cal-sick { background: color-mix(in srgb, #dc2626 50%, transparent); }
.teamcal-legend .cal-absent { background: color-mix(in srgb, #64748b 55%, transparent); }
.teamcal-legend .is-holiday { background: color-mix(in srgb, #6b7280 30%, transparent); }
.teamcal-legend .is-bridge { background: color-mix(in srgb, #6b7280 20%, transparent); }
.teamcal-legend .is-weekend { background: color-mix(in srgb, var(--muted) 16%, transparent); }
