:root{font-family:Inter,Arial,sans-serif;color:#14213d;background:#f5f7fb}
*{box-sizing:border-box}body{margin:0}.sidebar{position:fixed;inset:0 auto 0 0;width:230px;background:white;border-right:1px solid #e4e9f1;padding:24px;display:flex;flex-direction:column}.brand{font-weight:800;font-size:20px;color:#155eef;display:flex;gap:10px;align-items:center}.brand.large{font-size:26px}.sidebar nav{display:grid;gap:8px;margin-top:40px}.sidebar a{color:#344054;text-decoration:none;padding:12px 14px;border-radius:10px}.sidebar nav a:hover,.sidebar nav a.active{background:#edf4ff;color:#155eef}.logout{margin-top:auto}.content{margin-left:230px;padding:34px;min-height:100vh}.content header{display:flex;justify-content:space-between;margin-bottom:24px}.content h1{margin:0;font-size:30px}.content header p{margin:8px 0;color:#667085}.cards{display:grid;grid-template-columns:repeat(6,1fr);gap:14px;margin-bottom:20px}.cards.three{grid-template-columns:repeat(3,1fr)}.cards article,.panel{background:#fff;border:1px solid #e4e9f1;border-radius:16px;box-shadow:0 7px 22px rgba(16,24,40,.04)}.cards article{padding:20px}.cards span{display:block;color:#667085;font-size:14px}.cards strong{display:block;margin-top:10px;font-size:25px}.panel{padding:22px}.panel-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.panel h2{margin:0}.panel a{color:#155eef;text-decoration:none}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:14px;border-bottom:1px solid #edf0f5}th{font-size:13px;color:#667085}.badge{background:#eaf7ee;color:#257a45;padding:6px 10px;border-radius:999px;font-size:12px}.login-page{display:grid;grid-template-columns:1fr 1fr;min-height:100vh}.login-hero{padding:9vw;background:linear-gradient(145deg,#eff6ff,#dcecff);display:flex;flex-direction:column;justify-content:center}.login-hero h1{font-size:48px;max-width:560px;margin:42px 0 16px}.login-hero p{font-size:20px;color:#52627a;max-width:520px;line-height:1.6}.login-panel{display:flex;align-items:center;justify-content:center;padding:40px}.login-card{width:min(430px,100%);background:#fff;padding:42px;border:1px solid #e4e9f1;border-radius:20px;box-shadow:0 18px 50px rgba(16,24,40,.10)}.login-card h2{font-size:30px;margin:0}.login-card p{color:#667085}.login-card label{display:block;font-weight:700;margin-top:22px}.login-card input{width:100%;padding:14px;margin-top:8px;border:1px solid #ccd5e2;border-radius:10px}.login-card button{width:100%;padding:15px;margin-top:26px;border:0;border-radius:10px;background:#155eef;color:white;font-weight:800;font-size:16px}.login-card small{display:block;text-align:center;color:#667085;margin-top:18px}.error{background:#fff0f0;color:#b42318;padding:10px;border-radius:8px;margin-top:16px}@media(max-width:1000px){.cards{grid-template-columns:repeat(2,1fr)}.login-page{grid-template-columns:1fr}.login-hero{display:none}}@media(max-width:720px){.sidebar{position:static;width:auto}.content{margin:0;padding:18px}.sidebar nav{display:flex;overflow:auto;margin-top:20px}.cards,.cards.three{grid-template-columns:1fr}table{display:block;overflow-x:auto}}

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

.form-grid label{
  display:block;
  font-weight:700;
  color:#344054;
}

.form-grid input,
.form-grid select,
.form-grid textarea{
  width:100%;
  margin-top:8px;
  padding:12px;
  border:1px solid #ccd5e2;
  border-radius:10px;
  background:white;
  font:inherit;
}

.form-grid textarea{
  resize:vertical;
}

.form-grid .full-width{
  grid-column:1/-1;
}

.form-grid button{
  padding:13px 22px;
  border:0;
  border-radius:10px;
  background:#155eef;
  color:white;
  font-weight:800;
  cursor:pointer;
}

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

.secondary-button{
  display:inline-block;
  margin-left:12px;
  padding:12px 20px;
  border:1px solid #ccd5e2;
  border-radius:10px;
  color:#344054;
  text-decoration:none;
  background:white;
}

.warning-badge{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  background:#fff4e5;
  color:#9a5b13;
  font-size:12px;
  font-weight:700;
}

.danger-button{
  padding:8px 12px;
  border:0;
  border-radius:8px;
  background:#fff0f0;
  color:#b42318;
  font-weight:700;
  cursor:pointer;
}

.overdue-badge{
  display:inline-block;
  margin-top:6px;
  padding:5px 9px;
  border-radius:999px;
  background:#fff0f0;
  color:#b42318;
  font-size:12px;
  font-weight:800;
}

.secondary-action{
  padding:8px 12px;
  border:1px solid #ccd5e2;
  border-radius:8px;
  background:white;
  color:#344054;
  cursor:pointer;
}

.contract-end-date{
  display:inline-block;
  padding:7px 10px;
  border-radius:8px;
  background:#fff4e5;
  color:#9a3412;
  font-weight:800;
  white-space:nowrap;
}

.table-scroll{
  width:100%;
  overflow-x:auto;
}

.table-scroll table{
  min-width:1450px;
}

.contract-end-date{
  display:inline-block;
  padding:7px 10px;
  border-radius:8px;
  background:#fff4e5;
  color:#9a3412;
  font-weight:800;
  white-space:nowrap;
}

/* ============================================================
   SEZIONI CON PULSANTE CIRCOLARE +
   ============================================================ */

.section-create {
  margin-bottom: 22px;
}

.section-create > summary {
  list-style: none;
}

.section-create > summary::-webkit-details-marker {
  display: none;
}

.section-create-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border: 1px solid #e3e8ef;
  border-radius: 14px;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.section-create-head:hover {
  border-color: #b9cce5;
  box-shadow: 0 7px 20px rgba(15, 23, 42, 0.09);
  transform: translateY(-1px);
}

.section-create-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.section-create-head span {
  color: #6b7280;
  font-size: 14px;
}

.section-create-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff !important;
  box-shadow: 0 5px 12px rgba(37, 99, 235, 0.28);
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.section-create-head:hover .section-create-button {
  background: #1d4ed8;
}

.section-create-icon {
  color: #ffffff !important;
  font-size: 28px !important;
  font-weight: 400;
  line-height: 1;
  transition: transform 0.22s ease;
}

.section-create[open] .section-create-icon {
  transform: rotate(45deg);
}

.section-create-panel {
  margin-top: 14px;
  border-top: 3px solid #2563eb;
}

@media (max-width: 700px) {
  .section-create-head {
    padding: 15px 16px;
  }

  .section-create-head h2 {
    font-size: 18px;
  }

  .section-create-button {
    width: 40px;
    height: 40px;
  }
}

/* ============================================================
   ELENCO CONTRATTI SCORREVOLE
   ============================================================ */

#contracts-table-scroll {
  width: 100%;
  max-height: calc(100vh - 230px);
  overflow: auto;
  position: relative;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  scrollbar-gutter: stable;
}

#contracts-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#contracts-table th,
#contracts-table td {
  white-space: nowrap;
}

