:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: #fffaf1;
  --surface-strong: #ffffff;
  --panel: rgba(255, 250, 241, 0.94);
  --panel-soft: #f8f1e5;
  --topbar-panel: rgba(255, 250, 241, 0.92);
  --ink: #171a1d;
  --muted: #66717a;
  --line: #ded6c8;
  --line-soft: #eadfce;
  --input-border: #d1c8ba;
  --chip-border: #d9cfbf;
  --tab-bg: #e8dfd2;
  --label: #31383e;
  --focus-ring: rgba(12, 107, 120, 0.16);
  --timeline-grid: rgba(28, 31, 34, 0.08);
  --accent: #0c6b78;
  --accent-dark: #084d57;
  --danger: #9c2f24;
  --danger-bg: #fff5f2;
  --equipment-active-bg: #e4f2f3;
  --equipment-active-fg: #084d57;
  --coral: #c8584a;
  --amber: #b78516;
  --green: #2f7a52;
  --blue: #4267ac;
  --violet: #7a5aa8;
  --rose: #ad4d79;
  --shadow: 0 22px 60px rgba(38, 31, 22, 0.12);
  --radius: 8px;
  --sidebar: 360px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101214;
    --surface: #181b1e;
    --surface-strong: #202428;
    --panel: rgba(24, 27, 30, 0.94);
    --panel-soft: #202428;
    --topbar-panel: rgba(24, 27, 30, 0.92);
    --ink: #f4efe6;
    --muted: #a8b2ba;
    --line: #343a40;
    --line-soft: #2c3238;
    --input-border: #454c53;
    --chip-border: #3f464d;
    --tab-bg: #272b30;
    --label: #e4ddd2;
    --focus-ring: rgba(80, 190, 205, 0.22);
    --timeline-grid: rgba(232, 226, 214, 0.08);
    --accent: #40a7b4;
    --accent-dark: #2f8893;
    --danger: #ff9284;
    --danger-bg: #311f1d;
    --equipment-active-bg: #1d3840;
    --equipment-active-fg: #9ce3eb;
    --coral: #d96a5c;
    --amber: #d19d2d;
    --green: #3f9a6a;
    --blue: #678fe0;
    --violet: #9b78d1;
    --rose: #d66a99;
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  min-height: 100%;
  background: var(--bg);
}

body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

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

.app-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100dvh;
  min-height: 100vh;
  padding: 22px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding: 16px 18px;
  background: var(--topbar-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  align-content: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  padding: 9px;
  background: var(--ink);
  border-radius: var(--radius);
}

.brand-mark span {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--surface);
}

.brand-mark span:nth-child(2) {
  width: 72%;
  background: #8dc7bf;
}

.brand-mark span:nth-child(3) {
  width: 48%;
  background: #e7b554;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.85rem);
  letter-spacing: 0;
  line-height: 1.05;
}

.topbar-actions,
.form-title,
.toolbar,
.tabs,
.roadmap-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.icon-button,
.export-button,
.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.tab-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.icon-button:hover,
.export-button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.ghost-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
}

.export-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 84px;
  padding: 0 12px;
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
}

.tool-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.file-trigger {
  cursor: pointer;
}

.export-menu-wrap {
  position: relative;
  display: inline-flex;
}

.export-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  display: grid;
  min-width: 190px;
  padding: 6px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.export-menu button {
  min-height: 36px;
  padding: 8px 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  text-align: left;
  font-weight: 800;
}

.export-menu button:hover {
  background: var(--panel-soft);
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  padding: 0 15px;
  font-weight: 800;
}

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

.primary-button:hover {
  background: var(--accent-dark);
}

.danger-button {
  margin-top: 10px;
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

.secondary-button {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

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

.full-width {
  width: 100%;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 10, 12, 0.46);
  backdrop-filter: blur(10px);
}

.import-modal {
  display: grid;
  gap: 14px;
  width: min(980px, 100%);
  max-height: min(760px, calc(100dvh - 40px));
  padding: 18px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.modal-head h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.import-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.pdf-import-table-wrap {
  min-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.pdf-import-table {
  min-width: 820px;
}

.pdf-import-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-strong);
}

.pdf-import-empty {
  color: var(--muted);
  text-align: center;
}

.project-home {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.project-hero,
.project-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.project-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 18px;
}

.project-hero h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.project-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 10px;
  align-items: end;
  margin: 0;
}

.project-form input {
  margin-bottom: 0;
}

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

.project-card {
  padding: 16px;
}

.project-card.is-active {
  border-color: var(--accent);
}

