:root {
  --bg: #ececec;
  --surface: #f7f7f7;
  --white: #ffffff;
  --line: #c9c9c9;
  --line-strong: #a9a9a9;
  --text: #454545;
  --muted: #8a8a8a;
  --title: #6f7f7b;
  --gold: #b39c35;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid #d5d5d5;
  background: #e7e7e7;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-link {
  text-decoration: none;
  color: #5f6b68;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

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

.user-chip-role {
  margin-top: 2px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8d8d8d;
}

.mariage-wrap {
  max-width: 1240px;
  margin: 22px auto 44px;
  padding: 0 16px;
}

.mariage-title {
  margin: 0;
  color: var(--title);
  font-size: 2.1rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mariage-meta {
  margin: 2px 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.overview-card {
  display: grid;
  grid-template-columns: 1.4fr 0.75fr 1.35fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.overview-panel {
  padding: 14px 16px;
  min-height: 272px;
}

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

.panel-title {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 400;
  line-height: 1;
}

.panel-subtitle {
  color: #9d9d9d;
  font-style: italic;
  font-size: 0.82rem;
  margin-bottom: 8px;
}

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

.dropzone.dragover {
  border-color: #6d807d;
  background: #e7eceb;
}

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

.dropzone-icon {
  font-size: 1.8rem;
  color: #b5b5b5;
}

.dropzone-text {
  color: #747474;
  font-size: 0.92rem;
}

.dropzone-or {
  color: #979797;
  font-size: 0.8rem;
}

.dropzone-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #6d807d;
  color: #fff;
  border: 1px solid #5f726f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: 0.84rem;
  border-radius: 6px;
  padding: 4px 14px;
  line-height: 1;
}

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

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

.dropzone-selected.has-file {
  color: #4a5d5a;
  font-weight: 600;
}

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

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

.upload-fields input,
.upload-fields select,
.budget-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 3px;
  min-height: 31px;
  padding: 6px 8px;
  font-size: 0.84rem;
}

.action-btn {
  margin-top: 7px;
  border: 1px solid #768784;
  background: #768784;
  color: #fff;
  font-size: 0.84rem;
  border-radius: 3px;
  padding: 6px 10px;
}

.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: 250px;
  height: 250px;
  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-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.budget-head-main {
  min-width: 0;
}

.budget-main {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 3rem;
  line-height: 1;
  font-weight: 700;
  color: var(--gold);
}

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

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

.budget-label {
  font-size: 2rem;
  line-height: 1;
  margin-top: 2px;
}

.budget-sub {
  color: #9b9b9b;
  font-style: italic;
  font-size: 0.82rem;
  margin-top: 2px;
  margin-bottom: 28px;
}

.budget-vat {
  text-align: right;
  padding-top: 4px;
}

.budget-vat-main {
  color: var(--gold);
  font-size: 2.7rem;
  line-height: 1;
  font-weight: 700;
}

.budget-vat-sub {
  color: #9b9b9b;
  font-size: 0.72rem;
  font-style: italic;
}

.budget-lines {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.budget-line-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.budget-line-label span {
  display: block;
  color: #646464;
  font-size: 1rem;
  line-height: 1.1;
}

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

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

.budget-line-value strong {
  display: block;
  color: #575757;
  font-size: 1.05rem;
  line-height: 1;
}

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

.budget-line-value small {
  display: block;
  color: #9a9a9a;
  font-size: 0.72rem;
  font-style: italic;
  margin-top: 1px;
}

.tabs {
  margin-top: 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.tab {
  text-decoration: none;
  padding: 8px 10px 9px;
  border-bottom: 2px solid transparent;
  min-width: max-content;
}

.tab-label {
  display: block;
  font-size: 0.96rem;
  text-transform: uppercase;
  color: #717171;
  line-height: 1.05;
}

.tab-subtitle {
  display: block;
  color: #999;
  font-size: 0.78rem;
  line-height: 1;
  font-style: italic;
}

.tab.active {
  border-bottom-color: #6f7f7b;
}

.tab.active .tab-label {
  color: #4f5f5c;
  font-weight: 600;
}

.table-zone {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: #f5f5f5;
  border-radius: 4px;
  overflow: auto;
}

.mariage-table {
  min-width: 1080px;
  margin: 0;
}

.mariage-table thead th {
  border-bottom: 1px solid var(--line-strong);
  border-right: 1px solid #cfcfcf;
  background: #e6e6e6;
  padding: 8px 10px;
}

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

.mariage-table thead th span {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  color: #4d4d4d;
}

.mariage-table thead th small {
  display: block;
  font-size: 0.73rem;
  color: #8f8f8f;
  font-style: italic;
}

.mariage-table tbody td {
  border-top: 1px solid #d4d4d4;
  border-right: 1px solid #dddddd;
  padding: 7px 10px;
  font-size: 0.95rem;
  vertical-align: middle;
  background: #f8f8f8;
}

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

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

.budget-kpi {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 8px;
  color: var(--gold);
}

.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.82rem;
}

.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 #bfc5c8;
  background: #fff;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.74rem;
  margin: 4px 4px 0 0;
}

.tiny-btn {
  border: 1px solid #aeb3b5;
  background: #f3f4f4;
  color: #5f6669;
  border-radius: 5px;
  padding: 4px 10px;
  min-height: 28px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dl-btn {
  border: 1px solid #aeb3b5;
  background: #f5f5f5;
  color: #5f6669;
  border-radius: 5px;
  padding: 5px 14px;
  min-width: 132px;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dl-btn:hover,
.tiny-btn:hover {
  border-color: #8f989b;
  background: #eceeef;
  color: #4f575a;
}

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

.row-pending td {
  background: #f8f8f8;
  color: #a4a4a4;
}

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

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

.row-client-validated td {
  background: #edf7f1 !important;
  border-top: 2px solid #6c9984 !important;
  border-bottom: 1px solid #6c9984 !important;
  color: #2f4d41;
  font-weight: 700;
}

.row-agency-confirmed td {
  background: #d6e9df !important;
  border-top: 1px solid #3f7560 !important;
  border-bottom: 2px solid #3f7560 !important;
  color: #1f3b30;
  font-weight: 700;
}

.row-client-validated td:first-child {
  border-left: 4px solid #6c9984 !important;
}

.row-agency-confirmed td:first-child {
  border-left: 4px solid #3f7560 !important;
}

.row-category-not-desired td {
  background: #f1f1f1 !important;
  border-top: 1px solid #c9c9c9 !important;
  border-bottom: 1px solid #c9c9c9 !important;
  color: #7a7a7a;
}

.row-category-not-desired td:first-child {
  border-left: 4px solid #b8b8b8 !important;
}

.row-category-not-desired select,
.row-category-not-desired .tiny-input {
  background: #ececec;
  border-color: #c9c9c9;
  color: #666;
}

.recap-total-row td {
  background: #e8f0ed;
  border-top: 2px solid #7e968e !important;
  border-bottom: 2px solid #7e968e !important;
  color: #4b5652;
  font-weight: 600;
}

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

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

.validation-line.checked {
  color: #4c5f58;
  font-weight: 600;
}

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

.validation-line.checked .check-box {
  border-color: #7f9d8f;
  background: #eef5f2;
}

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

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

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

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

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

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

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