:root {
  --maba-hub-ink: #17191c;
  --maba-hub-gold: #f5a623;
  --maba-hub-gold-dark: #a85d00;
  --maba-hub-paper: #f7f5ef;
  --maba-hub-card: #fff;
  --maba-hub-muted: #68717c;
  --maba-hub-line: rgba(23, 25, 28, 0.13);
  --maba-hub-danger: #b42318;
  --maba-hub-success: #167647;
}

#maba-project-hub-launcher {
  position: fixed;
  z-index: 2147482997;
  bottom: 24px;
  left: 24px;
  height: 48px;
  padding: 0 20px 0 47px;
  border: 0;
  border-radius: 999px;
  background: var(--maba-hub-gold);
  color: var(--maba-hub-ink);
  box-shadow: 0 14px 36px rgba(23, 25, 28, 0.24);
  cursor: pointer;
  font: 850 14px/1 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.01em;
}

#maba-project-hub-launcher::before {
  position: absolute;
  top: 13px;
  left: 18px;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 4px;
  content: '';
}

#maba-project-hub-launcher::after {
  position: absolute;
  top: 8px;
  left: 26px;
  width: 2px;
  height: 28px;
  border-radius: 2px;
  background: currentColor;
  content: '';
  transform: rotate(45deg);
}

#maba-project-hub-launcher:hover {
  background: #ffb436;
  transform: translateY(-1px);
}

#maba-project-hub-launcher[hidden],
#maba-project-hub-backdrop[hidden],
.maba-hub-loading[hidden],
.maba-hub-error[hidden],
.maba-hub-content[hidden] {
  display: none !important;
}

#maba-project-hub-launcher:focus-visible,
.maba-hub-close:focus-visible,
.maba-hub-task summary:focus-visible {
  outline: 3px solid rgba(245, 166, 35, 0.6);
  outline-offset: 3px;
}

body.maba-project-hub-open {
  overflow: hidden !important;
}

#maba-project-hub-backdrop {
  position: fixed;
  z-index: 2147483010;
  inset: 0;
  display: grid;
  padding: 18px;
  background: rgba(12, 14, 17, 0.72);
  backdrop-filter: blur(5px);
}

#maba-project-hub {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1460px, 100%);
  height: min(940px, 100%);
  margin: auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background: var(--maba-hub-paper);
  color: var(--maba-hub-ink);
  box-shadow: 0 36px 110px rgba(0, 0, 0, 0.45);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.maba-hub-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--maba-hub-ink);
  color: #fff;
}

.maba-hub-heading {
  min-width: 0;
}

.maba-hub-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--maba-hub-gold);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.maba-hub-header h2 {
  margin: 0;
  overflow: hidden;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 820;
  letter-spacing: -0.035em;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maba-hub-header p {
  margin: 6px 0 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maba-hub-close {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  font: 300 26px/1 system-ui, sans-serif;
}

.maba-hub-close:hover {
  background: rgba(255, 255, 255, 0.13);
}

.maba-hub-main {
  overflow: auto;
  overscroll-behavior: contain;
}

.maba-hub-loading {
  display: flex;
  min-height: 360px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--maba-hub-muted);
  font-weight: 650;
}

.maba-hub-loading span {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(23, 25, 28, 0.15);
  border-top-color: var(--maba-hub-gold-dark);
  border-radius: 50%;
  animation: maba-hub-spin 0.8s linear infinite;
}

@keyframes maba-hub-spin {
  to { transform: rotate(360deg); }
}

.maba-hub-error {
  margin: 30px;
  padding: 18px;
  border: 1px solid rgba(180, 35, 24, 0.24);
  border-radius: 14px;
  background: #fef3f2;
  color: var(--maba-hub-danger);
}

.maba-hub-hero {
  padding: 22px 24px 24px;
  background: linear-gradient(150deg, #fff 0%, #fffaf0 100%);
  border-bottom: 1px solid var(--maba-hub-line);
}

.maba-hub-stage-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--maba-hub-muted);
  font-size: 12px;
  font-weight: 700;
}

.maba-hub-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 23px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #edf0f3;
  color: #46505b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.025em;
  line-height: 1.2;
  text-transform: uppercase;
}

.maba-hub-badge[data-status="completed"],
.maba-hub-badge[data-status="done"],
.maba-hub-badge[data-status="paid"],
.maba-hub-badge[data-status="approved"] {
  background: #e7f6ed;
  color: #146c42;
}

.maba-hub-badge[data-status="in_progress"],
.maba-hub-badge[data-status="ready"],
.maba-hub-badge[data-status="progress"] {
  background: #e8f1ff;
  color: #175cd3;
}

.maba-hub-badge[data-status="blocked"],
.maba-hub-badge[data-status="overdue"],
.maba-hub-badge[data-status="lost"],
.maba-hub-badge[data-status="canceled"] {
  background: #feeceb;
  color: #b42318;
}

.maba-hub-badge[data-status="punch_list"],
.maba-hub-badge[data-status="review"],
.maba-hub-badge[data-status="proposal_sent"] {
  background: #fff1dc;
  color: #9a5800;
}

.maba-hub-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.maba-hub-metric {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--maba-hub-line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.8);
}

.maba-hub-metric > span,
.maba-hub-metric small {
  display: block;
  overflow: hidden;
  color: var(--maba-hub-muted);
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maba-hub-metric strong {
  display: block;
  margin: 3px 0;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maba-hub-progress {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.maba-hub-progress > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.maba-hub-progress strong {
  font-size: 18px;
}

.maba-hub-progress span {
  color: var(--maba-hub-muted);
  font-size: 10px;
}

.maba-hub-progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 25, 28, 0.1);
}

.maba-hub-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--maba-hub-gold-dark), var(--maba-hub-gold));
  transition: width 0.35s ease;
}

