.is-filter-hidden {
  display: none !important;
}

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-strong: #f9fafb;
  --text: #172033;
  --muted: #667085;
  --line: #d8dde6;
  --line-soft: #eceff4;
  --green: #1f8a5b;
  --green-bg: #dff3ea;
  --yellow: #b7791f;
  --yellow-bg: #fff2cc;
  --red: #c2413a;
  --red-bg: #fde2df;
  --blue: #2f6fab;
  --blue-bg: #dcecff;
  --gray: #6b7280;
  --gray-bg: #eef0f3;
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
  --left-width: 360px;
  --week-width: 74px;
  --row-height: 48px;
  --bar-height: 22px;
  --detail-height: 200px;
  --axis-height: 72px;
  --staff-axis-height: 72px;
  --staff-summary-row-height: 40px;
  --visible-row-count: 15;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
  color-scheme: light;
  cursor: default;
}

body.day-mode {
  --week-width: 154px;
}

body.view-projects {
  --week-width: var(--project-week-width, 74px);
}

body.view-projects.day-mode {
  --week-width: var(--project-week-width, 154px);
  --left-width: 400px;
  --detail-height: 208px;
  --day-visible-rows: 10;
  --day-header-height: 20px;
  --day-bookings-top: 22px;
  --day-bookings-height: 60px;
  --day-markers-top: 86px;
  --day-markers-height: 114px;
  --day-gates-top: 0;
  --day-gates-height: 36px;
  --day-blockers-top: 38px;
  --day-blockers-height: 34px;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px 12px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 22px;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.top-actions,
.legend,
.control-panel,
.timeline-toolbar,
.section-head,
.panel-header {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 8px;
  position: relative;
}

.save-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: #f8fafc;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  appearance: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.save-status:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
}

.save-status:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.save-status.is-saving {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.save-status.is-saved {
  color: #166534;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.save-status.is-conflict {
  color: #9a3412;
  border-color: #fdba74;
  background: #fff7ed;
}

.sync-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1200;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #9a3412;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sync-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.sync-toast--conflict {
  border-color: #fdba74;
  background: #fff7ed;
  color: #9a3412;
}