#contracts-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f1f5f9;
  box-shadow:
    0 1px 0 #dbe2ea,
    0 3px 5px rgba(15, 23, 42, 0.08);
}

#contracts-table-scroll::-webkit-scrollbar {
  width: 15px;
  height: 15px;
}

#contracts-table-scroll::-webkit-scrollbar-track {
  background: #e5e7eb;
}

#contracts-table-scroll::-webkit-scrollbar-thumb {
  border: 3px solid #e5e7eb;
  border-radius: 10px;
  background: #8b8b8b;
}

#contracts-table-scroll::-webkit-scrollbar-thumb:hover {
  background: #666666;
}

@media (max-height: 750px) {
  #contracts-table-scroll {
    max-height: calc(100vh - 175px);
  }
}

@media (max-width: 900px) {
  #contracts-table-scroll {
    max-height: calc(100vh - 190px);
  }
}

/* ============================================================
   ELENCHI SCORREVOLI DELLE SEZIONI
   ============================================================ */

.section-table-scroll {
  position: relative;
  width: 100%;
  max-height: calc(100vh - 230px);
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  scrollbar-gutter: stable;
}

.section-table-scroll table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.section-table-scroll th,
.section-table-scroll td {
  white-space: nowrap;
}

.section-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f1f5f9;
  box-shadow:
    0 1px 0 #dbe2ea,
    0 3px 5px rgba(15, 23, 42, 0.08);
}

