:root {
  --bg: #eef2f8;
  --card: #ffffff;
  --ink: #131927;
  --muted: #697386;
  --line: #dfe6f1;
  --teal: #1cc7b5;
  --blue: #3f88ff;
  --violet: #7f6fff;
  --indigo: #5948d6;
  --danger: #e35f80;
  --ok: #16b986;
}

* {
  box-sizing: border-box;
}

html.i18n-pending body {
  visibility: hidden;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 400;
  background: radial-gradient(1200px 600px at 10% 0%, #f7f7f8 10%, #ececef 70%);
  color: var(--ink);
  overflow: hidden;
}

.app-footer {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 0;
  font-size: 0.72rem;
  font-weight: 400;
  color: #9ca3af;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: auto;
}

.app-footer a {
  color: #8e97a6;
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

p,
small,
.meta,
.kpi-label,
.menu-label {
  font-weight: 300;
}

h1,
h2,
h3,
th,
.menu-item,
.btn-primary {
  font-weight: 600;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  padding: 18px 18px 42px;
  transition: grid-template-columns 260ms ease;
  overflow: hidden;
}

.mobile-nav-toggle {
  display: none;
}

.mobile-nav-backdrop {
  display: none;
}

.sidebar,
.content {
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
}

.sidebar {
  padding: 20px 16px 8px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  overflow: visible;
  position: relative;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding-right: 46px;
  min-height: 38px;
  margin-bottom: 22px;
}

.brand-main {
  position: relative;
  width: 176px;
  height: 36px;
  min-width: 0;
}

.brand-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  display: block;
  transition: opacity 220ms ease;
}

.brand-logo-full {
  opacity: 1;
}

.brand-logo-compact {
  opacity: 0;
}

.sidebar-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #e2e5eb;
  background: rgba(255, 255, 255, 0.92);
  color: #5f6776;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(17, 23, 41, 0.05);
  transform: translateY(-50%);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  z-index: 4;
}

.toggle-icon {
  width: 15px;
  height: 15px;
  transition: transform 220ms ease, opacity 180ms ease;
}

.sidebar-toggle[aria-expanded="false"] .toggle-icon {
  transform: rotate(180deg);
}

.sidebar-toggle:hover {
  background: #ffffff;
  border-color: #d8dde6;
  box-shadow: 0 10px 22px rgba(17, 23, 41, 0.08);
}

