:root {
  --bg: #f5f7fb;
  --card-bg: #ffffff;
  --primary: #1c63d5;
  --primary-hover: #174da8;
  --accent: #57c973;
  --muted: #5f6b7c;
  --text: #1f2430;
  --border: #d7dbe8;
  --danger: #d64545;
  --shadow: 0 12px 28px rgba(31, 36, 48, 0.14);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

html {
  font-size: clamp(15px, 1.1vw, 17px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

body.viewer-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  margin: 0 0 0.5rem;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: inherit;
}

.muted {
  color: var(--muted);
}

.small-text {
  font-size: 0.85rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

button {
  font-family: inherit;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease, color 0.15s ease;
}

.primary-btn {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 12px 24px -12px rgba(28, 99, 213, 0.6);
}

.primary-btn:hover {
  background: var(--primary-hover);
}

.secondary-btn {
  background: rgba(28, 99, 213, 0.12);
  color: var(--primary);
}

.secondary-btn:hover {
  background: rgba(28, 99, 213, 0.18);
}

.ghost-btn {
  background: rgba(232, 235, 245, 0.6);
  color: var(--muted);
}

.ghost-btn:hover {
  background: rgba(28, 99, 213, 0.12);
  color: var(--text);
}

.danger-btn {
  background: rgba(214, 69, 69, 0.14);
  color: var(--danger);
}

.danger-btn:hover {
  background: rgba(214, 69, 69, 0.22);
}

.ghost-btn.small,
.secondary-btn.small,
.chip.small {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
}

.chip-group {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: rgba(232, 235, 245, 0.6);
  padding: 0.35rem;
  border-radius: 999px;
}

.chip {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.chip:hover {
  background: rgba(28, 99, 213, 0.14);
  color: var(--text);
}

.chip.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 22px -14px rgba(28, 99, 213, 0.55);
}

.chip.small {
  font-weight: 600;
}

.topbar {
  padding: 1.5rem min(6vw, 2.5rem) 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  height: 72px;
  width: auto;
  border-radius: 16px;
  object-fit: contain;
  background: #ffffff;
  padding: 0.5rem;
  box-shadow: 0 10px 20px rgba(31, 36, 48, 0.18);
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
}

.nav-toggle {
  display: none;
  border: none;
  background: var(--primary);
  color: #ffffff;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(28, 99, 213, 0.25);
}

.primary-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-link:hover {
  background: var(--primary);
  color: #ffffff;
}

.nav-link.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 24px -14px rgba(28, 99, 213, 0.6);
}

main {
  flex: 1;
  width: min(1200px, 94vw);
  margin: 0 auto 3rem;
  padding: 0 0.5rem;
  display: grid;
  gap: 1.5rem;
}

.commissioning-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 2rem;
}

.card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.35rem;
}

.commissioning-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 1.5rem;
}

.commissioning-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
      circle at top right,
      rgba(28, 99, 213, 0.12),
      transparent 55%
    ),
    radial-gradient(
      circle at bottom left,
      rgba(28, 99, 213, 0.08),
      transparent 60%
    );
}

.commissioning-hero > * {
  position: relative;
  z-index: 1;
}

.hero-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.hero-head h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
}

.emoji-timeline {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
}

.emoji-icon {
  width: clamp(48px, 12vw, 72px);
  height: auto;
  object-fit: contain;
}

.emoji-track {
  position: relative;
  height: 14px;
  background: linear-gradient(
    90deg,
    rgba(28, 99, 213, 0.2),
    rgba(87, 201, 115, 0.3)
  );
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(28, 99, 213, 0.25);
}

.emoji-boat {
  --progress: 0%;
  position: absolute;
  top: 50%;
  left: var(--progress);
  transform: translate(-50%, -50%);
  width: clamp(48px, 10vw, 68px);
  height: auto;
  transition: left 0.4s ease;
  pointer-events: none;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.metric {
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(215, 219, 232, 0.6);
  display: grid;
  gap: 0.35rem;
}

.metric-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.focus-card {
  display: grid;
  gap: 1.5rem;
}

.focus-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: min(240px, 100%);
}

.field-group label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}

.field-group input,
.field-group select {
  width: 100%;
}