.section-table-scroll::-webkit-scrollbar {
  width: 15px;
  height: 15px;
}

.section-table-scroll::-webkit-scrollbar-track {
  background: #e5e7eb;
}

.section-table-scroll::-webkit-scrollbar-thumb {
  border: 3px solid #e5e7eb;
  border-radius: 10px;
  background: #8b8b8b;
}

.section-table-scroll::-webkit-scrollbar-thumb:hover {
  background: #666666;
}

@media (max-height: 750px) {
  .section-table-scroll {
    max-height: calc(100vh - 175px);
  }
}

@media (max-width: 900px) {
  .section-table-scroll {
    max-height: calc(100vh - 190px);
  }
}


/* ============================================================
   RICERCA E ORDINAMENTO TABELLE
   ============================================================ */

.table-tools {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0 10px;
}

.table-search-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(100%, 420px);
}

.table-search-label {
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.table-search {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.table-search:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.table-results-counter {
  flex: 0 0 auto;
  padding-bottom: 10px;
  color: #64748b;
  font-size: 13px;
  white-space: nowrap;
}

th.table-sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

th.table-sortable:hover {
  background: #e2e8f0;
}

th.table-sortable:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.table-sort-indicator {
  display: inline-block;
  width: 15px;
  margin-left: 7px;
  color: #64748b;
  font-size: 11px;
  text-align: center;
}

th.table-sortable .table-sort-indicator::after {
  content: "↕";
}

th.table-sortable.sort-asc .table-sort-indicator::after {
  content: "▲";
  color: #2563eb;
}

th.table-sortable.sort-desc .table-sort-indicator::after {
  content: "▼";
  color: #2563eb;
}

th.table-column-no-sort {
  cursor: default;
}

.table-no-results td {
  padding: 28px 18px;
  color: #64748b;
  font-style: italic;
  text-align: center;
}

@media (max-width: 700px) {
  .table-tools {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .table-search-wrapper {
    width: 100%;
  }

  .table-results-counter {
    padding-bottom: 0;
  }
}


/* ============================================================
   PAGINAZIONE TABELLE
   ============================================================ */

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 12px;
  padding: 10px 2px 2px;
}

.table-page-size {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.table-page-size select {
  min-width: 72px;
  min-height: 36px;
  padding: 5px 28px 5px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
}

.table-page-navigation {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-page-button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #1e293b;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.table-page-button:hover:not(:disabled) {
  border-color: #94a3b8;
  background: #f8fafc;
}

.table-page-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.table-page-indicator {
  min-width: 95px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .table-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .table-page-navigation {
    justify-content: space-between;
  }
}


/* ============================================================
   AZIONI DOCUMENTI
   ============================================================ */

.link-button {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2563eb;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

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

.link-button-danger {
  color: #b91c1c;
}


/* ============================================================
   FASCICOLO UNITÀ IMMOBILIARE
   ============================================================ */

.unit-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.unit-summary-grid > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
}

.unit-summary-grid strong {
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
}

.unit-summary-grid span {
  color: #0f172a;
  font-weight: 700;
}

.unit-notes {
  margin-top: 16px;
  padding: 14px;
  border-left: 4px solid #2563eb;
  background: #f8fafc;
}

.unit-notes p {
  margin: 6px 0 0;
}

@media (max-width: 1100px) {
  .unit-summary-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 650px) {
  .unit-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================
   RATE E INCASSI
   ========================================================== */

.installment-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
  gap: 16px;
  align-items: end;
}

.installment-filters label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.installment-filters select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #ccd5e2;
  border-radius: 10px;
  background: white;
}

.installment-filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.installment-filter-actions button {
  margin: 0;
}

.neutral-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #475467;
  font-size: 12px;
}

@media (max-width: 1000px) {
  .installment-filters {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .installment-filter-actions {
    flex-wrap: wrap;
  }
}

.success-message {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #eaf7ee;
  color: #257a45;
  font-weight: 700;
}

.dashboard-status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
}


/* ============================================================
   TESTATA B RESPONSIVE
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #ffffff;
  border-bottom: 1px solid #dfe5ee;
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.06);
}

.topbar {
  min-height: 78px;
  padding: 12px clamp(18px, 3vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.top-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #155eef;
  text-decoration: none;
}

.brand-placeholder {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: #edf4ff;
  color: #155eef;
  font-size: 25px;
}

.brand-name {
  color: #344054;
  font-size: 20px;
  font-weight: 600;
  white-space: nowrap;
}

.brand-name strong {
  color: #155eef;
  font-weight: 800;
}

.account-area {
  display: flex;
  align-items: center;
  gap: 20px;
}

.account-name {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}

.account-name strong {
  color: #344054;
  font-size: 14px;
}

.account-name span {
  color: #667085;
  font-size: 12px;
}

.top-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid #ccd5e2;
  border-radius: 10px;
  background: #ffffff;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.top-logout:hover {
  background: #f8fafc;
  border-color: #98a2b3;
}

.navigation-bar {
  min-height: 54px;
  padding: 0 clamp(18px, 3vw, 44px);
  background: #f8fafc;
  border-top: 1px solid #edf0f5;
}

.navigation-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.navigation-button {
  display: none;
}

.main-navigation {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-height: 54px;
}

.nav-direct,
.nav-group-title {
  min-height: 54px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  color: #475467;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: default;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-direct {
  cursor: pointer;
}

.nav-group-title::after {
  content: "⌄";
  margin-left: 8px;
  color: #98a2b3;
  font-size: 14px;
}

.nav-direct:hover,
.nav-group:hover > .nav-group-title {
  background: #edf4ff;
  color: #155eef;
}

.nav-direct.active,
.nav-group.active > .nav-group-title {
  border-bottom-color: #155eef;
  color: #155eef;
}

.nav-group {
  position: relative;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  z-index: 1100;
  display: none;
  min-width: 230px;
  padding: 8px;
  border: 1px solid #dfe5ee;
  border-radius: 0 0 12px 12px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(16, 24, 40, 0.12);
}

.nav-group:hover .nav-dropdown,
.nav-group:focus-within .nav-dropdown {
  display: grid;
}

.nav-dropdown a {
  padding: 11px 13px;
  border-radius: 8px;
  color: #475467;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.nav-dropdown a:hover,
.nav-dropdown a.active {
  background: #edf4ff;
  color: #155eef;
}

.content {
  width: 100%;
  min-height: calc(100vh - 133px);
  margin-left: 0;
  padding: 28px clamp(18px, 3vw, 44px) 44px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(26px, 2.4vw, 34px);
}

/* Tablet e smartphone */

@media (max-width: 820px) {
  .site-header {
    position: relative;
  }

  .topbar {
    min-height: 66px;
    padding: 10px 18px;
  }

  .brand-placeholder {
    width: 42px;
    height: 42px;
  }

  .brand-name {
    font-size: 18px;
  }

  .account-name {
    display: none;
  }

  .account-area {
    gap: 8px;
  }

  .top-logout {
    min-height: 38px;
    padding: 8px 13px;
  }

  .navigation-bar {
    min-height: auto;
    padding: 0;
  }

  .navigation-button {
    min-height: 52px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #344054;
    font-weight: 800;
    cursor: pointer;
  }

  .navigation-icon {
    color: #155eef;
    font-size: 22px;
  }

  .main-navigation {
    display: none;
    min-height: auto;
    padding: 0 12px 14px;
    flex-direction: column;
    gap: 4px;
  }

  .navigation-toggle:checked ~ .main-navigation {
    display: flex;
  }

  .nav-direct,
  .nav-group-title {
    min-height: 46px;
    padding: 0 13px;
    border-bottom: 0;
    border-radius: 9px;
  }

  .nav-direct.active,
  .nav-group.active > .nav-group-title {
    background: #edf4ff;
    color: #155eef;
  }

  .nav-group-title::after {
    display: none;
  }

  .nav-dropdown {
    position: static;
    display: grid;
    min-width: 0;
    margin: 0 0 6px 14px;
    padding: 2px 0 2px 12px;
    border: 0;
    border-left: 2px solid #dbe7f8;
    border-radius: 0;
    box-shadow: none;
  }

  .nav-dropdown a {
    padding: 10px 13px;
    white-space: normal;
  }

  .content {
    min-height: auto;
    padding: 22px 16px 36px;
  }

  .page-header {
    margin-bottom: 18px;
  }
}

@media (max-width: 420px) {
  .brand-name {
    font-size: 16px;
  }

  .top-logout {
    padding: 8px 11px;
  }

  .cards,
  .cards.three {
    grid-template-columns: 1fr;
  }
}

/* ===== BUERA UI 20260805 ===== */

:root {
  --buera-blue: #173b63;
  --buera-blue-soft: #eaf1f6;
  --buera-burgundy: #8b2949;
  --buera-burgundy-soft: #f7eaee;
  --buera-gold: #c99643;
  --buera-gold-soft: #fbf3e5;
  --buera-cyan: #2c98aa;
  --buera-cream: #f4f0e8;
  --buera-ink: #263748;
}

body {
  background:
    radial-gradient(circle at top right, rgba(44, 152, 170, 0.08), transparent 28rem),
    #f5f3ee;
  color: var(--buera-ink);
}

.site-header {
  border-bottom: 1px solid #ded8cd;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 5px 22px rgba(23, 59, 99, 0.09);
}

.topbar {
  min-height: 84px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.top-brand {
  min-width: 200px;
}

.brand-logo {
  display: block;
  width: 200px;
  height: 60px;
  object-fit: contain;
  object-position: left center;
}

.account-name strong {
  color: var(--buera-blue);
}

.top-logout {
  border-color: #d7cbbd;
  color: var(--buera-blue);
}

.top-logout:hover {
  border-color: var(--buera-burgundy);
  background: var(--buera-burgundy-soft);
  color: var(--buera-burgundy);
}

.navigation-bar {
  border-top: 1px solid #ebe5db;
  background: #f7f4ee;
}

.nav-direct,
.nav-group-title {
  color: #42566b;
}

.nav-group-title::after {
  color: var(--buera-gold);
}

.nav-direct:hover,
.nav-group:hover > .nav-group-title {
  background: var(--buera-blue-soft);
  color: var(--buera-blue);
}

.nav-direct.active,
.nav-group.active > .nav-group-title {
  border-bottom-color: var(--buera-burgundy);
  color: var(--buera-burgundy);
}

.nav-dropdown {
  border-color: #ded8cd;
  box-shadow: 0 16px 34px rgba(23, 59, 99, 0.16);
}

.nav-dropdown a:hover,
.nav-dropdown a.active {
  background: var(--buera-blue-soft);
  color: var(--buera-blue);
}

.content {
  max-width: 1680px;
  margin-right: auto;
  margin-left: auto;
}

.page-header h1 {
  color: var(--buera-blue);
  letter-spacing: -0.02em;
}

.dashboard-panel {
  overflow: hidden;
  border: 1px solid #e0dacf;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 30px rgba(23, 59, 99, 0.07);
}

.dashboard-panel + .dashboard-panel {
  margin-top: 28px;
}

.dashboard-income-panel {
  border-top: 4px solid var(--buera-blue);
}

.dashboard-deadline-panel {
  border-top: 4px solid var(--buera-burgundy);
}

.dashboard-panel .panel-head {
  padding-bottom: 18px;
  border-bottom: 1px solid #eee9e1;
}

.dashboard-panel .panel-head h2 {
  color: var(--buera-blue);
  font-size: 21px;
}

.dashboard-deadline-panel .panel-head h2 {
  color: var(--buera-burgundy);
}

.dashboard-panel .panel-head > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid var(--buera-blue);
  border-radius: 9px;
  background: var(--buera-blue);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.dashboard-panel .panel-head > a:hover {
  background: #0f2f51;
}

.dashboard-deadline-panel .panel-head > a {
  border-color: var(--buera-burgundy);
  background: var(--buera-burgundy);
}

.dashboard-deadline-panel .panel-head > a:hover {
  background: #70203a;
}

.dashboard-panel .cards {
  gap: 14px;
  margin-top: 20px;
  margin-bottom: 18px;
}

.dashboard-panel .cards article {
  position: relative;
  overflow: hidden;
  min-height: 105px;
  border: 1px solid #e5dfd5;
  border-radius: 13px;
  background: #ffffff;
  box-shadow: 0 5px 15px rgba(23, 59, 99, 0.05);
}

.dashboard-panel .cards article::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--buera-blue);
  content: "";
}

