:root {
  --bg: #f8f7f5;
  --surface: #ffffff;
  --white: #ffffff;
  --line: #ddd8d1;
  --line-strong: #cfc9c1;
  --text: #67625d;
  --muted: #aaa49d;
  --title: #1d62b2;
  --gold: #8a847d;
  --accent: #ea4d99;
  --accent-soft: #fbe7f1;
  --tab-text: #a49f98;
  --header-bg: #f7f5f2;
  --table-head: #f2efeb;
}

.category-theme {
  --section-accent: var(--title);
  --section-soft: #f9fcff;
  --section-border: #bfd3ec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
}

.dashboard-page {
  background: #faf9f7;
}

.topbar {
  height: 30px;
  padding: 0 28px;
  border-bottom: 1px solid #ece7e0;
  background: #f8f6f3;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-link {
  text-decoration: none;
  color: #8f8a84;
  font-size: 0.68rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.user-chip {
  color: #595959;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}

.user-chip-name {
  font-weight: 700;
}

.user-chip-role {
  margin-top: 2px;
  font-size: 0.68rem;
  letter-spacing: 0;
  text-transform: none;
  color: #a6a09a;
}

.event-wrap {
  max-width: 1240px;
  margin: 12px auto 44px;
  padding: 0 18px;
}

.dashboard-breadcrumb {
  margin: 2px 0 4px;
  color: #9e9992;
  font-size: 0.56rem;
}

.event-title {
  margin: 0;
  color: var(--title);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.event-meta {
  margin: 2px 0 12px;
  color: #b0aaa4;
  font-size: 0.62rem;
}

.overview-card {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 1.15fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: none;
}

.overview-panel {
  padding: 10px 12px;
  min-height: 182px;
}

.overview-panel + .overview-panel {
  border-left: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 0.74rem;
  color: #65615b;
  font-weight: 400;
  line-height: 1.1;
}

.panel-subtitle {
  color: #c0bbb5;
  font-style: italic;
  font-size: 0.48rem;
  margin-bottom: 6px;
}

.dropzone {
  border: 1px dashed #d9d4cf;
  background: #fbfbfa;
  border-radius: 3px;
  height: 102px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: #7ea5d8;
  background: #f4f8fd;
}

.dropzone input[type="file"] {
  display: none;
}

.dropzone-icon {
  font-size: 1.45rem;
  color: #d4d0cb;
}

.dropzone-text {
  color: #9c9791;
  font-size: 0.58rem;
}

.dropzone-or {
  color: #b3aea9;
  font-size: 0.64rem;
}

.dropzone-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #2e6fbe;
  color: #fff;
  border: 1px solid #2a63a7;
  box-shadow: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  font-size: 0.56rem;
  border-radius: 3px;
  padding: 3px 10px;
  line-height: 1;
}

.dropzone-btn::before {
  content: "⤴";
  font-size: 0.78rem;
  line-height: 1;
}

.dropzone-selected {
  margin-top: 4px;
  max-width: 90%;
  color: #a09a94;
  font-size: 0.54rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropzone-selected.has-file {
  color: #2a63a7;
  font-weight: 600;
}

.file-types {
  margin-top: 3px;
  color: #bdb7b1;
  font-size: 0.48rem;
}

.upload-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 7px;
}

.upload-fields input,
.upload-fields select,
.budget-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 3px;
  min-height: 25px;
  padding: 4px 7px;
  font-size: 0.62rem;
  color: #69645d;
}

.action-btn {
  margin-top: 6px;
  border: 1px solid #2a63a7;
  background: #2e6fbe;
  color: #fff;
  font-size: 0.56rem;
  border-radius: 3px;
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.action-btn.ghost {
  margin-top: 9px;
  background: transparent;
  color: #666;
  border-color: var(--line);
}

.emblem-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

.emblem-ring {
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.emblem-ring img {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0.98;
}

.budget-lines {
  padding-top: 2px;
}

.budget-line-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  padding: 4px 0;
  border-bottom: 1px solid #ece7e0;
}

.budget-line-item.section-budget {
  padding: 5px 0;
  border: 0;
  border-bottom: 1px solid #ece7e0;
  background: transparent;
  border-radius: 0;
}

.budget-line-item.section-budget .budget-line-label span,
.budget-line-item.section-budget .budget-line-value strong,
.budget-line-item.section-budget .budget-line-vat {
  color: var(--section-accent);
}

.budget-line-item-accent {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #d8d2cb;
}

.budget-line-label span {
  display: block;
  color: #67625c;
  font-size: 0.6rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.budget-line-label small {
  display: block;
  color: #b0aba5;
  font-size: 0.42rem;
  font-style: italic;
  line-height: 1.1;
}

.budget-line-value {
  text-align: right;
}

.budget-line-value strong {
  display: block;
  color: #5f5a54;
  font-size: 0.62rem;
  line-height: 1;
}

.budget-line-vat {
  display: inline-block;
  margin-left: 6px;
  color: #928d87;
  font-weight: 700;
  font-size: 0.5rem;
}

.budget-line-value small {
  display: block;
  color: #b0aba5;
  font-size: 0.42rem;
  font-style: italic;
  margin-top: 1px;
  max-width: 180px;
}

.tabs {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.portal-nav {
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.category-tabs,
.utility-tabs,
.sub-tabs {
  margin-top: 0;
  border-bottom: 1px solid var(--line);
}

.category-tabs {
  flex: 1 1 auto;
  gap: 18px;
}

.utility-tabs {
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 16px;
}

.sub-tabs {
  margin-top: 6px;
  gap: 0;
  border-bottom-color: #dfdbd5;
}

.tab {
  text-decoration: none;
  padding: 4px 0 6px;
  border-bottom: 2px solid transparent;
  min-width: max-content;
}

.category-tab {
  padding-right: 6px;
  border-bottom-width: 3px;
}

.tab-label {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  color: var(--tab-text);
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.tab-subtitle {
  display: block;
  color: #c1bbb4;
  font-size: 0.38rem;
  line-height: 1;
  font-style: italic;
  margin-top: 2px;
}

.tab.active {
  border-bottom-color: var(--accent);
}

.tab.active .tab-label {
  color: var(--accent);
  font-weight: 700;
}

.category-tab .tab-label {
  color: var(--section-accent);
}

.category-tab .tab-subtitle {
  color: color-mix(in srgb, var(--section-accent) 55%, white);
}

.category-tab.active {
  border-bottom-color: var(--section-accent);
}

.category-tab.active .tab-label {
  color: var(--section-accent);
}

.utility-tabs .tab-label {
  font-size: 0.56rem;
  color: #a29d97;
}

.utility-tabs .tab-subtitle {
  text-align: right;
}

.sub-tabs .tab {
  min-width: 96px;
  padding: 6px 10px 7px;
  margin-right: 1px;
  border: 1px solid color-mix(in srgb, var(--section-border) 70%, #e1ddd8);
  border-bottom: 0;
  background: color-mix(in srgb, var(--section-soft) 40%, #fbfaf8);
}

.sub-tabs .tab-label {
  font-size: 0.52rem;
  text-align: center;
  color: color-mix(in srgb, var(--section-accent) 60%, #8f8a84);
}

.sub-tabs .tab-subtitle {
  font-size: 0.34rem;
  text-align: center;
  color: color-mix(in srgb, var(--section-accent) 35%, #b7b2ac);
}

.sub-tabs .tab.active {
  background: var(--section-soft);
  border-color: var(--section-border);
}

.sub-tabs .tab.active .tab-label {
  color: var(--section-accent);
}

.sub-tabs .tab.active .tab-subtitle {
  color: color-mix(in srgb, var(--section-accent) 55%, white);
}

.table-zone {
  margin-top: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 3px;
  overflow: auto;
  padding: 0;
}

.section-heading {
  padding: 11px 14px 6px;
}

.section-heading h2 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-heading.category-heading h2 {
  color: var(--accent);
}

.section-heading p {
  margin: 4px 0 0;
  color: #b7b2ac;
  font-size: 0.48rem;
  font-style: italic;
}

.event-table {
  min-width: 1120px;
  margin: 0;
}

.event-table thead th {
  border-bottom: 1px solid var(--line-strong);
  border-right: 1px solid #cfcfcf;
  background: var(--table-head);
  padding: 4px 6px;
}

.event-table thead th:last-child {
  border-right: none;
}

.event-table thead th span {
  display: block;
  font-size: 0.52rem;
  font-weight: 700;
  color: #5f5a54;
}

.event-table thead th small {
  display: block;
  font-size: 0.38rem;
  color: #b3aea8;
  font-style: italic;
}

.event-table tbody td {
  border-top: 1px solid #e4e0da;
  border-right: 1px solid #ece8e3;
  padding: 4px 6px;
  font-size: 0.58rem;
  vertical-align: middle;
  background: #fff;
}

.event-table tbody td:last-child {
  border-right: none;
}

.budget-cell {
  min-width: 240px;
}

.budget-kpi {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 8px;
  color: #7d7770;
}

.budget-kpi.budget-over {
  color: #9b4c4c;
}

.budget-kpi.budget-ok {
  color: var(--gold);
}

.budget-kpi-lines {
  border-top: 1px solid var(--line);
  padding-top: 6px;
  font-size: 0.62rem;
}

.budget-kpi-lines div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.budget-kpi-lines span {
  color: #888;
}

.inline-form {
  margin: 4px 0 0;
}

.tiny-input {
  width: 88px;
  min-height: 28px;
  border: 1px solid #d6d1cb;
  background: #fff;
  border-radius: 3px;
  padding: 4px 6px;
  font-size: 0.64rem;
  margin: 4px 4px 0 0;
}

.tiny-btn {
  border: 1px solid #d4cfd2;
  background: #fbf3f7;
  color: #8c5a74;
  border-radius: 3px;
  padding: 4px 10px;
  min-height: 28px;
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dl-btn {
  border: 1px solid #d5d0cb;
  background: #fff;
  color: #7a746d;
  border-radius: 3px;
  padding: 3px 10px;
  min-width: 102px;
  text-align: center;
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dl-btn:hover,
.tiny-btn:hover {
  border-color: #cc9bb5;
  background: #f9eaf1;
  color: #8e4068;
}

.dl-btn-file {
  text-transform: none;
  letter-spacing: 0;
  min-width: 0;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-pending td {
  background: #fff;
  color: #b5b0aa;
}

.row-pending .validation-line {
  color: #9f9f9f;
}

.row-pending .check-box {
  border-color: #c9c9c9;
  background: #fbfbfb;
  color: #b5b5b5;
}

.row-client-validated td {
  background: #fbf2f7 !important;
  border-top: 1px solid #df8db8 !important;
  border-bottom: 1px solid #df8db8 !important;
  color: #7a4561;
  font-weight: 700;
}

.row-agency-confirmed td {
  background: #f7edf3 !important;
  border-top: 1px solid #c45b96 !important;
  border-bottom: 1px solid #c45b96 !important;
  color: #703752;
  font-weight: 700;
}

.row-client-validated td:first-child {
  border-left: 2px solid #df8db8 !important;
}

.row-agency-confirmed td:first-child {
  border-left: 2px solid #c45b96 !important;
}

.recap-total-row td {
  background: #f8eef3;
  border-top: 1px solid #d68bb2 !important;
  border-bottom: 1px solid #d68bb2 !important;
  color: #7a4d64;
  font-weight: 600;
}

.validation-stack {
  display: grid;
  gap: 4px;
  margin-bottom: 2px;
}

.validation-line {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #918b84;
  font-size: 0.58rem;
  line-height: 1.2;
}

.validation-line.checked {
  color: #8b4f6b;
  font-weight: 600;
}

.check-box {
  width: 14px;
  height: 14px;
  border: 1px solid #d2cbc5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  background: #fff;
  color: #b95d8e;
}

.validation-line.checked .check-box {
  border-color: #d68bb2;
  background: #fdf3f8;
}

.empty {
  text-align: center;
  color: #8b8b8b;
  padding: 18px;
}

.welcome-title {
  margin: 34px 0 58px;
  color: #2f2f2f;
  font-size: 0.96rem;
  font-weight: 400;
  letter-spacing: 0;
}

.welcome-title span {
  color: var(--title);
  font-weight: 700;
}

.projects-group {
  margin-top: 12px;
}

.projects-group-history {
  margin-top: 86px;
}

.projects-group-title {
  position: relative;
  margin: 0 0 12px;
  padding-left: 10px;
  color: #7f7c79;
  font-size: 0.96rem;
  font-weight: 700;
  text-transform: uppercase;
}

.projects-group-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 3px;
  height: 24px;
  background: currentColor;
}

.projects-group-title.active {
  color: var(--title);
}

.projects-stack {
  display: grid;
  gap: 14px;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(320px, 2.2fr) minmax(240px, 1.05fr) 144px 132px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid #bfd3ec;
  border-radius: 3px;
  background: #fff;
}

.project-card.closed {
  border-color: #dfdbd5;
}

.project-card.empty-state {
  display: block;
  padding: 16px 20px;
  color: #aaa39d;
}

.project-card-title {
  color: var(--title);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.project-card.closed .project-card-title {
  color: #9d9892;
  font-weight: 500;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-start;
}

.project-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 15px;
  padding: 0 6px;
  border: 1px solid var(--section-border);
  border-radius: 999px;
  color: var(--section-accent);
  background: var(--section-soft);
  font-size: 0.46rem;
  line-height: 1;
  white-space: nowrap;
}

.project-tag.muted,
.project-card.closed .project-tag {
  border-color: color-mix(in srgb, var(--section-border) 60%, #e4e0da);
  color: color-mix(in srgb, var(--section-accent) 35%, #c0bbb4);
  background: #fff;
}

.section-option {
  border: 1px solid var(--section-border) !important;
  background: var(--section-soft) !important;
  border-radius: 10px !important;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
  min-height: 132px;
}

.section-option:hover {
  border-color: var(--section-accent) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.section-option input:checked + span .section-option-label {
  color: var(--section-accent) !important;
}

.section-option-label {
  display: block;
  color: var(--section-accent);
}

.section-option-subtitle {
  color: color-mix(in srgb, var(--section-accent) 60%, #8f8a84);
}

.section-budget-field.is-disabled {
  opacity: 0.45;
}

.project-section-col {
  display: flex;
  flex-direction: column;
}

.project-section-col .section-option {
  flex: 1 1 auto;
}

.section-budget-field {
  margin-top: 10px !important;
  position: relative;
}

.section-budget-input:disabled {
  background: #f6f4f1;
  color: #a59f98;
  cursor: not-allowed;
}

.category-budget-note {
  margin-top: 10px;
  padding-top: 2px;
}

.form-submit-row {
  margin-top: 18px !important;
  padding-top: 8px;
  border-top: 1px solid #ece7e0;
}

@media (max-width: 768px) {
  .section-option {
    min-height: auto;
  }
}

.project-card-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 30px;
  border-left: 1px solid #e5e1dc;
  border-right: 1px solid #e5e1dc;
}

.project-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 106px;
  min-height: 24px;
  padding: 0 16px;
  border: 1px solid #5e90d2;
  border-radius: 3px;
  color: var(--title);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.56rem;
  font-weight: 700;
  background: #fff;
  letter-spacing: 0.02em;
}

.project-card-link {
  color: #8f8a84;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.52rem;
  font-weight: 700;
}

.project-card-link.danger {
  border: 0;
  background: transparent;
  color: #b36b83;
  padding: 0;
}

.project-inline-form {
  margin: 0;
}

.project-card-date {
  color: var(--title);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
}

.project-card.closed .project-card-date {
  color: #9d9892;
  font-weight: 500;
}

@media (max-width: 1080px) {
  .overview-card {
    grid-template-columns: 1fr;
  }

  .overview-panel + .overview-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .portal-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .utility-tabs {
    justify-content: flex-start;
  }

  .tabs {
    gap: 16px;
  }

  .project-card {
    grid-template-columns: 1fr;
    padding: 14px 16px;
    gap: 12px;
  }

  .project-card-actions {
    justify-content: flex-start;
    border: 0;
    padding-top: 4px;
  }

  .project-card-date {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .event-title {
    font-size: 1.25rem;
  }

  .panel-title {
    font-size: 0.92rem;
  }

  .budget-main {
    font-size: 1.55rem;
  }

  .upload-fields {
    grid-template-columns: 1fr;
  }

  .welcome-title {
    margin: 18px 0 34px;
    font-size: 0.98rem;
  }

  .projects-group-history {
    margin-top: 48px;
  }
}