.commissioning-details {
  border: 1px solid rgba(215, 219, 232, 0.8);
  border-radius: 16px;
  background: rgba(248, 249, 254, 0.9);
  padding: 1rem 1.25rem;
}

.details-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.timeline-section {
  border: 1px solid rgba(215, 219, 232, 0.8);
  border-radius: 16px;
  background: rgba(248, 249, 254, 0.9);
  padding: 1.1rem 1.25rem;
  display: grid;
  gap: 1rem;
}

.timeline-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.timeline-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.timeline-list {
  display: grid;
  gap: 0.75rem;
}

.timeline-hidden {
  border: 1px dashed rgba(215, 219, 232, 0.9);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  background: rgba(247, 248, 254, 0.65);
  display: grid;
  gap: 0.5rem;
}

.timeline-hidden-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timeline-hidden-list button {
  font-size: 0.85rem;
}

.timeline-row-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.timeline-row {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: minmax(92px, 120px) minmax(180px, 1fr) auto;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 12px -10px rgba(31, 36, 48, 0.25);
}

.timeline-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.timeline-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.timeline-remove {
  align-self: flex-start;
}

.timeline-remove.hidden {
  display: none;
}

.export-output {
  display: grid;
  gap: 0.5rem;
}

.export-output textarea {
  width: 100%;
  min-height: 8rem;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  resize: vertical;
}

.export-output textarea:focus {
  border-color: rgba(28, 99, 213, 0.7);
  box-shadow: 0 0 0 4px rgba(28, 99, 213, 0.15);
}

.focus-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
}

.focus-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.focus-steps {
  display: grid;
  gap: 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(28, 99, 213, 0.12);
  color: var(--primary);
}

.status-badge.badge-complete {
  background: rgba(87, 201, 115, 0.18);
  color: #2a7a45;
}

.status-badge.badge-in-progress {
  background: rgba(28, 99, 213, 0.15);
  color: var(--primary);
}

.status-badge.badge-not-started {
  background: rgba(255, 181, 72, 0.2);
  color: #8c5a0f;
}

.status-progress {
  font-size: 0.9rem;
  font-weight: 600;
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.step-item label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  cursor: pointer;
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(232, 235, 245, 0.35);
  transition: background 0.2s ease, transform 0.2s ease;
}

.step-item label:hover {
  background: rgba(28, 99, 213, 0.12);
  transform: translateY(-1px);
}

.step-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-decorator {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid rgba(28, 99, 213, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease;
  margin-top: 2px;
}

.step-item input:checked + .checkbox-decorator {
  background: var(--primary);
  border-color: var(--primary);
}

.step-item input:checked + .checkbox-decorator::after {
  content: "\2713";
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
}

.step-text {
  display: grid;
  gap: 0.25rem;
}

.step-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.step-hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.step-group {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: 14px;
  background: rgba(232, 235, 245, 0.45);
}

.step-group-header {
  font-weight: 700;
  font-size: 0.95rem;
}

.step-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.step-sublist .step-item label {
  background: rgba(255, 255, 255, 0.7);
}

.step-sublist .step-item label:hover {
  background: rgba(28, 99, 213, 0.15);
}

.ddb-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  height: 100%;
  background: var(--card-bg);
  box-shadow: -24px 0 48px rgba(31, 36, 48, 0.2);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 60;
}

.ddb-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.drawer-controls {
  display: grid;
  gap: 0.75rem;
}

.drawer-search {
  width: 100%;
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  display: grid;
  gap: 0.75rem;
  padding-right: 0.2rem;
}

.drawer-item {
  border: 1px solid rgba(215, 219, 232, 0.8);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.45rem;
  cursor: pointer;
  background: rgba(248, 249, 254, 0.7);
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.drawer-item:hover {
  border-color: rgba(28, 99, 213, 0.5);
  box-shadow: 0 16px 28px -20px rgba(31, 36, 48, 0.4);
  transform: translateY(-2px);
}

.drawer-item.active {
  border-color: var(--primary);
  box-shadow: 0 18px 32px -18px rgba(28, 99, 213, 0.45);
}

.drawer-item:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28, 99, 213, 0.25);
  transform: translateY(-2px);
}

.drawer-item-name {
  font-weight: 700;
}

