:root {
  --dash-bg: var(--bg-page);
  --dash-panel: var(--container-normal-1-d);
  --dash-line: var(--border-container);
  --dash-line-soft: var(--border-section);
  --dash-current: rgba(93, 79, 249, 0.16);
  --dash-current-line: rgba(93, 79, 249, 0.72);
  --dash-achieved-bg: rgba(19, 192, 68, 0.11);
  --dash-achieved-line: var(--state-success-strong);
  --dash-missed-bg: rgba(244, 87, 87, 0.10);
  --dash-missed-line: var(--state-error);
  --dash-pending-bg: rgba(100, 116, 139, 0.14);
  --dash-empty-bg: rgba(15, 23, 42, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

body {
  overflow: auto;
  background: var(--dash-bg);
  color: var(--fg-1);
  font-family: var(--font-sans);
}

.dashboard-shell {
  width: 100%;
  min-width: 1760px;
  min-height: max(1080px, 100vh);
  display: grid;
  grid-template-rows: auto auto;
  gap: 12px;
  padding: 20px 24px 18px;
}

.top-panel,
.matrix-panel {
  border: 1px solid var(--dash-line);
  border-radius: var(--radius-lg);
  background: var(--dash-panel);
}

.top-panel {
  min-height: 0;
  padding: 14px 18px 16px;
  display: grid;
  grid-template-rows: auto auto;
  row-gap: 10px;
}

.top-panel-head {
  display: flex;
  align-items: center;
  min-width: 0;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.eyebrow {
  margin: 0;
  color: var(--fg-4);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
}

h2 {
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
}

.matrix-panel {
  min-height: 0;
  padding: 14px 16px 16px;
}

.matrix-panel {
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
  row-gap: 10px;
}

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

.week-card {
  min-width: 0;
  height: auto;
  min-height: 132px;
  border: 1px solid var(--dash-line-soft);
  border-left: 4px solid var(--dash-current-line);
  border-radius: var(--radius-lg);
  background: var(--dash-current);
  padding: 12px 14px;
  display: grid;
  grid-template-rows: 22px auto 1fr;
  align-content: start;
  gap: 6px;
}

.week-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.team-name {
  min-width: 0;
  color: var(--fg-1);
  font-size: 15px;
  line-height: 22px;
  font-weight: 700;
  white-space: normal;
}

.result-pill {
  flex: none;
  border-radius: var(--radius-pill);
  padding: 4px 8px;
  color: var(--fg-3);
  background: var(--dash-pending-bg);
  font-size: 12px;
  line-height: 12px;
  font-weight: 700;
}

.result-pill.achieved {
  color: #C8F7BC;
  background: rgba(19, 192, 68, 0.24);
}

.result-pill.missed {
  color: #FFC1C1;
  background: rgba(244, 87, 87, 0.22);
}

.objective {
  min-width: 0;
  color: var(--fg-2);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  display: block;
  overflow: visible;
  overflow-wrap: anywhere;
}

.objective.needs-input,
.week-card.empty .objective {
  color: var(--fg-4);
}

.matrix-progress {
  display: grid;
  grid-template-columns: 160px repeat(9, minmax(0, 1fr));
  gap: 6px;
  align-items: start;
  min-height: 44px;
  font-variant-numeric: tabular-nums;
}

.progress-bound {
  color: var(--fg-4);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.progress-bound-start {
  position: absolute;
  top: 0;
  left: 0;
}

.progress-lane {
  position: relative;
  grid-column: 2 / -1;
  min-width: 0;
  height: 44px;
  display: flex;
  align-items: start;
}

.progress-bound-end {
  position: absolute;
  top: 0;
  right: 0;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 8px;
  margin-top: 24px;
  overflow: visible;
  border-radius: var(--radius-pill);
  background: rgba(100, 116, 139, 0.18);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--primary);
  transition: width 320ms linear;
}

.progress-marker {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  transition: left 320ms linear;
}

.marker-pin {
  position: absolute;
  top: 50%;
  left: 0;
  width: 18px;
  height: 18px;
  border: 3px solid var(--fg-1);
  border-radius: var(--radius-pill);
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(93, 79, 249, 0.24);
  transform: translate(-50%, -50%);
}

.marker-label {
  position: absolute;
  top: -32px;
  left: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  color: var(--fg-2);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
}

.marker-label strong {
  color: var(--fg-1);
}

.cell-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--gray-500);
}

.cell-dot.achieved {
  border-color: var(--dash-achieved-line);
  background: var(--dash-achieved-line);
}

.cell-dot.missed {
  border-color: var(--dash-missed-line);
  background: var(--dash-missed-line);
}

.cell-dot.working {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(93, 79, 249, 0.18);
}

.cell-dot.planned {
  border-color: rgba(148, 163, 184, 0.62);
  background: transparent;
}

.plan-matrix {
  height: auto;
  min-height: 724px;
  display: grid;
  grid-template-columns: 160px repeat(9, minmax(0, 1fr));
  grid-template-rows: 52px repeat(4, minmax(161px, auto));
  gap: 6px;
}

.matrix-corner,
.week-head,
.team-head,
.goal-cell {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--dash-line-soft);
  border-radius: var(--radius-md);
}