.brand h1 {
  margin: 0;
  font-size: 1rem;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.menu {
  display: grid;
  gap: 6px;
}

.menu-label {
  margin: 10px 8px 4px;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  max-height: 18px;
  overflow: hidden;
  transition: opacity 180ms ease, max-height 180ms ease, margin 180ms ease;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.menu-item-icon {
  width: 25px;
  height: 25px;
  border-radius: 0;
  border: 0;
  display: grid;
  place-items: center;
  color: #697386;
  flex: 0 0 auto;
  overflow: hidden;
  background: transparent;
}

.menu-item-icon svg {
  width: 25px;
  height: 25px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-item-text {
  display: inline-block;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  opacity: 1;
  transition: opacity 180ms ease, max-width 180ms ease;
}

.menu-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #d94b63;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-badge[hidden] {
  display: none;
}

.menu-item:hover,
.menu-item.active {
  background: #eceff3;
}

.menu-item.active .menu-item-icon,
.menu-item:hover .menu-item-icon {
  color: #2f3745;
}

.side-card {
  margin-top: auto;
  padding: 14px;
  border-radius: 14px;
  background: #f2f2f2;
  border: 1px solid #e0e0e0;
  overflow: hidden;
  max-height: 160px;
  opacity: 1;
  transition: opacity 180ms ease, max-height 180ms ease, padding 180ms ease, border-width 180ms ease;
}

.scope-filter-wrap.sidebar-scope + .side-card {
  margin-top: 0;
}

.side-title {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: uppercase;
}

.side-name {
  margin: 6px 0;
  font-weight: 700;
}

.side-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.side-action {
  margin-top: 10px;
  width: 100%;
  min-height: 36px;
  border: 1px solid #111111;
  background: #111111;
  color: #ffffff;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.content {
  padding: 24px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  overflow-x: hidden;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 138px 1fr;
}

.app-shell.sidebar-collapsed .brand {
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding-right: 44px;
}

.app-shell.sidebar-collapsed .menu-label,
.app-shell.sidebar-collapsed .menu-item-text,
.app-shell.sidebar-collapsed .side-card,
.app-shell.sidebar-collapsed .scope-filter-wrap.sidebar-scope {
  opacity: 0;
}

.app-shell.sidebar-collapsed .brand-main {
  width: 82px;
  height: 52px;
}

.app-shell.sidebar-collapsed .brand-logo {
  object-position: center;
}

.app-shell.sidebar-collapsed .brand-logo-full {
  opacity: 0;
}

.app-shell.sidebar-collapsed .brand-logo-compact {
  opacity: 1;
}

.app-shell.sidebar-collapsed .menu-item {
  justify-content: center;
  padding: 6px 0;
}

.app-shell.sidebar-collapsed .menu-label {
  max-height: 0;
  margin: 0 8px;
}

.app-shell.sidebar-collapsed .menu-item-text {
  max-width: 0;
}

.app-shell.sidebar-collapsed .side-card {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

.app-shell.sidebar-collapsed .scope-filter-wrap.sidebar-scope {
  max-height: 0;
  margin: 0;
  overflow: hidden;
}

.app-shell.sidebar-collapsed .sidebar-language-wrap {
  max-height: 0;
  margin: 0;
  overflow: hidden;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 44px;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.scope-filter-wrap {
  display: grid;
  gap: 6px;
  min-width: 176px;
  margin-right: 10px;
}

.scope-filter-wrap.sidebar-scope {
  min-width: 0;
  width: 100%;
  margin-top: auto;
  margin-right: 0;
  margin-bottom: 12px;
}

.scope-filter-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.scope-filter-select {
  min-height: 42px;
  border: 1px solid #d7dce5;
  border-radius: 14px;
  padding: 0 14px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.scope-filter-wrap.sidebar-scope .scope-filter-select {
  width: 100%;
  border-radius: 16px;
  font-size: 0.76rem !important;
  line-height: 1.2;
}

.scope-filter-wrap.sidebar-scope .scope-filter-select option {
  font-size: 0.76rem;
}

.topbar-language-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-language-label {
  font-size: 0.78rem;
  color: #6d7483;
  font-weight: 600;
}

.topbar-language-select {
  border: 1px solid #d6dae3;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  min-width: 120px;
}

.sidebar-language-wrap {
  margin-top: 14px;
  margin-bottom: 0;
  display: flex;
  justify-content: center;
}

.sidebar-language-buttons {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid #e0e3e9;
  border-radius: 999px;
  background: #ffffff;
}

.sidebar-language-btn {
  border: 0;
  background: transparent;
  color: #6f7786;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 999px;
  min-width: 32px;
  height: 26px;
  padding: 0 8px;
  cursor: pointer;
}

.sidebar-language-btn.is-active {
  background: #eceff3;
  color: #2f3745;
}

.topbar h2 {
  margin: 0;
  font-size: 1.8rem;
}

.client-hero-logo {
  display: block;
  width: auto;
  max-width: 180px;
  max-height: 56px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 12px;
}

.client-topbar-logo {
  width: auto;
  max-width: 180px;
  max-height: 56px;
  object-fit: contain;
  object-position: right center;
  flex: 0 0 auto;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.project-inline-meta {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.project-inline-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.9rem;
}

.project-inline-meta-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-back-link-wrap {
  margin: 0 0 10px;
}

.bando-export-wrap {
  margin: 22px 0 0;
}

.btn-primary.bando-pdf-btn {
  min-height: 34px;
  padding: 7px 14px;
  font-size: 0.82rem;
}

.bando-export-wrap-bottom {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.main-grid > .bando-export-wrap-bottom {
  grid-column: span 12;
}

.bando-pdf-btn[aria-disabled="true"] {
  opacity: 0.56;
  pointer-events: none;
}

.detail-back-link,
.detail-inline-link {
  color: var(--indigo);
  text-decoration: none;
  font-weight: 600;
}

.detail-back-link {
  color: #8b93a3;
}

.detail-back-link:hover,
.detail-inline-link:hover {
  text-decoration: underline;
}

.btn-primary {
  min-height: 50px;
  border: 1px solid #111111;
  background: #111111;
  color: #ffffff;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

a.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-primary:hover,
.side-action:hover {
  background: #1c1c1c;
  box-shadow: 0 12px 24px rgba(17, 17, 17, 0.12);
  transform: translateY(-1px);
}

.btn-primary:active,
.side-action:active {
  transform: translateY(0);
  box-shadow: none;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.project-economic-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.project-progress-kpi {
  text-align: left;
}

.project-progress-kpi .target-progress {
  margin-left: 0;
  max-width: 320px;
}

.project-progress-kpi .target-progress-meta {
  justify-content: space-between;
}

.bando-kpi-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.projects-top-grid {
  grid-template-columns: 0.9fr 1fr 1fr 1.7fr;
  align-items: stretch;
}

.projects-top-grid > .kpi-card,
.projects-top-grid > .projects-status-panel {
  grid-column: span 1;
  min-height: 150px;
}

.projects-top-grid .kpi-card {
  padding: 12px 14px;
}

.projects-top-grid .kpi-label {
  font-size: 0.8rem;
}

.projects-top-grid .kpi-value {
  margin: 10px 0 0;
  font-size: 1.7rem;
  line-height: 1.08;
}

.projects-top-grid .kpi-trend {
  margin-top: 10px;
}

.projects-status-panel {
  grid-column: span 1;
  min-width: 0;
  padding: 14px;
}

.projects-status-panel .donut-panel {
  grid-template-columns: 148px 1fr;
  gap: 12px;
  align-items: center;
}

.projects-status-panel .donut-wrap {
  width: 144px;
  height: 144px;
}

.projects-status-panel .panel-head {
  position: relative;
  margin-bottom: 8px;
  min-height: 28px;
}

.projects-status-panel .panel-head h3 {
  font-size: 0.96rem;
  position: relative;
  z-index: 1;
}

.projects-status-panel .panel-head span {
  font-size: 0.76rem;
}

.projects-status-meta {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  max-width: 68%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #bcc3cf;
  pointer-events: none;
}

.projects-top-grid .donut-track,
.projects-top-grid .donut-segment {
  stroke-width: 15;
}

.projects-top-grid .donut-center-label {
  font-size: 0.68rem;
}

.projects-top-grid .donut-center-value {
  font-size: 0.86rem;
}

.projects-top-grid .donut-legend {
  gap: 6px;
}

.projects-top-grid .legend-filter {
  padding: 7px 9px;
}

.projects-top-grid .donut-legend-copy strong {
  font-size: 0.86rem;
}

.projects-top-grid .donut-legend-copy span {
  font-size: 0.78rem;
}

.home-top-grid {
  grid-template-columns: 0.78fr 0.9fr 1.2fr 2fr;
  align-items: stretch;
}

.home-top-grid > .kpi-card,
.home-top-grid > .home-status-panel {
  grid-column: span 1;
  min-height: 152px;
}

.home-status-panel .donut-panel {
  grid-template-columns: 200px 1fr;
  gap: 16px;
  align-items: center;
}

.home-status-panel .donut-wrap {
  width: 184px;
  height: 184px;
}

.home-finance-kpi .kpi-value {
  font-size: 1.64rem;
  margin-bottom: 8px;
}

.home-finance-kpi .kpi-trend {
  font-size: 0.94rem;
  color: #7c8592;
}

.home-finance-kpi .kpi-trend strong {
  color: #7c8592;
}

.home-gauge-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  column-gap: 10px;
  width: 100%;
  margin: 8px 0 10px;
}

.home-gauge {
  width: 100%;
  max-width: 260px;
  height: 94px;
  display: block;
  overflow: visible;
}

.home-gauge-track,
.home-gauge-value {
  fill: none;
  stroke-linecap: round;
  stroke-width: 7;
}

.home-gauge-track {
  stroke: #e7eaf0;
}

.home-gauge-value {
  stroke: #7e8795;
  stroke-dasharray: 0 999;
  transition: stroke-dasharray 240ms ease;
}

.home-gauge-indicator {
  fill: #161b25;
  transition: cx 240ms ease, cy 240ms ease;
}

.home-gauge-percent {
  margin: 0 0 10px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #646d7b;
  white-space: nowrap;
}

.bando-kpi-grid .kpi-card {
  padding: 14px;
}

.bando-kpi-grid .kpi-label {
  font-size: 0.8rem;
}

.bando-kpi-grid .detail-kpi-value {
  font-size: 1.08rem;
}

.bando-kpi-grid .profile-value {
  margin-top: 10px;
}

.bando-kpi-grid .table-link-icon {
  width: 34px;
  height: 34px;
}

.bandi-status-panel {
  grid-column: span 1;
  min-width: 0;
  padding: 14px;
}

.bandi-status-panel .donut-panel {
  grid-template-columns: 148px 1fr;
  gap: 12px;
  align-items: center;
}

.bandi-status-panel .donut-wrap {
  width: 144px;
  height: 144px;
}

.bandi-status-panel .donut-center-value {
  font-size: 0.86rem;
}

.bandi-status-panel .donut-legend {
  gap: 6px;
}

.bandi-status-panel .legend-filter {
  padding: 7px 9px;
}

.bandi-top-grid {
  grid-template-columns: 0.82fr 0.82fr 0.82fr 1.54fr;
  align-items: stretch;
}

.bandi-top-grid > .kpi-card,
.bandi-top-grid > .bandi-status-panel {
  grid-column: span 1;
  min-height: 150px;
}

.bandi-top-grid .kpi-card {
  padding: 12px 14px;
}

.bandi-top-grid .kpi-label {
  font-size: 0.78rem;
}

.bandi-top-grid .kpi-value {
  margin: 10px 0 0;
  font-size: 1.64rem;
  line-height: 1.1;
}

.bandi-top-grid .panel-head {
  position: relative;
  margin-bottom: 8px;
  min-height: 28px;
}

.bandi-top-grid .panel-head h3 {
  font-size: 0.96rem;
  position: relative;
  z-index: 1;
}

.bandi-top-grid .panel-head span {
  font-size: 0.76rem;
}

.bandi-status-meta {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  max-width: 68%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #bcc3cf;
  pointer-events: none;
}

.bandi-top-grid .donut-track,
.bandi-top-grid .donut-segment {
  stroke-width: 15;
}

.bandi-top-grid .donut-center-label {
  font-size: 0.68rem;
}

.bandi-top-grid .donut-legend-copy strong {
  font-size: 0.86rem;
}

.bandi-top-grid .donut-legend-copy span {
  font-size: 0.78rem;
}

@media (max-width: 1200px) {
  .projects-top-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .projects-top-grid > .projects-status-panel {
    grid-column: span 2;
  }

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

  .bandi-top-grid > .bandi-status-panel {
    grid-column: span 2;
  }

  .home-status-panel .donut-panel {
    grid-template-columns: 1fr;
  }

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

  .home-top-grid > .home-status-panel {
    grid-column: span 2;
  }

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

@media (max-width: 720px) {
  .projects-top-grid {
    grid-template-columns: 1fr;
  }

  .projects-top-grid > .projects-status-panel {
    grid-column: span 1;
  }

  .projects-status-panel .donut-panel {
    grid-template-columns: 1fr;
  }

  .home-status-panel .donut-wrap {
    width: 160px;
    height: 160px;
  }

  .home-top-grid {
    grid-template-columns: 1fr;
  }

  .home-top-grid > .home-status-panel {
    grid-column: span 1;
  }

  .bandi-top-grid {
    grid-template-columns: 1fr;
  }

  .bandi-top-grid > .bandi-status-panel {
    grid-column: span 1;
  }

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

  .bandi-status-panel .donut-panel {
    grid-template-columns: 1fr;
  }
}

.kpi-card,
.panel {
  background: var(--card);
  border: 1px solid #e6e8ec;
  border-radius: 16px;
  padding: 16px;
}

.kpi-label {
  margin: 0;
  color: var(--ink);
  font-size: 0.86rem;
}

.kpi-value {
  margin: 8px 0;
  font-size: 2rem;
  font-weight: 800;
}

.detail-kpi-value {
  font-size: 1.22rem;
  line-height: 1.3;
}

/* Uniform KPI value size across all KPI cards/pages. */
.kpi-card .kpi-value,
.kpi-card .detail-kpi-value {
  font-size: 1.64rem;
  line-height: 1.1;
}

#invoices-open-amount {
  position: relative;
  display: block;
  padding-right: 64px;
  min-height: 40px;
}

.kpi-alert-value {
  vertical-align: middle;
}

#invoices-open-amount .kpi-alert-icon {
  position: absolute;
  right: 0;
  top: 38%;
  transform: translateY(-50%);
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #e7d791;
}

#invoices-open-amount .kpi-alert-icon svg {
  width: 38px;
  height: 38px;
}

.detail-status-wrap {
  margin: 8px 0;
}

.kpi-trend {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #7d759f;
}

.target-progress {
  margin-top: 14px;
}

.target-progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #eceef2;
  overflow: hidden;
}

.target-progress-bar span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9ea3ad 0%, #7f8591 100%);
  transition: width 240ms ease;
}

.target-progress-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--muted);
}

.target-progress-meta span:first-child {
  font-weight: 600;
  color: var(--ink);
}

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

.panel {
  grid-column: span 4;
}

.project-type-panel {
  grid-column: span 6;
}

.panel.large {
  grid-column: span 8;
}

.panel.wide {
  grid-column: span 12;
}

.rendiconti-chart-panel {
  grid-column: span 6;
}

.rendiconto-costs-panel {
  grid-column: span 4;
}

.rendiconto-costs-panel .donut-panel {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 14px;
}

.rendiconto-costs-panel .donut-legend {
  width: 100%;
  max-width: 360px;
}

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

.panel-head h3 {
  margin: 0;
  font-size: 1.03rem;
}

.panel-head span,
.panel-head a {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
}

#client-subtitle a {
  color: #111111;
}

.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.calendar-hint {
  flex: 1 0 100%;
  margin: 0;
  font-size: 0.8rem;
  color: #7b8494;
}

.calendar-filters {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-filter {
  border: 1px solid #d9dce3;
  background: #ffffff;
  color: #2f3745;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.calendar-filter[data-calendar-filter="projects"] {
  border-color: #d7d2e2;
  background: #f5f3fa;
}

.calendar-filter[data-calendar-filter="activities"] {
  border-color: #c4e3e0;
  background: #eff8f7;
}

.calendar-filter[data-calendar-filter="rendiconti"] {
  border-color: #fac8aa;
  background: #fff4ec;
}

.calendar-filter[data-invoice-area-filter="domanda_contributo"] {
  border-color: #d7d2e2;
  background: #f5f3fa;
}

.calendar-filter[data-invoice-area-filter="consulenza_analisi"] {
  border-color: #c4e3e0;
  background: #eff8f7;
}

.calendar-filter.is-active[data-calendar-filter="projects"] {
  background: #d7d2e2;
}

.calendar-filter.is-active[data-calendar-filter="activities"] {
  background: #c4e3e0;
}

.calendar-filter.is-active[data-calendar-filter="rendiconti"] {
  background: #fac8aa;
}

.calendar-filter.is-active[data-invoice-area-filter="domanda_contributo"] {
  background: #d7d2e2;
}

.calendar-filter.is-active[data-invoice-area-filter="consulenza_analisi"] {
  background: #c4e3e0;
}

.calendar-filter:not(.is-active) {
  opacity: 0.62;
}

.calendar-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.calendar-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #d9dce3;
  background: #ffffff;
  color: #4d5666;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.calendar-grid-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-grid-head span {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-left: 2px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.calendar-main,
.calendar-side {
  min-width: 0;
}

.calendar-side {
  display: flex;
  flex-direction: column;
  border: 1px solid #e6e8ec;
  border-radius: 16px;
  background: #ffffff;
  padding: 14px;
}

.calendar-side .panel-head {
  margin-bottom: 8px;
}

#calendar-events-groups {
  margin-top: 16px;
  flex: 1 1 auto;
}

.calendar-events-group + .calendar-events-group {
  margin-top: 14px;
}

.calendar-events-group-head {
  margin-bottom: 8px;
}

.calendar-category-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--cat-bg, #d9d9d9);
  color: #2f3745;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.01em;
}