.drawer-item-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.drawer-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(232, 235, 245, 0.8);
  overflow: hidden;
}

.drawer-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(28, 99, 213, 0.85), rgba(87, 201, 115, 0.9));
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 32, 0.45);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer-backdrop:not(.hidden) {
  opacity: 1;
  pointer-events: all;
}

body.drawer-open {
  overflow: hidden;
}

.connection-banner {
  margin: 0 auto 1rem;
  width: min(1080px, 92%);
  background: #fff6de;
  color: #7a5a0a;
  border: 1px solid rgba(255, 193, 7, 0.45);
  padding: 0.75rem 1rem;
  border-radius: 16px;
  text-align: center;
  font-size: 0.95rem;
  box-shadow: 0 10px 18px rgba(122, 90, 10, 0.12);
}

.connection-banner.hidden {
  display: none;
}

.logbook-card {
  display: grid;
  gap: 1.5rem;
}

.logbook-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

.logbook-header h2 {
  margin: 0.35rem 0 0.75rem;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
}

.logbook-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-end;
}

.logbook-select {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logbook-select select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(215, 219, 232, 0.8);
  background: rgba(248, 249, 254, 0.8);
  padding: 0.8rem 1rem;
  font-size: 1rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-row.checkbox-row {
  margin-top: -0.25rem;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
}

input[type="text"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="file"],
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  background: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(28, 99, 213, 0.7);
  box-shadow: 0 0 0 4px rgba(28, 99, 213, 0.15);
}

.log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.log-filter {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.table-wrapper {
  border: 1px solid rgba(215, 219, 232, 0.7);
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
}

.inventory-label-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.inventory-label {
  font-weight: 600;
}

.inventory-label.muted {
  color: var(--muted);
  font-weight: 500;
}

.inventory-edit-label {
  padding: 0.25rem 0.75rem;
}

.inventory-delete {
  min-width: 96px;
}

.log-detail-row td {
  background: rgba(247, 248, 254, 0.9);
  padding: 0;
}

.log-detail {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(215, 219, 232, 0.7);
  display: grid;
  gap: 0.75rem;
}

.log-detail-head {
  font-weight: 600;
}

.log-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.log-detail-item {
  background: #ffffff;
  border: 1px solid rgba(215, 219, 232, 0.7);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  box-shadow: 0 10px 24px -18px rgba(31, 36, 48, 0.4);
}

.log-detail-item.log-resolved {
  border-color: rgba(67, 160, 71, 0.5);
  background: rgba(67, 160, 71, 0.12);
  box-shadow: 0 12px 28px -18px rgba(67, 160, 71, 0.6);
}

.log-detail-meta {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.log-status {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
}

.log-status.resolved {
  background: rgba(67, 160, 71, 0.15);
  color: #1c6c1f;
}

.log-status.open {
  background: rgba(243, 134, 107, 0.2);
  color: #8c2400;
}

.other-details {
  border: 1px dashed rgba(215, 219, 232, 0.9);
  border-radius: 16px;
  padding: 1.25rem;
  background: rgba(248, 249, 254, 0.5);
  display: grid;
  gap: 0.65rem;
}

.additional-work-card {
  display: grid;
  gap: 1rem;
}

.other-form .form-actions {
  display: flex;
  justify-content: flex-end;
}

.other-list {
  display: grid;
  gap: 1rem;
}

.other-list.empty {
  border: 1px dashed rgba(215, 219, 232, 0.9);
  border-radius: 16px;
  padding: 1rem;
  text-align: center;
}

.other-item {
  border: 1px solid rgba(215, 219, 232, 0.8);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  background: #ffffff;
  box-shadow: 0 15px 32px -25px rgba(31, 36, 48, 0.5);
  display: grid;
  gap: 0.5rem;
}

.other-item-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}

.other-item-actions {
  display: flex;
  justify-content: flex-end;
}

.mosaic-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #5f6b7c;
  background: rgba(95, 107, 124, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mosaic-chip::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.mosaic-chip.connected {
  color: #1d7547;
  background: rgba(87, 201, 115, 0.2);
  box-shadow: 0 8px 20px -12px rgba(29, 117, 71, 0.6);
}

.mosaic-chip.connected::before {
  opacity: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

thead {
  background: rgba(28, 99, 213, 0.08);
  color: var(--text);
}

th,
td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(215, 219, 232, 0.65);
}

.log-resolved-cell {
  text-align: center;
}

.log-resolved-toggle {
  width: 1.1rem;
  height: 1.1rem;
}

th.shrink,
td.shrink {
  width: 1%;
  white-space: nowrap;
}

tbody tr:hover {
  background: rgba(28, 99, 213, 0.05);
}

.ddb-row {
  cursor: pointer;
}

.ddb-row button {
  cursor: pointer;
}

.photo-upload {
  display: grid;
  gap: 0.75rem;
}

.photo-inputs {
  display: grid;
  gap: 0.65rem;
}

.photo-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.photo-card {
  border: 1px solid rgba(215, 219, 232, 0.7);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(248, 249, 254, 0.75);
  display: grid;
  gap: 0.6rem;
}

.photo-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: rgba(232, 235, 245, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: none;
  padding: 0;
  cursor: zoom-in;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.photo-preview:focus-visible {
  outline: 3px solid rgba(28, 99, 213, 0.65);
  outline-offset: 3px;
}

.photo-meta {
  padding: 0 1rem;
}

.photo-caption {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.photo-info {
  color: var(--muted);
  font-size: 0.85rem;
}

.photo-actions {
  padding: 0 1rem 1rem;
}

.photo-viewer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 2vw, 2.5rem);
  z-index: 1500;
}

.photo-viewer.hidden {
  display: none !important;
}

.photo-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 12, 26, 0.72);
  backdrop-filter: blur(8px);
}