.matrix-corner,
.week-head,
.team-head {
  background: rgba(15, 23, 42, 0.34);
}

.week-head {
  padding: 8px 10px;
}

.week-head.current {
  border-color: var(--dash-current-line);
  background: var(--dash-current);
}

.week-head:not(.current) {
  opacity: 0.78;
}

.week-head strong,
.team-head strong {
  display: block;
  color: var(--fg-1);
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
  white-space: nowrap;
}

.team-head strong {
  font-size: 13px;
  line-height: 18px;
  white-space: normal;
}

.week-head span {
  display: block;
  margin-top: 2px;
  color: var(--fg-4);
  font-size: 12px;
  line-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.team-head {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.goal-cell {
  display: grid;
  grid-template-rows: 22px auto 1fr;
  align-content: start;
  gap: 8px;
  padding: 12px;
  background: var(--dash-pending-bg);
}

.goal-cell.current {
  border-color: var(--dash-current-line);
  background: var(--dash-current);
}

.goal-cell.achieved {
  border-color: rgba(19, 192, 68, 0.38);
  background: var(--dash-achieved-bg);
}

.goal-cell.missed {
  border-color: rgba(244, 87, 87, 0.42);
  background: var(--dash-missed-bg);
}

.goal-cell.empty {
  border-color: rgba(148, 163, 184, 0.14);
  background: var(--dash-empty-bg);
}

.goal-cell:not(.current) {
  opacity: 0.82;
  filter: none;
}

.goal-cell:not(.current).achieved {
  border-color: rgba(19, 192, 68, 0.24);
}

.goal-cell:not(.current).missed {
  border-color: rgba(244, 87, 87, 0.28);
}

.goal-cell.current {
  border-color: var(--dash-current-line);
  background: rgba(93, 79, 249, 0.26);
  box-shadow: inset 0 0 0 1px rgba(93, 79, 249, 0.32);
}

.cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cell-result {
  color: var(--fg-4);
  font-size: 12px;
  line-height: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.goal-cell.achieved .cell-result {
  color: #C8F7BC;
}

.goal-cell.missed .cell-result {
  color: #FFC1C1;
}

.goal-cell.current .cell-result.pending {
  color: var(--fg-1);
}

.goal-cell.current .cell-result.working {
  color: var(--fg-1);
}

.cell-objective {
  color: var(--fg-2);
  font-size: 13px;
  line-height: 17px;
  font-weight: 600;
  display: block;
  overflow: visible;
  overflow-wrap: anywhere;
}

.objective-line,
.objective-detail {
  display: block;
}

.objective-line + .objective-line {
  margin-top: 2px;
}

.objective-line.bulleted {
  position: relative;
  padding-left: 10px;
}

.objective-line.bulleted::before {
  position: absolute;
  left: 0;
  content: "•";
}

.objective-detail {
  margin-top: 4px;
  color: var(--fg-4);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
}

.goal-cell.empty .cell-objective {
  color: var(--fg-4);
}

.goal-cell:not(.current) .cell-objective {
  font-weight: 500;
}

.goal-cell.current .cell-objective {
  color: var(--fg-1);
  font-weight: 700;
}

.missed-detail-trigger {
  width: auto;
  min-width: 0;
  min-height: 28px;
  margin-top: 2px;
  border: 1px solid rgba(244, 87, 87, 0.34);
  border-radius: var(--radius-sm);
  background: rgba(244, 87, 87, 0.08);
  padding: 5px 9px;
  align-self: end;
  justify-self: start;
  color: #FFC1C1;
  font: inherit;
  font-size: 11px;
  line-height: 16px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.missed-detail-trigger:hover {
  border-color: rgba(244, 87, 87, 0.72);
  background: rgba(244, 87, 87, 0.16);
  color: #FFE0E0;
}

.missed-detail-trigger:focus-visible {
  outline: 2px solid #FFC1C1;
  outline-offset: 2px;
}

.missed-modal {
  width: min(720px, calc(100vw - 40px));
  max-width: none;
  max-height: min(820px, calc(100vh - 40px));
  margin: auto;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-xl);
  background: transparent;
  padding: 0;
  color: var(--fg-1);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.52);
}

.missed-modal::backdrop {
  background: rgba(7, 12, 24, 0.78);
  backdrop-filter: blur(6px);
}

.missed-modal[open] {
  animation: missed-modal-enter 160ms ease-out;
}

.missed-modal-shell {
  max-height: min(820px, calc(100vh - 40px));
  overflow: auto;
  background: var(--dash-panel);
}

.missed-modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  min-width: 0;
  border-bottom: 1px solid var(--dash-line);
  padding: 20px 22px 18px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  background: rgba(19, 28, 48, 0.96);
  backdrop-filter: blur(12px);
}

.missed-modal-heading {
  min-width: 0;
}

.missed-modal-kicker {
  margin-bottom: 4px;
  color: #FF9A9A;
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.missed-modal-heading h2 {
  color: var(--fg-1);
  font-size: 21px;
  line-height: 28px;
  font-weight: 700;
}

.missed-modal-objective {
  margin-top: 7px;
  color: var(--fg-3);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}

.missed-modal-header form {
  flex: none;
  margin: 0;
}

.missed-modal-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--dash-line-soft);
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.08);
  color: var(--fg-3);
  font: inherit;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.missed-modal-close:hover {
  border-color: rgba(148, 163, 184, 0.48);
  background: rgba(148, 163, 184, 0.16);
  color: var(--fg-1);
}