.danger-action {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.danger-action:hover:not(:disabled) {
  color: #991b1b;
  border-color: #fca5a5;
  background: #fee2e2;
}

.danger-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.reset-dialog-warning {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
}

.back-link {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.shared-plan-hint {
  margin-top: 4px;
}

.archive-type-group {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.archive-type-legend {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.archive-type-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.archive-type-option strong {
  display: block;
  font-size: 13px;
}

.archive-type-option small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.mini-button--archive {
  width: 100%;
}

.notify-groups {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.notify-groups label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

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

#notify-message {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  font: inherit;
}

.save-hint {
  margin-top: 2px;
}

.history-trigger {
  min-width: 40px;
  opacity: 0.35;
  transition: opacity 0.15s ease;
}

.history-trigger:hover,
.history-trigger:focus-visible {
  opacity: 1;
}

.change-history-panel {
  position: fixed;
  top: 68px;
  right: 24px;
  z-index: 40;
  width: min(360px, calc(100vw - 32px));
  max-height: min(420px, calc(100vh - 96px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  padding: 14px 16px 12px;
}

.change-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.change-history-head h2 {
  font-size: 16px;
}

.change-history-note {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.change-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.change-history-item {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
}

.change-history-item strong {
  font-size: 12px;
}

.change-history-item time {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.change-history-item--empty {
  color: var(--muted);
  font-style: italic;
}

.change-history-actions {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-trigger {
  min-width: 40px;
  opacity: 0.35;
  transition: opacity 0.15s ease;
}

.settings-trigger:hover,
.settings-trigger:focus-visible {
  opacity: 1;
}

.settings-panel {
  position: fixed;
  top: 68px;
  right: 24px;
  z-index: 40;
  width: min(360px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 96px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  padding: 14px 16px 12px;
}

.settings-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-panel-head h2 {
  font-size: 16px;
}

.settings-panel-note {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.settings-form {
  display: grid;
  gap: 12px;
}

.settings-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
}

.settings-field input {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.settings-section {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 10px;
}

.settings-section legend {
  padding: 0;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.settings-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
}

.settings-preview {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  color: #475467;
  font-size: 11px;
  line-height: 1.45;
}

.detail-decision-field {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.detail-decision-field__label {
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-decision-input {
  width: 100%;
  min-height: 52px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  resize: vertical;
}

.detail-decision-input:focus {
  outline: 2px solid var(--blue-bg);
  border-color: var(--blue);
}

.icon-button,
.close-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.icon-button {
  min-width: 64px;
  min-height: 36px;
  border-radius: 8px;
  font-weight: 700;
}

.primary-action {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.primary-action:hover {
  border-color: #255f96;
  background: #255f96;
}

.dialog-actions--notify {
  justify-content: flex-end;
  margin-top: 4px;
}

.dialog-actions--notify .primary-action {
  min-width: 96px;
}

.icon-button:hover,
.close-button:hover {
  border-color: #9aa4b2;
}

.app-shell {
  padding: 0 24px 20px;
}

.control-panel {
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select,
input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

.search-label {
  flex: 1;
}

.timeline-card,
.decision-dock > article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.timeline-card {
  overflow: hidden;
  box-shadow: var(--shadow);
}



.timeline-toolbar {
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.timeline-toolbar__title h2 {
  font-size: 16px;
}

.calendar-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.metric-group--status {
  padding-right: 10px;
  border-right: 1px solid var(--line-soft);
}

.metric-chip--hidden {
  display: none !important;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--panel-strong);
}

.metric-chip strong {
  font-size: 14px;
}

.metric-chip--on-track strong {
  color: var(--green);
}

.metric-chip--critical strong {
  color: var(--red);
}

.metric-chip--risk strong {
  color: var(--yellow);
}

.metric-chip--inactive strong {
  color: var(--gray);
}

.metric-chip--blockers strong {
  color: var(--red);
}

.metric-chip--decisions strong {
  color: var(--blue);
}

.metric-chip--overdue strong {
  color: var(--red);
}

.calendar-summary span:not(.metric-chip) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--panel-strong);
}

.calendar-summary strong {
  color: var(--text);
  font-size: 14px;
}

.legend {
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.legend span,
.status-pill,
.risk-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.green {
  background: var(--green);
}

.yellow {
  background: var(--yellow);
}

.red {
  background: var(--red);
}

.gray {
  background: var(--gray);
}

.blue {
  background: var(--blue);
}

body.day-mode .view-panel--projects {
  display: flex;
  flex-direction: column;
  gap: 0;
}

body.day-mode .view-panel--projects .timeline-card {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  overflow: visible;
  min-height: 0;
}

body.day-mode .view-panel--projects .timeline-toolbar {
  flex: none;
}

body.day-mode .decision-dock {
  display: none !important;
}

body:not(.day-mode) .project-focus-dock {
  display: none !important;
}

.project-focus-dock {
  flex: none;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 10px 14px 12px;
  min-height: 132px;
  max-height: 148px;
  overflow: hidden;
}

.project-focus-dock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.project-focus-dock__title {
  min-width: 0;
}

.project-focus-dock__title strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-focus-dock__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.project-focus-dock__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.project-focus-section {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-focus-section__label {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.project-focus-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
  overflow: hidden;
}

.focus-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.focus-chip:hover {
  border-color: #cbd5e1;
  background: #eef5ff;
}

.focus-chip--gate.focus-chip--overdue {
  border-color: #fecaca;
  background: var(--red-bg);
  color: var(--red);
}

.focus-chip--gate.focus-chip--soon {
  border-color: #fde68a;
  background: var(--yellow-bg);
  color: var(--yellow);
}

.focus-chip--booking {
  border-color: #bfdbfe;
  background: var(--blue-bg);
  color: var(--blue);
}

.focus-chip--plan {
  border-color: rgba(47, 111, 171, 0.35);
  background: rgba(220, 236, 255, 0.95);
  color: #1e3a5f;
}

.focus-chip--plan.focus-chip--procurement {
  border-color: rgba(0, 112, 192, 0.35);
  background: rgba(220, 242, 255, 0.95);
}

.focus-chip__date {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.focus-chip__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-focus-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text);
}

.project-focus-note--muted {
  color: var(--muted);
}

.project-focus-note strong {
  display: block;
  margin-bottom: 2px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-focus-note--risk {
  border-left: 3px solid var(--red);
  padding-left: 8px;
}

.project-focus-note--warn {
  border-left: 3px solid var(--yellow);
  padding-left: 8px;
}

body.day-mode .metric-group--action {
  display: none;
}

.gantt-shell {
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

body:not(.day-mode) .gantt-shell {
  height: calc(var(--axis-height) + (var(--visible-row-count) * var(--row-height)) + 18px);
  max-height: calc(var(--axis-height) + (var(--visible-row-count) * var(--row-height)) + 18px);
}

body.day-mode .view-panel--projects .gantt-shell {
  flex: none;
  height: calc(
    var(--axis-height)
    + (var(--day-visible-rows) * var(--row-height))
    + var(--detail-height)
    + 30px
  );
  min-height: 420px;
  max-height: calc(
    var(--axis-height)
    + (var(--day-visible-rows) * var(--row-height))
    + var(--detail-height)
    + 30px
  );
  overflow: hidden;
}

body.day-mode .gantt-rows-viewport {
  overscroll-behavior-y: auto;
}

body.day-mode .app-shell {
  padding-bottom: 28px;
}

.gantt-head {
  display: grid;
  grid-template-columns: var(--left-width) minmax(0, 1fr);
  flex: none;
  border-bottom: 1px solid var(--line);
}

.gantt-head .left-head {
  border-right: 1px solid var(--line);
  background: var(--panel-strong);
}

.gantt-rows-viewport {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: auto;
  scrollbar-color: #64748b #e2e8f0;
}

.gantt-rows-viewport::-webkit-scrollbar {
  width: 14px;
}

.gantt-rows-viewport::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 999px;
}

.gantt-rows-viewport::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #64748b;
  border: 2px solid #e2e8f0;
}

.gantt-rows-viewport::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.gantt-rows-pair {
  display: grid;
  grid-template-columns: var(--left-width) minmax(0, 1fr);
  align-items: start;
}

.project-labels {
  border-right: 1px solid var(--line);
  background: var(--panel-strong);
  overflow: hidden;
  min-width: 0;
}

.gantt-track {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  background: #fff;
  scrollbar-width: none;
}

.gantt-track::-webkit-scrollbar {
  display: none;
}

.gantt-hscroll {
  flex: none;
  display: grid;
  grid-template-columns: var(--left-width) minmax(0, 1fr);
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.gantt-hscroll__pad {
  border-right: 1px solid var(--line);
  background: var(--panel-strong);
}

.gantt-hscroll__track {
  overflow-x: auto;
  overflow-y: hidden;
  height: 28px;
  padding: 2px 0 4px;
  scrollbar-width: auto;
  scrollbar-color: #64748b #e2e8f0;
}

.gantt-hscroll__track::-webkit-scrollbar {
  height: 20px;
}

.gantt-hscroll__track::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 999px;
}

.gantt-hscroll__track::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #64748b;
  border: 2px solid #e2e8f0;
}

.gantt-hscroll__track::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.gantt-hscroll__spacer {
  height: 1px;
  pointer-events: none;
}

body.view-staff .gantt-hscroll {
  display: none;
}

.left-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 72px;
  padding: 15px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.left-head__label {
  min-width: 0;
}

.add-project-button {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.add-project-button:hover {
  filter: brightness(1.08);
}

.add-project-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.project-labels {
  display: grid;
  position: relative;
}

.gantt-grid {
  display: flex;
  flex-direction: column;
  flex: none;
  position: relative;
  width: calc(var(--week-width) * var(--week-count));
  min-width: calc(var(--week-width) * var(--week-count));
}

.project-slot,
.gantt-slot {
  position: relative;
  will-change: transform;
}

.gantt-slot {
  min-width: calc(var(--week-width) * var(--week-count));
}

.is-reordering .project-slot:not(.is-dragging),
.is-reordering .gantt-slot:not(.is-dragging) {
  transition: transform 200ms cubic-bezier(0.2, 0, 0, 1);
}

.project-slot.is-dragging {
  z-index: 6;
}

.project-slot.is-dragging .project-label {
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(16, 24, 40, 0.18);
}

.gantt-slot.is-dragging {
  z-index: 5;
  filter: drop-shadow(0 8px 20px rgba(16, 24, 40, 0.12));
}

.project-slot.is-dragging,
.gantt-slot.is-dragging {
  transition: none;
}

body.is-reordering {
  cursor: grabbing;
  user-select: none;
}

body.is-reordering .project-label {
  cursor: grabbing;
}

.project-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: var(--row-height);
  min-height: var(--row-height);
  max-height: var(--row-height);
  padding: 4px 6px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 10px;
  line-height: 1.15;
  overflow: hidden;
}

.project-label:hover,
.project-label.active {
  background: #eef5ff;
}



.project-label.dimmed,
.gantt-row.dimmed {
  opacity: 0.35;
}

body.day-mode .project-label.dimmed,
body.day-mode .gantt-row.dimmed {
  opacity: 0.5;
}

body.day-mode .project-slot.is-expanded {
  position: relative;
  z-index: 1;
}

body.day-mode .project-slot.is-expanded .project-label.active {
  box-shadow: inset 4px 0 0 var(--blue);
}

body.day-mode .gantt-slot.is-expanded {
  background: #f8fbff;
  position: relative;
  z-index: 10;
}

.project-label--gate-soon {
  box-shadow: inset 3px 0 0 var(--yellow);
}

.project-label--gate-overdue {
  box-shadow: inset 3px 0 0 var(--red);
  background: rgba(194, 65, 58, 0.06);
}

.project-main {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  flex: none;
}

.drag-handle {
  flex: none;
  color: #9aa4b2;
  cursor: grab;
  font-size: 11px;
  line-height: 1;
  touch-action: none;
  padding: 1px 2px;
  border-radius: 4px;
  margin-top: 1px;
}

.drag-handle:hover {
  color: #667085;
  background: rgba(47, 111, 171, 0.08);
}

.drag-handle:active,
body.is-reordering .drag-handle {
  cursor: grabbing;
}

.project-title-block {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.project-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.priority-badge {
  flex: none;
  min-width: 22px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-align: center;
}

.priority-badge--1 {
  background: var(--red-bg);
  color: var(--red);
}

.priority-badge--2 {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.priority-badge--3 {
  background: var(--blue-bg);
  color: var(--blue);
}

.project-label.priority-row {
  border-left: 3px solid transparent;
}

.project-label.priority-row--1 {
  border-left-color: var(--red);
}

.project-label.priority-row--2 {
  border-left-color: var(--yellow);
}

.project-label.priority-row--3 {
  border-left-color: var(--blue);
}

.po-lane-head,
.po-lane-head-spacer {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  padding: 4px 10px;
  background: #eef0f3;
  box-sizing: border-box;
}

.po-lane-head__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #111827;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.po-lane-head__title {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.po-lane-head__lock {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.po-lane-separator,
.po-lane-separator-spacer {
  height: 10px;
  min-height: 10px;
  max-height: 10px;
  border-bottom: 3px solid #111827;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  box-sizing: border-box;
}

.project-slot--po .project-label {
  background: #f8fafc;
}

.gantt-slot--po .gantt-row {
  background: rgba(248, 250, 252, 0.9);
}

.po-lane-lock {
  flex: none;
  color: #9aa4b2;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 4px;
  margin-top: 1px;
  border-radius: 4px;
  background: #eef0f3;
  cursor: default;
  user-select: none;
}

.project-id {
  color: var(--text);
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.project-name {
  color: #3d4a63;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
}

.project-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 2px;
  width: 100%;
  min-width: 0;
  flex: none;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.1;
}

.project-sub-meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 58px;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 1px 5px;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.status-pill:hover {
  filter: brightness(0.96);
}

.detail-color-row {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
  flex: none;
  font-size: 10px;
  color: var(--muted);
}

.color-picker {
  display: flex;
  align-items: center;
  gap: 6px;
}

.day-detail-plan .detail-color-row__label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.day-detail-plan .color-picker {
  flex-wrap: nowrap;
  gap: 5px;
}

.day-detail-plan .color-swatch {
  width: 20px;
  height: 20px;
  flex: none;
}

.detail-lifecycle-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex: none;
}

.detail-lifecycle-row .mini-button {
  flex: 1;
  min-height: 24px;
  padding: 2px 6px;
  font-size: 10px;
}

.mini-button--muted {
  background: #f8fafc;
  color: var(--muted);
}

.detail-archive-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  flex: none;
}

.detail-archive-banner--completed {
  background: var(--green-bg);
  color: var(--green);
}

.detail-archive-banner--removed {
  background: var(--gray-bg);
  color: var(--gray);
}

.project-archive-badge {
  flex: none;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-archive-badge--completed {
  background: var(--green-bg);
  color: var(--green);
}

.project-archive-badge--removed {
  background: var(--gray-bg);
  color: var(--gray);
}

.project-label--archived .project-name {
  color: var(--muted);
}

.color-swatch {
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  padding: 0;
}

.color-swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--text);
}

.color-swatch--green {
  background: var(--green);
}

.color-swatch--yellow {
  background: var(--yellow);
}

.color-swatch--red {
  background: var(--red);
}

.color-swatch--gray {
  background: var(--gray);
}

.status-gron {
  background: var(--green-bg);
  color: var(--green);
}

.status-gul {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.status-rod {
  background: var(--red-bg);
  color: var(--red);
}

.status-gra {
  background: var(--gray-bg);
  color: var(--gray);
}

.gantt-axis {
  min-width: 0;
  height: var(--axis-height);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  background: var(--panel);
}

.gantt-axis::-webkit-scrollbar {
  display: none;
}



.month-axis,
.week-axis,
.gantt-row {
  position: relative;
  min-width: calc(var(--week-width) * var(--week-count));
}

.month-axis {
  display: grid;
  grid-template-columns: repeat(var(--week-count), var(--week-width));
  height: 36px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.month-cell {
  padding: 10px 8px;
  border-right: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.week-axis {
  display: grid;
  grid-template-columns: repeat(var(--week-count), var(--week-width));
  height: 36px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.week-cell {
  padding: 10px 8px;
  border-right: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.week-cell--today {
  background: var(--blue-bg);
  color: var(--blue);
  box-shadow: inset 0 -3px 0 var(--blue);
}

.day-axis {
  position: relative;
  height: 28px;
  min-width: calc(var(--week-width) * var(--week-count));
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.day-axis-cell {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.day-axis-cell__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  min-height: 18px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(47, 111, 171, 0.16);
}

.day-axis-cell--weekend .day-axis-cell__num {
  color: #8a94a6;
  border-color: rgba(138, 148, 166, 0.28);
}

.day-axis-cell--today .day-axis-cell__num {
  background: var(--blue-bg);
  color: var(--blue);
  border-color: rgba(47, 111, 171, 0.35);
  font-weight: 800;
}

.day-axis-cell--holiday .day-axis-cell__num {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(194, 65, 58, 0.25);
}

.gantt-row {
  height: var(--row-height);
  border-bottom: 1px solid var(--line-soft);
  background-image: linear-gradient(to right, var(--line-soft) 1px, transparent 1px);
  background-size: var(--week-width) 100%;
  isolation: isolate;
  cursor: pointer;
}

.gantt-row:hover {
  background-color: #f8fbff;
}

.gantt-row.selected {
  background-color: #f2f7ff;
}

.bar {
  position: absolute;
  top: calc((var(--row-height) - var(--bar-height)) / 2);
  height: var(--bar-height);
  border: 0;
  border-radius: 5px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);
  overflow: hidden;
  z-index: 2;
}

.bar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
}

.bar.green {
  background: var(--green);
}

.bar.yellow {
  background: var(--yellow);
}

.bar.red {
  background: var(--red);
}

.bar.gray {
  background: var(--gray);
}

.bar.bar--procurement {
  top: calc((var(--row-height) - calc(var(--bar-height) * 0.55)) / 2);
  height: calc(var(--bar-height) * 0.55);
  background: rgba(0, 112, 192, 0.38);
  border: 1px solid rgba(0, 112, 192, 0.5);
  box-shadow: none;
  z-index: 1;
}

.bar.bar--execution {
  z-index: 3;
}

body:not(.day-mode) .bar.bar--execution[data-span-start],
body:not(.day-mode) .bar.bar--procurement[data-span-start] {
  cursor: pointer;
}

.bar.bar--execution.green,
.bar.green.bar--execution {
  background: var(--green);
}

.bar.bar--execution.yellow,
.bar.yellow.bar--execution {
  background: var(--yellow);
}

.bar.bar--execution.red,
.bar.red.bar--execution {
  background: var(--red);
}

.bar.bar--execution.gray,
.bar.gray.bar--execution {
  background: var(--gray);
}

.bar.bar--milestone {
  top: calc((var(--row-height) - calc(var(--bar-height) * 0.45)) / 2);
  height: calc(var(--bar-height) * 0.45);
  background: #ffc000;
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.1);
  border-radius: 3px;
  z-index: 1;
  pointer-events: none;
}

body:not(.day-mode) .bar {
  top: calc((var(--row-height) - var(--bar-height)) / 2);
}

body:not(.day-mode) .bar.bar--milestone {
  top: calc((var(--row-height) - calc(var(--bar-height) * 0.45)) / 2);
}

.bom-due-marker .gate-marker__pill {
  background: #5b4bb7;
  border-color: #fff;
}

.gate-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.gate-layer .gate-marker {
  pointer-events: auto;
}

.gate-marker {
  position: absolute;
  top: 12px;
  transform: translateX(-50%);
  z-index: 6;
  pointer-events: auto;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
}

.gate-marker__pill {
  display: inline-flex;
  align-items: center;
  max-width: 56px;
  justify-content: center;
  padding: 4px 8px;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(16, 24, 40, 0.22);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gate-marker--green .gate-marker__pill {
  background: var(--green);
}

.gate-marker--yellow .gate-marker__pill {
  background: var(--yellow);
}

.gate-marker--red .gate-marker__pill {
  background: var(--red);
}

.gate-marker--gray .gate-marker__pill {
  background: var(--gray);
}

.gate-marker::before {
  content: "";
  position: absolute;
  top: 24px;
  left: 50%;
  width: 2px;
  height: 14px;
  transform: translateX(-50%);
  background: currentColor;
  opacity: 0.55;
}

.gate-marker--green {
  color: var(--green);
}

.gate-marker--yellow {
  color: var(--yellow);
}

.gate-marker--red {
  color: var(--red);
}

.gate-marker--gray {
  color: var(--gray);
}

.today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  width: 2px;
  background: #111827;
  pointer-events: none;
}

.today-line::before {
  content: "Today";
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #111827;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}



.day-detail-spacer {
  flex: none;
  display: flex;
  flex-direction: column;
  height: var(--detail-height);
  min-height: var(--detail-height);
  max-height: var(--detail-height);
  overflow: hidden;
}

body.day-mode .project-slot.is-expanded {
  display: flex;
  flex-direction: column;
  height: calc(var(--row-height) + var(--detail-height));
  min-height: calc(var(--row-height) + var(--detail-height));
}

body.day-mode .gantt-slot.is-expanded {
  display: grid;
  grid-template-rows: var(--row-height) var(--detail-height);
  height: calc(var(--row-height) + var(--detail-height));
  min-height: calc(var(--row-height) + var(--detail-height));
}

body.day-mode .gantt-slot.is-expanded .gantt-row {
  grid-row: 1;
}

body.day-mode .gantt-slot.is-expanded .day-detail-row {
  grid-row: 2;
}

body.day-mode .project-slot:not(.is-expanded) {
  height: var(--row-height);
  min-height: var(--row-height);
}

body.day-mode .gantt-slot:not(.is-expanded) {
  height: var(--row-height);
  min-height: var(--row-height);
}

.day-detail-plan {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #eef5ff;
  overflow: hidden;
}

.detail-plan-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex: none;
  flex-wrap: wrap;
}

.detail-plan-toolbar .detail-color-row {
  margin-bottom: 0;
  flex: 1;
  min-width: 200px;
}

.detail-plan-toolbar .detail-lifecycle-row,
.detail-plan-toolbar .detail-archive-banner {
  margin-bottom: 0;
  flex: none;
}

.detail-plan-toolbar .mini-button--archive {
  width: auto;
  white-space: nowrap;
}

.day-detail-timeline {
  position: relative;
  width: calc(var(--week-width) * var(--week-count));
  min-width: calc(var(--week-width) * var(--week-count));
  height: var(--detail-height);
  overflow: hidden;
}

.detail-label-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex: none;
}

.detail-label-top strong {
  font-size: 14px;
}

.detail-label-heading {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.detail-project-lead {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.detail-project-lead__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mini-button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.detail-label-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.detail-label-grid span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.detail-label-grid b {
  display: block;
  color: var(--text);
  font-size: 10px;
  text-transform: uppercase;
}

.pm-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--blue-bg);
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: middle;
}

.risk-card .pm-initials {
  margin-left: 0;
}

.day-detail-row {
  position: relative;
  height: var(--detail-height);
  min-height: var(--detail-height);
  max-height: var(--detail-height);
  min-width: calc(var(--week-width) * var(--week-count));
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
  isolation: isolate;
}

.day-grid-lines {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(to right, var(--line-soft) 1px, transparent 1px);
  background-size: calc(var(--week-width) / 7) 100%;
}

.day-col-guide {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  border-right: 1px solid rgba(47, 111, 171, 0.1);
}

.day-col-guide--week {
  border-right: 2px solid rgba(47, 111, 171, 0.28);
  background: rgba(47, 111, 171, 0.03);
}

.day-detail-row .day-col-guide--week {
  background: transparent;
}

.day-today-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
  background: rgba(17, 24, 39, 0.06);
  box-shadow: inset 0 0 0 2px rgba(17, 24, 39, 0.55);
}

.day-detail-row .row-day-shades {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.day-detail-row .day-shade {
  position: absolute;
  top: 0;
  bottom: 0;
}

.day-detail-row .day-shade--weekend {
  background: rgba(194, 65, 58, 0.08);
}

.day-detail-row .day-shade--holiday {
  background: rgba(194, 65, 58, 0.18);
  box-shadow: inset 0 0 0 1px rgba(194, 65, 58, 0.22);
}

.day-project-window {
  position: absolute;
  border-radius: 6px;
  pointer-events: none;
  z-index: 1;
}

body.day-mode .day-project-window--editable {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  z-index: 3;
}

body.day-mode .day-project-window--editable::before {
  content: "✎ Dra eller klicka för datum";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.88);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.01em;
  pointer-events: none;
  white-space: nowrap;
}

body.day-mode .day-project-window--execution.day-project-window--editable::before {
  color: rgba(146, 64, 14, 0.95);
}

body.day-mode .day-project-window--procurement.day-project-window--editable::before {
  color: rgba(47, 111, 171, 0.95);
}

body.day-mode .day-project-window--execution.day-project-window--editable:hover {
  filter: brightness(0.98);
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.28);
}

body.day-mode .day-project-window--procurement.day-project-window--editable:hover {
  filter: brightness(0.98);
  box-shadow: inset 0 0 0 1px rgba(47, 111, 171, 0.2);
}

body.day-mode .day-project-window--execution.day-project-window--editable.is-dragging {
  cursor: grabbing;
  z-index: 8;
  filter: brightness(1.02);
  box-shadow: inset 0 0 0 2px rgba(217, 119, 6, 0.4);
}

body.day-mode .day-project-window--procurement.day-project-window--editable.is-dragging {
  cursor: grabbing;
  z-index: 8;
  filter: brightness(1.02);
  box-shadow: inset 0 0 0 2px rgba(47, 111, 171, 0.35);
}

.day-project-window--execution {
  top: var(--day-bookings-top, 22px);
  height: var(--day-bookings-height, 60px);
  border: 1px solid rgba(217, 119, 6, 0.42);
  background: rgba(255, 236, 179, 0.48);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.day-project-window--procurement {
  top: var(--day-markers-top, 86px);
  height: var(--day-markers-height, 114px);
  border: 1px solid rgba(0, 112, 192, 0.35);
  background: rgba(0, 112, 192, 0.08);
}

.day-booking-hits {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.day-booking-hit {
  position: absolute;
  top: 0;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.day-header-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 22px;
  z-index: 3;
  pointer-events: none;
}

.day-tick {
  position: absolute;
  top: 2px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
}

.day-tick--monday {
  color: #111827;
  font-weight: 800;
}

.day-tick--today {
  color: #fff;
  background: #111827;
  border-radius: 4px;
  padding: 0 4px;
}

body.day-mode .day-tick {
  font-size: 10px;
}

body.day-mode .day-tick--dense {
  justify-content: center;
  padding-left: 0;
}

.day-cell {
  position: absolute;
  top: 0;
  height: 30px;
  z-index: 1;
  border: 0;
  padding: 2px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  pointer-events: auto;
}

.day-cell:hover {
  background: rgba(47, 111, 171, 0.08);
}

.day-cell__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(47, 111, 171, 0.18);
  font-weight: 800;
  line-height: 1;
}

.day-cell.monday .day-cell__num {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.day-cell.friday .day-cell__num {
  border-color: var(--line);
  background: #f8fafc;
}

.day-cell--today {
  background: rgba(17, 24, 39, 0.05);
}

.day-cell--today .day-cell__num {
  background: #111827;
  color: #fff;
  border-color: #111827;
  box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.15);
}

.day-cell--weekend {
  background: rgba(194, 65, 58, 0.06);
}

.day-cell--holiday {
  background: rgba(194, 65, 58, 0.14);
}

.day-cell--weekend .day-cell__num,
.day-cell--holiday .day-cell__num {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(194, 65, 58, 0.25);
}

.day-lane {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 0;
  pointer-events: none;
  border-top: 1px dashed rgba(47, 111, 171, 0.16);
  border-bottom: 1px dashed rgba(47, 111, 171, 0.16);
}

.day-lane--bookings {
  top: var(--day-bookings-top, 28px);
  height: var(--day-bookings-height, 104px);
  background: rgba(255, 236, 179, 0.1);
}

.day-lane--markers {
  top: var(--day-markers-top, 138px);
  height: var(--day-markers-height, 72px);
  background: rgba(220, 236, 255, 0.14);
}

.day-markers-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--day-markers-top, 138px);
  height: var(--day-markers-height, 72px);
  z-index: 11;
  pointer-events: none;
}

.day-bookings-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--day-bookings-top, 28px);
  height: var(--day-bookings-height, 104px);
  z-index: 25;
  pointer-events: none;
}

.day-gates-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.day-gates-layer .day-milestone {
  top: var(--day-gates-top, 0);
  height: var(--day-gates-height, 36px);
}

.day-blockers-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.day-blockers-layer .day-milestone {
  top: var(--day-blockers-top, 38px);
  height: var(--day-blockers-height, 34px);
}

.day-detail-row .day-booking {
  pointer-events: auto;
}

.day-booking {
  position: absolute;
  top: 0;
  height: 100%;
  min-width: 20px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: grab;
  overflow: visible;
  touch-action: none;
  z-index: 14;
}

.day-booking:hover {
  z-index: 16;
}

.day-booking:hover .day-booking-bar {
  border-color: #b45309;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.65),
    0 3px 10px rgba(16, 24, 40, 0.2);
}

.day-booking.is-dragging {
  cursor: grabbing;
  z-index: 20;
}

.day-booking-bar {
  position: absolute;
  inset: 4px 2px;
  box-sizing: border-box;
  border: 1px solid #d97706;
  border-radius: 6px;
  background: rgba(255, 242, 204, 0.98);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.65),
    0 2px 8px rgba(16, 24, 40, 0.14);
  pointer-events: auto;
  cursor: inherit;
}

.day-booking.is-dragging .day-booking-bar {
  background: rgba(255, 230, 153, 0.98);
  border-color: #b45309;
}

.day-booking__handle {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  opacity: 0.85;
  font-size: 12px;
  line-height: 1;
  color: #92400e;
  pointer-events: auto;
  cursor: inherit;
}

.day-booking__code {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  min-width: 28px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #1f2937;
  pointer-events: auto;
  cursor: inherit;
}

.day-booking__text {
  position: absolute;
  left: 40px;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  color: #92400e;
  pointer-events: auto;
  cursor: inherit;
}

.booking-code--vacation .day-booking-bar,
.booking-code--parental .day-booking-bar {
  border-color: transparent;
}

.booking-code--vacation .day-booking-bar {
  background: var(--staff-vacation-bg);
  border-color: var(--staff-vacation-border);
}

.booking-code--parental .day-booking-bar {
  background: var(--staff-parental-bg);
  border-color: var(--staff-parental-border);
}

.booking-code--delivery .day-booking-bar {
  background: #fff6bf;
  border-color: #d4a72c;
}

.booking-code--fat .day-booking-bar,
.booking-code--gate .day-booking-bar {
  background: #dcecff;
  border-color: #2f6fab;
}

.booking-code--site .day-booking-bar,
.booking-code--install .day-booking-bar {
  background: #dff3ea;
  border-color: #1f8a5b;
}

.booking-code--sick .day-booking-bar {
  background: #fde2df;
  border-color: #c2413a;
}

.booking-code--training .day-booking-bar,
.booking-code--production .day-booking-bar,
.booking-code--work .day-booking-bar {
  background: rgba(220, 236, 255, 0.95);
  border-color: #2f6fab;
}

.day-booking:not(:has(.day-booking__code)) .day-booking__text {
  left: 18px;
}

.booking-code--vacation .day-booking__text,
.booking-code--parental .day-booking__text,
.booking-code--delivery .day-booking__text,
.booking-code--fat .day-booking__text,
.booking-code--gate .day-booking__text,
.booking-code--site .day-booking__text,
.booking-code--install .day-booking__text,
.booking-code--sick .day-booking__text,
.booking-code--training .day-booking__text,
.booking-code--production .day-booking__text,
.booking-code--work .day-booking__text {
  color: #1f2937;
}

.day-band {
  position: absolute;
  top: 74px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  pointer-events: none;
}

.day-milestone {
  position: absolute;
  top: 0;
  width: 2px;
  height: 36px;
  background: #111827;
  pointer-events: none;
}

.day-milestone--editable {
  width: 132px;
  margin-left: -10px;
  pointer-events: auto;
  cursor: grab;
  border: 0;
  padding: 0;
  background: transparent !important;
  z-index: 2;
  touch-action: none;
  overflow: visible;
  -webkit-user-drag: none;
  user-select: none;
}

.day-milestone--blocker {
  pointer-events: auto;
  z-index: 1;
}

.day-milestone--blocker-editable {
  width: 132px;
  margin-left: -10px;
  cursor: grab;
  border: 0;
  padding: 0;
  background: transparent !important;
  touch-action: none;
  z-index: 2;
  overflow: visible;
  -webkit-user-drag: none;
  user-select: none;
}

.day-milestone--blocker-editable::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 0;
  width: 2px;
  height: 100%;
  border-radius: 1px;
  pointer-events: none;
}

.day-milestone--blocker-editable.red::before {
  background: var(--red);
}

.day-milestone--blocker-editable.yellow::before {
  background: var(--yellow);
}

.day-milestone--blocker-editable.green::before {
  background: var(--green);
}

.day-milestone--blocker-editable:hover::before {
  width: 3px;
  left: 8.5px;
  box-shadow: 0 0 0 2px rgba(194, 65, 58, 0.18);
}

.day-milestone--blocker-editable.is-dragging {
  cursor: grabbing;
  opacity: 0.88;
  z-index: 8;
}

.day-milestone--blocker-editable.is-dragging::before {
  width: 3px;
  left: 8.5px;
  box-shadow: 0 0 0 3px rgba(194, 65, 58, 0.22);
}

.day-milestone--blocker span {
  border: 1px dashed rgba(194, 65, 58, 0.45);
}

.day-milestone--editable::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 0;
  width: 2px;
  height: 100%;
  background: #111827;
  border-radius: 1px;
  pointer-events: none;
}

.day-milestone--editable.day-milestone--green::before {
  background: var(--green);
}

.day-milestone--editable.day-milestone--yellow::before {
  background: var(--yellow);
}

.day-milestone--editable.day-milestone--red::before {
  background: var(--red);
}

.day-milestone--editable.day-milestone--gray::before {
  background: var(--gray);
}

.day-milestone--editable:hover::before {
  width: 3px;
  left: 8.5px;
  box-shadow: 0 0 0 2px rgba(47, 111, 171, 0.2);
}

.day-milestone--editable.is-dragging {
  cursor: grabbing;
  opacity: 0.88;
  z-index: 8;
}

.day-milestone--editable.is-dragging::before {
  width: 3px;
  left: 8.5px;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.day-milestone--editable:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.day-milestone--green {
  background: var(--green);
}

.day-milestone--green span {
  background: var(--green);
}

.day-milestone--yellow {
  background: var(--yellow);
}

.day-milestone--yellow span {
  background: var(--yellow);
}

.day-milestone--red {
  background: var(--red);
}

.day-milestone--red span {
  background: var(--red);
}

.day-milestone--gray {
  background: var(--gray);
}

.day-milestone--gray span {
  background: var(--gray);
}

.day-plan-quick-picks {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.day-plan-quick-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.day-plan-quick-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.day-plan-quick-pick {
  min-width: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.day-plan-quick-pick:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.day-plan-quick-pick[data-gate-label]:hover {
  border-color: #5b4bb7;
  background: #f3f0ff;
}

.day-milestone span {
  position: absolute;
  top: 0;
  left: 5px;
  max-width: 120px;
  border-radius: 5px;
  padding: 3px 6px;
  background: #111827;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-milestone.red {
  background: var(--red);
}

.day-milestone.red span {
  background: var(--red);
}

.day-milestone.yellow {
  background: var(--yellow);
}

.day-milestone.yellow span {
  background: var(--yellow);
}

.day-milestone.gate {
  background: #111827;
}

.day-milestone--soon {
  box-shadow: 0 0 0 2px var(--yellow);
}

.day-milestone--overdue {
  box-shadow: 0 0 0 2px var(--red);
  animation: deadline-pulse 1.6s ease-in-out infinite;
}

@keyframes deadline-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

.decision-dock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.decision-dock > article {
  padding: 14px;
  min-height: 0;
}

.supply-chain-export-main {
  width: 100%;
  justify-content: center;
  min-height: 42px;
  margin-bottom: 10px;
  font-size: 14px;
}

.dock-article--hot {
  border-top: 3px solid var(--blue);
}

.section-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.dock-rules-note {
  margin: -2px 0 10px;
  color: #475467;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

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

.risk-card,
.detail-card {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.risk-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.risk-card--with-action {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  cursor: default;
}

.risk-card__open {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  position: relative;
}

.risk-card__open:hover::after {
  content: "Open project →";
  position: absolute;
  right: 10px;
  top: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.risk-card__clear {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 76px;
  padding: 10px 8px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 7px 7px 0;
  background: var(--green-bg);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.risk-card__clear-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
}

.risk-card__clear-label {
  text-align: center;
}

.risk-card__clear:hover {
  background: #c9ead8;
}

.risk-card__clear:hover .risk-card__clear-icon {
  background: #18724d;
}

.risk-card__clear:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

.risk-card.red {
  border-left-color: var(--red);
}

.risk-card.yellow {
  border-left-color: var(--yellow);
}

.risk-card.blue {
  border-left-color: var(--blue);
}

.detail-card.red {
  border-left-color: var(--red);
}

.detail-card.yellow {
  border-left-color: var(--yellow);
}

.detail-card.blue {
  border-left-color: var(--blue);
}

.risk-card strong,
.detail-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.risk-card p,
.detail-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.risk-card small {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.risk-card--soon {
  background: #fffbeb;
}

.risk-card--soon small {
  color: #92400e;
}

.risk-card--overdue {
  background: var(--red-bg);
}

.risk-card--overdue small {
  color: var(--red);
}

.calendar-summary strong#metric-overdue {
  color: var(--red);
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: min(440px, 100vw);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(16, 24, 40, 0.18);
  transform: translateX(105%);
  transition: transform 160ms ease;
  display: flex;
  flex-direction: column;
}

.detail-panel.open {
  transform: translateX(0);
}

.panel-header {
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  font-size: 20px;
}

.close-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
}

.panel-body {
  overflow: auto;
  padding: 16px 18px 22px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

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

.fact span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.fact strong {
  font-size: 13px;
}

.panel-section {
  margin-top: 16px;
}

.panel-section h3 {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.empty-text {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.project-dialog {
  width: min(720px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.project-dialog::backdrop {
  background: rgba(16, 24, 40, 0.32);
}

.project-form {
  padding: 18px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head {
  margin-bottom: 16px;
}

.dialog-head h2 {
  font-size: 22px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
}

.form-grid textarea {
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
}

.danger-button {
  border-color: var(--red);
  color: var(--red);
}

.form-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.dialog-actions {
  margin-top: 16px;
}

.risk-chip {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--gray-bg);
  color: var(--gray);
  font-size: 11px;
  font-weight: 800;
}

.risk-chip.blue {
  background: var(--blue-bg);
  color: var(--blue);
}

.risk-chip.yellow {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.risk-chip.red {
  background: var(--red-bg);
  color: var(--red);
}

.view-switch {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
}

.view-switch__btn {
  min-height: 34px;
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.view-switch__btn.is-active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.08);
}

.view-switch__short {
  display: none;
}

/* When view-switch is moved inside .topbar (for mobile sticky header), keep desktop layout by wrapping it below */
.topbar > .view-switch {
  flex-basis: 100%;
  order: 3;
  margin-top: 8px;
  margin-bottom: 0;
}

/* Ensure the tabs are inside the sticky mobile header */
@media (max-width: 768px) {
  .topbar .view-switch {
    margin-top: 0;
    margin-bottom: 4px;
  }
}

.dock-panel {
  border: 0;
  margin: 0;
}

.dock-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
  cursor: default;
}

.dock-panel__head::-webkit-details-marker {
  display: none;
}

.dock-panel__titles {
  min-width: 0;
}

.dock-panel__titles h2 {
  margin: 0;
}

.dock-panel__body {
  margin-top: 0;
}

.back-link__short {
  display: none;
}

.mobile-filters {
  margin-bottom: 10px;
}

.mobile-filters__summary {
  display: none;
  list-style: none;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.mobile-filters__summary::-webkit-details-marker {
  display: none;
}

.mobile-filters .control-panel {
  margin-top: 0;
}

.staff-toolbar-extra {
  margin: 0;
  border: 0;
}

.staff-toolbar-extra__summary {
  display: none;
  list-style: none;
  min-height: 36px;
  padding: 6px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.staff-toolbar-extra__summary::-webkit-details-marker {
  display: none;
}

.staff-toolbar-extra__body {
  display: grid;
  gap: 8px;
}

body.view-staff .control-panel,
body.view-staff .view-panel--projects,
body.view-staff .view-panel--brief {
  display: none;
}

body.view-brief .view-panel--projects,
body.view-brief .view-panel--staff {
  display: none;
}

body.view-projects .view-panel--staff,
body.view-projects .view-panel--brief {
  display: none;
}

body.view-projects .view-panel--projects {
  display: flex;
  flex-direction: column;
  gap: 0;
}

body.view-staff {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  --week-width: 154px;
  --staff-vacation-bg: #fcd34d;
  --staff-vacation-border: #ca8a04;
  --staff-parental-bg: #c4b5fd;
  --staff-parental-border: #7c3aed;
  --staff-company-bg: #d1d5db;
  --staff-company-border: #6b7280;
}

body.view-staff .app-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 12px;
}

body.view-staff .view-switch {
  flex: none;
}

body.view-staff .view-panel--staff {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.view-staff .staff-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.view-staff .timeline-toolbar {
  flex: none;
}

.lead-times-card {
  padding-bottom: 18px;
}

.lead-times-toolbar {
  align-items: flex-start;
}

.lead-times-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.semester-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.semester-toggle input {
  width: 16px;
  height: 16px;
  min-height: 0;
  accent-color: var(--blue);
}

.lead-times-grid-wrap {
  padding: 10px 0 4px;
  overflow-x: auto;
}

.lead-times-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
}

.lead-times-table th,
.lead-times-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}

.lead-times-table thead th {
  background: #f1f5f9;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.lead-times-table tbody th {
  width: 34%;
  background: #fbfdff;
  font-weight: 800;
}

.lead-times-table td[contenteditable="true"] {
  background: #fff;
  cursor: text;
  font-weight: 800;
}

.lead-times-table td[contenteditable="true"]:focus {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  background: var(--blue-bg);
}

.lead-times-table .is-active-lead-time {
  background: #ecfdf3;
  color: #166534;
}

.ai-export-panel {
  margin: 14px 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.ai-export-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ai-export-output {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.ai-export-output[hidden] {
  display: none;
}

.ai-export-output--dock {
  min-height: 260px;
}

.ai-export-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ai-export-actions[hidden] {
  display: none;
}

.lead-times-advanced {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.lead-times-advanced > summary {
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style-position: inside;
}

.lead-times-advanced__body {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lead-times-advanced__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 640px) {
  .lead-times-toolbar,
  .lead-times-advanced__head,
  .ai-export-head {
    align-items: stretch;
    flex-direction: column;
  }

  .lead-times-actions,
  .ai-export-actions {
    justify-content: stretch;
  }

  .lead-times-actions .icon-button,
  .ai-export-head .icon-button,
  .ai-export-actions .icon-button,
  .semester-toggle {
    justify-content: center;
    width: 100%;
    white-space: normal;
  }
}

.staff-shell {
  display: grid;
  grid-template-columns: var(--left-width) minmax(0, 1fr);
  flex: 0 1 auto;
  height: min(var(--staff-shell-height, auto), 100%);
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

body.staff-all-collapsed .staff-shell {
  flex: none;
}

.staff-overview {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.staff-overview__head h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.staff-overview__head p {
  margin: 0;
}

.staff-overview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
}

.staff-overview__dept {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.staff-overview__dept:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 14px rgba(47, 111, 171, 0.12);
}

.staff-overview__dept:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.staff-overview__dept-name {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #334155;
}

.staff-overview__dept-meta {
  font-size: 12px;
  color: var(--muted);
}

.staff-overview__dept-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.staff-overview__dept-stat {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: #475467;
}

.staff-overview__dept-stat--vacation {
  background: #fef3c7;
  color: #92400e;
}

.staff-overview__dept-stat--parental {
  background: #ede9fe;
  color: #5b21b6;
}

.staff-left .left-head,
#staff-axis {
  flex: none;
  height: var(--staff-axis-height);
}

:root {
  --staff-row-height: 32px;
}

.staff-left {
  border-right: 1px solid var(--line);
  background: var(--panel-strong);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.staff-labels {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.staff-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

#staff-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #64748b #e2e8f0;
}

#staff-scroll::-webkit-scrollbar {
  width: 12px;
}

#staff-scroll::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 999px;
}

#staff-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #64748b;
  border: 2px solid #e2e8f0;
}

.staff-hscroll {
  flex: 0 0 30px;
  display: none;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

body.view-staff .staff-hscroll {
  display: block;
}

body.view-staff .topbar {
  flex: none;
}

.staff-hscroll__track {
  overflow-x: auto;
  overflow-y: hidden;
  height: 28px;
  padding: 2px 0 4px;
  scrollbar-width: auto;
  scrollbar-color: #64748b #e2e8f0;
}

.staff-hscroll__track::-webkit-scrollbar {
  height: 20px;
}

.staff-hscroll__track::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 999px;
}

.staff-hscroll__track::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #64748b;
  border: 2px solid #e2e8f0;
}

.staff-hscroll__track::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.staff-hscroll__spacer {
  height: 1px;
  pointer-events: none;
}

.staff-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  height: var(--staff-row-height);
  min-height: var(--staff-row-height);
  padding: 0 10px;
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
  white-space: nowrap;
}

.staff-label__name {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
}

.staff-label__role {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.staff-grid {
  position: relative;
  min-width: calc(var(--week-width) * var(--week-count));
}

.staff-today-column {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  background: rgba(47, 111, 171, 0.1);
  box-shadow: inset 0 0 0 1px rgba(47, 111, 171, 0.22);
  pointer-events: none;
}

.staff-grid .today-line {
  z-index: 7;
}

.staff-row {
  position: relative;
  height: var(--staff-row-height);
  border-bottom: 1px solid var(--line-soft);
}

.staff-row .row-day-shades {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.staff-cell {
  position: absolute;
  top: 4px;
  height: 24px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  padding: 0;
  z-index: 1;
  pointer-events: none;
}

.staff-bookings-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: 24px;
  z-index: 5;
  pointer-events: none;
}

.staff-row .day-booking {
  height: 100%;
  pointer-events: auto;
  z-index: 6;
}

.staff-row .day-booking:focus-visible {
  outline: 2px solid rgba(47, 111, 171, 0.45);
  outline-offset: 1px;
}

.staff-status-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: 24px;
  z-index: 3;
  pointer-events: none;
}

.staff-status-band {
  position: absolute;
  top: 0;
  height: 100%;
  box-sizing: border-box;
  border-radius: 4px;
}

.staff-status-band--draggable {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  z-index: 4;
}

.staff-status-band--draggable:focus-visible {
  outline: 2px solid rgba(47, 111, 171, 0.45);
  outline-offset: 1px;
}

.staff-status-band--draggable.is-dragging {
  cursor: grabbing;
  z-index: 6;
}

.staff-status-band__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.staff-status-band--draggable .staff-status-band__fill {
  border: 1px solid transparent;
  box-sizing: border-box;
}

.staff-status-band--vacation.staff-status-band--draggable .staff-status-band__fill {
  background: var(--staff-vacation-bg);
  border-color: var(--staff-vacation-border);
}

.staff-status-band--parental.staff-status-band--draggable .staff-status-band__fill {
  background: var(--staff-parental-bg);
  border-color: var(--staff-parental-border);
}

.staff-status-band--draggable.is-dragging .staff-status-band__fill {
  filter: brightness(0.96);
}

.staff-status-band__code {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.03em;
  pointer-events: none;
}

.staff-status-band__handle {
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  font-size: 9px;
  line-height: 1;
  opacity: 0.75;
  pointer-events: none;
}

.staff-status-band--vacation .staff-status-band__handle {
  color: #92400e;
}

.staff-status-band--parental .staff-status-band__handle {
  color: #5b21b6;
}

.staff-row-hit {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

.staff-row:hover .staff-cell {
  background: rgba(47, 111, 171, 0.08);
}

.day-detail-hit {
  position: absolute;
  inset: 0;
  z-index: 4;
  cursor: default;
  background: transparent;
  border: 0;
  pointer-events: none;
}

.day-detail-hit::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--day-bookings-top, 28px) + var(--day-bookings-height, 104px));
  bottom: 0;
  pointer-events: auto;
  cursor: cell;
}

body.day-drag-active {
  cursor: grabbing !important;
  user-select: none;
}

body.day-drag-active .day-booking.is-dragging,
body.day-drag-active .day-milestone.is-dragging,
body.day-drag-active .day-milestone--editable.is-dragging,
body.day-drag-active .day-milestone--blocker-editable.is-dragging {
  cursor: grabbing !important;
}

body.day-drag-active .day-detail-hit,
body.day-drag-active .day-detail-hit::before {
  pointer-events: none;
}

.day-detail-timeline.is-dragging-day::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--drag-day-left, 0);
  width: var(--drag-day-width, 0);
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px dashed rgba(59, 130, 246, 0.45);
  pointer-events: none;
  z-index: 5;
}

.calendar-zoom-controls {
  position: absolute;
  right: 10px;
  bottom: 28px;
  z-index: 12;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(216, 221, 230, 0.9);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

body.view-staff .calendar-zoom-controls {
  display: none;
}

.calendar-zoom-controls button {
  pointer-events: auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}

.calendar-zoom-controls button:hover {
  border-color: #9aa4b2;
  background: #f8fafc;
}

.staff-status-band--vacation {
  background: var(--staff-vacation-bg);
  border: 1px solid var(--staff-vacation-border);
}

.staff-status-band--parental {
  background: var(--staff-parental-bg);
  border: 1px solid var(--staff-parental-border);
}

.staff-status-band--company {
  background: var(--staff-company-bg);
  border: 1px solid var(--staff-company-border);
}

.staff-status-band--today {
  box-shadow: inset 0 0 0 2px rgba(17, 24, 39, 0.55);
}

.staff-cell:hover {
  background: rgba(47, 111, 171, 0.08);
}

.staff-cell--weekend {
  background: rgba(194, 65, 58, 0.1);
}

.staff-cell--holiday {
  background: rgba(194, 65, 58, 0.22);
}

.staff-cell--today {
  background: rgba(47, 111, 171, 0.12);
  box-shadow: inset 0 0 0 2px rgba(47, 111, 171, 0.45);
}

.dot.staff-work {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.dot.staff-vacation {
  background: var(--staff-vacation-bg);
  box-shadow: inset 0 0 0 1px var(--staff-vacation-border);
}

.dot.staff-parental {
  background: var(--staff-parental-bg);
  box-shadow: inset 0 0 0 1px var(--staff-parental-border);
}

.dot.staff-company {
  background: var(--staff-company-bg);
  box-shadow: inset 0 0 0 1px var(--staff-company-border);
}

.staff-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.area-code-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.staff-period-quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.staff-period-quick-pick {
  min-width: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.staff-period-quick-pick:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.staff-period-quick-pick.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.staff-period-quick-pick--clear {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff5f5;
}

.staff-period-quick-pick--clear:hover {
  border-color: #f87171;
  background: #fee2e2;
}

.area-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.area-code-chip strong {
  color: var(--text);
  font-size: 10px;
}

.staff-label--summary {
  background: #f8fafc;
  font-weight: 800;
}

.staff-dept-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  height: 30px;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-top: 2px solid #c5d0e0;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #e8eef6 0%, #eef2f7 100%);
  color: #334155;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: sticky;
  top: var(--staff-summary-row-height);
  z-index: 4;
  cursor: pointer;
  text-align: left;
}

.staff-dept-label:hover {
  background: linear-gradient(180deg, #dfe8f3 0%, #e8eef6 100%);
}

.staff-dept-label:focus-visible {
  outline: 2px solid rgba(47, 111, 171, 0.45);
  outline-offset: -2px;
}

.staff-dept-label--collapsed {
  color: #64748b;
  background: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%);
}

.staff-dept-label--collapsed .staff-dept-label__count {
  color: #94a3b8;
}

.staff-dept-label__chevron {
  flex-shrink: 0;
  width: 10px;
  font-size: 11px;
  line-height: 1;
  color: #64748b;
}

.staff-dept-label__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-dept-label__count {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
}

.staff-row--dept {
  height: 30px;
  min-height: 30px;
  background: linear-gradient(180deg, #e8eef6 0%, #eef2f7 100%);
  border-top: 2px solid #c5d0e0;
  border-bottom: 1px solid var(--line-soft);
  pointer-events: none;
}

.staff-row--dept-collapsed {
  background: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%);
}

.staff-row--dept-collapsed .staff-dept-band {
  color: #64748b;
}

.staff-dept-band {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #334155;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.staff-dept-band__count {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.staff-row--summary {
  height: var(--staff-summary-row-height);
  min-height: var(--staff-summary-row-height);
  background: #f8fafc;
  border-bottom: 2px solid var(--line);
}

.staff-label--summary {
  height: var(--staff-summary-row-height);
  min-height: var(--staff-summary-row-height);
}

.staff-summary-day {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  padding-top: 2px;
  box-sizing: border-box;
  pointer-events: none;
}

.staff-summary-day__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  min-height: 18px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(47, 111, 171, 0.16);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.staff-summary-day--weekend .staff-summary-day__num {
  color: #8a94a6;
  border-color: rgba(138, 148, 166, 0.28);
}

.staff-summary-day--today .staff-summary-day__num {
  background: var(--blue-bg);
  color: var(--blue);
  border-color: rgba(47, 111, 171, 0.35);
  font-weight: 800;
}

.staff-summary-day--holiday .staff-summary-day__num {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(194, 65, 58, 0.25);
}

.staff-summary-day__off {
  flex: 1;
  width: calc(100% - 4px);
  margin: 0 2px 2px;
  border-radius: 3px;
  background: transparent;
}

.staff-summary-day__off.is-all-off {
  background: rgba(107, 114, 128, 0.38);
  box-shadow: inset 0 0 0 1px rgba(107, 114, 128, 0.55);
}

.staff-summary-day--today .staff-summary-day__off.is-all-off {
  box-shadow: inset 0 0 0 2px rgba(17, 24, 39, 0.55);
}

.staff-label__edit {
  margin-left: auto;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.staff-label__edit:hover,
.staff-label__edit:focus-visible {
  background: rgba(47, 111, 171, 0.08);
  color: var(--blue);
}

/* ── Responsive: tablet (≤1024px) ── */
@media (max-width: 1024px) {
  :root {
    --left-width: 260px;
  }

  .topbar {
    padding: 14px 16px 10px;
    gap: 14px;
  }

  .app-shell {
    padding: 0 16px 16px;
  }

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

  .control-panel .search-label {
    grid-column: 1 / -1;
  }

  .decision-dock {
    grid-template-columns: 1fr 1fr;
  }

  .decision-dock > article:last-child {
    grid-column: 1 / -1;
  }

  .timeline-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-summary {
    margin-left: 0;
    max-width: 100%;
  }

  .brief-layout.brief-layout--detail {
    grid-template-columns: 1fr;
  }

  .brief-detail {
    position: static;
    top: auto;
    max-height: none;
    overflow: visible;
  }

  /* On tablets, relax staff calendar height so scrolling the full list is easy */
  body.view-staff .staff-shell {
    max-height: min(70dvh, calc(100dvh - 140px));
  }

  /* Tablet and below: simplify to calendar overview only.
     Settings, history, and the before-gate/risk/rules dock not needed. */
  .history-trigger,
  .settings-trigger {
    display: none !important;
  }

  .change-history-panel,
  .settings-panel {
    display: none !important;
  }

  .decision-dock {
    display: none !important;
  }
}

/* ── Responsive: mobile landscape / small tablet (≤768px) ── */
@media (max-width: 768px) {
  :root {
    --left-width: 140px;
    --row-height: 56px;
    --visible-row-count: 6;
  }

  body.view-projects:not(.day-mode) {
    --week-width: min(var(--project-week-width, 40px), 45px);
  }

  body.view-projects.day-mode {
    --left-width: 130px;
    --day-visible-rows: 6;
    --detail-height: 248px;
    --week-width: min(var(--project-week-width, 108px), 116px);
  }

  body:not(.day-mode) .view-panel--projects .decision-dock {
    order: -1;
    margin-top: 0;
    margin-bottom: 10px;
  }

  .shared-plan-hint {
    display: none;
  }

  .topbar .eyebrow {
    display: none;
  }

  .back-link__long {
    display: none;
  }

  .back-link__short {
    display: inline;
  }

  .mobile-filters__summary {
    display: flex;
  }

  .mobile-filters__summary::after {
    content: "▾";
    color: var(--muted);
    font-size: 14px;
    transition: transform 0.15s ease;
  }

  .mobile-filters:not([open]) .mobile-filters__summary::after {
    transform: rotate(-90deg);
  }

  .mobile-filters:not([open]) .control-panel {
    display: none;
  }

  body.view-projects.day-mode .mobile-filters {
    display: none;
  }

  .staff-toolbar-extra__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
    padding: 2px 0;
    font-size: 10px;
  }

  .staff-toolbar-extra__summary::after {
    content: "▾";
    color: var(--muted);
    font-size: 14px;
    transition: transform 0.15s ease;
  }

  .staff-toolbar-extra:not([open]) .staff-toolbar-extra__summary::after {
    transform: rotate(-90deg);
  }

  .staff-toolbar-extra:not([open]) .staff-toolbar-extra__body {
    display: none;
  }

  #gantt-scroll,
  #gantt-axis,
  #staff-scroll,
  #staff-axis,
  .gantt-hscroll__track,
  .staff-hscroll__track {
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }

  #gantt-rows-scroll {
    overscroll-behavior-y: auto;
  }

  h1 {
    font-size: 18px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }

  /* Taller project rows on mobile so P-number + full name fit (2 lines) */
  .project-label {
    padding: 6px 7px;
    justify-content: flex-start;
    line-height: 1.2;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .top-actions .save-status,
  .top-actions .icon-button {
    width: 100%;
    min-height: 44px;
  }

  .view-switch {
    display: flex;
    width: 100%;
  }

  .view-switch__btn {
    flex: 1;
    min-height: 44px;
    padding: 8px 6px;
  }

  .view-switch__long {
    display: none;
  }

  .view-switch__short {
    display: inline;
  }

  .control-panel {
    grid-template-columns: 1fr 1fr;
  }

  select,
  input,
  .icon-button,
  .close-button,
  .primary-action,
  .mini-button,
  .status-pill {
    min-height: 44px;
  }

  .status-pill {
    padding: 6px 10px;
  }

  .calendar-summary {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .calendar-summary::-webkit-scrollbar {
    display: none;
  }

  .metric-group--status {
    padding-right: 0;
    border-right: 0;
  }

  .metric-chip--inactive {
    display: none !important;
  }

  .decision-dock {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .decision-dock > article:last-child {
    grid-column: auto;
  }

  .dock-panel__head {
    cursor: pointer;
    min-height: 44px;
    padding: 2px 0;
  }

  .dock-panel__head::after {
    content: "▾";
    flex: none;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
    transition: transform 0.15s ease;
  }

  .dock-panel:not([open]) .dock-panel__head::after {
    transform: rotate(-90deg);
  }

  .dock-panel:not([open]) .dock-panel__body {
    display: none;
  }

  .dock-panel[open] .dock-panel__body {
    display: block;
  }

  body:not(.day-mode) .gantt-shell {
    height: auto;
    min-height: calc(var(--axis-height) + (var(--visible-row-count) * var(--row-height)) + 18px);
    max-height: min(55dvh, calc(100dvh - 220px));
  }

  body.day-mode .view-panel--projects .gantt-shell {
    min-height: 280px;
    max-height: min(72dvh, calc(100dvh - 180px));
  }

  body.view-staff .staff-shell {
    /* Give more room on mobile/tablet so it's easy to scroll the full list */
    height: auto;
    min-height: 260px;
    max-height: min(75dvh, calc(100dvh - 160px));
  }

  body.view-staff #staff-scroll {
    max-height: none;
    overscroll-behavior-y: auto;
    padding-bottom: 30px; /* ensure you can scroll to the very last staff rows */
  }

  /* On mobile, relax staff view constraints so sticky header works and scrolling the staff list doesn't get trapped */
  body.view-staff {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  /* Lock weeks on mobile staff view so the week headers are always visible (fixed scale) */
  body.view-staff {
    --week-width: 40px !important;
  }

  body.view-staff .calendar-zoom-controls {
    display: none;
  }

  body.view-staff .app-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-top: 0; /* content can scroll under sticky header */
  }

  /* Compact staff planning header on mobile so you can reach the actual calendar rows more easily */
  body.view-staff .timeline-toolbar {
    padding: 6px 10px;
  }

  body.view-staff .timeline-toolbar__title h2 {
    font-size: 13px;
  }

  body.view-staff .calendar-summary {
    gap: 4px;
    font-size: 10px;
  }

  /* Give the staff calendar shell more of the available height */
  body.view-staff .staff-shell {
    max-height: min(82dvh, calc(100dvh - 90px));
  }

  body.staff-all-collapsed .staff-overview {
    margin-top: 8px;
    padding: 12px 14px;
  }

  .staff-overview__grid {
    grid-template-columns: 1fr;
  }

  /* Remove "Choose a department" prompt on mobile to simplify the staff view */
  .staff-overview__head {
    display: none;
  }

  .project-sub-meta {
    display: none;
  }

  .project-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
  }

  /* Denser weeks on mobile: shrink axis labels to fit more weeks without being unreadable */
  .month-cell,
  .week-cell {
    padding: 4px 3px;
    font-size: 9px;
  }

  .project-focus-dock {
    min-height: 0;
    max-height: none;
    padding: 10px 12px;
  }

  .project-focus-dock__head {
    flex-direction: column;
    align-items: stretch;
  }

  .project-focus-dock__actions {
    justify-content: flex-start;
  }

  .project-focus-dock__grid {
    grid-template-columns: 1fr;
  }

  .detail-label-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .detail-plan-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-plan-toolbar .detail-color-row {
    min-width: 0;
  }

  .calendar-zoom-controls {
    right: 6px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .calendar-zoom-controls button {
    width: 44px;
    height: 44px;
  }

  .change-history-panel,
  .settings-panel {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    max-height: min(88vh, 100%);
    border-radius: 16px 16px 0 0;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 36px rgba(15, 23, 42, 0.18);
  }

  .project-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 24px - env(safe-area-inset-top, 0px));
    margin: auto;
  }

  .project-form {
    max-height: calc(100vh - 48px - env(safe-area-inset-top, 0px));
    overflow: auto;
  }

  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .staff-shell {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  body.view-staff .staff-hscroll {
    display: none !important;
  }

  #staff-scroll {
    overflow-x: auto;
    scrollbar-width: auto;
    overscroll-behavior-y: auto;
    padding-bottom: 20px;
  }

  #staff-scroll::-webkit-scrollbar:horizontal {
    height: 12px;
    display: block;
  }

  .staff-label__role {
    display: none;
  }

  .staff-hint {
    font-size: 11px;
  }

  /* Even more compact for small phones */
  body.view-staff .timeline-toolbar {
    padding: 4px 8px;
  }

  body.view-staff .timeline-toolbar__title h2 {
    font-size: 12px;
  }

  body.view-staff .calendar-summary {
    font-size: 9px;
  }

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

  .risk-card,
  .risk-card__open {
    min-height: 44px;
  }

  /* Larger staff department headers/rubriker on mobile for better tap targets and readability */
  :root {
    --staff-row-height: 44px;
  }

  /* Lock weeks on mobile staff view */
  body.view-staff {
    --week-width: 40px !important;
  }

  body.view-staff .calendar-zoom-controls {
    display: none;
  }

  .staff-row--dept {
    height: 44px;
    min-height: 44px;
  }

  .staff-overview__dept {
    padding: 14px 12px;
    min-height: 52px;
  }

  .staff-overview__dept-name {
    font-size: 15px;
  }

  .staff-overview__dept-meta {
    font-size: 12px;
  }

  .staff-label__name {
    font-size: 14px;
  }

  /* On mobile, hide "X people" / "antal personer" meta so only department name shows in the overview */
  .staff-overview__dept-meta {
    display: none;
  }

  /* Hide people count in dept labels and bands on mobile - show only department name */
  .staff-dept-label__count,
  .staff-dept-band__count {
    display: none;
  }
}

/* ── Responsive: phone (≤480px) ── */
@media (max-width: 480px) {
  :root {
    --left-width: 120px;
    --row-height: 52px;
    --staff-row-height: 42px;
  }

  body.view-projects:not(.day-mode) {
    --week-width: min(var(--project-week-width, 36px), 40px);
  }

  .month-cell,
  .week-cell {
    padding: 3px 2px;
    font-size: 8.5px;
  }

  body.view-projects.day-mode {
    --left-width: 112px;
    --day-visible-rows: 5;
    --detail-height: 272px;
  }

  .app-shell {
    padding: 0 10px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .control-panel {
    grid-template-columns: 1fr;
  }

  .top-actions {
    grid-template-columns: 1fr;
  }

  .timeline-toolbar {
    padding: 10px 12px;
  }

  .metric-chip {
    font-size: 11px;
    padding: 4px 8px;
  }

  .project-id {
    font-size: 11px;
  }

  .day-detail-plan {
    padding: 10px;
  }

  .dock-rules-note {
    font-size: 11px;
  }

  /* Make staff dept rubriker larger on tiny phones */
  .staff-row--dept {
    height: 44px;
    min-height: 44px;
  }

  .staff-overview__dept {
    padding: 14px 12px;
    min-height: 50px;
  }

  .staff-overview__dept-name {
    font-size: 14px;
  }

  /* Hide people count on mobile - only department name */
  .staff-dept-label__count,
  .staff-dept-band__count,
  .staff-overview__dept-meta {
    display: none;
  }
}

/* Desktop: dock panels always expanded, no collapse affordance */
@media (min-width: 769px) {
  .dock-panel__head {
    pointer-events: none;
  }

  .dock-panel__head::after {
    display: none;
  }

  .mobile-filters__summary {
    display: none;
  }

  .mobile-filters:not([open]) .control-panel {
    display: revert;
  }

  .staff-toolbar-extra__summary {
    display: none;
    pointer-events: none;
  }

  .staff-toolbar-extra__body {
    display: grid;
  }
}

body.view-brief .view-panel--brief {
  display: block;
}

.brief-card {
  padding-bottom: 20px;
}

.brief-hint {
  margin: 4px 0 0;
}

.brief-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.brief-layout.brief-layout--detail {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
}

.brief-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.brief-card-item {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.brief-card-item:hover,
.brief-card-item.is-active {
  border-color: #b8c4d8;
  box-shadow: var(--shadow);
}

.brief-card-item__cover {
  position: relative;
  height: 132px;
  background: linear-gradient(145deg, #eef2f7, #f8fafc);
  overflow: hidden;
}

.brief-card-item__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brief-card-item__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.brief-card-item__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 14px;
  flex: 1;
}

.brief-card-item__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brief-card-item__id {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.brief-card-item__name {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.brief-card-item__meta {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.brief-card-item__summary {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.brief-card-item__assets {
  margin-top: auto;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.brief-detail {
  position: sticky;
  top: 12px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 180px);
  overflow: auto;
}

.brief-detail__head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brief-detail__back {
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

.brief-detail__title-wrap h3 {
  margin: 0;
  font-size: 18px;
}

.brief-summary-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.brief-summary-label textarea {
  resize: vertical;
  min-height: 110px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.45;
}

.brief-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.brief-upload-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  background: var(--panel-strong);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.brief-upload-button:hover {
  border-color: #b8c4d8;
  background: #fff;
}

.brief-upload-button.is-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

.brief-upload-status.is-error {
  color: var(--red);
}

.brief-assets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.brief-asset {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-strong);
}

.brief-asset__preview {
  position: relative;
  height: 108px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brief-asset__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brief-asset__pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.brief-asset__body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brief-asset__title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.brief-asset__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.brief-asset__actions button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

.brief-asset__actions button:hover {
  color: var(--text);
}

.brief-asset__actions .is-cover {
  color: var(--green);
}

.brief-asset__actions .is-danger:hover {
  color: var(--red);
}

.brief-empty {
  grid-column: 1 / -1;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
}