.photo-viewer__panel {
  position: relative;
  width: min(1200px, 94vw);
  height: min(900px, 92vh);
  background: var(--card-bg);
  border-radius: 24px;
  box-shadow: 0 40px 120px rgba(8, 15, 40, 0.45);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.5rem 1.5rem;
  z-index: 1;
}

.photo-viewer__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.photo-viewer__caption {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.photo-viewer__meta {
  margin: 0;
}

.photo-viewer__header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.photo-viewer__counter {
  font-weight: 600;
  color: var(--muted);
}

.photo-viewer__close {
  border: none;
  background: rgba(31, 36, 48, 0.08);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.35rem;
  cursor: pointer;
  line-height: 1;
}

.photo-viewer__close:hover {
  background: rgba(31, 36, 48, 0.16);
}

.photo-viewer__stage {
  position: relative;
  flex: 1;
  border-radius: 18px;
  background: radial-gradient(circle at top, rgba(28, 99, 213, 0.15), #050913);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.photo-viewer__canvas {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-viewer__canvas::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.photo-viewer__canvas::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}

.photo-viewer__image {
  max-width: 100%;
  max-height: 100%;
  transition: transform 0.2s ease;
  transform-origin: center;
}

.photo-viewer__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(5, 12, 26, 0.55);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
}

.photo-viewer__nav--prev {
  left: 1rem;
}

.photo-viewer__nav--next {
  right: 1rem;
}

.photo-viewer__nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.photo-viewer__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.photo-viewer__zoom-controls {
  display: inline-flex;
  gap: 0.5rem;
}

.photo-viewer__zoom-controls .ghost-btn {
  min-width: 48px;
  font-size: 1.1rem;
}

.photo-viewer__hint {
  margin: 0;
}

@media (max-width: 768px) {
  .photo-viewer__panel {
    padding: 1rem;
    border-radius: 18px;
  }

  .photo-viewer__nav {
    width: 40px;
    height: 40px;
  }
}

.summary-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 32, 0.45);
  display: grid;
  place-items: center;
  padding: 1.5rem;
  z-index: 70;
}

.summary-modal.hidden {
  display: none;
}

.summary-content {
  background: var(--card-bg);
  border-radius: 20px;
  width: min(520px, 95vw);
  max-height: 90vh;
  padding: 1.75rem;
  display: grid;
  gap: 1rem;
  box-shadow: var(--shadow);
  overflow-y: auto;
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.summary-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: var(--muted);
  cursor: pointer;
}

.summary-list {
  display: grid;
  gap: 1rem;
}

