:root {
  --yellow: #ffcc02;
  --ink: #343344;
  --ink-soft: #56546c;
  --paper: #fffdf3;
  --line: #e8e4d7;
  --muted: #f5f2e8;
  --good: #16794c;
  --warn: #b36a00;
  --bad: #b42318;
  --blue-tint: #ececf4;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #faf8f0;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.62rem 0.85rem;
  color: var(--ink);
  background: white;
  cursor: pointer;
}

button:hover {
  border-color: var(--ink);
}

button.primary {
  border-color: var(--yellow);
  background: var(--yellow);
  color: var(--ink);
  font-weight: 800;
}

button.danger {
  border-color: #ffd4d0;
  color: var(--bad);
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 2rem;
  background: var(--ink);
  color: white;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--yellow);
  text-transform: uppercase;
  font-weight: 900;
  font-size: 0.76rem;
}

.header-actions,
.dialog-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

main {
  width: min(1500px, calc(100% - 2rem));
  margin: 1rem auto 3rem;
}

.control-bar,
.tabs,
.summary-grid,
.section-title {
  margin-bottom: 1rem;
}

.control-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 0.75rem;
  align-items: end;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 800;
  font-size: 0.82rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.58rem 0.65rem;
  color: var(--ink);
  background: white;
}

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

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

.metric,
.card,
.month-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.metric {
  padding: 1rem;
}

.metric span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.45rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.section-title h2 {
  margin: 0;
  font-size: 1.35rem;
}

.section-title p {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.month-card {
  min-height: 260px;
  overflow: hidden;
}

.month-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  color: white;
  background: var(--ink);
}

.month-card header strong {
  font-size: 1rem;
}

.month-card header span {
  color: var(--yellow);
  font-weight: 900;
}

.month-body {
  display: grid;
  gap: 0.5rem;
  padding: 0.7rem;
}

.activity-pill {
  border-left: 5px solid var(--yellow);
  border-radius: 7px;
  padding: 0.55rem 0.65rem;
  background: var(--paper);
  cursor: pointer;
}

.activity-pill h3 {
  margin: 0 0 0.2rem;
  font-size: 0.9rem;
}

.activity-pill p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.35;
}

.activity-pill.compact p:nth-of-type(n + 2) {
  display: none;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  background: var(--blue-tint);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 900;
}

.tag.warn {
  background: #fff1d6;
  color: var(--warn);
}

.tag.bad {
  background: #ffe7e4;
  color: var(--bad);
}

.tag.good {
  background: #daf5e6;
  color: var(--good);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

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

th,
td {
  padding: 0.72rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
}

th {
  color: white;
  background: var(--ink);
  font-size: 0.74rem;
  text-transform: uppercase;
}

tbody tr:hover {
  background: var(--paper);
}

.dashboard {
  display: grid;
  gap: 0.75rem;
}

.line-row {
  display: grid;
  grid-template-columns: 1.3fr repeat(8, minmax(95px, 1fr));
  gap: 0;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.line-row > div {
  padding: 0.7rem;
  border-right: 1px solid var(--line);
}

.line-row > div:last-child {
  border-right: 0;
}

.line-row.header {
  color: white;
  background: var(--ink);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.line-row:not(.header) > div:first-child {
  font-weight: 900;
}

.bar {
  height: 7px;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: var(--muted);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--yellow);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.card {
  padding: 1rem;
}

.card h3 {
  margin: 0 0 0.45rem;
}

.card p {
  margin: 0.25rem 0;
  color: var(--ink-soft);
  line-height: 1.38;
}

.card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.75rem;
  margin: 0.7rem 0 0;
}

.card dt {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 900;
}

.card dd {
  margin: 0;
  font-weight: 800;
}

.score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.8rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.score strong {
  font-size: 1.4rem;
}

dialog {
  width: min(980px, calc(100% - 1rem));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(52, 51, 68, 0.25);
}

dialog::backdrop {
  background: rgba(52, 51, 68, 0.45);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  color: white;
  background: var(--ink);
}

.dialog-header h2 {
  margin: 0;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  color: white;
  background: transparent;
  font-size: 1.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  padding: 1rem;
}

.wide {
  grid-column: span 3;
}

.dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  padding: 1rem;
  border-top: 1px solid var(--line);
}

.print-mode .control-bar,
.print-mode .tabs,
.print-mode .summary-grid,
.print-mode .section-title p,
.print-mode #activitiesView,
.print-mode #dashboardView,
.print-mode #clientsView,
.print-mode #strategyView,
.print-mode #goalsView,
.print-mode #costsView {
  display: none;
}

.print-mode main {
  width: 100%;
  margin: 0;
  padding: 0.6rem;
}

.print-mode .app-header {
  padding: 0.7rem 1rem;
}

.print-mode .timeline {
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
}

.print-mode .month-card {
  min-height: 142px;
}

.print-mode .month-card header {
  padding: 0.38rem 0.45rem;
}

.print-mode .month-body {
  gap: 0.25rem;
  padding: 0.35rem;
}

.print-mode .activity-pill {
  padding: 0.28rem 0.35rem;
  border-left-width: 4px;
}

.print-mode .activity-pill h3 {
  font-size: 0.63rem;
}

.print-mode .activity-pill p,
.print-mode .tag-row {
  display: none;
}

@media (max-width: 1050px) {
  .control-bar,
  .summary-grid,
  .timeline,
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .line-row {
    grid-template-columns: 1fr 1fr;
  }

  .line-row.header {
    display: none;
  }
}

@media (max-width: 700px) {
  .app-header,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  main {
    width: calc(100% - 1rem);
  }

  .control-bar,
  .summary-grid,
  .timeline,
  .cards-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }
}

@page {
  size: A4 landscape;
  margin: 8mm;
}

@media print {
  body {
    background: white;
  }

  .no-print,
  .control-bar,
  .tabs,
  dialog {
    display: none !important;
  }

  .app-header {
    padding: 0.4rem 0;
    color: var(--ink);
    background: white;
    border-bottom: 3px solid var(--yellow);
  }

  main {
    width: 100%;
    margin: 0;
  }

  .view {
    display: none !important;
  }

  #annualView.active,
  .print-mode #annualView {
    display: block !important;
  }

  .summary-grid,
  .section-title p {
    display: none;
  }

  .timeline {
    grid-template-columns: repeat(6, 1fr);
    gap: 3mm;
  }

  .month-card {
    min-height: 31mm;
    break-inside: avoid;
  }

  .month-card header {
    padding: 2mm 2.5mm;
  }

  .month-card header strong,
  .month-card header span {
    font-size: 8pt;
  }

  .month-body {
    gap: 1.4mm;
    padding: 2mm;
  }

  .activity-pill {
    padding: 1.2mm 1.6mm;
    border-left-width: 2mm;
  }

  .activity-pill h3 {
    font-size: 6.8pt;
    line-height: 1.1;
  }

  .activity-pill p,
  .activity-pill .tag-row {
    display: none;
  }
}