.dashboard-panel .cards article:nth-child(2)::before,
.dashboard-panel .cards article:nth-child(5)::before {
  background: var(--buera-gold);
}

.dashboard-panel .cards article:nth-child(3)::before {
  background: var(--buera-cyan);
}

.dashboard-panel .cards article:nth-child(4)::before,
.dashboard-panel .cards article:nth-child(6)::before {
  background: var(--buera-burgundy);
}

.dashboard-panel .cards article span {
  color: #697887;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.dashboard-panel .cards article strong {
  color: var(--buera-blue);
}

.dashboard-panel table thead th {
  border-bottom-color: var(--buera-blue);
  background: #edf2f5;
  color: var(--buera-blue);
}

.dashboard-panel table tbody tr:hover {
  background: #faf7f1;
}

.dashboard-status-summary .badge {
  background: #e4f3ef;
  color: #176b59;
}

.dashboard-status-summary .warning-badge {
  background: var(--buera-gold-soft);
  color: #845c1e;
}

.overdue-badge {
  background: var(--buera-burgundy-soft);
  color: var(--buera-burgundy);
}

@media (max-width: 1050px) {
  .nav-direct,
  .nav-group-title {
    padding-right: 12px;
    padding-left: 12px;
    font-size: 13px;
  }
}

@media (max-width: 820px) {
  .topbar {
    min-height: 72px;
  }

  .top-brand {
    min-width: 0;
  }

  .brand-logo {
    width: 176px;
    height: 53px;
  }

  .navigation-icon {
    color: var(--buera-burgundy);
  }

  .nav-direct.active,
  .nav-group.active > .nav-group-title {
    background: var(--buera-blue-soft);
    color: var(--buera-blue);
  }

  .nav-dropdown {
    border-left-color: #d8c49f;
  }

  .dashboard-panel {
    border-radius: 13px;
  }

  .dashboard-panel .panel-head {
    align-items: flex-start;
    gap: 14px;
  }
}