.calendar-day {
  min-height: 86px;
  border: 1px solid #e3e6ec;
  background: #ffffff;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  overflow: visible;
}

.calendar-day.is-empty {
  visibility: hidden;
}

.calendar-day.is-selected {
  border-color: #bfb6d1;
  box-shadow: inset 0 0 0 1px #bfb6d1;
  z-index: 3;
}

.calendar-day-num {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.calendar-day-markers {
  display: inline-flex;
  gap: 4px;
}

.calendar-day-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.calendar-day-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 280px;
  max-width: 320px;
  background: #ffffff;
  border: 1px solid #dfe3ea;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(17, 23, 41, 0.12);
  padding: 10px;
  z-index: 8;
}

.calendar-day-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 16px;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-top: 1px solid #dfe3ea;
  border-left: 1px solid #dfe3ea;
  transform: rotate(45deg);
}

.calendar-day-popover-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.calendar-day-popover-item + .calendar-day-popover-item {
  margin-top: 8px;
}

.calendar-day-popover-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex: 0 0 auto;
}

.calendar-day-popover-copy {
  display: grid;
  gap: 2px;
  text-align: left;
  justify-items: start;
}

.calendar-day-popover-copy strong {
  font-size: 0.76rem;
  color: #4d5666;
  text-transform: uppercase;
}