.maba-hub-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.8fr);
  gap: 16px;
  padding: 16px;
}

.maba-hub-primary,
.maba-hub-secondary {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.maba-hub-panel {
  overflow: hidden;
  border: 1px solid var(--maba-hub-line);
  border-radius: 16px;
  background: var(--maba-hub-card);
  box-shadow: 0 4px 16px rgba(23, 25, 28, 0.035);
}

.maba-hub-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--maba-hub-line);
}

.maba-hub-section-head h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.maba-hub-section-head span {
  color: var(--maba-hub-muted);
  font-size: 10px;
  text-align: right;
}

.maba-hub-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.maba-hub-details-single {
  grid-template-columns: 1fr;
}

.maba-hub-detail {
  min-width: 0;
  padding: 13px 17px;
  border-bottom: 1px solid var(--maba-hub-line);
}

.maba-hub-detail:nth-last-child(-n+2) {
  border-bottom: 0;
}

.maba-hub-detail-wide {
  grid-column: 1 / -1;
}

.maba-hub-detail dt {
  margin-bottom: 4px;
  color: var(--maba-hub-muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.maba-hub-detail dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.maba-hub-risk {
  background: #fff9ec;
  box-shadow: inset 3px 0 var(--maba-hub-gold);
}

.maba-hub-task-list {
  display: grid;
}

.maba-hub-task {
  border-bottom: 1px solid var(--maba-hub-line);
}

.maba-hub-task:last-child {
  border-bottom: 0;
}

.maba-hub-task summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 17px;
  cursor: pointer;
  list-style: none;
}

.maba-hub-task summary::-webkit-details-marker {
  display: none;
}

.maba-hub-task-heading {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.maba-hub-task-heading strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maba-hub-task-heading small,
.maba-hub-task-body small,
.maba-hub-update small {
  color: var(--maba-hub-muted);
  font-size: 10px;
}

.maba-hub-task-body {
  padding: 0 17px 14px;
}

.maba-hub-task-body p {
  margin: 0 0 10px;
  color: #414850;
  font-size: 11px;
}

.maba-hub-checklist {
  margin: 0 0 8px;
  overflow: auto;
  color: #46505b;
  font: 10px/1.7 Inter, ui-sans-serif, system-ui, sans-serif;
  white-space: pre-wrap;
}

.maba-hub-timeline {
  padding: 4px 17px 12px;
}

.maba-hub-update {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--maba-hub-line);
}

.maba-hub-update:last-child {
  border-bottom: 0;
}

.maba-hub-update-marker {
  width: 9px;
  height: 9px;
  margin-top: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--maba-hub-gold);
  box-shadow: 0 0 0 1px var(--maba-hub-gold-dark);
}

.maba-hub-update-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.maba-hub-update time {
  color: var(--maba-hub-muted);
  font-size: 10px;
}

.maba-hub-update h4 {
  margin: 7px 0 4px;
  font-size: 12px;
}

.maba-hub-update p {
  margin: 0 0 5px;
  color: #46505b;
  font-size: 11px;
}

.maba-hub-gallery-grid {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.maba-hub-photo {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--maba-hub-line);
  border-radius: 12px;
  background: #fff;
}

.maba-hub-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #e9e7e1;
}

.maba-hub-photo figcaption {
  padding: 10px 11px;
}

.maba-hub-photo p {
  margin: 7px 0 3px;
  font-size: 11px;
}

.maba-hub-photo small {
  color: var(--maba-hub-muted);
  font-size: 9px;
}

.maba-hub-finance-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.maba-hub-finance-card {
  overflow: hidden;
  border: 1px solid var(--maba-hub-line);
  border-radius: 11px;
}

.maba-hub-finance-head,
.maba-hub-finance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.maba-hub-finance-head {
  padding: 9px 10px;
  background: #f8f8f6;
  font-size: 11px;
}

.maba-hub-finance-row {
  padding: 7px 10px;
  border-top: 1px solid var(--maba-hub-line);
  font-size: 10px;
}

.maba-hub-finance-row span {
  color: var(--maba-hub-muted);
}

.maba-hub-finance-row strong {
  text-align: right;
}

.maba-hub-empty {
  margin: 0;
  padding: 20px;
  color: var(--maba-hub-muted);
  font-size: 11px;
  text-align: center;
}

.maba-hub-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--maba-hub-line);
  background: #efede7;
  color: var(--maba-hub-muted);
  font-size: 9px;
  text-align: center;
}

@media (max-width: 900px) {
  #maba-project-hub-backdrop {
    padding: 0;
  }

  #maba-project-hub {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .maba-hub-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  #maba-project-hub-launcher {
    bottom: 82px;
    left: 14px;
    height: 44px;
  }

  .maba-hub-header,
  .maba-hub-hero {
    padding-right: 16px;
    padding-left: 16px;
  }

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

  .maba-hub-header p {
    max-width: calc(100vw - 90px);
  }

  .maba-hub-metrics,
  .maba-hub-details {
    grid-template-columns: 1fr;
  }

  .maba-hub-progress {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .maba-hub-layout {
    padding: 10px;
  }

  .maba-hub-detail,
  .maba-hub-detail:nth-last-child(-n+2) {
    border-bottom: 1px solid var(--maba-hub-line);
  }

  .maba-hub-detail:last-child {
    border-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .maba-hub-loading span {
    animation-duration: 1.6s;
  }

  .maba-hub-progress-track span {
    transition: none;
  }
}