.summary-entry {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  background: #f8f9fe;
  box-shadow: 0 10px 20px rgba(31, 36, 48, 0.08);
  display: grid;
  gap: 0.35rem;
}

.service-alert {
  border-radius: 12px;
  border: 1px solid rgba(255, 193, 7, 0.4);
  background: #fff8e1;
  color: #725400;
  font-size: 0.95rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 6px 18px rgba(114, 84, 0, 0.12);
}

.service-alert.hidden {
  display: none;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.progress-main {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.progress-main .progress-overview,
.progress-main .insights-card {
  grid-column: 1 / -1;
}

.progress-overview {
  display: grid;
  gap: 1.75rem;
}

.overview-hero {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: center;
}

.overview-copy p {
  margin: 0;
}

.overview-metrics {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.overview-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.status-chips {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-chip {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.status-chip.ready {
  background: rgba(87, 201, 115, 0.18);
  color: #2a7a45;
}

.status-chip.progress {
  background: rgba(28, 99, 213, 0.15);
  color: var(--primary);
}

.status-chip.remaining {
  background: rgba(255, 181, 72, 0.18);
  color: #9c6409;
}

.chart-card {
  display: grid;
  gap: 1.25rem;
}

.chart-tabs-card {
  position: relative;
}

.chart-tabs-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chart-tabs {
  display: inline-flex;
  gap: 0.4rem;
  border-radius: 18px;
  background: rgba(215, 219, 232, 0.45);
  padding: 0.25rem;
}

.chart-tab {
  border: none;
  background: transparent;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.chart-tab:hover,
.chart-tab:focus-visible {
  color: var(--primary);
}

.chart-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 4px 12px -6px rgba(31, 36, 48, 0.5);
}

.chart-tab-panels {
  position: relative;
  min-height: 260px;
}

.chart-tab-panels .chart-canvas {
  position: relative;
  z-index: 1;
}

.chart-canvas {
  width: 100%;
  min-height: 200px;
}

.chart-fallback {
  margin: 0;
  font-style: italic;
  color: var(--muted);
}

.completion-list {
  display: grid;
  gap: 0.9rem;
}

.completion-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  padding: 0.6rem 0.2rem;
}

.completion-label {
  flex: 1 1 180px;
  min-width: 150px;
}

.completion-label strong {
  display: block;
  font-size: 0.95rem;
}

.completion-bar {
  flex: 2 1 240px;
  height: 9px;
  border-radius: 999px;
  background: rgba(28, 99, 213, 0.12);
  position: relative;
  overflow: hidden;
}

.completion-fill {
  position: absolute;
  inset: 0;
  background: var(--primary);
  border-radius: inherit;
  transition: width 0.3s ease;
}

.completion-item.ready .completion-fill {
  background: #16a34a;
}

.completion-item.progress .completion-fill {
  background: #2563eb;
}

.completion-item.remaining .completion-fill {
  background: #f59e0b;
}

.completion-percent {
  font-weight: 700;
  min-width: 3ch;
  text-align: right;
}

@media (min-width: 768px) {
  .chart-tabs-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.highlight-card {
  display: grid;
}

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

.highlight-item {
  padding: 1rem;
  border: 1px solid rgba(215, 219, 232, 0.8);
  border-radius: 14px;
  background: #ffffff;
  display: grid;
  gap: 0.35rem;
}

.highlight-value {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
}

.chart-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.signal-card {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.signal-block {
  display: grid;
  gap: 1rem;
}

.momentum-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.momentum-item {
  border: 1px solid rgba(215, 219, 232, 0.8);
  border-radius: 14px;
  padding: 0.85rem 1rem 1rem;
  display: grid;
  gap: 0.65rem;
  background: #ffffff;
  box-shadow: 0 15px 34px -28px rgba(31, 36, 48, 0.6);
}

.momentum-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.momentum-item.muted {
  justify-content: center;
  color: var(--muted);
}

.momentum-pill {
  font-weight: 700;
  color: #1c63d5;
  background: rgba(28, 99, 213, 0.12);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.momentum-track {
  width: 100%;
  background: rgba(28, 99, 213, 0.15);
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
}

.momentum-bar {
  height: 100%;
  background: #1c63d5;
  border-radius: inherit;
  transition: width 0.25s ease;
}

.recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.recent-item {
  border: 1px solid rgba(215, 219, 232, 0.8);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #fff;
}

.recent-pill {
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(31, 36, 48, 0.08);
}

.chart-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}

.chart-card canvas {
  width: 100%;
  min-height: 240px;
}

.insights-card {
  display: grid;
  gap: 1.5rem;
}

.insight-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.insight-card-item {
  border: 1px solid rgba(215, 219, 232, 0.7);
  border-radius: 16px;
  padding: 1.25rem;
  background: rgba(248, 249, 254, 0.65);
  display: grid;
  gap: 0.75rem;
}

.insight-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.insight-card-header h3 {
  margin: 0;
  font-size: 1rem;
}

.insight-percent {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
}

.insight-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(232, 235, 245, 0.9);
  overflow: hidden;
}

.insight-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(28, 99, 213, 0.85),
    rgba(87, 201, 115, 0.9)
  );
  transition: width 0.4s ease;
}

.insight-note {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

.insight-footnote {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1180px) {
  main {
    width: min(100%, 96vw);
    padding: 0 1rem;
  }

  .topbar {
    padding: 1.25rem 1.5rem 0.85rem;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .primary-nav {
    justify-content: flex-start;
  }

  .card {
    padding: 1.5rem;
  }

  .progress-main {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  }
}

@media (max-width: 1024px) {
  html {
    font-size: 15px;
  }

  .logo {
    height: 60px;
  }

  .card {
    padding: 1.4rem;
  }

  .highlight-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .signal-card {
    grid-template-columns: 1fr;
  }

  .progress-main {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

@media (max-width: 920px) {
  .topbar {
    flex-wrap: wrap;
    padding: 1.25rem 1.5rem 0.75rem;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
  }

  .primary-nav {
    order: 3;
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    border: 1px solid rgba(215, 219, 232, 0.7);
    box-shadow: 0 18px 45px -20px rgba(31, 36, 48, 0.3);
  }

  .primary-nav.open {
    display: flex;
  }

  .nav-link {
    justify-content: flex-start;
    width: 100%;
  }

  .logbook-actions {
    align-items: stretch;
  }

  .logbook-actions .secondary-btn,
  .ghost-btn {
    width: 100%;
  }

  .emoji-timeline {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (max-width: 640px) {
  .card {
    padding: 1.35rem;
  }

  .commissioning-main {
    gap: 1.1rem;
  }

  .commissioning-hero {
    padding: 1.25rem;
  }

  .hero-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  #ddbDrawerToggle {
    width: 100%;
  }
  .hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .focus-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .focus-actions {
    width: 100%;
    align-items: stretch;
  }

  .focus-actions .ghost-btn {
    width: 100%;
  }

  .commissioning-details,
  .timeline-section {
    padding: 1rem;
  }

  .timeline-row {
    grid-template-columns: 1fr;
  }

  .timeline-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .focus-status {
    gap: 0.35rem;
  }

  .focus-steps .step-item label {
    padding: 0.7rem;
  }

  .drawer-header {
    align-items: center;
  }

  .drawer-item {
    padding: 0.85rem;
    font-size: 0.95rem;
  }

  .drawer-item-meta {
    font-size: 0.8rem;
  }

  .drawer-list {
    max-height: calc(100vh - 200px);
  }

  .ddb-drawer {
    width: min(100%, 100vw);
    padding: 1.25rem;
  }

  .logbook-select {
    flex-direction: column;
    align-items: stretch;
  }

  .log-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .logbook-actions {
    align-items: stretch;
  }

  .logbook-actions .secondary-btn,
  .ghost-btn,
  .secondary-btn {
    width: 100%;
  }

  .emoji-timeline {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}


.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}


.hidden {
  display: none !important;
}


.progress-ring {
  --ring-fill: 0deg;
  width: clamp(96px, 12vw, 140px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(
      var(--primary) 0deg,
      var(--primary) var(--ring-fill),
      rgba(232, 235, 245, 0.8) var(--ring-fill)
    );
  display: grid;
  place-items: center;
  position: relative;
}

.progress-ring::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: var(--card-bg);
}

.progress-ring span {
  position: relative;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
}