.calendar-day-popover-copy span {
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.25;
}

.calendar-day-popover-empty {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: end;
  min-height: 210px;
}

.stage {
  text-align: center;
}

.stage p {
  margin: 0 0 8px;
  font-size: 0.84rem;
  color: var(--muted);
}

.stack {
  height: var(--h);
  min-height: 64px;
  border-radius: 12px 12px 8px 8px;
}

.stack.teal {
  background: linear-gradient(180deg, #8cf1e8, var(--teal));
}

.stack.blue {
  background: linear-gradient(180deg, #88bcff, var(--blue));
}

.stack.violet {
  background: linear-gradient(180deg, #b8adff, var(--violet));
}

.stack.indigo {
  background: linear-gradient(180deg, #968eff, var(--indigo));
}

.stage small {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-weight: 700;
}

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

.activity-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3a455a;
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--indigo);
  flex: 0 0 auto;
}

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

.deadline-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  padding: 10px 12px;
}

.deadline-item.high {
  border-left-color: #dd5a7e;
}

.deadline-item.medium {
  border-left-color: #f1a922;
}

.deadline-item p {
  margin: 0;
}

.deadline-item .title {
  font-weight: 700;
  font-size: 0.92rem;
}

.deadline-item .meta {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.82rem;
}

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

.project-type-item {
  border: 1px solid #e6e8ec;
  border-radius: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #fff 0%, #fafbfd 100%);
}

.project-type-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.project-type-name {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
}

.project-type-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.project-link,
.project-link-text {
  color: var(--ink);
  text-decoration: none;
}

.rendiconto-project-link {
  font-weight: 700;
}

#client-subtitle .rendiconto-project-link {
  color: var(--muted);
  font-weight: 300;
  text-decoration: none;
}