.missed-modal-close:focus-visible {
  outline: 2px solid var(--dash-current-line);
  outline-offset: 2px;
}

.missed-modal-close span {
  font-size: 25px;
  line-height: 1;
  transform: translateY(-1px);
}

.missed-modal-sections {
  padding: 20px 24px 24px;
  display: grid;
  gap: 12px;
}

.missed-modal-section {
  min-width: 0;
  border: 1px solid var(--dash-line-soft);
  border-left-width: 4px;
  border-radius: var(--radius-lg);
  padding: 16px 18px 17px;
  background: rgba(100, 116, 139, 0.08);
}

.missed-modal-section.scope {
  border-left-color: #F97373;
  background: rgba(244, 87, 87, 0.08);
}

.missed-modal-section.reason {
  border-left-color: #F2B94B;
  background: rgba(242, 185, 75, 0.07);
}

.missed-modal-section.plan {
  border-left-color: #8E84FF;
  background: rgba(93, 79, 249, 0.10);
}

.missed-modal-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.missed-modal-index {
  flex: none;
  color: var(--fg-4);
  font-size: 10px;
  line-height: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.missed-modal-section h3 {
  margin: 0;
  color: var(--fg-1);
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
}

.missed-modal-section ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--fg-2);
  font-size: 14px;
  line-height: 21px;
  font-weight: 500;
}

.missed-modal-section li + li {
  margin-top: 5px;
}

@keyframes missed-modal-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 720px) {
  .missed-modal {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .missed-modal-shell {
    max-height: calc(100vh - 24px);
  }

  .missed-modal-header {
    padding: 17px 16px 15px 18px;
  }

  .missed-modal-sections {
    padding: 16px 18px 18px;
  }

  .missed-modal-section {
    padding: 14px 15px 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .missed-detail-trigger,
  .missed-modal-close {
    transition: none;
  }

  .missed-modal[open] {
    animation: none;
  }
}

.load-error {
  grid-column: 1 / -1;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--fg-2);
  text-align: center;
}

.load-error span {
  color: var(--fg-4);
  font-size: 13px;
}
