  .module-schichtplanung, .module-schichtplanung *, .module-schichtplanung *::before, .module-schichtplanung *::after { box-sizing: border-box; margin: 0; padding: 0; }

  .module-schichtplanung {
    --bg: var(--bg-surface);
    --surface: var(--bg-surface);
    --surface2: var(--bg-surface-alt);
    --surface3: var(--bg-surface-alt);
    --border: var(--border-default);
    --text: var(--text-primary);
    --text2: var(--text-secondary);
    --text3: var(--text-tertiary);
    --accent: #4f46e5;
    --accent-soft: #e0e7ff;
    --danger: var(--signal-red, #dc2626);
    --danger-soft: var(--signal-red-light, #fee2e2);
    --ok: var(--signal-green, #16a34a);
    --tab: linear-gradient(180deg, var(--bg-surface-alt) 0%, var(--bg-surface-hover) 100%);
    --tab-active: var(--bg-surface);
    --shadow: var(--shadow-md);
    --day-weekday-bg: #f6f8fb;
    --day-sat-bg: #edf3df;
    --day-sun-bg: #feb13e;
    --day-today-bg: #d9e9ff;
    --day-weekday-text: #223144;
    --day-sat-text: #445131;
    --day-sun-text: #6a3600;
    --day-today-text: #4f46e5;
    --cell-sat-bg: #f5f8ee;
    --cell-sat-alt-bg: #edf3e2;
    --cell-sun-bg: #fff4df;
    --cell-sun-alt-bg: #ffedd1;
    --cell-today-bg: #edf4ff;
    --cell-today-alt-bg: #e4eeff;
    --divider-sat-bg: #eef4e2;
    --divider-sun-bg: #feefd3;
    --shift-summary-width: 132px;
    --legend-space: 58px;
  }

  .module-schichtplanung {
    height: 100%;
    font-family: var(--font-family-base);
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg) 100%);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    user-select: none;
  }

  .module-schichtplanung[data-tool="paint"] .shift-cell { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23111' d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zm2.92 2.33H5v-.92l8.06-8.06.92.92-8.06 8.06z'/%3E%3Cpath fill='%23444' d='M20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/%3E%3C/svg%3E") 2 22, crosshair; }
  .module-schichtplanung[data-tool="move"] .shift-cell { cursor: grab; }
  .module-schichtplanung[data-tool="erase"] .shift-cell { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Crect x='7.5' y='2' width='5' height='1.5' rx='0.75' fill='%23ef4444'/%3E%3Crect x='3' y='4' width='14' height='2' rx='1' fill='%23ef4444'/%3E%3Crect x='4.5' y='7' width='11' height='11' rx='1.5' fill='%23ef4444'/%3E%3Crect x='8' y='9' width='1' height='7' rx='0.5' fill='rgba(255,255,255,0.45)'/%3E%3Crect x='11' y='9' width='1' height='7' rx='0.5' fill='rgba(255,255,255,0.45)'/%3E%3C/svg%3E") 10 5, cell; }
  .shift-btn.paint-active {
    outline: 2px solid #fff;
    outline-offset: -2px;
    box-shadow: 0 0 0 3px rgba(79,70,229,.7);
    z-index: 1;
    position: relative;
  }
  .module-schichtplanung[data-tool="paint"] .shift-cell.paint-hover {
    outline: 2px solid #4f46e5;
    outline-offset: -2px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
    z-index: 8;
  }
  #shiftCursorTip {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    display: none;
    align-items: center;
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    transform: translate(14px, 2px);
  }

  .module-schichtplanung .sp-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  /* ── Topbar / Ribbon ─────────────────────────────────────── */

  .topbar {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
  }

  /* Title bar */
  .ribbon-title {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 5px 14px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid #020617;
    flex-shrink: 0;
  }

  .ribbon-menu-tabs {
    display: flex;
    align-items: flex-end;
    gap: 1px;
    padding: 0 10px;
    min-height: 30px;
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-surface-alt) 100%);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
    position: relative;
  }

  .ribbon-menu-tab {
    margin-top: 4px;
    height: 26px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-1);
    font-weight: 600;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
    position: relative;
    top: 1px;
  }

  .ribbon-menu-tab:hover {
    background: rgba(255,255,255,.62);
    border-color: var(--border-default);
  }

  .ribbon-menu-tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-default);
    box-shadow: 0 -1px 0 var(--bg-surface) inset;
    z-index: 2;
  }

  .ribbon-menu-tab.active::after {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    bottom: -1px;
    height: 2px;
    background: var(--bg-surface);
  }

  .app-logo {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: var(--font-size-2);
    font-weight: var(--font-weight-bold);
    letter-spacing: -.1px;
    color: var(--border-default);
  }

  .app-logo-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4f46e5;
    box-shadow: 0 0 8px rgba(79,70,229,.55);
  }

  .spacer { flex: 1; }

  /* Language switcher */
  .lang-switcher {
    position: relative;
    margin-right: 10px;
  }
  .lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px 3px 8px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.1);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--font-size-2);
    line-height: 1;
    transition: background .15s;
  }
  .lang-trigger:hover,
  .lang-trigger.open {
    background: rgba(255,255,255,.2);
  }
  .lang-trigger .lang-flag {
    font-size: var(--font-size-3);
    line-height: 1;
  }
  .lang-trigger .lang-caret {
    font-size: var(--font-size-3)!important;
    line-height: 1;
    color: rgba(220,233,249,.85);
  }
  .lang-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 150px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    display: none;
    z-index: 1000;
  }
  .lang-menu.open {
    display: block;
  }
  .lang-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: none;
    background: transparent;
    color: inherit;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--font-size-2);
    text-align: left;
  }
  .lang-item:hover {
    background: var(--bg-surface-alt);
  }
  .lang-item.active {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
  }
  .lang-item .lang-flag {
    font-size: var(--font-size-3);
    line-height: 1;
  }

  /* Mode switch in title bar */
  .mode-switch {
    display: flex;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 6px;
    padding: 2px;
    gap: 1px;
  }

  .mode-btn {
    padding: 4px 13px;
    border: none;
    background: transparent;
    color: rgba(220,233,249,.75);
    font-size: var(--font-size-1);
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all .15s;
    white-space: nowrap;
  }

  .mode-btn.active {
    background: rgba(255,255,255,.2);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
  }

  .mode-btn:hover:not(.active) {
    background: rgba(255,255,255,.1);
    color: #fff;
  }

  /* Ribbon bar */
  .ribbon-bar {
    display: flex;
    align-items: stretch;
    padding: 5px 10px 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    min-height: 62px;
    gap: 0;
  }

  .topbar[data-ribbon-tab="home"] [data-ribbon-panel]:not([data-ribbon-panel="home"]),
  .topbar[data-ribbon-tab="insert"] [data-ribbon-panel]:not([data-ribbon-panel="insert"]),
  .topbar[data-ribbon-tab="view"] [data-ribbon-panel]:not([data-ribbon-panel="view"]) {
    display: none;
  }

  .ribbon-group {
    display: flex;
    flex-direction: column;
    padding: 0 6px;
    min-width: 0;
  }

  .ribbon-group-btns {
    display: flex;
    align-items: center;
    gap: 1px;
    flex: 1;
    padding-bottom: 3px;
  }

  .ribbon-group-name {
    font-size: var(--font-size-0);
    color: var(--text-tertiary);
    text-align: center;
    font-weight: 500;
    padding: 3px 4px 4px;
    letter-spacing: .2px;
    border-top: 1px solid var(--border-default);
    margin-top: auto;
    white-space: nowrap;
  }

  .ribbon-vsep {
    width: 1px;
    background: var(--border-default);
    margin: 6px 2px;
    flex-shrink: 0;
  }

  /* Ribbon buttons */
  .rb-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 50px;
    padding: 5px 7px 4px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    transition: background .12s, border-color .12s;
    flex-shrink: 0;
  }

  .rb-icon {
    font-size: var(--font-size-4);
    line-height: 1;
    display: block;
  }

  .rb-lbl {
    font-size: var(--font-size-0);
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: .05px;
  }

  .rb-btn:hover:not(:disabled) {
    background: var(--bg-surface-hover);
    border-color: var(--border-strong);
  }

  .rb-btn:active:not(:disabled) {
    background: var(--bg-surface-hover);
  }

  .rb-btn:disabled {
    opacity: .36;
    cursor: default;
  }

  .rb-btn.rb-primary {
    background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
    border-color: #1e50c8;
    color: #fff;
  }

  .rb-btn.rb-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #6366f1 0%, #4338ca 100%);
    border-color: #1a44b0;
  }

  .rb-btn.rb-danger { color: var(--signal-red-deep, #a03535); }

  .rb-btn.rb-danger:hover:not(:disabled) {
    background: var(--signal-red-light, #fee2e2);
    border-color: var(--signal-red-border, #e8a2a2);
  }

  /* Year picker inside ribbon */
  .year-picker {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
  }

  .year-picker label {
    font-size: var(--font-size-0);
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-tertiary);
    font-weight: var(--font-weight-bold);
  }

  .year-select {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: var(--font-size-2);
    font-weight: 600;
    outline: none;
    min-width: 80px;
  }

  .year-select option { background: var(--bg-surface); color: var(--text-primary); }
  .year-select option:checked { color: var(--text-primary); font-weight: var(--font-weight-bold); }

  /* Zoom control inside ribbon */
  .zoom-ctrl {
    display: flex;
    align-items: center;
    gap: 3px;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    padding: 3px 5px;
  }

  .nav-btn {
    width: 22px;
    height: 22px;
    border-radius: 3px;
    background: transparent;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: var(--font-size-3);
    font-weight: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s;
  }

  .nav-btn:hover:not(:disabled) { background: var(--bg-surface-hover); }
  .nav-btn:disabled { opacity: .35; cursor: default; }

  .zoom-lbl {
    min-width: 34px;
    text-align: center;
    color: var(--text2);
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
  }

  .rb-btn.rb-zoom-reset {
    min-width: 58px;
  }

  .sep { display: none; }

  .action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 7px;
    font-size: var(--font-size-1);
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-surface-alt) 100%);
    color: var(--text2);
    white-space: nowrap;
    transition: all .15s;
  }

  .action-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
  }

  .action-btn.primary {
    background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
    border-color: #4f46e5;
    color: #fff;
  }

  .action-btn.primary:hover { background: linear-gradient(180deg, #6366f1 0%, #4338ca 100%); }

  .action-btn:disabled {
    opacity: .45;
    cursor: default;
    filter: grayscale(.12);
  }

  /* ── Tabs ─────────────────────────────────────────────────── */

  .tabs-stack {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--bg-surface-alt);
  }

  .tab-row {
    display: flex;
    align-items: flex-end;
    min-width: 0;
    border-bottom: 1px solid var(--border-strong);
    background: var(--bg-surface-alt);
    padding: 0 10px;
    gap: 0;
    position: relative;
    --tab-connect-bg: var(--bg-surface);
  }

  .month-tabs-row {
    --tab-connect-bg: var(--bg-surface-alt);
  }

  .version-tabs-row {
    --tab-connect-bg: var(--bg-surface);
  }

  .tab-label {
    flex-shrink: 0;
    font-size: var(--font-size-0);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    font-weight: var(--font-weight-bold);
    padding: 0 10px 6px 2px;
    align-self: flex-end;
  }

  .tab-scroller {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px 0 0;
    flex: 1;
    min-width: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .tab-scroller::-webkit-scrollbar { display: none; }

  .month-tab,
  .version-tab {
    border: 1px solid var(--border-strong);
    border-bottom: none;
    background: linear-gradient(180deg, var(--bg-surface-alt) 0%, var(--bg-surface-hover) 100%);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .12s, color .12s, box-shadow .12s;
    white-space: nowrap;
    position: relative;
    top: 1px;
    border-radius: 3px 3px 0 0;
  }

  .month-tab {
    padding: 6px 11px;
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .month-tab.active,
  .version-tab.active {
    background: var(--bg-surface);
    border-color: var(--border-default);
    color: var(--text-primary);
    box-shadow: inset 0 2px 0 var(--accent);
    z-index: 2;
    font-weight: var(--font-weight-bold);
  }

  .month-tab.active::after,
  .version-tab.active::after {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    bottom: -1px;
    height: 2px;
    background: var(--tab-connect-bg, var(--bg-surface));
  }

  .month-tab:hover:not(.active),
  .version-tab:hover:not(.active) {
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-surface-alt) 100%);
    color: var(--text-primary);
  }

  .version-tab {
    padding: 6px 10px;
    border-radius: 4px 4px 0 0;
    font-size: var(--font-size-1);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
  }

  .version-tab.add-tab {
    min-width: 28px;
    justify-content: center;
    font-size: var(--font-size-2);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    color: #4f46e5;
    padding: 4px 10px 6px;
  }

  .version-tab.add-tab:hover {
    color: #4338ca;
  }

  .version-tab:disabled {
    opacity: .5;
    cursor: default;
    filter: grayscale(.1);
  }

  .month-tab-count {
    min-width: 16px;
    height: 16px;
    border-radius: 4px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
    background: rgba(79,70,229,.14);
    color: #4f46e5;
  }

  .version-tab-wrap {
    position: relative;
    display: inline-flex;
    align-items: stretch;
  }

  .version-tab-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .version-tab-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 999px;
    background: rgba(68,87,111,.12);
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: var(--font-size-1);
    line-height: 1;
    opacity: 0;
    transition: all .15s;
  }

  .version-tab-wrap:hover .version-tab-delete,
  .version-tab-wrap .version-tab.active + .version-tab-delete,
  .version-tab-wrap .version-tab-delete:focus-visible {
    opacity: 1;
  }

  .version-tab-delete:hover {
    background: rgba(190, 50, 50, 0.15);
    color: var(--signal-red-deep, #a03535);
  }

  .toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 20px;
    background: var(--bg-surface-alt);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    transition: opacity .2s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
  }

  .toolbar.disabled {
    opacity: .35;
    pointer-events: none;
  }

  .toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .toolbar-label {
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text3);
  }

  .toolbar-no-shifts {
    font-size: var(--font-size-1);
    color: var(--text3);
    font-style: italic;
  }

  .tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-surface-alt) 100%);
    color: var(--text2);
    cursor: pointer;
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    transition: all .15s;
  }

  .tool-btn:hover {
    color: var(--text);
    background: var(--bg-surface-hover);
  }

  .tool-btn.active {
    color: #fff;
    border-color: #4f46e5;
    background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  }

  .tool-ic {
    width: 16px;
    text-align: center;
    font-size: var(--font-size-2);
  }

  .shift-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .12s;
    letter-spacing: .3px;
  }

  .shift-btn:hover {
    filter: brightness(1.08);
    box-shadow: 0 8px 14px -12px rgba(18, 40, 60, .42);
  }

  .shift-btn.undefined-shift {
    border-style: dashed;
    border-color: rgba(133, 77, 14, .45);
  }

  .erase-tool-btn {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .12s;
    background: var(--bg-surface-alt);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .erase-tool-btn:hover {
    background: var(--bg-surface-hover);
    border-color: rgba(0,0,0,.08);
  }
  .erase-tool-btn.paint-active {
    outline: 2px solid #fff;
    outline-offset: -2px;
    box-shadow: 0 0 0 3px rgba(79,70,229,.7);
    z-index: 1;
    position: relative;
  }

  .view-banner {
    background: rgba(79,70,229,.08);
    border-bottom: 1px solid var(--border);
    padding: 8px 20px;
    font-size: var(--font-size-1);
    color: var(--text2);
    display: none;
    flex-shrink: 0;
  }

  .view-banner.shown { display: block; }
  .view-banner b { color: var(--accent); }

  .view-banner.warn-banner {
    background: #fff1cc;
    border-bottom: 1px solid #e7c77a;
    color: #664200;
  }

  .view-banner.warn-banner b {
    color: #a65d00;
  }

  .version-toast {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 140;
    opacity: 0;
    transition: opacity .24s ease;
  }

  .version-toast.show {
    opacity: 1;
  }

  .version-toast-card {
    min-width: 270px;
    max-width: min(90vw, 480px);
    text-align: center;
    background: rgba(255,255,255,.98);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 18px 24px;
    transform: translateY(12px) scale(.95);
    transition: transform .24s ease;
  }

  .version-toast.show .version-toast-card {
    transform: translateY(0) scale(1);
  }

  .version-toast-month {
    font-size: var(--font-size-3);
    font-weight: var(--font-weight-bold);
    color: var(--text);
    letter-spacing: .2px;
  }

  .version-toast-name {
    margin-top: 6px;
    font-size: var(--font-size-3);
    color: var(--text2);
  }

  .grid-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
    padding-bottom: 4px;
    margin-bottom: 0;
  }

  .grid-edge-shadow {
    position: fixed;
    pointer-events: none;
    opacity: 0;
    transition: opacity .14s ease;
    z-index: 44;
  }

  .grid-edge-shadow.left {
    top: var(--edge-top-anchor, 0px);
    left: var(--edge-left-anchor, 0px);
    width: 18px;
    height: var(--edge-region-height, 0px);
    background: linear-gradient(to right, rgba(0,0,0,.42), rgba(0,0,0,0));
  }

  .grid-edge-shadow.right {
    top: var(--edge-top-anchor, 0px);
    right: var(--edge-right-anchor, 0px);
    width: 18px;
    height: var(--edge-region-height, 0px);
    background: linear-gradient(to left, rgba(0,0,0,.42), rgba(0,0,0,0));
  }

  .grid-edge-shadow.top {
    left: var(--edge-left-anchor, 0px);
    width: var(--edge-region-width, 0px);
    top: var(--edge-top-anchor, 0px);
    height: 16px;
    background: linear-gradient(to bottom, rgba(0,0,0,.36), rgba(0,0,0,0));
  }

  .grid-edge-shadow.bottom {
    left: var(--edge-left-anchor, 0px);
    width: var(--edge-region-width, 0px);
    bottom: var(--edge-bottom-anchor, 0px);
    height: 16px;
    background: linear-gradient(to top, rgba(0,0,0,.36), rgba(0,0,0,0));
  }

  .grid-wrapper.shadow-left .grid-edge-shadow.left {
    opacity: 1;
  }

  .grid-wrapper.shadow-right .grid-edge-shadow.right {
    opacity: 1;
  }

  .grid-wrapper.shadow-top .grid-edge-shadow.top {
    opacity: 1;
  }

  .grid-wrapper.shadow-bottom .grid-edge-shadow.bottom {
    opacity: 1;
  }

  .grid {
    display: grid;
    min-width: max-content;
    position: relative;
  }

  .cell-corner {
    position: sticky;
    left: 0;
    top: 18px;
    z-index: 25;
    background: var(--surface);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    min-width: 220px;
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    justify-content: flex-end;
    gap: 0;
  }

  .corner-label {
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-primary);
    text-align: right;
    width: 100%;
  }

  .add-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: var(--font-size-3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: all .15s;
    line-height: 1;
  }

  .add-btn:hover {
    background: #5254e8;
    transform: scale(1.08);
  }

  .add-btn:disabled {
    opacity: .3;
    cursor: default;
    transform: none;
  }

  .day-header {
    width: 44px;
    height: 50px;
    background: var(--day-weekday-bg);
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    position: sticky;
    top: 18px;
    z-index: 10;
    color: var(--day-weekday-text);
  }

  .day-header.sat {
    background: var(--day-sat-bg);
    color: var(--day-sat-text);
  }

  .day-header.sun {
    background: var(--day-sun-bg);
    color: var(--day-sun-text);
  }

  .day-header.today {
    background: var(--day-today-bg);
    color: var(--day-today-text);
    box-shadow: inset 0 -2px 0 #4338ca;
  }

  .day-header.today.sat {
    background: var(--day-sat-bg);
    color: var(--day-sat-text);
  }

  .day-header.today.sun {
    background: var(--day-sun-bg);
    color: var(--day-sun-text);
  }

  .day-num {
    font-size: var(--font-size-2);
    font-weight: var(--font-weight-bold);
    color: inherit;
    line-height: 1;
  }

  .day-name {
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: .5px;
    color: inherit;
    opacity: .72;
  }

  .day-header.today .day-name,
  .day-header.today .day-num {
    color: inherit;
  }

  .kw-corner {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 24;
    background: var(--surface);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    min-width: 220px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 10px;
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-primary);
  }

  .kw-cell {
    width: 44px;
    height: 18px;
    background: var(--day-weekday-bg);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
    color: var(--day-weekday-text);
    letter-spacing: .2px;
  }

  .kw-cell.sat {
    background: var(--day-sat-bg);
    color: var(--day-sat-text);
  }

  .kw-cell.sun {
    background: var(--day-sun-bg);
    color: var(--day-sun-text);
  }

  .kw-cell.today {
    background: var(--day-today-bg);
    color: var(--day-today-text);
    box-shadow: inset 0 -2px 0 #4338ca;
  }

  .kw-cell.today.sat {
    background: var(--day-sat-bg);
    color: var(--day-sat-text);
  }

  .kw-cell.today.sun {
    background: var(--day-sun-bg);
    color: var(--day-sun-text);
  }

  .week-corner {
    position: sticky;
    left: 0;
    top: 68px;
    z-index: 23;
    background: var(--surface2);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    min-width: 220px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 10px;
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-primary);
  }

  .week-cell {
    width: 44px;
    height: 18px;
    background: var(--surface2);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 68px;
    z-index: 9;
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    letter-spacing: .2px;
  }

  .week-cell.sat,
  .week-cell.sun,
  .week-cell.today,
  .week-cell.today.sat,
  .week-cell.today.sun {
    background: var(--surface2);
    color: var(--text-primary);
    box-shadow: none;
  }

  .day-header.axis-selected::after {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: -18px;
    height: 68px;
    border: 2px solid rgba(79,70,229,.62);
    background: rgba(79,70,229,.10);
    pointer-events: none;
    z-index: 0;
  }

  .day-header.axis-selected {
    z-index: 12;
  }

  .day-header.axis-selected .day-num,
  .day-header.axis-selected .day-name {
    position: relative;
    z-index: 1;
  }

  .hours-header {
    width: 84px;
    height: 86px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 15;
  }

  .shift-hours-header {
    width: var(--shift-summary-width);
    height: 86px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 15;
  }

  .hours-header .h-top,
  .shift-hours-header .h-top {
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    color: var(--text);
    letter-spacing: .5px;
    text-transform: uppercase;
  }

  .hours-header .h-sub,
  .shift-hours-header .h-sub {
    font-size: var(--font-size-0);
    color: var(--text3);
    margin-top: 1px;
  }

  .section-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: 32px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    left: 0;
  }

  .section-row.collapsed {
    border-bottom-style: dashed;
  }

  .section-toggle {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-surface);
    color: var(--text2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: var(--font-size-3);
    font-weight: normal;
    line-height: 1;
  }

  .section-toggle:hover {
    color: var(--text);
    border-color: var(--accent-soft);
  }

  .section-stripe {
    width: 3px;
    height: 16px;
    border-radius: 99px;
    flex-shrink: 0;
  }

  .section-name {
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: .9px;
    cursor: text;
  }

  .section-count {
    font-size: var(--font-size-0);
    color: var(--text2);
  }

  .section-add {
    margin-left: auto;
    position: relative;
  }

  .section-add-btn {
    font-size: var(--font-size-1);
    font-weight: 600;
    color: var(--text2);
    cursor: pointer;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    transition: all .12s;
  }

  .section-add-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
  }

  .section-del {
    font-size: var(--font-size-3);
    color: var(--text3);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color .12s;
    line-height: 1;
  }

  .section-del:hover { color: var(--danger); }

  .last-row-hotspot {
    position: absolute;
    left: 34px;
    right: 8px;
    bottom: 0;
    height: 10px;
    z-index: 7;
  }

  .last-row-actions {
    position: absolute;
    left: 34px;
    bottom: -14px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity .12s ease, transform .12s ease, color .12s ease, border-color .12s ease;
    pointer-events: none;
    z-index: 11;
  }

  .name-cell.last-in-section .last-row-hotspot:hover + .last-row-actions,
  .name-cell.last-in-section .last-row-actions:hover,
  .name-cell.last-in-section .last-row-actions:focus-within {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .last-row-quick-btn {
    font-size: var(--font-size-1);
    font-weight: 600;
    color: var(--text2);
    cursor: pointer;
    padding: 2px 9px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    white-space: nowrap;
  }

  .last-row-quick-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
  }

  .divider-row {
    position: sticky;
    left: 0;
    z-index: 5;
    background: linear-gradient(0deg, var(--section-tint, transparent), var(--section-tint, transparent)), var(--surface);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: inset 3px 0 0 var(--section-accent, transparent);
    min-width: 220px;
    height: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
  }

  .divider-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    border-radius: 2px;
  }

  .divider-del {
    opacity: 0;
    font-size: var(--font-size-3);
    color: var(--text3);
    cursor: pointer;
    padding: 0 4px;
    transition: opacity .1s, color .1s;
    line-height: 1;
  }

  .divider-row:hover .divider-del { opacity: 1; }
  .divider-del:hover { color: var(--danger); }

  .divider-cells {
    height: 16px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  .divider-cells.sat { background: var(--divider-sat-bg); }
  .divider-cells.sun { background: var(--divider-sun-bg); }

  .divider-hours {
    height: 16px;
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    background: var(--surface);
  }

  .name-cell {
    position: sticky;
    left: 0;
    z-index: 5;
    background: linear-gradient(0deg, var(--section-tint, transparent), var(--section-tint, transparent)), var(--surface);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: inset 3px 0 0 var(--section-accent, transparent);
    height: 40px;
    min-width: 220px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 10px;
    transition: background .1s;
    overflow: visible;
  }

  .name-cell:hover {
    background: linear-gradient(0deg, var(--section-tint, transparent), var(--section-tint, transparent)), var(--bg-surface-hover);
  }

  .name-cell.row-alt {
    background: linear-gradient(0deg, var(--section-tint, transparent), var(--section-tint, transparent)), var(--bg-surface-alt);
  }

  .name-cell.axis-selected,
  .name-cell.axis-selected.row-alt,
  .name-cell.axis-selected:hover {
    background: #e0e7ff !important;
    box-shadow: inset 0 0 0 2px rgba(79,70,229,.55);
  }

  .emp-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .emp-name-text {
    font-size: var(--font-size-2);
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    cursor: text;
  }

  .emp-delete {
    opacity: 0;
    cursor: pointer;
    font-size: var(--font-size-3);
    color: var(--text3);
    transition: opacity .1s, color .1s;
    flex-shrink: 0;
    padding: 2px 2px;
    border-radius: 4px;
    line-height: 1;
  }

  .name-cell:hover .emp-delete { opacity: 1; }
  .emp-delete:hover { color: var(--danger); }

  .shift-cell {
    width: 44px;
    height: 40px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
    letter-spacing: .2px;
    position: relative;
    transition: outline .08s, transform .12s ease, box-shadow .12s ease;
  }

  .shift-cell::after {
    content: "";
    position: absolute;
    inset: 0;
    background: transparent;
    transition: background .08s;
    pointer-events: none;
  }

  .shift-cell:hover::after { background: transparent; }
  .shift-cell.row-alt { background: var(--surface); }
  .shift-cell.sat { background: var(--cell-sat-bg); }
  .shift-cell.sun { background: var(--cell-sun-bg); }
  .shift-cell.today { background: var(--cell-today-bg); }
  .shift-cell.today.sat { background: var(--cell-sat-bg); }
  .shift-cell.today.sun { background: var(--cell-sun-bg); }
  .shift-cell.row-alt.sat { background: var(--cell-sat-bg); }
  .shift-cell.row-alt.sun { background: var(--cell-sun-bg); }
  .shift-cell.row-alt.today { background: var(--cell-today-bg); }
  .shift-cell.row-alt.today.sat { background: var(--cell-sat-bg); }
  .shift-cell.row-alt.today.sun { background: var(--cell-sun-bg); }

  .shift-label {
    pointer-events: none;
  }

  .shift-menu-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 16px;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,.22);
    color: rgba(255,255,255,.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2);
    font-weight: normal;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease, transform .12s ease;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  }

  .module-schichtplanung[data-tool="none"]:not(.is-multi-select) .shift-cell.selected .shift-menu-btn {
    opacity: 1;
    pointer-events: auto;
  }

  .shift-menu-btn:hover {
    transform: scale(1.08);
  }

  .shift-cell.selected {
    outline: 2px solid #4f46e5;
    outline-offset: -2px;
    z-index: 8;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
  }

  .clipboard-outline {
    position: absolute;
    pointer-events: none;
    z-index: 46;
    box-sizing: border-box;
    border: 2px solid #4f46e5;
    border-radius: 3px;
    --pulse-rgb: 79,70,229;
    --pulse-border-weak: .72;
    --pulse-border-strong: .98;
    --pulse-glow-weak: .30;
    --pulse-glow-strong: .20;
    animation: clipboardPulse 1.2s ease-in-out infinite;
  }

  .clipboard-outline.copy-outline {
    --pulse-rgb: 79,70,229;
    --pulse-border-weak: .72;
    --pulse-border-strong: .98;
    --pulse-glow-weak: .30;
    --pulse-glow-strong: .20;
  }

  .clipboard-outline.cut-outline {
    --pulse-rgb: 249,115,22;
    --pulse-border-weak: .78;
    --pulse-border-strong: 1;
    --pulse-glow-weak: .32;
    --pulse-glow-strong: .24;
  }

  @keyframes clipboardPulse {
    0% {
      border-color: rgba(var(--pulse-rgb), var(--pulse-border-weak));
      box-shadow: 0 0 0 1px rgba(255,255,255,.74), 0 0 0 0 rgba(var(--pulse-rgb), var(--pulse-glow-weak));
    }
    50% {
      border-color: rgba(var(--pulse-rgb), var(--pulse-border-strong));
      box-shadow: 0 0 0 1px rgba(255,255,255,.86), 0 0 0 4px rgba(var(--pulse-rgb), var(--pulse-glow-strong));
    }
    100% {
      border-color: rgba(var(--pulse-rgb), var(--pulse-border-weak));
      box-shadow: 0 0 0 1px rgba(255,255,255,.74), 0 0 0 0 rgba(var(--pulse-rgb), var(--pulse-glow-weak));
    }
  }

  .swap-flight {
    position: fixed;
    z-index: 620;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
    letter-spacing: .2px;
    border-radius: 6px;
    box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255,255,255,.35);
    pointer-events: none;
  }

  .shift-cell.swap-settle {
    animation: swapSettle .18s ease-out;
  }

  @keyframes swapSettle {
    0% {
      transform: scale(0.96);
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 0 0 2px rgba(79,70,229,.32);
    }
    100% {
      transform: scale(1);
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
    }
  }

  .shift-cell.undefined-shift {
    box-shadow: inset 0 0 0 2px rgba(120, 53, 15, .28);
  }

  .shift-undef-mark {
    position: absolute;
    top: 2px;
    left: 3px;
    z-index: 3;
    font-size: var(--font-size-2);
    font-weight: var(--font-weight-heavy);
    line-height: 1;
    pointer-events: auto;
    cursor: help;
    opacity: .92;
  }

  .shift-cell:not(.selected) .shift-undef-mark {
    pointer-events: none;
  }

  .shift-undef-mark[data-undef-tip]::after {
    content: attr(data-undef-tip);
    position: absolute;
    left: 11px;
    top: -6px;
    transform: translateY(-100%);
    background: #ffe38a;
    color: #5a3a00;
    border: 1px solid #e6b84a;
    padding: 4px 7px;
    border-radius: 6px;
    font-size: var(--font-size-1);
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(140, 98, 10, .22);
    opacity: 0;
    visibility: hidden;
    transition: opacity .04s linear;
  }

  .shift-cell.selected .shift-undef-mark[data-undef-tip]:hover::after {
    opacity: 1;
    visibility: visible;
  }

  .shift-cell.typeahead-active {
    background: var(--bg-surface) !important;
    background-image: none !important;
    color: var(--accent) !important;
  }

  .shift-cell.typeahead-active .shift-label,
  .shift-cell.typeahead-active .shift-undef-mark,
  .shift-cell.typeahead-active .shift-menu-btn {
    display: none;
  }

  .typeahead-inline {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    color: var(--accent);
    background: var(--bg-surface);
  }

  .typeahead-inline-text {
    line-height: 1;
  }

  .typeahead-inline-caret {
    width: 1px;
    height: 14px;
    margin-left: 1px;
    background: var(--accent);
    animation: typeaheadCaretBlink .92s steps(1, end) infinite;
  }

  @keyframes typeaheadCaretBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
  }

  .shift-cell.move-armed {
    cursor: grabbing;
    outline: 2px dashed rgba(79,70,229,.7);
    outline-offset: -2px;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.7);
  }

  .shift-cell.move-source {
    outline: 2px dashed #4338ca;
    outline-offset: -2px;
    z-index: 6;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.7);
  }

  .shift-cell.move-hidden {
    opacity: 1;
    transform: none;
    background: var(--bg-surface) !important;
    background-image: none !important;
    color: transparent !important;
  }

  .shift-cell.move-hidden .shift-label,
  .shift-cell.move-hidden .shift-undef-mark,
  .shift-cell.move-hidden .shift-menu-btn {
    display: none;
  }

  .shift-cell.move-hidden::after {
    background: rgba(255,255,255,.96);
    border: 1px dashed rgba(79,70,229,.58);
  }

  .shift-cell.move-target {
    background: rgba(22, 163, 74, 0.18) !important;
    outline: 1px dashed rgba(22, 163, 74, 0.55);
    outline-offset: -1px;
    z-index: 6;
  }

  .shift-cell.fill-target {
    outline: 2px dashed #4f46e5;
    outline-offset: -2px;
    z-index: 7;
  }

  .module-schichtplanung[data-tool="none"] .shift-cell.fill-ready,
  .module-schichtplanung[data-tool="move"] .shift-cell.fill-ready {
    cursor: all-scroll;
  }

  .shift-cell.fill-ready::before {
    content: "";
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 3px;
    height: 2px;
    border-radius: 2px;
    background: var(--fill-ready-line, #4f46e5);
    pointer-events: none;
  }

  .shift-cell.fill-ready::after {
    background: linear-gradient(to top, var(--fill-ready-glow, rgba(79,70,229,.22)), rgba(79,70,229,0) 40%);
  }

  .name-cell.reorder-before,
  .divider-row.reorder-before,
  .section-row.reorder-before {
    box-shadow: inset 0 3px 0 #4338ca;
  }

  .name-cell.reorder-after,
  .divider-row.reorder-after,
  .section-row.reorder-after {
    box-shadow: inset 0 -3px 0 #4338ca;
  }

  .module-schichtplanung.is-view-mode .shift-cell:hover::after { background: transparent; }
  .module-schichtplanung.is-view-mode .shift-menu-btn,
  .module-schichtplanung.is-view-mode .emp-delete,
  .module-schichtplanung.is-view-mode .section-add,
  .module-schichtplanung.is-view-mode .last-row-actions,
  .module-schichtplanung.is-view-mode .last-row-hotspot,
  .module-schichtplanung.is-view-mode .section-del,
  .module-schichtplanung.is-view-mode .divider-del,
  .module-schichtplanung.is-view-mode .add-btn { display: none !important; }

  .module-schichtplanung.is-selection-mode .shift-menu-btn {
    opacity: 0 !important;
    pointer-events: none;
  }

  .hours-cell {
    width: 84px;
    height: 40px;
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    background: linear-gradient(0deg, var(--section-tint, transparent), var(--section-tint, transparent)), var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
  }

  .hours-num {
    font-size: var(--font-size-2);
    font-weight: var(--font-weight-bold);
    color: var(--text);
    line-height: 1;
  }

  .hours-unit {
    font-size: var(--font-size-0);
    color: var(--text3);
    font-weight: var(--font-weight-bold);
    margin-top: 1px;
  }

  .shift-hours-cell {
    width: var(--shift-summary-width);
    min-height: 40px;
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    background: linear-gradient(0deg, var(--section-tint, transparent), var(--section-tint, transparent)), var(--surface);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    padding: 4px 6px;
    overflow: hidden;
  }

  .hours-cell.zero .hours-num { color: var(--text3); }

  .hours-cell.row-alt,
  .shift-hours-cell.row-alt {
    background: linear-gradient(0deg, var(--section-tint, transparent), var(--section-tint, transparent)), var(--bg-surface-alt);
  }

  .shift-hours-cell.empty {
    color: var(--text3);
    font-size: var(--font-size-0);
  }

  .shift-hours-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-radius: 999px;
    padding: 1px 6px;
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
    border: 1px solid rgba(255,255,255,.45);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
    white-space: nowrap;
  }

  .menu-icon {
    width: 20px;
    text-align: center;
    color: var(--text2);
    font-size: var(--font-size-3);
    font-weight: normal;
    line-height: 1;
    flex-shrink: 0;
  }

  .add-menu,
  #ctxMenu,
  #ctxShiftMenu,
  #versionMenu,
  #sectionMenu,
  #dayMenu {
    position: fixed;
    z-index: 400;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 6px;
    box-shadow: var(--shadow-lg);
    display: none;
    animation: pop .12s ease;
  }

  .add-menu.open { display: block; }

  .add-menu .item,
  .ctx-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--font-size-2);
    font-weight: 500;
    color: var(--text-primary);
    transition: background .1s;
  }

  .add-menu .item:hover,
  .ctx-item:hover {
    background: var(--bg-surface-alt);
    color: var(--text-primary);
  }

  .add-menu .item .ic {
    width: 20px;
    text-align: center;
    color: var(--accent);
    font-size: var(--font-size-3);
    font-weight: normal;
  }

  .ctx-item {
    font-size: var(--font-size-1);
    font-weight: 600;
    color: var(--text-primary);
  }

  .ctx-item.active {
    color: var(--text-primary);
    background: var(--accent-soft);
  }

  .add-menu .item.active {
    color: var(--text-primary);
    background: var(--accent-soft);
  }

  .ctx-item.disabled {
    color: var(--text-tertiary);
    opacity: 1;
    cursor: default;
    pointer-events: auto;
  }

  .ctx-item.disabled .menu-icon {
    color: var(--text-tertiary);
  }

  .ctx-item.disabled:hover {
    background: transparent;
    color: var(--text-tertiary);
  }

  .ctx-item.typeahead-hint {
    color: #7a5300;
    background: #fff6cf;
    border: 1px solid #f2df9e;
    cursor: default;
    pointer-events: none;
    font-weight: var(--font-weight-bold);
  }

  .ctx-item.typeahead-hint .menu-icon {
    color: #a56b00;
  }

  .ctx-item.typeahead-hint:hover {
    background: #fff6cf;
    color: #7a5300;
  }

  #ctxShiftMenu {
    max-height: min(330px, 56vh);
    overflow-y: auto;
  }

  .ctx-meta {
    display: block;
    font-size: var(--font-size-0);
    color: var(--text3);
    margin-top: 1px;
    font-weight: 500;
  }

  .ctx-chip {
    width: 30px;
    height: 18px;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
  }

  .ctx-sep {
    height: 1px;
    background: var(--border-default);
    margin: 4px 0;
  }

  .grip-btn {
    width: 18px;
    flex-shrink: 0;
    text-align: center;
    color: var(--text3);
    cursor: grab;
    font-size: var(--font-size-3);
    line-height: 1;
    user-select: none;
  }

  .grip-btn:hover { color: var(--text); }
  .grip-btn:active { cursor: grabbing; }

  .drag-float {
    position: fixed;
    left: 0;
    top: 0;
    pointer-events: none;
    z-index: 600;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,.55);
    animation: dragLift .16s ease-out;
  }

  @keyframes dragLift {
    from {
      opacity: .2;
      transform: scale(.86);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }

  .drag-float.block-preview {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
    overflow: visible;
    filter: drop-shadow(0 12px 22px rgba(37, 55, 86, .26));
  }

  .drag-block {
    position: relative;
  }

  .drag-block-cell {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,.58);
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    letter-spacing: .2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
  }

  .drag-block-cell.empty {
    background: transparent;
    border-width: 2px;
    border-style: dashed;
    border-color: rgba(79,70,229,.64);
    box-shadow: 0 0 0 1px rgba(255,255,255,.78), 0 8px 16px rgba(37, 55, 86, .16);
  }

  .inline-edit {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--accent-soft);
    border-radius: 4px;
    background: var(--bg-surface);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    padding: 3px 6px;
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
  }

  .empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    pointer-events: none;
  }

  .empty-icon {
    font-size: var(--font-size-8);
    opacity: .3;
  }

  .empty-text {
    font-size: var(--font-size-2);
    color: var(--text2);
    opacity: .7;
  }

  .modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay, rgba(61,72,90,.24));
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
  }

  .modal-overlay.open { display: flex; }

  .modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 340px;
    box-shadow: var(--shadow-lg);
    animation: pop .18s ease;
  }

  .modal h3 {
    margin: -24px -24px 16px;
    padding: 14px 16px;
    font-size: var(--font-size-3);
    font-weight: var(--font-weight-bold);
    color: var(--text);
    background: linear-gradient(180deg, var(--bg-surface-hover) 0%, var(--bg-surface-alt) 100%);
    border-bottom: 1px solid var(--border-strong);
  }

  .modal label {
    font-size: var(--font-size-1);
    font-weight: 600;
    color: var(--text2);
    display: block;
    margin-bottom: 5px;
  }

  .modal input,
  .modal select {
    width: 100%;
    background: var(--bg-surface);
    border: 1.6px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: var(--font-size-2);
    color: var(--text);
    outline: none;
    margin-bottom: 14px;
    font-family: inherit;
    transition: border-color .15s;
  }

  .modal input:focus,
  .modal select:focus { border-color: var(--accent); }

  .modal select option {
    background: var(--bg-surface);
    color: var(--text-primary);
  }

  .modal select option:checked {
    color: var(--text-primary);
    font-weight: var(--font-weight-bold);
  }

  .modal-btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
  }

  .dialog-modal {
    width: 420px;
    max-width: calc(100vw - 28px);
  }

  .dialog-message {
    font-size: var(--font-size-2);
    line-height: 1.5;
    color: var(--text2);
    margin-bottom: 14px;
  }

  .dialog-message strong {
    color: var(--text);
    font-weight: var(--font-weight-bold);
  }

  .dialog-field {
    margin-bottom: 14px;
  }

  .dialog-field.hidden {
    display: none;
  }

  .shift-modal {
    width: 660px;
    max-width: calc(100vw - 28px);
    max-height: calc(100vh - 28px);
    display: flex;
    flex-direction: column;
  }

  .shift-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
    min-height: 0;
    flex: 1;
  }

  .shift-modal.single-edit #shiftAddGroup {
    display: none;
  }

  .shift-modal.single-edit .shift-editor-actions {
    display: none;
  }

  .shift-modal.single-edit .shift-editor-hint {
    display: none;
  }

  .shift-modal.single-edit .shift-group-handle,
  .shift-modal.single-edit .shift-editor-group-actions {
    display: none;
  }

  .shift-modal.single-edit .shift-editor-head,
  .shift-modal.single-edit .shift-editor-row-single {
    grid-template-columns: 56px 72px minmax(0, 1fr) 84px 84px 82px 20px;
  }

  .shift-modal.single-edit .shift-editor-head > :first-child,
  .shift-modal.single-edit .shift-editor-row-single > :first-child {
    display: none;
  }

  .shift-modal.single-edit .shift-editor-table {
    gap: 0;
  }

  .shift-modal.single-edit .shift-editor-head {
    margin: 0;
    border-radius: 10px 10px 0 0;
    border-bottom: none;
  }

  .shift-modal.single-edit .shift-editor-list-wrap {
    padding: 0;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: none;
  }

  .shift-editor-single {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
  }

  .shift-modal.single-edit .shift-editor-single {
    border: none;
    border-radius: 0;
  }

  .shift-editor-row-single {
    margin: 0;
  }

  .shift-modal.single-edit .shift-editor-row-single {
    border-top: 1px solid var(--border);
  }

  .shift-modal.single-edit .shift-editor-row-single .shift-row-color {
    width: 100%;
    height: 26px;
    min-height: 26px;
    border-radius: 6px;
    align-self: center;
    justify-self: stretch;
    margin: 0;
    padding: 0;
    position: relative;
    left: 0;
    top: -1px;
    line-height: 1;
  }

  .shift-editor-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 2px;
  }

  .shift-editor-hint {
    font-size: var(--font-size-1);
    color: var(--text3);
  }

  .shift-save-state {
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    color: #0f766e;
    opacity: 0;
    transform: translateY(3px);
    transition: all .18s ease;
  }

  .shift-save-state.visible {
    opacity: 1;
    transform: translateY(0);
  }

  .shift-editor-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
  }

  .shift-editor-list-wrap {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    padding: 6px;
    max-height: min(58vh, 520px);
    overflow: auto;
  }

  .shift-editor-head,
  .shift-editor-row {
    display: grid;
    grid-template-columns: 18px 32px 64px minmax(0, 1fr) 84px 84px 82px 20px;
    gap: 6px;
    align-items: center;
    padding: 5px 10px;
  }

  .shift-editor-head {
    margin: 0 1px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface-alt);
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: .5px;
  }

  .shift-editor-group {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
  }

  .shift-editor-group.dragging {
    opacity: .55;
  }

  .shift-editor-group.group-drop {
    box-shadow: inset 0 0 0 2px rgba(79,70,229,.35);
  }

  .shift-editor-group.drop-before {
    box-shadow: inset 0 3px 0 #4f46e5;
  }

  .shift-editor-group.drop-after {
    box-shadow: inset 0 -3px 0 #4f46e5;
  }

  .shift-editor-group-head {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 10px;
    background: linear-gradient(180deg, var(--bg-surface-alt) 0%, var(--bg-surface-hover) 100%);
    border-bottom: 1px solid var(--border);
  }

  .shift-editor-group-stripe {
    width: 3px;
    height: 16px;
    border-radius: 999px;
    flex-shrink: 0;
    background: #7d8da1;
  }

  .shift-group-handle {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text3);
    cursor: grab;
    font-size: var(--font-size-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: color .1s;
  }

  .shift-group-handle:hover { color: var(--text); }
  .shift-group-handle:active { cursor: grabbing; }

  .shift-editor-group-name {
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--text);
    cursor: pointer;
  }

  .shift-editor-group-count {
    font-size: var(--font-size-0);
    color: var(--text2);
  }

  .shift-editor-group-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
    align-items: center;
  }

  .shift-editor-group-btn {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-surface-alt) 100%);
    color: var(--text2);
    font: inherit;
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    padding: 3px 8px;
    cursor: pointer;
    height: 22px;
    display: inline-flex;
    align-items: center;
  }

  .shift-editor-group-btn:hover { color: var(--text); border-color: var(--border-strong); }

  .shift-editor-group-del {
    font-size: var(--font-size-3);
    color: var(--text3);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    border: none;
    background: transparent;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    transition: color .1s;
  }

  .shift-editor-group-del:hover { color: var(--danger); }

  .shift-editor-group-body {
    padding: 4px 0;
  }

  .shift-editor-group-body.empty {
    padding: 10px;
  }

  .shift-editor-group-empty {
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
    font-size: var(--font-size-1);
    color: var(--text3);
    background: var(--bg-surface);
  }

  .shift-editor-row {
    border-bottom: 1px solid var(--border-default);
    background: transparent;
    min-height: 38px;
  }

  .shift-editor-row > * {
    align-self: center;
  }

  .shift-editor-row:last-child { border-bottom: none; }

  .shift-editor-row:nth-child(even) { background: var(--bg-surface-alt); }

  .shift-editor-row.dragging { opacity: .4; }

  .shift-editor-row.drop-before { box-shadow: inset 0 2px 0 #4f46e5; }
  .shift-editor-row.drop-after  { box-shadow: inset 0 -2px 0 #4f46e5; }

  .shift-editor-row input {
    width: 100%;
    min-width: 0;
    height: 26px;
    margin: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    padding: 4px 6px;
    font-size: var(--font-size-1);
    color: var(--text);
    font-family: inherit;
    transition: border-color .1s, background .1s, box-shadow .1s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
  }

  .shift-editor-row input:focus {
    background: var(--bg-surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
    outline: none;
  }

  .shift-editor-row input[type="color"] { display: none; }

  .shift-editor-row input[type="time"] {
    font-variant-numeric: tabular-nums;
  }

  .shift-hours-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16px;
    gap: 6px;
    align-items: center;
    width: 100%;
  }

  .shift-hours-field input[data-field="hours"] {
    padding-right: 6px;
  }

  .shift-hours-field.is-warning input[data-field="hours"] {
    background: #fff5bf;
    border-color: #d8b552;
  }

  .shift-hours-field.is-warning input[data-field="hours"]:focus {
    background: #fff8d4;
    border-color: #c28b22;
    box-shadow: 0 0 0 2px rgba(194, 139, 34, .2);
  }

  .shift-hours-warn {
    position: relative;
    top: 1px;
    left: 0px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 26px;
    font-family: var(--font-family-icons);
    font-weight: normal;
    font-style: normal;
    font-size: var(--font-size-4);
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    color: #b77400;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
  }

  .shift-hours-warn.visible {
    opacity: 1;
    pointer-events: auto;
    cursor: help;
  }

  .shift-hours-tip-floating {
    position: fixed;
    background: #ffe38a;
    color: #5a3a00;
    border: 1px solid #e6b84a;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: var(--font-size-1);
    font-weight: 600;
    font-family: var(--font-family-base);
    line-height: 1.35;
    white-space: normal;
    min-width: 220px;
    max-width: 300px;
    box-shadow: 0 8px 18px rgba(140, 98, 10, .22);
    pointer-events: none;
    z-index: 9999;
  }

  .shift-row-preview,
  .shift-row-color {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    border-radius: 6px;
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    border: 1px solid rgba(15,23,42,.08);
  }

  .shift-row-color {
    width: 100%;
    cursor: pointer;
    background: var(--bg-surface);
    position: relative;
    transition: opacity .1s;
  }

  .shift-row-color:hover { opacity: .85; }

  .shift-row-handle {
    width: 18px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--text3);
    cursor: grab;
    font-size: var(--font-size-3);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: color .1s;
  }

  .shift-row-handle:hover:not(:disabled) { color: var(--text); }
  .shift-row-handle:active:not(:disabled) { cursor: grabbing; }
  .shift-row-handle:disabled { opacity: .25; cursor: default; }

  .shift-row-remove {
    width: 20px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--text3);
    cursor: pointer;
    font-size: var(--font-size-3);
    font-weight: normal;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 0;
    transition: color .1s;
  }

  .shift-row-remove:hover:not(:disabled) { color: var(--danger); }
  .shift-row-remove:disabled { opacity: .25; cursor: default; }

  .shift-color-modal {
    width: 320px;
    max-width: calc(100vw - 28px);
    padding: 16px;
  }

  .shift-color-modal h3 {
    font-size: var(--font-size-2);
    font-weight: var(--font-weight-bold);
    color: var(--text2);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .6px;
  }

  .shift-color-preview {
    height: 40px;
    border-radius: 6px;
    border: 1px solid rgba(15,23,42,.10);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    font-size: var(--font-size-2);
    font-weight: var(--font-weight-bold);
  }

  .shift-color-section-label {
    font-size: var(--font-size-0);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--text3);
    margin-bottom: 5px;
  }

  .shift-color-swatches,
  .section-color-swatches {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
    width: 100%;
  }

  .shift-color-row,
  .section-color-row {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 2px;
    width: 100%;
  }

  .shift-color-swatch {
    width: 100%;
    height: 18px;
    border-radius: 1px;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,.16);
    position: relative;
    transition: box-shadow .08s, border-color .08s;
    outline: none;
    padding: 0;
  }

  .shift-color-swatch:hover {
    z-index: 1;
    border-color: rgba(0,0,0,.35);
  }

  .shift-color-swatch.active::after {
    content: '';
    position: absolute;
    inset: -2px;
    border: 2px solid #4338ca;
    border-radius: 2px;
    pointer-events: none;
  }

  .shift-color-sep {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
  }

  .shift-color-custom-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-1);
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    padding: 4px 0;
    border: none;
    background: transparent;
    margin-bottom: 4px;
  }

  .shift-color-custom-toggle:hover { color: #4f46e5; }

  .shift-color-custom-panel {
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 10px;
    overflow: hidden;
  }

  .shift-color-custom-panel.open {
    display: flex;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(640px, calc(100vw - 20px));
    max-height: min(620px, calc(100vh - 20px));
    overflow: hidden;
    margin: 0;
    z-index: 650;
    animation: color-mix-popup .16s ease;
  }

  .module-schichtplanung.is-color-mix-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(35, 48, 70, .2);
    z-index: 160;
    pointer-events: none;
  }

  @keyframes color-mix-popup {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); }
    to { opacity: 1; transform: translate(-50%, -50%); }
  }

  .color-mix-window-head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 14px 8px;
    background: linear-gradient(180deg, var(--bg-surface-alt) 0%, var(--bg-surface-hover) 100%);
    border-bottom: 1px solid var(--border);
  }

  .color-mix-window-title {
    font-size: var(--font-size-3);
    font-weight: var(--font-weight-bold);
    color: var(--text);
    letter-spacing: -.2px;
  }

  .excel-color-shell {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
  }

  .excel-color-dialog {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 106px;
    gap: 12px;
    padding: 12px;
    min-height: 0;
    overflow: auto;
  }

  .excel-color-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
  }

  .excel-color-body {
    display: grid;
    grid-template-columns: 1fr 192px;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, var(--bg-surface-alt) 0%, var(--bg-surface-alt) 100%);
  }

  .excel-color-map-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22px;
    gap: 10px;
    align-items: stretch;
  }

  .excel-color-map {
    position: relative;
    min-height: 254px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: crosshair;
    touch-action: none;
    overflow: hidden;
    background:
      linear-gradient(to top, #000, rgba(0, 0, 0, 0)),
      linear-gradient(to right, #fff, var(--mix-hue-color, #ff0000));
  }

  .excel-color-map-cursor {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 999px;
    box-shadow: 0 0 0 1px #0f172a;
    pointer-events: none;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 50%;
  }

  .excel-color-hue {
    position: relative;
    width: 22px;
    min-height: 254px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: ns-resize;
    touch-action: none;
    overflow: hidden;
    background: linear-gradient(
      to top,
      #ff0000 0%,
      #ff00ff 17%,
      #0000ff 33%,
      #00ffff 50%,
      #00ff00 67%,
      #ffff00 83%,
      #ff0000 100%
    );
  }

  .excel-color-hue-knob {
    position: absolute;
    left: 1px;
    right: 1px;
    height: 7px;
    border: 1px solid #ffffff;
    background: rgba(17, 24, 39, .86);
    box-shadow: 0 0 0 1px rgba(17, 24, 39, .32);
    pointer-events: none;
    transform: translateY(-50%);
    top: 50%;
  }

  .excel-color-hue:focus-visible {
    outline: 2px solid #4338ca;
    outline-offset: 1px;
  }

  .excel-color-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .excel-model-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .color-model-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface2);
  }

  .color-model-btn {
    border: none;
    background: transparent;
    color: var(--text2);
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    border-radius: 6px;
    padding: 4px 9px;
    cursor: pointer;
    min-width: 40px;
  }

  .color-model-btn.active {
    background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
    color: #ffffff;
  }

  .excel-field-label {
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    color: var(--text2);
  }

  .excel-rgb-list {
    display: grid;
    gap: 6px;
  }

  .excel-rgb-list label {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    font-size: var(--font-size-1);
    color: var(--text2);
    font-weight: 600;
  }

  .excel-channel-label {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
  }

  .excel-rgb-list input {
    margin: 0;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    background: var(--bg-surface);
    color: var(--text);
    font-size: var(--font-size-1);
  }

  .excel-hex-line {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    font-size: var(--font-size-1);
    color: var(--text2);
    font-weight: 600;
  }

  .excel-hidden-color-input {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    width: 0;
    height: 0;
  }

  .excel-preview-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 2px;
  }

  .excel-preview-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: var(--font-size-1);
    color: var(--text2);
    font-weight: 600;
  }

  .excel-preview-box {
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-surface);
  }

  .shift-color-custom-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .shift-color-custom-inputs input[type="color"] {
    width: 56px;
    height: 36px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    margin-bottom: 0;
  }

  .shift-color-hex-input {
    flex: 1;
    min-width: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 6px 8px;
    font-size: var(--font-size-1);
    font-family: var(--font-family-mono);
    color: var(--text);
    outline: none;
    margin-bottom: 0;
  }

  .shift-color-hex-input:focus { border-color: var(--accent); }

  .color-rgb-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .color-rgb-grid label {
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    color: var(--text2);
  }

  .color-rgb-grid input {
    width: 100%;
    margin-top: 4px;
    margin-bottom: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: var(--font-size-1);
    color: var(--text);
  }

  .color-rgb-grid input:focus {
    border-color: var(--accent);
    outline: none;
  }

  .color-recent-row {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 6px;
    padding: 2px 0 4px;
  }

  .color-recent-swatch {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 4px;
    border: 1px solid var(--border-strong);
    cursor: pointer;
    background: var(--bg-surface);
  }

  .color-recent-empty {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 4px;
    border: 1px dashed var(--border-default);
    background: var(--bg-surface-alt);
  }

  .color-recent-swatch.active {
    box-shadow: 0 0 0 2px #4338ca;
    border-color: #4338ca;
  }

  .color-defined-empty {
    font-size: var(--font-size-1);
    color: var(--text-secondary);
    padding: 4px 2px 8px;
  }

  .shift-color-custom-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: flex-start;
    padding-top: 30px;
    width: 106px;
  }

  .shift-color-custom-btns .action-btn {
    width: 100%;
    justify-content: center;
  }

  @media (max-width: 680px) {
    .excel-color-dialog {
      grid-template-columns: 1fr;
    }

    .shift-color-custom-btns {
      flex-direction: row;
      padding-top: 0;
    }

    .shift-color-custom-btns .action-btn {
      flex: 1;
    }
  }

  .day-color-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
  }

  .day-color-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface-alt);
  }

  .day-color-meta strong {
    display: block;
    font-size: var(--font-size-2);
    color: var(--text);
  }

  .day-color-meta span {
    display: block;
    margin-top: 2px;
    font-size: var(--font-size-1);
    color: var(--text3);
  }

  .day-color-preview {
    height: 34px;
    width: 100%;
    padding: 0;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(15,23,42,.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-1);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    background-clip: padding-box;
  }

  button.day-color-preview {
    font-family: inherit;
  }

  .day-color-preview:hover {
    filter: brightness(1.02);
  }

  .day-color-preview:focus-visible {
    outline: 2px solid rgba(79,70,229,.45);
    outline-offset: 1px;
  }

  #shiftColorModal {
    z-index: 260;
  }

  .legend {
    position: relative;
    background: linear-gradient(180deg, var(--bg-surface-alt) 0%, var(--bg-surface-hover) 100%);
    border-top: 1px solid var(--border-strong);
    padding: 10px 14px;
    box-shadow: none;
    display: flex;
    flex-wrap: wrap;
    gap: 5px 10px;
    width: 100%;
    max-width: none;
    flex-shrink: 0;
    z-index: 10;
    font-size: var(--font-size-1);
    color: var(--text2);
  }

  .legend-no-shifts {
    font-size: var(--font-size-1);
    color: var(--text3);
    font-style: italic;
    align-self: center;
  }

  .leg-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--bg-surface);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
    cursor: default;
  }

  .leg-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
  }

  @keyframes pop {
    from { opacity: 0; transform: scale(.94); }
    to { opacity: 1; transform: scale(1); }
  }

  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
  ::-webkit-scrollbar-thumb:hover { background: #3e4260; }

  @media (max-width: 900px) {
    .ribbon-menu-tabs { padding: 0 6px; }
    .ribbon-menu-tab { padding: 0 10px; }
    .ribbon-bar { padding: 4px 6px 0; }
    .rb-btn { min-width: 42px; }
  }

  @media (max-width: 680px) {
    .ribbon-title { padding: 4px 10px; }
    .ribbon-menu-tabs {
      padding: 0 4px;
      min-height: 28px;
    }
    .ribbon-menu-tab {
      padding: 0 8px;
      height: 24px;
      font-size: var(--font-size-1);
    }
    .ribbon-bar { padding: 4px 4px 0; gap: 0; }
    .toolbar { padding: 8px 10px; }
    .view-banner { padding: 8px 12px; }
    .grid-wrapper {
      padding-bottom: 6px;
      margin-bottom: 0;
    }
  }

  /* Material Icons: inherit size from context, override the 24px default */
  .material-icons {
    font-size: inherit;
    line-height: inherit;
    vertical-align: middle;
  }

  /* Color toggle icon slightly larger than its 12px container font */
  .shift-color-custom-toggle .material-icons {
    font-size: var(--font-size-3);
    line-height: 1;
  }

  /* ── Mobile-Anpassungen Schichtplanung ─────────────────────────────────
     Die Plan-Tabelle hat absichtlich min-widths fuer Spalten – auf kleinen
     Viewports erlauben wir horizontales Scrollen statt umzubrechen. */
  .module-schichtplanung .sp-app {
    /* 100vh ignoriert die mobile Top-Bar im SPA-Shell. Auf 100% wechseln,
       damit der Plan in den verfuegbaren Bereich passt und die Top-Bar
       sichtbar bleibt. */
    height: 100%;
    min-height: 0;
  }

  @media (max-width: 860px) {
    .module-schichtplanung .grid-wrapper {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
  }

  @media (max-width: 480px) {
    .module-schichtplanung .toolbar {
      flex-wrap: wrap;
      gap: 6px;
    }

    .module-schichtplanung .ribbon-menu-tabs {
      overflow-x: auto;
      flex-wrap: nowrap;
      white-space: nowrap;
      -webkit-overflow-scrolling: touch;
    }

    .module-schichtplanung .ribbon-bar {
      overflow-x: auto;
      flex-wrap: nowrap;
      -webkit-overflow-scrolling: touch;
    }
  }