#client-subtitle .rendiconto-project-link:hover {
  text-decoration: underline;
}

.table-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.table-link:hover {
  text-decoration: underline;
}

.table-link-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid #d9dee8;
  background: #f8f9fb;
}

.table-link-icon svg {
  width: 19px;
  height: 19px;
}

.table-link-icon:hover {
  text-decoration: none;
  background: #f0f2f6;
}

.table-link.muted {
  color: var(--muted);
  font-weight: 400;
}

#bandi-table-body td {
  font-size: 0.86rem;
}

#bandi-table-body .status-chip {
  font-size: 0.69rem;
}

.project-link {
  transition: color 180ms ease;
}

.project-link:hover {
  color: var(--indigo);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1;
  color: var(--status-color);
  background: var(--status-bg);
  border: 1px solid var(--status-border, var(--status-bg));
  white-space: nowrap;
}

.message-action {
  width: 42px;
  height: 42px;
  border: 1px solid #111111;
  background: #111111;
  color: #ffffff;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
  position: relative;
}

.message-action-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d94b63;
  border: 2px solid #ffffff;
}

.message-action-badge[hidden] {
  display: none;
}

.message-action svg {
  width: 20px;
  height: 20px;
}

.message-action:hover {
  background: #1c1c1c;
  box-shadow: 0 12px 24px rgba(17, 17, 17, 0.12);
  transform: translateY(-1px);
}

