:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #637381;
  --line: #d7dee7;
  --paper: #ffffff;
  --wash: #f4f7fb;
  --blue: #246fa8;
  --red: #c83d3d;
  --yellow: #e7c71b;
  --green: #28785f;
  --focus: #174f7c;
  --shadow: 0 14px 36px rgba(20, 32, 46, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand,
.brand-button {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.brand-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
}

.brand strong,
.brand-button strong {
  font-size: 34px;
  letter-spacing: 0;
}

.brand span,
.brand-button span {
  color: var(--muted);
  font-size: 18px;
}

.trade-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3d4852;
  font-weight: 700;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

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

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 28px) 36px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.step {
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.step.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.subtle {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.order-form,
.rapport-form,
.placeholder-panel,
.list-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.order-form,
.placeholder-panel,
.list-section {
  padding: clamp(16px, 3vw, 24px);
}

.order-form {
  margin-bottom: 18px;
}

.panel {
  display: none;
  padding: clamp(16px, 3vw, 30px);
}

.panel.active {
  display: block;
}

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

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 { font-size: 26px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

.compact {
  margin-top: 28px;
}

.order-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

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

.order-card {
  display: grid;
  width: 100%;
  min-height: 76px;
  justify-items: start;
  gap: 4px;
  text-align: left;
  border-color: #cbd6e2;
}

.order-card strong {
  font-size: 17px;
}

.order-project,
.order-date,
.empty {
  color: var(--muted);
}

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

.form-card {
  display: grid;
  min-height: 112px;
  align-content: start;
  justify-items: start;
  gap: 8px;
  text-align: left;
}

.form-card strong {
  font-size: 19px;
}

.form-card span {
  color: var(--muted);
  line-height: 1.35;
}

.form-card.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(36, 111, 168, 0.18);
}

.form-card.done {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.form-card.done span,
.form-card.done .done-label {
  color: white;
}

.done-label {
  align-self: end;
  display: inline-flex;
  margin-top: 10px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.form-card.disabled {
  background: #f8fafc;
}

.form-card.disabled.done {
  background: var(--blue);
}

.global-finish {
  margin-top: 16px;
}

.link-button {
  min-height: auto;
  padding: 0 0 8px;
  border: 0;
  color: var(--blue);
  background: transparent;
  border-radius: 0;
}

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

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

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

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

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(36, 111, 168, 0.22);
  border-color: var(--focus);
}

.service-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.service-switch label,
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.service-switch input,
.check input {
  width: auto;
  min-height: auto;
}

.table-header,
.line {
  display: grid;
  gap: 8px;
  align-items: center;
}

.material-head,
.material-line {
  grid-template-columns: 76px 92px 1fr 42px;
}

.time-line {
  grid-template-columns: 1.4fr 140px 92px 92px 90px 88px 42px;
}

.table-header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 10px 0 6px;
}

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

.inline-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
}

.small-field {
  width: 120px;
}

.photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  min-height: 180px;
}

.photo-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.photo-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eef2f6;
}

.photo-item textarea {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.signature-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 220px;
  touch-action: none;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(0deg, transparent 0 43px, #eef1f5 44px);
}

.preview {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  line-height: 1.5;
}

.status {
  min-height: 24px;
  margin-top: 14px;
  color: var(--green);
  font-weight: 700;
}

.actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}

.actions.split {
  justify-content: space-between;
  gap: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

button,
.file-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.secondary {
  background: #eef3f8;
  border-color: #c8d6e2;
}

.ghost {
  color: var(--blue);
}

.icon {
  width: 42px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.file-button input {
  display: none;
}

@media (max-width: 820px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand strong {
    font-size: 28px;
  }

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

  .order-columns,
  .form-grid,
  .grid.two,
  .material-head,
  .material-line,
  .time-line {
    grid-template-columns: 1fr;
  }

  .table-header {
    display: none;
  }

  .line {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
  }

  .section-title,
  .actions.split {
    align-items: stretch;
    flex-direction: column;
  }

  .button-row,
  .actions {
    width: 100%;
  }

  button,
  .file-button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .trade-dots {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto 1fr;
    width: 100%;
    font-size: 13px;
  }

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