@media (max-width: 520px) {
  .brand-logo {
    width: 150px;
    height: 45px;
  }

  .dashboard-panel .panel-head > a {
    width: 100%;
  }

  .dashboard-panel .section-table-scroll {
    margin-right: -12px;
    margin-left: -12px;
  }
}

/* ===== BUERA LOGIN 20260805 ===== */

.login-page {
  background: #f5f3ee;
  color: var(--buera-ink);
}

.login-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(54px, 8vw, 130px);
  background:
    radial-gradient(circle at 15% 15%, rgba(201, 150, 67, 0.22), transparent 21rem),
    radial-gradient(circle at 90% 85%, rgba(44, 152, 170, 0.20), transparent 25rem),
    linear-gradient(145deg, #f8f4ec 0%, #e9f0f3 58%, #dce9ed 100%);
}

.login-hero::after {
  position: absolute;
  right: -110px;
  bottom: -170px;
  width: 430px;
  height: 430px;
  border: 70px solid rgba(139, 41, 73, 0.07);
  border-radius: 50%;
  content: "";
}

.login-brand-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: 200px;
  height: 60px;
  object-fit: contain;
  object-position: left center;
}

.login-hero h1 {
  position: relative;
  z-index: 1;
  max-width: 650px;
  margin: 54px 0 20px;
  color: var(--buera-blue);
  font-size: clamp(42px, 4.2vw, 68px);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.login-hero p {
  position: relative;
  z-index: 1;
  max-width: 590px;
  color: #526779;
  font-size: 20px;
  line-height: 1.65;
}

.login-panel {
  background:
    radial-gradient(circle at top right, rgba(139, 41, 73, 0.07), transparent 20rem),
    #ffffff;
}

.login-card {
  border: 1px solid #e2dacf;
  border-top: 5px solid var(--buera-burgundy);
  box-shadow: 0 24px 65px rgba(23, 59, 99, 0.13);
}

.login-card h2 {
  color: var(--buera-blue);
  letter-spacing: -0.025em;
}

.login-card > p {
  line-height: 1.5;
}

.login-card label {
  color: #394d60;
}

.login-card input {
  border-color: #cfc8bd;
  background: #fffefa;
  color: var(--buera-ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card input:focus {
  outline: none;
  border-color: var(--buera-cyan);
  box-shadow: 0 0 0 4px rgba(44, 152, 170, 0.13);
}

.login-card button {
  background: var(--buera-blue);
  box-shadow: 0 8px 20px rgba(23, 59, 99, 0.18);
  transition: background 0.2s, transform 0.2s;
}

.login-card button:hover {
  background: #0f2f51;
  transform: translateY(-1px);
}

.login-card button:focus-visible {
  outline: 3px solid rgba(201, 150, 67, 0.45);
  outline-offset: 3px;
}

.login-mobile-logo {
  display: none;
}

.login-card .error {
  border-left: 4px solid var(--buera-burgundy);
  background: var(--buera-burgundy-soft);
  color: var(--buera-burgundy);
}

@media (max-width: 1000px) {
  .login-panel {
    min-height: 100vh;
    padding: 32px 20px;
    background:
      radial-gradient(circle at top right, rgba(44, 152, 170, 0.10), transparent 22rem),
      #f5f3ee;
  }

  .login-mobile-logo {
    display: block;
    width: 200px;
    height: 60px;
    margin: 0 auto 34px;
    object-fit: contain;
  }
}

@media (max-width: 520px) {
  .login-panel {
    padding: 18px 14px;
  }

  .login-card {
    padding: 30px 24px;
    border-radius: 16px;
  }

  .login-card h2 {
    font-size: 27px;
  }

  .login-mobile-logo {
    width: 176px;
    height: 53px;
    margin-bottom: 28px;
  }
}

/* ===== BUERA MOBILE DASHBOARD 20260805 ===== */

@media (max-width: 520px) {
  .topbar {
    min-height: 66px;
    padding: 8px 14px;
  }

  .brand-logo {
    width: 150px;
    height: 45px;
  }

  .navigation-button {
    min-height: 46px;
    padding: 0 15px;
  }

  .navigation-icon {
    font-size: 20px;
  }

  .main-navigation {
    padding: 0 10px 10px;
    gap: 2px;
  }

  .nav-direct,
  .nav-group-title {
    min-height: 40px;
    padding: 0 11px;
    font-size: 13px;
  }

  .nav-dropdown {
    margin: 0 0 4px 11px;
    padding-left: 9px;
  }

  .nav-dropdown a {
    padding: 8px 11px;
    font-size: 13px;
  }

  .content {
    padding: 18px 12px 30px;
  }

  .dashboard-panel {
    padding: 16px;
  }

  .dashboard-panel .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-bottom: 14px;
  }

  .dashboard-panel .panel-head h2 {
    font-size: 19px;
    line-height: 1.25;
  }

  .dashboard-panel .panel-head > a {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
  }

  .dashboard-panel .cards {
    gap: 10px;
    margin-top: 14px;
    margin-bottom: 14px;
  }

  .dashboard-panel .cards article {
    min-height: 78px;
    padding: 14px 16px;
    border-radius: 11px;
  }

  .dashboard-panel .cards article span {
    font-size: 11px;
  }

  .dashboard-panel .cards article strong {
    margin-top: 6px;
    font-size: 22px;
    line-height: 1.15;
  }

  .dashboard-panel + .dashboard-panel {
    margin-top: 18px;
  }

  .dashboard-panel .section-table-scroll {
    margin-right: -16px;
    margin-left: -16px;
  }
}

/* ============================================================
   AZIONI RATE E INCASSI
   ============================================================ */

.installment-actions {
  min-width: 185px;
  white-space: nowrap;
}

.installment-contract-link {
  display: inline-block;
  color: var(--buera-blue);
  font-weight: 650;
}

.installment-payment-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.installment-payment-primary {
  border-color: var(--buera-burgundy);
  background: var(--buera-burgundy);
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(112, 32, 58, 0.18);
}

.installment-payment-primary:hover {
  background: #70203a;
  color: #ffffff !important;
  box-shadow: 0 6px 14px rgba(112, 32, 58, 0.24);
  transform: translateY(-1px);
}

.installment-payment-secondary {
  border-color: #d9d1c5;
  background: #f7f4ee;
  color: var(--buera-blue) !important;
}

.installment-payment-secondary:hover {
  border-color: var(--buera-blue);
  background: #edf2f5;
}

@media (max-width: 720px) {
  .installment-actions {
    min-width: 200px;
  }

  .installment-payment-action {
    min-height: 46px;
    padding: 12px 14px;
  }
}