.project-card-head,
.project-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.project-card-head span,
.project-card-foot span,
.project-card-metrics span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

.project-card h3 {
  margin-bottom: 0;
  overflow: hidden;
  font-size: 1.1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-card-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 14px 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.project-card-metrics div {
  min-width: 0;
  padding: 11px;
  background: var(--surface);
}

.project-card-metrics strong {
  display: block;
  margin-top: 4px;
  font-size: 1.1rem;
}

.project-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, var(--sidebar)) minmax(0, 1fr);
  gap: 18px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.side-panel,
.main-panel {
  min-width: 0;
}

.side-panel {
  display: grid;
  gap: 14px;
  align-self: stretch;
  min-height: 0;
  overflow: auto;
}

.event-panel,
.task-form,
.main-panel,
.summary-strip,
.toolbar,
.gantt-shell,
.roadmap-output,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.event-panel,
.task-form {
  padding: 16px;
}

.form-title {
  justify-content: space-between;
  margin-bottom: 12px;
}

.form-title h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

label,
legend {
  display: block;
  margin-bottom: 7px;
  color: var(--label);
  font-size: 0.78rem;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  margin-bottom: 13px;
  padding: 10px 11px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

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

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

fieldset {
  margin: 2px 0 13px;
  padding: 0;
  border: 0;
}

.equipment-grid,
.provider-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.equipment-chip,
.provider-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0;
  padding: 8px 10px;
  background: var(--panel-soft);
  border: 1px solid var(--chip-border);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 0.8rem;
}

.equipment-chip input,
.provider-chip input {
  width: 15px;
  min-height: 15px;
  margin: 0;
  padding: 0;
}

.provider-picker-field {
  margin-top: -2px;
}

.main-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.print-heading {
  display: none;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--line);
}

.metric {
  min-width: 0;
  padding: 15px;
  background: var(--surface);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 1.3rem;
  letter-spacing: 0;
}

.toolbar {
  flex-wrap: wrap;
  padding: 11px;
  margin-bottom: 12px;
}

.toolbar select,
.search-box,
.toolbar input {
  margin-bottom: 0;
}

.search-box {
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  min-width: 190px;
  min-height: 42px;
  padding-left: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
}

.search-box span {
  color: var(--muted);
  font-weight: 900;
}

.search-box input {
  border: 0;
  box-shadow: none;
  background: transparent;
}

.toolbar select {
  flex: 0 1 210px;
}

.tabs {
  align-items: stretch;
  padding: 4px;
  margin-bottom: 12px;
  background: var(--tab-bg);
  border-radius: var(--radius);
}

.tab-button {
  flex: 1 1 0;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.tab-button.active {
  background: var(--surface-strong);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 8px 22px rgba(54, 45, 34, 0.1);
}

.tab-view {
  display: none;
  min-height: 0;
}

.tab-view.active {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: auto;
}

#ganttView.tab-view.active {
  overflow: hidden;
}

.gantt-shell {
  position: relative;
  flex: 1 1 auto;
  overflow: auto;
  height: auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overscroll-behavior: contain;
}

.gantt-header,
.gantt-row {
  display: grid;
  grid-template-columns: 180px var(--timeline-width, minmax(1080px, 1fr));
  width: calc(180px + var(--timeline-width, 1080px));
  min-width: 100%;
}

.gantt-header {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 16px rgba(24, 27, 30, 0.08);
}

.gantt-corner,
.gantt-label {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 14px rgba(24, 27, 30, 0.06);
}