.message-action:active {
  transform: translateY(0);
  box-shadow: none;
}

.empty-state,
.empty-table {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-table {
  text-align: center;
  padding: 20px 8px;
}

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

.donut-panel {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  align-items: center;
}

.donut-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

.donut-chart {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-track,
.donut-segment {
  fill: none;
  stroke-width: 18;
}

.donut-track {
  stroke: #eceef2;
}

.donut-segment {
  stroke-linecap: butt;
}


.donut-segment-clickable {
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, filter 180ms ease;
  transform-origin: 80px 80px;
}

.donut-segment-clickable:hover {
  filter: brightness(0.96);
}

.donut-segment-clickable.is-selected {
  opacity: 1;
  transform: scale(1.04);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-center-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.donut-center-value {
  margin-top: 6px;
  font-size: 1rem;
  line-height: 1.35;
}

.donut-legend {
  display: grid;
  gap: 12px;
}

.donut-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.donut-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  flex: 0 0 auto;
}

.donut-legend-copy {
  display: grid;
  gap: 3px;
}

.donut-legend-copy strong {
  font-size: 0.92rem;
}

.donut-legend-copy span {
  color: var(--muted);
  font-size: 0.85rem;
}

.legend-filter {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.legend-filter:hover {
  background: #f7f8fb;
  border-color: #eceff4;
}

.legend-filter.is-selected {
  background: #f3f5f8;
  border-color: #e0e4eb;
}


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

th,
td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid #edf1f7;
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.projects-table th:nth-child(4),
.projects-table th:nth-child(5),
.projects-table td:nth-child(4),
.projects-table td:nth-child(5) {
  text-align: right;
}

.projects-table th:nth-child(8),
.projects-table td:nth-child(8) {
  text-align: center;
}

.projects-table thead th {
  text-align: left !important;
}

.home-projects-table td:nth-child(3),
.home-projects-table td:nth-child(4),
.home-projects-table td:nth-child(5) {
  text-align: right;
}

.rendiconti-table th:nth-child(5),
.rendiconti-table th:nth-child(6),
.rendiconti-table th:nth-child(7),
.rendiconti-table th:nth-child(8),
.rendiconti-table td:nth-child(5),
.rendiconti-table td:nth-child(6),
.rendiconti-table td:nth-child(7),
.rendiconti-table td:nth-child(8) {
  text-align: right;
}

.invoices-table td:nth-child(6) {
  text-align: right;
}

td .status-chip {
  min-height: 28px;
  font-size: 0.73rem;
}

.badge {
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 10px;
}

.badge.good {
  background: #ddf7ec;
  color: #038b63;
}

.badge.info {
  background: #e8f1ff;
  color: #2061d3;
}

.badge.warn {
  background: #fff1da;
  color: #b07700;
}

.invoice-type-badge {
  display: inline-block;
  white-space: nowrap;
}

.invoice-type-chip {
  --status-color: #4f5667;
  --status-bg: #eceff4;
  --status-border: #d8dee8;
  white-space: nowrap;
}

.invoices-filters {
  margin-bottom: 14px;
}

.progress {
  width: 120px;
  height: 8px;
  border-radius: 999px;
  background: #edf1f8;
}

.progress-with-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.progress-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  min-width: 34px;
  text-align: right;
}

.progress span {
  display: block;
  height: 100%;
  width: var(--p);
  border-radius: inherit;
  background: #d7d2e2;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.prelogin-splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #f2f2f3 0%, #e7e7e8 100%);
  opacity: 1;
  visibility: visible;
  transition: opacity 520ms ease, visibility 520ms ease;
}

.prelogin-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.prelogin-mark-image {
  width: min(440px, 58vw);
  height: auto;
  transform: translateY(0) scale(1);
  animation: splashFloat 1.35s ease-in-out infinite alternate;
  filter: drop-shadow(0 18px 40px rgba(17, 23, 41, 0.08));
  mix-blend-mode: multiply;
}

.auth-shell {
  width: min(100%, 520px);
  padding: 24px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 420ms ease, transform 420ms ease;
}

.auth-shell.is-ready {
  opacity: 1;
  transform: translateY(0);
}

.auth-card {
  position: relative;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #e6e8ec;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(17, 23, 41, 0.06);
}

.auth-corner-art {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 108px;
  height: auto;
  object-fit: contain;
  opacity: 0.92;
  pointer-events: none;
}

.auth-logo {
  width: 190px;
  height: auto;
  display: block;
  margin-bottom: 18px;
}

.auth-copy h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.auth-copy p {
  margin: 0 0 24px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-label,
.profile-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-input {
  width: 100%;
  border: 1px solid #d7dce5;
  border-radius: 12px;
  padding: 13px 14px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.auth-input:focus {
  outline: 2px solid rgba(89, 72, 214, 0.12);
  border-color: #b9b2ec;
}

.auth-error {
  margin: 4px 0 0;
  color: #b64a65;
  font-weight: 600;
}

.auth-submit {
  margin-top: 8px;
}

.account-panel {
  min-height: 520px;
}

.account-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.account-company-title {
  margin: 0;
  font-size: clamp(1.2rem, 1.9vw, 1.55rem);
  line-height: 1.1;
  font-weight: 600;
}

.account-company-logo {
  display: block;
  margin: 0;
  max-width: 180px;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: right center;
  flex: 0 0 auto;
}

.account-profile-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.account-profile-grid .profile-field.full {
  grid-column: 1 / -1;
}

.account-top-layout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.4fr);
  gap: 12px;
  align-items: stretch;
}

.account-top-stack {
  display: grid;
  gap: 12px;
}

.account-stack-card {
  padding: 12px;
}

.account-address-card {
  display: flex;
  flex-direction: column;
}

.account-website-link {
  color: var(--ink);
  text-decoration: underline;
}

.account-inline-field {
  grid-column: span 4;
  padding: 12px;
}

.account-inline-field .profile-label {
  font-size: 0.72rem;
}

.account-inline-field .profile-value {
  margin-top: 6px;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-inline-field .account-website-link {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.account-input {
  margin-top: 6px;
  width: 100%;
  border: 1px solid #d8dde6;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  padding: 10px 12px;
}

.account-input:focus {
  outline: none;
  border-color: #bfc6d4;
  box-shadow: 0 0 0 3px rgba(215, 210, 226, 0.35);
}

.account-password-input-wrap {
  position: relative;
}

.account-password-input {
  padding-right: 42px;
}

.account-password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: #6b7382;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.account-password-toggle svg {
  width: 18px;
  height: 18px;
}

.account-map-field {
  margin-top: 4px;
}

.account-map-wrap {
  margin-top: 10px;
  border: 1px solid #e6e8ec;
  border-radius: 14px;
  overflow: hidden;
  background: #f7f8fa;
  flex: 1 1 auto;
  min-height: 0;
}

.account-map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 288px;
}

.account-map-canvas .leaflet-tooltip {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
}

.account-map-pin {
  background: transparent !important;
  border: 0 !important;
}

.account-map-pin svg {
  display: block;
  width: 30px;
  height: 42px;
}

.account-actions {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.account-save-feedback {
  margin: 0;
  font-size: 0.84rem;
  color: #5c6778;
  text-align: right;
}

.account-admin-box {
  margin-top: 4px;
}

.account-admin-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.account-admin-item .profile-label {
  font-size: 0.72rem;
}

.account-credentials-box {
  margin-top: 4px;
}

.account-credentials-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 900px) {
  .account-top-layout {
    grid-template-columns: 1fr;
  }

  .account-admin-grid {
    grid-template-columns: 1fr;
  }

  .account-credentials-grid {
    grid-template-columns: 1fr;
  }
}

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

.profile-grid.account-profile-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.profile-field {
  border: 1px solid #e6e8ec;
  border-radius: 14px;
  padding: 16px;
}

.profile-field.full {
  grid-column: span 2;
}

.bando-overview-rows {
  display: grid;
  gap: 16px;
}

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

.bando-overview-rows .profile-label {
  margin: 0;
}

.profile-value {
  margin: 8px 0 0;
  font-size: 1rem;
  color: var(--ink);
  word-break: break-word;
}

.rich-copy {
  color: var(--ink);
  line-height: 1.7;
  font-size: 0.98rem;
}

.rich-copy p {
  margin: 0 0 14px;
}

.rich-copy p:last-child {
  margin-bottom: 0;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(15, 18, 27, 0.34);
  backdrop-filter: blur(4px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(84vh, 880px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e6e8ec;
  border-radius: 24px;
  box-shadow: 0 28px 60px rgba(17, 23, 41, 0.14);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid #edf1f7;
}

.modal-eyebrow {
  margin: 0 0 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.modal-head h3 {
  margin: 0;
  font-size: 1.28rem;
}

.modal-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.modal-close {
  width: 40px;
  height: 40px;
  border: 1px solid #d9dee7;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.messages-thread {
  overflow: auto;
  padding: 22px 24px;
  display: grid;
  gap: 16px;
  background: linear-gradient(180deg, #fcfcfd 0%, #f7f8fb 100%);
}

.message-thread-card {
  display: grid;
  gap: 12px;
}

.message-replies {
  display: grid;
  gap: 10px;
  padding-left: 28px;
}

.message-bubble {
  max-width: min(640px, 100%);
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid #e6e8ec;
}

.message-bubble.client {
  justify-self: end;
  background: #d7d2e2;
  color: #131927;
  border-color: #d7d2e2;
}

.message-bubble.internal {
  justify-self: start;
  width: fit-content;
  max-width: min(420px, 82%);
  background: #fac8aa;
  color: #131927;
  border-color: #fac8aa;
}

.message-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.message-author {
  font-size: 0.82rem;
  font-weight: 600;
}

.message-date {
  font-size: 0.78rem;
  color: inherit;
  opacity: 0.72;
}

.message-bubble p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.message-compose {
  display: grid;
  gap: 10px;
  padding: 18px 24px 24px;
  border-top: 1px solid #edf1f7;
  background: #ffffff;
}

.message-input {
  width: 100%;
  min-height: 120px;
  border: 1px solid #d7dce5;
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  resize: vertical;
}

.message-input:focus {
  outline: 2px solid rgba(89, 72, 214, 0.12);
  border-color: #b9b2ec;
}

.message-feedback {
  min-height: 20px;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
}

.message-feedback[data-state="success"] {
  color: #128c61;
}

.message-feedback[data-state="error"] {
  color: #b64a65;
}

.message-feedback[data-state="info"] {
  color: var(--muted);
}

.message-actions {
  display: flex;
  justify-content: flex-end;
}

.detail-side-copy {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.detail-message-button,
.detail-primary-link {
  width: 100%;
}

@keyframes splashFloat {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(-8px) scale(1.02);
  }
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel,
  .panel.large {
    grid-column: span 6;
  }

  .panel.wide {
    grid-column: span 12;
  }

  .donut-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    order: 1;
    position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: min(320px, calc(100vw - 24px));
    z-index: 90;
    height: auto;
    min-height: 0;
    overflow-y: auto;
    margin: 0;
    transform: translateX(calc(-100% - 18px));
    transition: transform 220ms ease;
    box-shadow: 0 18px 40px rgba(17, 23, 41, 0.22);
  }

  .content {
    order: 1;
    height: auto;
    overflow: visible;
    padding-top: 64px;
  }

  .app-shell.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(16, 22, 35, 0.28);
    backdrop-filter: blur(1px);
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open .mobile-nav-backdrop {
    display: block;
  }

  .mobile-nav-toggle {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 95;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid #d6dbe4;
    background: rgba(255, 255, 255, 0.96);
    color: #4d5566;
    box-shadow: 0 8px 20px rgba(17, 23, 41, 0.14);
    cursor: pointer;
  }

  .mobile-nav-toggle svg {
    width: 19px;
    height: 19px;
  }

  .sidebar-toggle {
    display: none;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed .brand {
    gap: 8px;
    padding-right: 0;
  }

  .app-shell.sidebar-collapsed .brand-main {
    width: 176px;
    height: 36px;
  }

  .app-shell.sidebar-collapsed .brand-logo-full {
    opacity: 1;
  }

  .app-shell.sidebar-collapsed .brand-logo-compact {
    opacity: 0;
  }

  .app-shell.sidebar-collapsed .menu-label,
  .app-shell.sidebar-collapsed .menu-item-text,
  .app-shell.sidebar-collapsed .side-card,
  .app-shell.sidebar-collapsed .scope-filter-wrap.sidebar-scope {
    opacity: 1;
    max-height: none;
  }

  .app-shell.sidebar-collapsed .menu-item {
    justify-content: flex-start;
    padding: 6px 12px;
  }

  .app-shell.sidebar-collapsed .menu-item-text {
    max-width: 140px;
  }

  .app-shell.sidebar-collapsed .side-card {
    max-height: 160px;
    padding: 14px;
    border-width: 1px;
  }

  .panel,
  .panel.large,
  .panel.wide {
    grid-column: span 12;
  }

  .kpi-card .kpi-value,
  .kpi-card .detail-kpi-value {
    font-size: 1.24rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

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

  .profile-field.full {
    grid-column: span 1;
  }

  .prelogin-mark-image {
    width: min(300px, 70vw);
  }

  .project-type-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .calendar-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .calendar-grid {
    gap: 6px;
  }

  .calendar-day {
    min-height: 72px;
    padding: 6px;
  }

  .calendar-day-popover {
    width: min(240px, calc(100vw - 72px));
    left: 0;
  }

  .modal-backdrop {
    padding: 16px;
  }

  .modal-card {
    max-height: 92vh;
  }

  .message-replies {
    padding-left: 12px;
  }

  .message-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

.empty-page {
  min-height: 520px;
}
