:root {
  color-scheme: light;
  --bg: #faf9f6;
  --panel: #ffffff;
  --line: #e4dfd8;
  --line-dark: #d8d0c7;
  --text: #262421;
  --muted: #716c65;
  --soft: #f1ece5;
  --accent: #9b7a42;
  --accent-soft: #e8dccb;
  --green: #2f8b4e;
  --blue: #4c7da9;
  --red: #c85b4a;
  --shadow: 0 18px 45px rgba(47, 42, 35, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  line-height: 1.45;
  margin: 0;
  min-height: 100vh;
}

.login-body {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 28px;
}

.login-shell {
  width: min(460px, 100%);
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 24px;
  padding: 34px;
}

.login-logo {
  margin: 0;
}

.login-logo img {
  max-width: 260px;
}

.login-kicker,
.login-hint,
.login-error {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  color: var(--muted);
  display: grid;
  font-size: 0.86rem;
  font-weight: 600;
  gap: 6px;
}

.login-form input {
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 9px 10px;
}

.login-submit {
  min-height: 42px;
}

.login-error {
  color: var(--red);
}

button,
a {
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3,
.logo-fallback strong {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 3vw, 3.1rem);
  line-height: 1.08;
}

h2 {
  font-size: 1.42rem;
}

h3 {
  font-size: 1.15rem;
}

.logo {
  display: grid;
  justify-items: center;
  margin: 0 8px 44px;
  text-align: center;
}

.logo img {
  display: block;
  height: auto;
  max-width: 208px;
  width: 100%;
}

.logo img:not(.is-hidden) + .logo-fallback {
  display: none;
}

.logo img.is-hidden {
  display: none;
}

.logo-fallback {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.logo-fallback strong {
  display: block;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: none;
}

.logo-fallback small {
  color: var(--muted);
  display: block;
  font-size: 0.86rem;
  font-weight: 300;
  letter-spacing: 0.04em;
}

.logo-symbol {
  border: 3px solid #20201e;
  border-radius: 999px;
  display: block;
  height: 64px;
  position: relative;
  width: 64px;
}

.logo-symbol::before,
.logo-symbol::after {
  border: 2px solid #20201e;
  content: "";
  position: absolute;
}

.logo-symbol::before {
  inset: 12px;
}

.logo-symbol::after {
  border-left: 0;
  border-right: 0;
  height: 38px;
  left: 7px;
  top: 12px;
  width: 46px;
}

.app {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: rgba(250, 249, 246, 0.95);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 76px;
  padding: 10px 36px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 20px;
  min-width: 240px;
}

.brand-link {
  align-items: center;
  display: inline-flex;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
}

.brand-link img {
  display: block;
  height: 48px;
  max-width: 122px;
  object-fit: contain;
  object-position: left center;
  width: auto;
}

.brand-link img.is-hidden {
  display: none;
}

.brand-text {
  display: grid;
  gap: 3px;
  line-height: 1.05;
  min-width: 0;
}

.brand-text strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.back-link {
  color: #5c574f;
  flex: none;
  font-size: 0.92rem;
  text-decoration: none;
}

.top-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.top-actions button {
  color: #5b564f;
  font-size: 0.88rem;
}

.edit-button,
.logout-button,
.secondary-top-button {
  border-radius: 999px;
  min-height: 34px;
  padding: 0 14px;
  white-space: nowrap;
}

.edit-button {
  background: var(--text);
  color: #fff !important;
}

.secondary-top-button,
.logout-button {
  border: 1px solid var(--line-dark);
  color: var(--text);
}

.project-switch {
  background: var(--panel);
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  color: var(--text);
  font: inherit;
  max-width: 280px;
  min-height: 34px;
  padding: 0 12px;
}

.avatar {
  align-items: center;
  background: #b8a991;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-weight: 700;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.content {
  margin: 0 auto;
  max-width: 1480px;
  padding: 18px 36px 0;
}

.content[hidden] {
  display: none;
}

.section {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: 150px minmax(0, 1fr);
  padding: 18px 0;
}

.section > h2 {
  align-self: start;
}

.project-head {
  display: block;
  padding-top: 22px;
}

.project-row {
  align-items: start;
  display: grid;
  gap: 32px;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  min-width: 0;
}

.project-image {
  aspect-ratio: 1.72;
  background:
    linear-gradient(180deg, rgba(40, 49, 38, 0.02), rgba(25, 27, 23, 0.22)),
    radial-gradient(circle at 18% 20%, #789060 0 8%, transparent 9%),
    radial-gradient(circle at 84% 26%, #879766 0 10%, transparent 11%),
    linear-gradient(90deg, transparent 0 18%, #efebe2 18% 82%, transparent 82%),
    linear-gradient(180deg, #cfd6cd 0 46%, #e9dfd0 46% 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 16px 36px rgba(47, 42, 35, 0.09), inset 0 -36px 70px rgba(35, 29, 21, 0.25);
  overflow: hidden;
  position: relative;
  background-position: center;
  background-size: cover;
  width: 100%;
}

.project-image.has-image {
  box-shadow: 0 16px 36px rgba(47, 42, 35, 0.09);
}

.project-image.has-image::before,
.project-image.has-image::after {
  display: none;
}

.project-image:not(.has-image)::before {
  background:
    linear-gradient(90deg, #1e211d 0 20%, transparent 20% 38%, #1e211d 38% 58%, transparent 58% 78%, #1e211d 78%),
    linear-gradient(180deg, #eee8dc 0 48%, #cbbda8 48% 100%);
  bottom: 26px;
  content: "";
  height: 72px;
  left: 46px;
  position: absolute;
  width: 150px;
}

.project-image:not(.has-image)::after {
  background: #d8d0c1;
  bottom: 96px;
  content: "";
  height: 42px;
  left: 70px;
  position: absolute;
  width: 100px;
}

.project-main {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.project-facts {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: 0;
}

.fact {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  min-height: 92px;
  min-width: 0;
  padding: 16px 18px;
}

.fact:first-child {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.fact span {
  color: var(--muted);
  font-size: 0.92rem;
}

.fact strong {
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.status-pill,
.phase-state,
.table-tag,
.table-status,
.status-list span {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.82rem;
  line-height: 1;
  padding: 8px 12px;
  width: max-content;
}

.status-pill {
  background: var(--accent-soft);
  color: #6d552f;
}

.progress-panel {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 18px;
  grid-template-columns: 74px minmax(160px, 1.2fr) repeat(2, minmax(135px, 1fr));
  min-height: 96px;
  min-width: 0;
  padding: 18px 20px;
}

.progress-circle {
  align-items: center;
  background: conic-gradient(var(--accent) 0deg, var(--accent) 137deg, #e8e3dc 137deg 360deg);
  border-radius: 999px;
  display: flex;
  height: 70px;
  justify-content: center;
  position: relative;
  width: 70px;
}

.progress-circle::after {
  background: var(--panel);
  border-radius: inherit;
  content: "";
  inset: 7px;
  position: absolute;
}

.progress-circle span {
  font-size: 1.15rem;
  position: relative;
  z-index: 1;
}

.progress-copy,
.mini-fact {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.progress-copy span,
.mini-fact span {
  color: var(--muted);
  font-size: 0.86rem;
}

.mini-fact strong,
.progress-copy strong {
  overflow-wrap: anywhere;
}

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

.phase-card {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  min-height: 216px;
  min-width: 0;
  overflow: hidden;
  padding: 18px 16px;
  text-align: left;
  width: 100%;
}

.phase-card:hover,
.phase-card.selected {
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(47, 42, 35, 0.08);
}

.phase-card.is-locked {
  cursor: default;
  opacity: 0.58;
}

.phase-card.is-locked:hover {
  border-color: var(--line);
  box-shadow: none;
}

.phase-card.is-locked .phase-arrow {
  visibility: hidden;
}

.phase-card.is-locked .details-link {
  color: var(--muted);
  text-decoration: none;
}

.phase-card-top {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.phase-icon {
  align-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  color: #6b604f;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 1.35rem;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.phase-title {
  min-width: 0;
  margin-right: auto;
}

.phase-title span {
  display: block;
  font-weight: 700;
}

.phase-title strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.phase-arrow {
  color: #605a52;
  font-size: 1.3rem;
}

.phase-state {
  align-items: center;
  gap: 7px;
  padding: 0;
}

.phase-state::before {
  background: #8b8880;
  border-radius: 999px;
  content: "";
  height: 9px;
  width: 9px;
}

.phase-state.done::before {
  background: var(--green);
}

.phase-state.active::before {
  background: var(--accent);
}

.phase-line {
  border-top: 1px solid var(--line);
  margin: 8px 0 4px;
}

.phase-protocol {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.phase-protocol span {
  color: var(--muted);
}

.phase-protocol strong {
  overflow-wrap: anywhere;
}

.details-link {
  align-self: end;
  color: #48433d;
  text-decoration: none;
}

.protocol-layout {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr);
}

.phase-detail-content {
  display: grid;
  gap: 14px;
}

.phase-page {
  display: grid;
  gap: 20px;
  padding-top: 28px;
}

.phase-page-head {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) 190px;
  padding: 24px;
}

.back-button {
  align-self: start;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  color: #4d4740;
  min-height: 38px;
  padding: 0 14px;
  width: max-content;
}

.phase-page-title {
  display: grid;
  gap: 8px;
}

.phase-page-title .back-button {
  margin-bottom: 6px;
}

.phase-page-title p,
.phase-page-meta span {
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: uppercase;
}

.phase-page-meta {
  border-left: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-left: 22px;
}

.phase-page-meta strong {
  font-size: 1.05rem;
}

.phase-page-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.admin-page {
  display: grid;
  gap: 18px;
  padding-top: 28px;
}

.admin-hero {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 24px;
}

.admin-hero p {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.admin-panel {
  min-width: 0;
}

.admin-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.admin-row {
  align-items: center;
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px 14px;
  text-align: left;
  width: 100%;
}

.admin-row-open {
  background: transparent;
  border: 0;
  color: inherit;
  flex: 1;
  min-height: auto;
  padding: 0;
  text-align: left;
}

.admin-row:hover,
.admin-row.selected {
  border-color: var(--accent);
}

.admin-row.is-disabled {
  opacity: 0.55;
}

.admin-row.is-archived {
  background: #f4f1ed;
}

.static-row:hover {
  border-color: var(--line);
}

.admin-row strong,
.admin-row small {
  display: block;
}

.admin-row small {
  color: var(--muted);
  margin-top: 4px;
}

.admin-row-meta {
  flex: 0 0 170px;
  text-align: right;
}

.admin-row-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.admin-row-actions .secondary-button {
  min-height: 34px;
  padding: 7px 12px;
}

.approval-overview {
  display: grid;
  gap: 12px;
}

#approvalOverviewContent {
  display: grid;
  gap: 10px;
}

.approval-overview-card {
  align-items: center;
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 14px 16px;
  text-align: left;
  width: 100%;
}

.approval-overview-card.is-open {
  border-color: #c7a15a;
  box-shadow: inset 4px 0 0 #c7a15a;
}

.approval-overview-card strong,
.approval-overview-card small {
  display: block;
}

.approval-overview-card small,
.approval-overview-card em {
  color: var(--muted);
  font-style: normal;
}

.detail-heading {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px;
}

.detail-heading p {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.detail-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.detail-panel-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.detail-head-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.budget-panel {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.budget-details {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.budget-details summary {
  align-items: center;
  background: #fbfaf8;
  cursor: pointer;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  list-style: none;
  padding: 16px;
}

.budget-details summary::-webkit-details-marker {
  display: none;
}

.budget-details summary span,
.budget-details summary strong,
.budget-details summary small {
  display: block;
}

.budget-details summary strong {
  font-size: 1rem;
}

.budget-details summary small,
.budget-details summary em {
  background: var(--text);
  border-radius: 999px;
  color: #fff;
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 700;
  min-width: 142px;
  padding: 10px 14px;
  text-align: center;
}

.budget-details summary b {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.4rem, 2.4vw, 2.1rem);
  font-weight: 500;
}

.budget-details[open] summary em {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line-dark);
  color: var(--text);
}

.contract-details {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.planner-details {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.contract-details summary,
.planner-details summary {
  align-items: center;
  cursor: pointer;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  list-style: none;
  padding: 18px 20px 18px 18px;
  transition: background 160ms ease;
}

.contract-details summary:hover,
.planner-details summary:hover {
  background: #fff;
}

.contract-details[open] summary,
.planner-details[open] summary {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.contract-details summary::-webkit-details-marker,
.planner-details summary::-webkit-details-marker {
  display: none;
}

.contract-details summary span,
.contract-details summary strong,
.contract-details summary small,
.planner-details summary span,
.planner-details summary strong,
.planner-details summary small {
  display: block;
}

.contract-details summary > span:first-child,
.planner-details summary > span:first-child {
  display: grid;
  gap: 5px;
}

.contract-details summary > span:first-child strong,
.planner-details summary > span:first-child strong {
  font-size: 1.05rem;
}

.contract-details summary > span:first-child small,
.planner-details summary > span:first-child small {
  color: var(--muted);
  font-size: 0.9rem;
}

.contract-toggle-icon {
  border-bottom: 1.5px solid var(--text);
  border-right: 1.5px solid var(--text);
  height: 9px;
  transform: rotate(45deg);
  transition: transform 160ms ease;
  width: 9px;
}

.contract-details[open] .contract-toggle-icon {
  transform: rotate(-135deg);
}

.planner-details[open] .contract-toggle-icon {
  transform: rotate(-135deg);
}

.contract-document-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
}

.contract-document-head {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.contract-document-head p {
  color: var(--muted);
  margin: 0;
}

.contract-document-list {
  display: grid;
  gap: 10px;
}

.contract-document-list .empty-state {
  margin: 0;
}

.contract-document-card {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px 16px;
}

.contract-document-card span,
.contract-document-card small {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  line-height: 1.45;
}

.contract-document-card strong {
  display: block;
  line-height: 1.35;
  margin: 4px 0;
  overflow-wrap: anywhere;
}

.contract-document-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.planner-document-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
}

.planner-document-head {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.planner-document-head h3,
.planner-document-head p {
  margin: 0;
}

.planner-document-head p {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

.planner-document-list,
.planner-loose-files,
.planner-folder-files {
  display: grid;
  gap: 10px;
}

.planner-discipline-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.planner-discipline-card {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 14px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  min-height: 98px;
  padding: 16px;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.planner-discipline-card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 26px rgba(40, 34, 27, 0.08);
  transform: translateY(-1px);
}

.planner-discipline-card strong,
.planner-discipline-card span,
.planner-discipline-card small {
  display: block;
}

.planner-discipline-card strong {
  font-size: 1rem;
  margin-bottom: 8px;
}

.planner-discipline-card span {
  font-weight: 700;
  margin-bottom: 8px;
}

.planner-discipline-card small {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  margin-top: 3px;
}

.planner-folder {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-left: calc(var(--folder-depth, 0) * 18px);
  overflow: hidden;
}

.planner-folder summary {
  align-items: center;
  cursor: pointer;
  display: grid;
  gap: 14px;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  list-style: none;
  padding: 13px 14px;
}

.planner-folder summary::before {
  color: var(--muted);
  content: ">";
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.planner-folder[open] > summary::before {
  transform: rotate(90deg);
}

.planner-folder summary::-webkit-details-marker {
  display: none;
}

.planner-folder summary small {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  margin-top: 3px;
}

.planner-folder-files {
  border-top: 1px solid var(--line);
  padding: 10px;
}

.planner-file-card {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  padding: 12px 14px;
}

.planner-file-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.planner-file-card span,
.planner-file-card small {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  line-height: 1.45;
  margin-top: 2px;
}

.planner-file-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.discipline-form {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 12px;
}

.discipline-form input {
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  min-height: 38px;
  padding: 0 12px;
}

.budget-calculator {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(430px, 0.85fr) minmax(560px, 1.15fr);
  padding: 16px;
}

.budget-lock-notice {
  background: #fbfaf8;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0;
  padding: 12px 16px 0;
}

.budget-locked .budget-control input:disabled {
  background: #f8f6f2;
  color: #5e574f;
}

.budget-locked #saveBudget {
  opacity: 0.45;
}

.budget-section-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-bottom: 10px;
}

.budget-section-head h3 {
  font-size: 1rem;
}

.budget-section-head span {
  color: var(--muted);
  font-size: 0.82rem;
}

.budget-head-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.budget-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.budget-form {
  display: grid;
  align-content: start;
  gap: 10px;
}

.budget-control {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 9px;
  padding: 12px;
}

.budget-control-warning {
  background: #fffdfb;
  border-color: rgba(159, 52, 52, 0.24);
}

.budget-control.is-readonly {
  background: #fbfaf8;
}

.budget-control-title {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.budget-control-title label,
.budget-line > span,
.budget-toggle > span {
  font-weight: 700;
}

.budget-control-title small,
.budget-note,
.budget-line > span {
  color: var(--muted);
  font-size: 0.82rem;
}

.budget-note {
  line-height: 1.45;
}

.budget-range-line,
.budget-line,
.budget-toggle,
.budget-computed-lines div {
  align-items: center;
  display: grid;
  gap: 10px;
}

.budget-range-line {
  grid-template-columns: minmax(120px, 1fr) 110px 32px;
}

.budget-line {
  grid-template-columns: minmax(160px, 1fr) 132px 46px;
}

.budget-toggle {
  grid-template-columns: 18px minmax(160px, 1fr) 96px 30px;
}

.budget-toggle > input[type="checkbox"] {
  accent-color: var(--accent);
  height: 16px;
  width: 16px;
}

.budget-toggle-row {
  display: grid;
  gap: 8px;
}

.budget-computed-lines {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 6px;
  padding: 8px;
}

.budget-computed-lines div {
  grid-template-columns: minmax(0, 1fr) auto;
}

.budget-computed-lines span,
.budget-range-line strong {
  color: var(--muted);
  font-size: 0.82rem;
}

.budget-line input,
.budget-range-line input[type="number"],
.budget-toggle input[type="number"] {
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

.budget-range-line input[type="range"] {
  accent-color: var(--accent);
}

.budget-line em,
.budget-range-line em,
.budget-toggle em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.82rem;
}

.budget-control input:disabled {
  background: #f5f2ee;
  color: var(--muted);
  cursor: not-allowed;
}

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

.budget-admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.budget-grid label {
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 600;
  gap: 6px;
  position: relative;
}

.budget-grid input {
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  padding: 9px 38px 9px 10px;
  width: 100%;
}

.budget-grid label span {
  bottom: 10px;
  color: var(--muted);
  pointer-events: none;
  position: absolute;
  right: 10px;
}

.budget-grid input:disabled {
  background: #f5f2ee;
  color: var(--muted);
}

.budget-summary {
  background: #fbfaf8;
  display: grid;
  gap: 16px;
}

.budget-total-panel,
.budget-chart-panel,
.budget-detail-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.budget-summary > span,
.budget-kpis span,
.budget-bar-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.budget-total-panel > span {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.budget-total-panel > strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.budget-subtotal {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.86rem;
  margin-top: 8px;
}

.budget-kpis {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 16px;
}

.budget-kpis div {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-top: 10px;
}

.budget-chart-panel {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: 220px minmax(0, 1fr);
}

.budget-donut-wrap {
  display: grid;
  place-items: center;
  position: relative;
}

.budget-donut-wrap svg {
  height: 220px;
  width: 220px;
}

.budget-donut-center {
  align-items: center;
  display: grid;
  left: 50%;
  justify-items: center;
  pointer-events: none;
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
}

.budget-donut-center strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  text-align: center;
}

.budget-donut-center span {
  color: var(--muted);
  display: block;
  font-size: 0.75rem;
  text-align: center;
}

.budget-legend {
  display: grid;
  gap: 8px;
}

.budget-legend-item {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 10px minmax(0, 1fr) auto;
}

.budget-legend-item i {
  border-radius: 999px;
  height: 10px;
  width: 10px;
}

.budget-legend-item span {
  color: var(--muted);
  font-size: 0.84rem;
}

.budget-legend-item strong {
  font-size: 0.84rem;
}

.budget-breakdown {
  display: grid;
  gap: 12px;
  grid-template-columns: 0.8fr 1.2fr;
}

.budget-breakdown.is-single {
  grid-template-columns: 1fr;
}

.budget-detail-block h3 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.budget-cost-list {
  display: grid;
  gap: 8px;
}

.budget-cost-list div {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding-bottom: 7px;
}

.budget-cost-list span {
  color: var(--muted);
  font-size: 0.84rem;
}

.budget-bars {
  display: grid;
  gap: 9px;
}

.budget-bar-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(210px, 0.9fr) minmax(180px, 1fr) max-content;
}

.budget-bar-row div {
  background: #ece7df;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.budget-bar-row i {
  background: var(--accent);
  display: block;
  height: 100%;
}

.budget-bar-row strong {
  font-size: 0.84rem;
  text-align: right;
  white-space: nowrap;
}

.budget-bar-row span {
  line-height: 1.25;
}

.budget-notes,
.budget-legal-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0;
}

.budget-legal-note {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.detail-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 6px;
  padding: 12px;
}

.detail-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.detail-row span,
.empty-state {
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.panel-heading {
  display: grid;
  gap: 6px;
  padding: 14px 16px 12px;
}

.panel-heading p {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-weight: 500;
}

td strong {
  font-weight: 700;
}

.table-tag {
  background: var(--soft);
  color: #6d552f;
}

.pdf-link {
  align-items: baseline;
  color: var(--ink);
  display: inline-flex;
  gap: 7px;
  text-decoration: none;
  white-space: nowrap;
}

.pdf-link:hover .file-name-label {
  color: #6d552f;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.file-type-label {
  color: #b74235;
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
}

.file-name-label {
  color: var(--ink);
  min-width: 0;
}

.table-status {
  background: #e6edf6;
  color: var(--blue);
}

.table-status.green {
  background: #e3f0e5;
  color: var(--green);
}

.table-status.red {
  background: #f8e5e1;
  color: var(--red);
}

.protocol-notes {
  display: grid;
  gap: 8px;
}

.protocol-notes .panel {
  padding: 14px 16px;
}

.protocol-notes ul {
  margin: 12px 0 0;
  padding-left: 18px;
}

.status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.status-list span {
  background: #f2f0ed;
}

.status-list .blue {
  background: #e6edf6;
  color: var(--blue);
}

.status-list .green {
  background: #e3f0e5;
  color: var(--green);
}

.status-list .red {
  background: #f8e5e1;
  color: var(--red);
}

.documents .panel {
  padding: 14px 12px;
}

.documents h3 {
  margin: 0 0 14px;
}

.document-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.document-grid.detail-documents {
  gap: 10px;
  grid-template-columns: 1fr;
}

.doc-card {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  min-height: 76px;
  padding: 12px;
}

.doc-card > div {
  min-width: 0;
}

.doc-card-detail {
  align-items: start;
  gap: 14px;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  min-height: 104px;
  padding: 16px;
  width: 100%;
}

.doc-icon {
  color: #bd3f32;
  font-size: 1.7rem;
}

.doc-icon.folder {
  color: #6b604f;
}

.doc-card-detail .doc-icon {
  align-items: center;
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  font-size: 0.82rem;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.doc-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-card-detail strong {
  white-space: normal;
}

.doc-card span {
  color: var(--muted);
  display: block;
  font-size: 0.8rem;
}

.doc-card-detail .pdf-link {
  display: block;
  margin-top: 8px;
  white-space: normal;
}

.doc-menu {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.doc-card-detail .doc-menu {
  justify-self: end;
}

.muted-link {
  color: var(--muted);
}

.cost-report-panel {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.cost-report-panel .detail-panel-head p:last-child {
  color: var(--muted);
  margin-top: 4px;
}

.cost-report-content {
  display: grid;
  gap: 14px;
}

.cost-report-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr);
  padding: 16px;
}

.cost-report-total {
  align-content: center;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 6px;
  padding-right: 18px;
}

.cost-report-total span,
.cost-report-meta dt,
.cost-report-groups span,
.cost-report-note {
  color: var(--muted);
}

.cost-report-total strong {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 400;
  letter-spacing: 0;
}

.cost-report-total small {
  color: var(--ink);
  font-weight: 700;
}

.cost-report-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.cost-report-meta div {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.cost-report-meta dt {
  font-size: 0.72rem;
  text-transform: uppercase;
}

.cost-report-meta dd {
  font-weight: 700;
  margin: 4px 0 0;
}

.cost-report-groups {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  padding-top: 12px;
}

.cost-report-groups div {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.cost-report-note {
  border-top: 1px solid var(--line);
  grid-column: 1 / -1;
  line-height: 1.5;
  margin: 0;
  padding-top: 12px;
}

.cost-report-empty {
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px;
}

.cost-report-empty p {
  color: var(--muted);
  margin: 0;
}

.approval-panel {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.approval-panel .detail-panel-head p:last-child {
  color: var(--muted);
  margin-top: 4px;
}

.approval-content {
  display: grid;
  gap: 14px;
}

.approval-summary {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}

.approval-summary h3 {
  margin: 8px 0 6px;
}

.approval-summary p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.approval-summary dl {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.approval-summary dl div {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.approval-summary dt {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.approval-summary dd {
  font-weight: 700;
  margin: 2px 0 0;
}

.approval-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 10px;
}

.approval-status-draft {
  background: #f2f0ed;
  color: var(--muted);
}

.approval-status-sent {
  background: #e6edf6;
  color: var(--blue);
}

.approval-status-approved {
  background: #e3f0e5;
  color: var(--green);
}

.approval-status-changes,
.approval-status-rejected {
  background: #f8e5e1;
  color: var(--red);
}

.approval-file-list,
.approval-choice-list {
  display: grid;
  gap: 10px;
}

.approval-file-list article,
.approval-choice {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  padding: 12px;
}

.approval-choice {
  cursor: pointer;
  grid-template-columns: auto 40px minmax(0, 1fr);
}

.approval-choice-fixed {
  cursor: default;
  grid-template-columns: 44px minmax(0, 1fr);
}

.approval-file-list strong,
.approval-choice strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
}

.approval-file-list span,
.approval-file-list small,
.approval-choice small,
.approval-choice em {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  font-style: normal;
  line-height: 1.45;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.approval-file-list article > div,
.approval-choice > span:last-child,
.approval-choice-fixed > span:last-child {
  min-width: 0;
}

.approval-budget-item {
  background: #fbfaf8;
}

.doc-icon.budget {
  align-items: center;
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #6d552f;
  display: flex;
  font-size: 0.72rem;
  font-weight: 700;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.approval-result {
  background: #e3f0e5;
  border-radius: 6px;
  color: var(--green);
  font-weight: 700;
  line-height: 1.5;
  margin: 0;
  padding: 12px 14px;
}

.approval-result.warning {
  background: #f8e5e1;
  color: var(--red);
}

.approval-action-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.approval-action-box label {
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
}

.approval-action-box input,
.approval-action-box textarea {
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  font: inherit;
  padding: 10px 12px;
}

.approval-signature-field {
  color: var(--muted);
  display: grid;
  gap: 8px;
  font-size: 0.86rem;
}

.approval-signature-field canvas {
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  cursor: crosshair;
  display: block;
  height: 150px;
  pointer-events: auto;
  position: relative;
  touch-action: none;
  user-select: none;
  width: 100%;
}

.approval-signature-field .text-button {
  justify-self: start;
}

.approval-signature-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px 14px;
}

.approval-signature-preview figcaption {
  color: var(--muted);
  font-size: 0.84rem;
}

.approval-signature-preview img {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  display: block;
  max-height: 120px;
  max-width: 360px;
  object-fit: contain;
  width: 100%;
}

.approval-confirm {
  align-items: start;
  grid-template-columns: auto minmax(0, 1fr);
}

.approval-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.approval-action-buttons button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.approval-action-hint {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
  padding: 10px 12px;
}

.approval-action-hint.is-ready {
  border-left-color: var(--green);
  color: var(--ink);
}

.approval-timeline {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 14px 0 0;
}

.approval-timeline li {
  display: grid;
  gap: 3px;
}

.approval-timeline span,
.approval-timeline em {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

.is-client .admin-only,
.is-client #editProject,
.is-client #addPhaseProtocol,
.is-client #addPhaseDocument,
.is-client .text-button,
.is-client .doc-menu {
  display: none;
}

.footer {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 auto;
  max-width: 1480px;
  padding: 10px 28px 14px;
  text-align: center;
}

.footer-link {
  border-bottom: 1px solid currentColor;
  color: inherit;
  font: inherit;
  min-height: auto;
  padding: 0;
}

.legal-page {
  display: grid;
  gap: 18px;
  padding-top: 28px;
}

.legal-hero {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 24px;
}

.legal-hero p {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.legal-panel {
  display: grid;
  gap: 12px;
  line-height: 1.62;
  padding: 24px;
}

.legal-panel h2 {
  margin-bottom: 4px;
}

.legal-panel h3 {
  font-size: 1rem;
  margin-top: 10px;
}

.legal-panel p {
  color: #4d4740;
  max-width: 920px;
}

.toast {
  background: #262421;
  border-radius: 999px;
  bottom: 24px;
  box-shadow: 0 18px 45px rgba(47, 42, 35, 0.18);
  color: #fff;
  font-size: 0.9rem;
  left: 50%;
  padding: 11px 18px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 50;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(31, 28, 23, 0.28);
  max-height: min(88vh, 980px);
  max-width: min(980px, calc(100vw - 28px));
  padding: 0;
  width: 980px;
}

dialog::backdrop {
  background: rgba(32, 29, 24, 0.36);
}

.editor-form {
  display: grid;
  gap: 16px;
  max-height: min(88vh, 980px);
  overflow: auto;
  padding: 22px;
}

.editor-head,
.editor-section-head,
.repeat-title,
.editor-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.editor-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.editor-head span {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.close-button,
.small-button,
.secondary-button,
.primary-button,
.remove-button {
  border-radius: 6px;
  min-height: 36px;
  padding: 0 12px;
}

.close-button {
  border: 1px solid var(--line);
  width: 38px;
}

.editor-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.editor-section-hero {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) 170px;
}

.editor-section-copy {
  display: grid;
  gap: 4px;
}

.editor-section-copy p {
  color: var(--muted);
}

.editor-progress-preview {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  justify-items: start;
  padding: 12px;
}

.editor-progress-preview span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  line-height: 1;
}

.editor-progress-preview strong {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.editor-grid-stand {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

details.editor-section summary {
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
}

.editor-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.editor-grid .wide {
  grid-column: 1 / -1;
}

.editor-form label {
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 600;
  gap: 6px;
}

.editor-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.editor-form input,
.editor-form textarea,
.editor-form select {
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

.editor-form textarea {
  resize: vertical;
}

.repeat-list {
  display: grid;
  gap: 12px;
}

.repeat-item {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.compact-repeat .editor-grid.compact {
  grid-template-columns: minmax(180px, 0.5fr) minmax(0, 1fr);
}

.repeat-title {
  color: var(--text);
  font-weight: 700;
}

.repeat-title .phase-state {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 600;
}

.small-button,
.secondary-button {
  border: 1px solid var(--line-dark);
  color: var(--text);
}

.primary-button {
  background: var(--text);
  color: #fff;
}

.remove-button {
  border: 1px solid #efd0ca;
  color: var(--red);
}

.danger-button {
  border-color: #efd0ca;
  color: var(--red);
}

.text-button {
  border-bottom: 1px solid currentColor;
  color: #4d4740;
  min-height: auto;
  padding: 0;
}

.item-fields[hidden],
.danger-button[hidden] {
  display: none;
}

.editor-actions {
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 16px 0 0;
}

.editor-actions span {
  flex: 1;
}

.check-label {
  align-content: center;
  grid-template-columns: auto 1fr;
}

.check-label input {
  min-height: auto;
  width: auto;
}

.project-complete-field {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  grid-column: 1 / -1;
  min-height: 44px;
  padding: 10px 12px;
}

.project-complete-field:has(input:disabled) {
  opacity: 0.55;
}

@media (max-width: 1180px) {
  .project-facts,
  .progress-panel,
  .phase-grid,
  .document-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .progress-panel {
    align-items: start;
  }

  .protocol-layout,
  .detail-grid,
  .phase-page-grid,
  .budget-calculator,
  .budget-chart-panel,
  .budget-breakdown,
  .budget-layout,
  .phase-page-head,
  .admin-grid,
  .editor-section-hero {
    grid-template-columns: 1fr;
  }

  .phase-page-meta {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 16px 0 0;
  }
}

@media (max-width: 1400px) and (min-width: 821px) {
  .section {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .project-row {
    align-items: start;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  }

  .project-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 16px;
  }

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

  .planner-discipline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .document-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: stretch;
    gap: 12px;
    padding: 12px 16px;
    position: static;
    flex-direction: column;
  }

  .topbar-left {
    gap: 12px;
    justify-content: space-between;
    min-width: 0;
  }

  .brand-link img {
    height: 38px;
    max-width: 98px;
  }

  .brand-text strong {
    font-size: 1.05rem;
  }

  .brand-text small {
    font-size: 0.68rem;
  }

  .top-actions {
    justify-content: flex-start;
  }

  #userName {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .section,
  .project-row,
  .project-facts,
  .progress-panel,
  .phase-grid,
  .document-grid,
  .detail-documents,
  .editor-grid,
  .editor-grid-stand,
  .budget-details summary,
  .contract-details summary,
  .contract-document-card,
  .contract-document-head,
  .contract-document-actions,
  .budget-range-line,
  .budget-line,
  .budget-toggle,
  .budget-grid,
  .budget-admin-grid,
  .budget-kpis,
  .budget-legend-item,
  .budget-bar-row,
  .approval-overview-card,
  .approval-file-list article,
  .approval-choice,
  .cost-report-card,
  .cost-report-meta {
    grid-template-columns: 1fr;
  }

  .cost-report-total {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 14px;
  }

  .budget-details summary b,
  .budget-bar-row strong,
  .budget-legend-item strong {
    text-align: left;
  }

  .contract-document-head,
  .contract-document-actions,
  .admin-row-actions {
    align-items: stretch;
    justify-content: flex-start;
  }

  .admin-row-open,
  .admin-row-meta,
  .admin-row-actions {
    flex-basis: 100%;
    text-align: left;
  }

  .budget-chart-panel {
    justify-items: center;
  }

  .detail-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-hero,
  .admin-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-row-meta {
    flex: none;
    text-align: left;
  }

  .detail-panel-head,
  .detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .content {
    padding: 14px 16px 0;
  }

  .fact {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 14px 0 0;
  }

  .fact:first-child {
    border-top: 0;
  }

  .editor-grid,
  .editor-grid.compact,
  .compact-repeat .editor-grid.compact {
    grid-template-columns: 1fr;
  }

  .editor-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-actions span {
    display: none;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  body.printing-budget {
    background: #fff;
    color: #111;
  }

  body.printing-budget > * {
    visibility: hidden;
  }

  body.printing-budget #budgetSection,
  body.printing-budget #budgetSection * {
    visibility: visible;
  }

  body.printing-budget #budgetSection {
    border: 0;
    box-shadow: none;
    left: 0;
    padding: 0;
    position: absolute;
    top: 0;
    width: 100%;
  }

  body.printing-budget .budget-panel {
    gap: 8px;
  }

  body.printing-budget .detail-panel-head {
    border-bottom: 1px solid #d9d5cd;
    display: block;
    margin-bottom: 5px;
    padding: 0 0 5px;
  }

  body.printing-budget .detail-panel-head h2 {
    font-size: 17pt;
    margin: 0;
  }

  body.printing-budget .detail-panel-head p {
    font-size: 7.5pt;
    margin-top: 3px;
  }

  body.printing-budget #budgetDetails,
  body.printing-budget #budgetDetails[open] {
    border: 0;
  }

  body.printing-budget #budgetDetails summary,
  body.printing-budget .budget-head-actions,
  body.printing-budget .topbar,
  body.printing-budget .footer,
  body.printing-budget .phase-page-head,
  body.printing-budget .phase-page-grid {
    display: none;
  }

  body.printing-budget #budgetDetails:not([open]) .budget-calculator {
    display: grid;
  }

  body.printing-budget .budget-calculator {
    border: 0;
    grid-template-columns: 0.82fr 1.18fr;
    gap: 6px;
    padding: 0;
  }

  body.printing-budget .budget-form,
  body.printing-budget .budget-summary {
    gap: 4px;
  }

  body.printing-budget .budget-control,
  body.printing-budget .budget-total-panel,
  body.printing-budget .budget-chart-panel,
  body.printing-budget .budget-detail-block {
    box-shadow: none;
    padding: 5px;
  }

  body.printing-budget .budget-control {
    gap: 4px;
  }

  body.printing-budget .budget-section-head {
    padding-bottom: 3px;
  }

  body.printing-budget .budget-section-head h3,
  body.printing-budget .budget-detail-block h3 {
    font-size: 8.5pt;
  }

  body.printing-budget .budget-control-title label,
  body.printing-budget .budget-line > span,
  body.printing-budget .budget-toggle > span,
  body.printing-budget .budget-cost-list span,
  body.printing-budget .budget-bar-row span,
  body.printing-budget .budget-legend-item span,
  body.printing-budget .budget-note,
  body.printing-budget .budget-notes,
  body.printing-budget .budget-legal-note {
    font-size: 6.8pt;
  }

  body.printing-budget input[type="range"],
  body.printing-budget .budget-toggle input[type="checkbox"] {
    display: none;
  }

  body.printing-budget .budget-range-line,
  body.printing-budget .budget-line,
  body.printing-budget .budget-toggle {
    grid-template-columns: minmax(0, 1fr) 72px 22px;
  }

  body.printing-budget .budget-line input,
  body.printing-budget .budget-range-line input[type="number"],
  body.printing-budget .budget-toggle input[type="number"],
  body.printing-budget .budget-toggle input[type="text"] {
    border: 0;
    min-height: auto;
    padding: 0;
    text-align: right;
  }

  body.printing-budget .budget-total-panel > strong {
    font-size: 19pt;
  }

  body.printing-budget .budget-kpis {
    gap: 4px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 5px;
  }

  body.printing-budget .budget-chart-panel {
    gap: 6px;
    grid-template-columns: 92px minmax(0, 1fr);
  }

  body.printing-budget .budget-donut-wrap svg {
    height: 92px;
    width: 92px;
  }

  body.printing-budget .budget-donut-center strong {
    font-size: 11pt;
  }

  body.printing-budget .budget-donut-center span {
    font-size: 6.5pt;
  }

  body.printing-budget .budget-legend,
  body.printing-budget .budget-bars,
  body.printing-budget .budget-cost-list {
    gap: 2px;
  }

  body.printing-budget .budget-breakdown {
    gap: 8px;
    grid-template-columns: 1fr;
  }

  body.printing-budget .budget-breakdown .budget-detail-block:last-child {
    display: none;
  }

  body.printing-budget .budget-bar-row {
    gap: 5px;
    grid-template-columns: minmax(92px, 1fr) minmax(60px, 0.8fr) max-content;
  }

  body.printing-budget .budget-cost-list div {
    padding-bottom: 3px;
  }

  body.printing-budget .budget-notes,
  body.printing-budget .budget-legal-note {
    line-height: 1.15;
    margin-top: 2px;
  }

  body.printing-budget .budget-notes {
    max-height: 30px;
    overflow: hidden;
  }

  body.printing-budget * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* ---------------------------------------------------------------- Terminplan */

.schedule-overview-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.schedule-overview-head {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.schedule-overview-head strong {
  display: block;
}

.schedule-overview-head small,
.schedule-next-card small,
.schedule-group-title small {
  color: var(--muted);
  font-size: 0.84rem;
}

.schedule-overview-empty {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.schedule-next-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.schedule-next-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-dark);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
}

.schedule-next-card.is-decision {
  border-left-color: var(--accent);
}

.schedule-next-card.is-participation {
  border-left-color: var(--blue);
}

.schedule-next-date {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.schedule-next-card strong {
  overflow-wrap: anywhere;
}

.schedule-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.schedule-panel > *,
.gantt-scroll {
  min-width: 0;
}

.schedule-page .phase-page-title h1,
.schedule-overview-head strong {
  overflow-wrap: anywhere;
}

a.small-button {
  align-items: center;
  display: inline-flex;
  text-decoration: none;
}

.schedule-toolbar {
  align-items: center;
  flex-wrap: wrap;
}

.schedule-view-switch {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
}

.schedule-view-button {
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.86rem;
  min-height: 32px;
  padding: 0 16px;
}

.schedule-view-button.is-active {
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(47, 42, 35, 0.14);
  color: var(--text);
  font-weight: 600;
}

.schedule-legend {
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.82rem;
  gap: 6px 16px;
  padding-bottom: 12px;
}

.schedule-legend-item {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.schedule-legend-note {
  color: var(--muted);
  margin-left: auto;
}

.schedule-chip {
  border-radius: 3px;
  display: inline-block;
  height: 10px;
  width: 18px;
}

.schedule-chip.is-decision {
  background: var(--accent);
}

.schedule-chip.is-participation {
  background: var(--blue);
}

.schedule-chip.is-milestone {
  background: var(--text);
  border-radius: 2px;
  height: 9px;
  transform: rotate(45deg);
  width: 9px;
}

.schedule-view {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.schedule-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.schedule-group-head {
  align-items: center;
  background: var(--soft);
  display: grid;
  gap: 12px;
  grid-template-columns: 14px minmax(0, 1fr) max-content;
  padding: 12px 14px;
  text-align: left;
  width: 100%;
}

.schedule-group-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.schedule-caret {
  border-bottom: 2px solid var(--muted);
  border-right: 2px solid var(--muted);
  height: 7px;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  width: 7px;
}

[aria-expanded="true"] .schedule-caret {
  transform: rotate(45deg);
}

.schedule-group-body {
  display: grid;
}

.schedule-row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.5fr) 116px minmax(90px, 1fr) 138px;
  padding: 11px 14px 11px calc(14px + var(--depth, 0) * 16px);
}

.schedule-group.is-single .schedule-row {
  border-top: 0;
}

.schedule-row-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.schedule-row-main strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.schedule-row-main small {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.8rem;
  gap: 8px;
}

.schedule-outline {
  color: #8d8479;
  font-variant-numeric: tabular-nums;
}

.schedule-row.is-milestone .schedule-row-main strong::before {
  background: var(--text);
  content: "";
  display: inline-block;
  height: 8px;
  margin-right: 8px;
  transform: rotate(45deg);
  width: 8px;
}

.schedule-row.is-decision .schedule-row-main strong::before {
  background: var(--accent);
}

.schedule-tag {
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 9px;
  width: max-content;
}

.schedule-tag.is-decision {
  background: var(--accent-soft);
  color: #6d552f;
}

.schedule-tag.is-participation {
  background: #dde7f0;
  color: #35617f;
}

.schedule-row-dates {
  display: grid;
  font-variant-numeric: tabular-nums;
  gap: 2px;
}

.schedule-row-dates small {
  color: var(--muted);
  font-size: 0.8rem;
}

.schedule-row-bar {
  background: var(--soft);
  border-radius: 999px;
  height: 8px;
  position: relative;
}

.schedule-row-bar i {
  background: var(--accent);
  border-radius: 999px;
  bottom: 0;
  min-width: 6px;
  position: absolute;
  top: 0;
}

.schedule-row.is-planned .schedule-row-bar i {
  background: #c2b8a9;
}

.schedule-row.is-past .schedule-row-bar i {
  background: #ded7cd;
}

.schedule-row.is-milestone .schedule-row-bar i {
  border-radius: 2px;
  min-width: 8px;
  transform: rotate(45deg) scale(0.72);
}

.schedule-status {
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 3px 10px;
  text-align: center;
  white-space: nowrap;
  width: max-content;
}

.schedule-status.is-planned {
  background: var(--soft);
  color: var(--muted);
}

.schedule-status.is-running {
  background: #dcefe1;
  color: #226b3d;
}

.schedule-status.is-past {
  background: #efe9e1;
  color: #7c7367;
}

/* Gantt */

.gantt-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.gantt {
  --label-width: 260px;
  min-width: calc(var(--label-width) + var(--track-width));
  position: relative;
}

.gantt-axis {
  background: var(--panel);
  border-bottom: 1px solid var(--line-dark);
  display: grid;
  grid-template-columns: var(--label-width) var(--track-width);
  position: sticky;
  top: 0;
  z-index: 3;
}

.gantt-axis-corner {
  background: var(--panel);
  border-right: 1px solid var(--line);
  left: 0;
  position: sticky;
  z-index: 1;
}

.gantt-axis-track {
  display: grid;
  gap: 2px;
  padding-bottom: 4px;
}

.gantt-axis-quarters,
.gantt-axis-months {
  height: 18px;
  position: relative;
}

.gantt-axis-quarters span,
.gantt-axis-months span {
  color: var(--muted);
  font-size: 0.72rem;
  overflow: hidden;
  position: absolute;
  text-align: center;
  text-overflow: clip;
  top: 0;
  white-space: nowrap;
}

.gantt-axis-quarters span {
  background: var(--soft);
  border-radius: 3px;
  color: #6d6459;
  font-weight: 600;
  line-height: 18px;
}

.gantt-axis-months span {
  border-left: 1px solid var(--line);
  line-height: 18px;
}

.gantt-body {
  position: relative;
}

.gantt-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: var(--label-width) var(--track-width);
  min-height: 30px;
}

.gantt-row.is-group {
  background: var(--soft);
}

.gantt-row-label {
  align-items: center;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  font-size: 0.83rem;
  gap: 8px;
  left: 0;
  min-width: 0;
  overflow: hidden;
  padding: 6px 12px 6px calc(12px + var(--depth, 0) * 14px);
  position: sticky;
  text-align: left;
  z-index: 2;
}

.gantt-row-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-row.is-group .gantt-row-label {
  background: var(--soft);
  font-weight: 600;
}

.gantt-row.is-decision .gantt-row-label,
.gantt-row.is-participation .gantt-row-label {
  font-weight: 600;
}

.gantt-row-track {
  height: 100%;
  position: relative;
}

.gantt-bar {
  background: var(--accent);
  border-radius: 3px;
  height: 11px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.gantt-bar.is-group {
  background: #6f6559;
  border-radius: 2px;
  height: 7px;
}

.gantt-bar.is-planned {
  background: #c2b8a9;
}

.gantt-bar.is-past {
  background: #ded7cd;
}

.gantt-bar.is-participation {
  background: var(--blue);
}

.gantt-diamond {
  background: var(--text);
  height: 10px;
  margin-left: -5px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 10px;
}

.gantt-diamond.is-decision,
.gantt-diamond.is-planned.is-decision {
  background: var(--accent);
}

.gantt-diamond.is-planned {
  background: #a99f92;
}

.gantt-today-layer {
  bottom: 0;
  left: var(--label-width);
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
}

.gantt-today {
  background: var(--red);
  bottom: 0;
  position: absolute;
  top: 0;
  width: 1px;
}

.gantt-today b {
  background: var(--red);
  border-radius: 0 3px 3px 0;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  left: 0;
  padding: 1px 5px;
  position: absolute;
  top: 0;
}

/* Import-Dialog */

.schedule-preview {
  display: grid;
  gap: 12px;
}

.schedule-preview-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.schedule-preview-summary div {
  background: var(--soft);
  border-radius: 6px;
  display: grid;
  gap: 2px;
  padding: 9px 11px;
}

.schedule-preview-summary span {
  color: var(--muted);
  font-size: 0.78rem;
}

.schedule-preview-summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.schedule-preview-warnings {
  background: #fbf3e6;
  border: 1px solid #e5d3ae;
  border-radius: 6px;
  color: #7a5c1f;
  display: grid;
  font-size: 0.85rem;
  gap: 6px;
  margin: 0;
  padding: 10px 12px 10px 28px;
}

.schedule-preview-error {
  background: #fbeceb;
  border: 1px solid #edc7c1;
  border-radius: 6px;
  color: #96382c;
  padding: 10px 12px;
}

.schedule-preview-groups {
  display: grid;
  gap: 6px;
}

.schedule-preview-groups div {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  justify-content: space-between;
  padding-top: 6px;
}

@media (max-width: 900px) {
  .schedule-row {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 6px 12px;
  }

  .schedule-row-bar {
    display: none;
  }

  .schedule-row .schedule-row-dates {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    gap: 6px;
  }

  .schedule-row .schedule-status {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .schedule-group-head {
    align-items: start;
    grid-template-columns: 14px minmax(0, 1fr);
    row-gap: 6px;
  }

  .schedule-group-head .schedule-status {
    grid-column: 2;
  }

  .gantt {
    --label-width: 168px;
  }

  .schedule-legend-note {
    margin-left: 0;
    width: 100%;
  }
}


/* ============================================================
   Schritt 1 – Kopfleiste, Bearbeitungsmodus, Admin-Listen
   ============================================================ */

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.topbar-left .project-switch {
  border-left: 1px solid var(--line);
  border-radius: 0;
  border-bottom: 0;
  border-right: 0;
  border-top: 0;
  margin-left: 6px;
  max-width: 300px;
  padding: 6px 8px 6px 18px;
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 14px;
}

.edit-button {
  background: var(--text);
  border: 1px solid var(--text);
  border-radius: 999px;
  color: #fff !important;
  cursor: pointer;
  font: inherit;
  min-height: 38px;
  padding: 8px 20px;
}

.edit-button.is-active {
  background: #fff;
  color: var(--text) !important;
}

.account {
  position: relative;
}

.account-trigger {
  align-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: flex;
  gap: 7px;
  padding: 3px;
}

.account-caret {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #8b847b;
  display: block;
}

.account-trigger[aria-expanded="true"] .account-caret {
  border-bottom: 5px solid var(--text);
  border-top: 0;
}

.account-menu {
  background: var(--panel);
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  box-shadow: 0 18px 45px rgba(47, 42, 35, 0.14);
  display: grid;
  min-width: 232px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 40;
}

.account-head {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px;
  margin-bottom: 6px;
  padding: 8px 12px 12px;
}

.account-head strong {
  font-size: 0.98rem;
}

.account-head small {
  color: var(--muted);
  font-size: 0.82rem;
}

.account-item {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 10px 12px;
  text-align: left;
}

.account-item:hover {
  background: var(--soft);
}

/* Bearbeitungsmodus */

.edit-bar {
  align-items: center;
  background: var(--text);
  color: #fff;
  display: flex;
  gap: 18px;
  padding: 12px 36px;
  position: sticky;
  top: 76px;
  z-index: 9;
}

.edit-bar strong {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.edit-bar > span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.88rem;
}

.edit-bar-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.edit-bar-secondary,
.edit-bar-done {
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  min-height: 34px;
  padding: 6px 18px;
  white-space: nowrap;
}

.edit-bar-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
}

.edit-bar-secondary:hover {
  border-color: #fff;
}

.edit-bar-done {
  background: #fff;
  border: 1px solid #fff;
  color: var(--text);
}

.inline-input {
  background: #fff;
  border: 1px solid var(--text);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(47, 42, 35, 0.12);
  color: var(--text);
  max-width: 100%;
  outline: none;
  padding: 3px 7px;
  resize: vertical;
  vertical-align: baseline;
}

body.is-editing .inline-edit {
  border-bottom: 1px dashed #9a938a;
  cursor: text;
  padding-bottom: 1px;
}

body.is-editing .inline-edit:hover {
  background: rgba(38, 36, 33, 0.05);
  border-bottom-color: var(--text);
}

body.is-editing .inline-edit:empty::before {
  color: var(--muted);
  content: "nicht gesetzt";
  font-style: italic;
  font-weight: 400;
}

body.is-editing .inline-derived {
  border-bottom: 1px dotted #c3bcb2;
  cursor: alias;
}

body.is-editing .inline-derived:hover {
  border-bottom-style: solid;
}

.is-source-flash {
  animation: sourceFlash 1.4s ease-out;
}

@keyframes sourceFlash {
  0%, 40% { background: rgba(155, 122, 66, 0.12); }
  100% { background: transparent; }
}

.toast {
  align-items: center;
  display: flex;
  gap: 16px;
}

.toast[hidden] {
  display: none;
}

.toast-undo {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  padding: 4px 12px;
  white-space: nowrap;
}

.toast-undo:hover {
  border-color: currentColor;
}

/* Admin: zwei Ebenen statt drei gleicher Panels */

.admin-hero {
  display: block;
}

.admin-panel-primary {
  padding-bottom: 6px;
}

.admin-secondary {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.admin-secondary > .admin-panel {
  grid-column: span 1;
}

.admin-panel-minor {
  max-width: 760px;
}

.admin-panel-heading {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
}

.admin-panel-heading > div {
  min-width: 0;
}

.admin-panel-heading .discipline-form {
  flex: 0 0 auto;
  margin: 0;
}

/* Listen als Tabellen – keine Kästchen im Kasten */

.admin-table-wrap {
  margin: 0 -22px -18px;
  overflow-x: auto;
}

.admin-table {
  border-collapse: collapse;
  width: 100%;
}

.admin-table thead th {
  border-bottom: 1px solid var(--line-dark);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  padding: 10px 14px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-table thead th:first-child,
.admin-table tbody td:first-child {
  padding-left: 22px;
}

.admin-table thead th:last-child,
.admin-table tbody td:last-child {
  padding-right: 22px;
}

.admin-table tbody td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  vertical-align: middle;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-tr {
  cursor: pointer;
}

.admin-tr:hover td {
  background: #f7f4ef;
}

.admin-tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.admin-tr strong {
  display: block;
  font-size: 1rem;
  font-weight: 600;
}

.admin-tr small {
  color: var(--muted);
  display: block;
  font-size: 0.84rem;
  margin-top: 3px;
}

.admin-tr em {
  color: var(--muted);
  font-size: 0.86rem;
  font-style: normal;
}

.admin-tr.is-current td {
  box-shadow: inset 3px 0 0 var(--accent);
}

.admin-tr.is-current td:not(:first-child) {
  box-shadow: none;
}

.admin-tr.is-archived,
.admin-tr.is-disabled {
  color: var(--muted);
}

.admin-tr.is-archived strong,
.admin-tr.is-disabled strong {
  font-weight: 500;
}

.admin-table .mono {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
}

.admin-table .col-number { width: 132px; }
.admin-table .col-phase { white-space: nowrap; width: 190px; }
.admin-table .col-people { width: 210px; }
.admin-table .col-changed { white-space: nowrap; width: 130px; }
.admin-table .col-actions { width: 56px; }

.admin-progress {
  background: #e8e3dc;
  border-radius: 999px;
  display: block;
  height: 3px;
  margin-top: 7px;
  overflow: hidden;
  width: 96px;
}

.admin-progress span {
  background: var(--accent);
  display: block;
  height: 100%;
}

.row-menu {
  position: relative;
  text-align: right;
}

.row-menu-trigger {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  opacity: 0;
  padding: 6px 8px;
}

.admin-tr:hover .row-menu-trigger,
.admin-tr:focus-within .row-menu-trigger {
  opacity: 1;
}

.row-menu-trigger:hover {
  background: var(--soft);
  color: var(--text);
}

.row-menu-list {
  background: var(--panel);
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  box-shadow: 0 16px 40px rgba(47, 42, 35, 0.16);
  display: grid;
  min-width: 190px;
  padding: 5px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
}

.row-menu-list button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 9px 11px;
  text-align: left;
  white-space: nowrap;
}

.row-menu-list button:hover {
  background: var(--soft);
}

.row-menu-list button.is-danger {
  color: var(--red);
}

/* Fachrichtungen als Chips */

.discipline-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.discipline-chip {
  align-items: center;
  background: #fbfaf8;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.9rem;
  gap: 8px;
  padding: 6px 8px 6px 14px;
}

.discipline-chip.is-off {
  border-style: dashed;
  color: var(--muted);
}

.discipline-chip button {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
  height: 20px;
  line-height: 1;
  padding: 0;
  width: 20px;
}

.discipline-chip button:hover {
  background: var(--soft);
  color: var(--text);
}

@media (max-width: 980px) {
  .admin-secondary {
    grid-template-columns: minmax(0, 1fr);
  }

  .edit-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 20px;
  }

  .edit-bar-actions {
    margin-left: 0;
  }
}

body.is-editing .progress-circle.inline-derived {
  border-bottom: 0;
  cursor: alias;
}

body.is-editing .progress-circle.inline-derived:hover {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Korrektur: .panel hat selbst kein Padding – Tabellen bündig ausrichten */
.admin-table-wrap {
  margin: 0;
  overflow-x: auto;
}

.admin-panel-primary {
  padding-bottom: 0;
}

.admin-table thead th:first-child,
.admin-table tbody td:first-child {
  padding-left: 16px;
}

.admin-table thead th:last-child,
.admin-table tbody td:last-child {
  padding-right: 16px;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
  padding-bottom: 16px;
}

.admin-panel-heading {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  padding: 16px 16px 14px;
}

.admin-panel-heading > div {
  display: grid;
  gap: 4px;
}

.admin-secondary {
  display: block;
}

.admin-secondary > .admin-panel {
  max-width: 980px;
}

.admin-panel-minor {
  max-width: 660px;
}

.discipline-chips {
  margin: 0;
  padding: 0 16px 18px;
}

.admin-page {
  padding-bottom: 40px;
}

.field-hint {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 6px;
}

.development-page .project-head {
  border-bottom: 1px solid var(--line);
}

.explorer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 320px;
  overflow: hidden;
}

.explorer-tree {
  background: var(--soft);
  border-right: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 12px 0;
}

.explorer-group {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 10px 16px 4px;
  text-transform: uppercase;
}

.explorer-group + .explorer-group {
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

.explorer-node {
  background: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 8px;
  justify-content: space-between;
  padding: 7px 16px;
  text-align: left;
  width: 100%;
}

.explorer-node:hover:not(:disabled) {
  background: var(--accent-soft);
}

.explorer-node.is-active {
  background: var(--panel);
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 600;
}

.explorer-node:disabled {
  color: var(--muted);
  cursor: default;
}

.explorer-node .explorer-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.explorer-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 16px 10px;
}

.explorer-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.explorer-path {
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 6px;
  min-height: 42px;
  padding: 8px 16px;
}

.explorer-path .is-current {
  color: var(--text);
  font-weight: 600;
}

.explorer-list {
  overflow-x: auto;
  padding: 16px;
}

@media (max-width: 760px) {
  .explorer {
    grid-template-columns: minmax(0, 1fr);
  }

  .explorer-tree {
    border-bottom: 1px solid var(--line);
    border-right: 0;
  }
}

.explorer-add {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  margin-top: 6px;
  padding: 7px 16px;
  text-align: left;
  width: 100%;
}

.explorer-add:hover {
  background: var(--accent-soft);
}

.explorer-crumb {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.explorer-crumb:hover {
  color: var(--text);
}

.explorer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.explorer-members {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
}

.explorer-members h3 {
  margin: 0;
}

.explorer-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.member-list {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.member-list li {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 8px 12px;
}

.member-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.member-add select {
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  font: inherit;
  min-width: 220px;
  padding: 7px 10px;
}

.explorer-node.is-child {
  font-size: 13px;
  padding-left: 32px;
}

.explorer-count.is-open {
  background: var(--accent);
  border-radius: 9px;
  color: #fff;
  font-size: 11px;
  min-width: 18px;
  padding: 1px 6px;
  text-align: center;
}

.status-chip {
  border-radius: 4px;
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  white-space: nowrap;
}

.status-chip.is-none {
  color: var(--muted);
}

.status-chip.is-draft {
  background: var(--soft);
  color: var(--muted);
}

.status-chip.is-in-review {
  background: #e6eef5;
  color: var(--blue);
}

.status-chip.is-approved {
  background: #e3f0e7;
  color: var(--green);
}

.status-chip.is-approved-with-notes {
  background: #f3ecdc;
  color: var(--accent);
}

.status-chip.is-rejected {
  background: #f6e3e0;
  color: var(--red);
}

.plan-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 0 0 20px;
}

.plan-facts div {
  display: grid;
  gap: 4px;
}

.plan-facts dt {
  color: var(--muted);
  font-size: 12px;
}

.plan-facts dd {
  margin: 0;
}

.explorer-list h3 {
  margin: 0 0 10px;
}

.explorer-list td small {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.explorer-list .col-actions {
  text-align: right;
  white-space: nowrap;
}

.explorer-list .col-actions .small-button + .small-button {
  margin-left: 6px;
}

.small-button.primary-inline {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.event-list {
  display: grid;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.event-list li {
  align-items: baseline;
  display: grid;
  gap: 12px;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  padding: 4px 0;
}

.event-list .event-when,
.event-list .event-who {
  color: var(--muted);
  font-size: 12px;
}

.checkbox-row {
  align-items: center;
  display: flex !important;
  flex-direction: row !important;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
}

@media (max-width: 760px) {
  .event-list li {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

.file-row td {
  background: var(--bg);
  padding-top: 4px;
}

.file-list {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.file-list li {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-list a {
  color: var(--text);
}

.file-meta {
  color: var(--muted);
  font-size: 12px;
}

.file-actions {
  display: inline-flex;
  gap: 6px;
}

.file-list.is-replaced a {
  color: var(--muted);
  text-decoration: line-through;
}

.file-empty {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 10px;
}