.gantt-corner {
  z-index: 10;
  padding: 13px 14px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.gantt-scale {
  width: var(--timeline-width, 1080px);
  min-width: var(--timeline-width, 1080px);
}

.gantt-days,
.gantt-hours {
  display: grid;
  grid-template-columns: repeat(var(--slots, 1), minmax(0, 1fr));
}

.gantt-day-group,
.gantt-hour {
  border-right: 1px solid var(--line-soft);
  color: var(--muted);
  text-align: center;
}

.gantt-day-group {
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.gantt-hour {
  padding: 7px 8px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.7rem;
  font-weight: 800;
}

.gantt-row {
  min-height: 72px;
  border-bottom: 1px solid var(--line-soft);
}

.gantt-label {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
}

.provider-name {
  overflow: hidden;
  font-size: 0.86rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.gantt-timeline {
  position: relative;
  width: var(--timeline-width, 1080px);
  min-width: var(--timeline-width, 1080px);
  background-image: linear-gradient(to right, var(--timeline-grid) 1px, transparent 1px);
  background-size: calc(100% / var(--slots, 1)) 100%;
  cursor: crosshair;
}

.gantt-bar {
  position: absolute;
  top: var(--bar-top);
  left: var(--bar-left);
  width: var(--bar-width);
  min-width: 124px;
  min-height: 38px;
  padding: 6px 9px;
  overflow: hidden;
  color: #fff;
  border-radius: 7px;
  box-shadow: 0 9px 16px rgba(31, 24, 16, 0.16);
  cursor: grab;
  touch-action: none;
}

.gantt-bar.is-dragging {
  z-index: 5;
  cursor: grabbing;
  outline: 3px solid rgba(255, 255, 255, 0.72);
  outline-offset: 2px;
}

.gantt-bar.is-copying {
  box-shadow: 0 0 0 3px rgba(231, 181, 84, 0.46), 0 12px 22px rgba(31, 24, 16, 0.2);
}

.gantt-bar.is-resizing {
  outline-color: rgba(64, 167, 180, 0.82);
}

.gantt-bar.is-dragging::after {
  position: absolute;
  top: -24px;
  left: 0;
  min-width: max-content;
  padding: 3px 7px;
  color: var(--ink);
  font-size: 0.67rem;
  font-weight: 900;
  content: attr(data-drag-time);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

body.is-gantt-dragging {
  user-select: none;
}

.gantt-create-preview {
  position: absolute;
  top: var(--bar-top);
  left: var(--bar-left, 0);
  z-index: 4;
  display: flex;
  align-items: center;
  min-width: 42px;
  width: var(--bar-width, 0);
  min-height: 36px;
  padding: 6px 9px;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-strong));
  border: 2px dashed var(--accent);
  border-radius: 7px;
  pointer-events: none;
}

.gantt-resize-handle {
  position: absolute;
  top: 4px;
  bottom: 4px;
  z-index: 2;
  width: 10px;
  cursor: ew-resize;
  border-radius: 6px;
  opacity: 0.45;
  touch-action: none;
}

.gantt-resize-handle::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 4px;
  width: 2px;
  content: "";
  background: rgba(255, 255, 255, 0.72);
  border-radius: 99px;
}

.gantt-resize-handle.is-left {
  left: 3px;
}

.gantt-resize-handle.is-right {
  right: 3px;
}

.gantt-bar:hover .gantt-resize-handle,
.gantt-bar.is-resizing .gantt-resize-handle {
  opacity: 1;
}

.gantt-bar strong,
.gantt-bar > span:not(.gantt-resize-handle) {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-bar strong {
  font-size: 0.76rem;
}

.gantt-bar > span:not(.gantt-resize-handle) {
  margin-top: 1px;
  font-size: 0.67rem;
  opacity: 0.9;
}

.type-deco {
  background: var(--coral);
}

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

.type-mobilier {
  background: var(--amber);
}

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

.type-divers {
  background: #69727c;
}

.type-secu {
  background: #20262b;
}

.type-engins {
  background: var(--violet);
}

.type-livraison-reprise {
  background: var(--rose);
}

.empty-state {
  padding: 44px 18px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.roadmap-actions {
  justify-content: space-between;
  margin-bottom: 12px;
}

.roadmap-actions select {
  max-width: 320px;
  margin-bottom: 0;
}

.roadmap-output {
  padding: 18px;
}

.roadmap-provider {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.roadmap-provider:first-child {
  padding-top: 0;
}

.roadmap-provider:last-child {
  border-bottom: 0;
}

.roadmap-provider h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.roadmap-item {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px dashed var(--chip-border);
}

.roadmap-item:first-of-type {
  border-top: 0;
}

.roadmap-time {
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 950;
}

.roadmap-title {
  margin-bottom: 3px;
  font-weight: 900;
}

.roadmap-detail {
  color: var(--muted);
  font-size: 0.82rem;
}

.equipment-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.equipment-kpi,
.equipment-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.equipment-kpi {
  min-width: 0;
  padding: 14px;
}

.equipment-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.equipment-kpi strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  font-size: 1.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-planning-shell {
  overflow: auto;
  max-height: 520px;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.equipment-planning-table {
  min-width: 980px;
}

.equipment-planning-table th,
.equipment-planning-table td {
  min-width: 86px;
  text-align: center;
}

.equipment-planning-table th:first-child,
.equipment-planning-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 170px;
  background: var(--surface);
  text-align: left;
}

.equipment-planning-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
}

.equipment-planning-table thead th:first-child {
  z-index: 4;
}

.equipment-planning-table .is-active {
  background: var(--equipment-active-bg);
  color: var(--equipment-active-fg);
  font-weight: 950;
}

.equipment-planning-table .is-peak {
  background: var(--accent);
  color: #fff;
}

.equipment-total-row th,
.equipment-total-row td {
  background: var(--surface-strong);
  font-weight: 950;
}

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

.equipment-card {
  padding: 14px;
}

.equipment-card h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.equipment-card p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.equipment-task {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 9px 11px;
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  text-align: left;
}

.equipment-task strong,
.equipment-task span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-task strong {
  font-size: 0.82rem;
}

.equipment-task span {
  margin-top: 2px;
  font-size: 0.72rem;
  opacity: 0.9;
}

.todo-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(170px, 0.9fr) minmax(150px, 0.7fr) minmax(130px, 0.6fr);
  gap: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.todo-form input,
.todo-form select {
  margin-bottom: 0;
}

.todo-form .primary-button {
  align-self: end;
  min-height: 42px;
}

.todo-notes-field {
  grid-column: span 3;
}

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

.todo-kpi,
.todo-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.todo-kpi {
  padding: 14px;
}

.todo-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.todo-kpi strong {
  display: block;
  margin-top: 5px;
  font-size: 1.2rem;
}

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

.todo-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.todo-item.is-done {
  opacity: 0.65;
}

.todo-item.is-done .todo-content {
  text-decoration: line-through;
}

.todo-check {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 950;
}

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

.todo-title-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-content p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.todo-priority {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 950;
}

.priority-low {
  background: var(--muted);
}

.priority-normal {
  background: var(--accent);
}

.priority-high {
  background: var(--danger);
}

.todo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

td {
  font-size: 0.86rem;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.mini-button {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  min-height: 32px;
  padding: 0 9px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 900;
}

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

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .workspace {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .side-panel {
    position: static;
    overflow: visible;
  }

  .main-panel {
    overflow: visible;
  }

  .gantt-shell {
    height: clamp(420px, 62vh, 680px);
    min-height: 420px;
  }

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

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

  .equipment-summary,
  .equipment-detail,
  .todo-summary {
    grid-template-columns: 1fr;
  }

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

  .todo-notes-field {
    grid-column: span 2;
  }

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

  .todo-actions {
    grid-column: 2;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 12px;
  }

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

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

  .project-hero,
  .project-card-head,
  .project-card-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .project-form,
  .project-card-metrics {
    grid-template-columns: 1fr;
  }

  .primary-button {
    grid-column: span 3;
  }

  .icon-button,
  .export-button {
    width: 100%;
  }

  .export-menu-wrap {
    width: 100%;
  }

  .export-button {
    justify-content: center;
    min-width: 0;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .import-modal {
    max-height: calc(100dvh - 20px);
    padding: 14px;
  }

  .modal-head,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .project-date-grid,
  .equipment-grid,
  .provider-checklist,
  .equipment-summary,
  .equipment-detail,
  .todo-form,
  .todo-summary,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .todo-notes-field,
  .todo-actions {
    grid-column: auto;
  }

  .todo-item {
    grid-template-columns: 1fr;
  }

  .todo-check {
    width: 100%;
    border-radius: var(--radius);
  }

  .tabs {
    overflow-x: auto;
  }

  .tab-button {
    min-width: 145px;
  }

  .roadmap-actions,
  .roadmap-item {
    grid-template-columns: 1fr;
  }

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

  .roadmap-actions select {
    max-width: none;
  }
}

@media print {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --panel: #ffffff;
    --panel-soft: #ffffff;
    --topbar-panel: #ffffff;
    --ink: #111111;
    --muted: #555555;
    --line: #dddddd;
    --line-soft: #eeeeee;
    --label: #222222;
  }

  body {
    background: #fff;
    color: #111;
  }

  .topbar,
  .side-panel,
  .toolbar,
  .tabs,
  #ganttView,
  #tableView {
    display: none !important;
  }

  .print-heading {
    display: block;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dddddd;
  }

  .print-heading p {
    margin-bottom: 4px;
    color: #555555;
    font-size: 0.82rem;
    font-weight: 800;
  }

  .print-heading h2 {
    margin-bottom: 0;
    color: #111111;
    font-size: 1.6rem;
  }

  .app-shell,
  .main-panel,
  .roadmap-output {
    padding: 0;
    box-shadow: none;
    border: 0;
  }

  .workspace {
    display: block;
  }

  .tab-view {
    display: none !important;
  }

  .tab-view.active {
    display: block !important;
  }
}
