/* Tipografia e base */
body {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background-color: #f7f8fb;
}

.text-secondary {
  color: #979da3 !important;
}

.card h2.text-secondary,
.card h3.text-secondary,
.card h2.text-uppercase.text-secondary,
.card h3.text-uppercase.text-secondary {
  color: #979da3 !important;
}

/* Navbar */
.navbar.navbar-custom {
  background-color: #f2f2f3;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.navbar-brand .brand-logo {
  height: 84px;
  width: auto;
  margin-left: 0.75rem;
}
@media (max-width: 575.98px) {
  .navbar-brand .brand-logo {
    height: 60px;
  }
}
.navbar-custom .nav-link {
  color: #243447;
}
.navbar-custom .nav-link.active {
  color: #0b2447;
  font-weight: 600;
}
.navbar-custom .navbar-toggler {
  border-color: rgba(36, 52, 71, 0.35);
}
.navbar-custom .navbar-toggler-icon {
  filter: invert(45%);
}

/* Sezione hero dashboard */
/* Card navigazione */
.dashboard-card {
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-radius: 1rem;
}
.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 1.25rem 2.5rem rgba(0, 0, 0, 0.12);
}
.dashboard-card .card-body {
  padding: 1.75rem 1.5rem;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
@media (min-width: 768px) {
  .dashboard-card .card-body {
    min-height: 200px;
  }
}

/* Icone card */
.icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.04);
  margin-bottom: 1rem;
}
.dashboard-icon {
  width: 34px;
  height: 34px;
}

/* Palette supporto */
.bg-primary-subtle { background-color: rgba(18, 61, 127, 0.12) !important; }
.bg-success-subtle { background-color: #e1f5e9 !important; }
.bg-warning-subtle { background-color: #fff4d6 !important; }
.text-primary { color: #0f2f6c !important; }

/* Sezioni legacy */
.quick-action {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.quick-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.65rem 1.5rem rgba(0, 0, 0, 0.15);
}

/* Componenti offerte/schede */
#offer-rows input,
#job-task-table input {
  min-width: 95px;
}
#job-task-table input[type="time"] {
  min-width: 75px;
}
#job-task-table [data-task-hours] {
  min-width: 54px;
  max-width: 72px;
}
.job-task-compact-table td,
.job-task-compact-table th {
  vertical-align: top;
  font-size: 0.72rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  line-height: 1.25;
}
.job-task-compact-table textarea {
  resize: vertical;
  min-height: 2.8rem;
  overflow-y: auto;
}
.job-task-compact-table [data-task-status] {
  min-width: 140px;
}
.job-task-compact-table .action-icon {
  transform: translateY(-1px);
}
.job-task-compact-table > :not(caption) > * > * {
  vertical-align: middle !important;
}
.job-task-compact-table td:nth-child(2) {
  padding-top: 0.5rem;
  padding-left: 0;
  text-align: left;
}
.job-task-text-cell {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
  font-size: 0.95rem;
  color: #112a46;
}
.job-task-description-static {
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background-color: #fff;
  border: 1px solid rgba(36, 52, 71, 0.18);
  border-radius: 0.65rem;
  padding: 0.45rem 0.65rem;
  margin: 0;
  color: inherit;
  min-height: 2.8rem;
  display: block;
}
.job-task-compact-table textarea,
.job-task-compact-table input,
.job-task-compact-table select {
  font-size: 0.95rem;
  padding: 0.5rem 0.65rem;
}
.job-task-compact-table--readonly td {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.job-task-compact-table--readonly .form-control,
.job-task-compact-table--readonly .form-select,
.job-task-compact-table--readonly textarea {
  background-color: #fff;
  border: 1px solid rgba(36, 52, 71, 0.18);
  color: #112a46;
  pointer-events: none;
  opacity: 1;
}
.job-task-compact-table--readonly textarea {
  resize: none;
  min-height: 2.8rem;
}
.card h2,
.card h3 {
  color: #0b2447;
}
.readonly-field {
  display: block;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid rgba(36, 52, 71, 0.18);
  border-radius: 0.65rem;
  background-color: #fff;
  min-height: calc(1.5em + 1.25rem);
  word-break: break-word;
}
.readonly-field .badge {
  margin-top: -0.1rem;
}
.readonly-field--richtext {
  min-height: 120px;
  background-color: #fff;
}
.readonly-field--richtext p,
.readonly-field--richtext ul,
.readonly-field--richtext ol {
  margin-bottom: 0.75rem;
}
.readonly-field--richtext p:first-of-type,
.readonly-field--richtext ul:first-of-type,
.readonly-field--richtext ol:first-of-type {
  margin-top: 0;
}
.readonly-field--richtext p:last-child,
.readonly-field--richtext ul:last-child,
.readonly-field--richtext ol:last-child {
  margin-bottom: 0;
}
.offer-editor {
  min-height: 56px;
  max-height: 320px;
  overflow-y: auto;
}
.offer-editor:focus {
  outline: none;
  box-shadow: 0 0 0 0.25rem rgba(13, 138, 67, 0.25);
}
.intro-highlight {
  background-color: #dff4d8;
  color: #117a37;
  padding: 0 0.15rem;
  border-radius: 0.15rem;
}
.offer-row-vat,
.offer-row-total {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.table-header-sm th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.status-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background-color: #6c8bef;
}
.draft-dot { background-color: #6c8bef; }
.sent-dot { background-color: #2fb8ff; }
.approved-dot { background-color: #22c55e; }
.replaced-dot { background-color: #f59e0b; }
.rejected-dot { background-color: #ef4444; }
.job-dot-planning { background-color: #fbbf24; }
.job-dot-in-progress { background-color: #2563eb; }
.job-dot-paused { background-color: #64748b; }
.job-dot-completed { background-color: #22c55e; }
.job-dot-archived { background-color: #1f2937; }

.offer-row-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.offer-row-card {
  border: 1px solid rgba(36, 52, 71, 0.12);
  border-radius: 0.85rem;
  padding: 1.25rem;
  background-color: #fff;
}

.offer-row-toolbar .btn {
  font-size: 0.75rem;
}

.offer-conditions-card {
  border: 1px solid rgba(36, 52, 71, 0.12);
  border-radius: 0.85rem;
  background-color: #fff;
  padding: 1.5rem;
}
.offer-conditions-card h2 {
  color: #88c83c;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.offer-conditions-table {
  width: 100%;
  border-collapse: collapse;
}
.offer-conditions-table th,
.offer-conditions-table td {
  border: 1px solid rgba(36, 52, 71, 0.12);
  padding: 0.75rem 0.9rem;
  vertical-align: middle;
  font-size: 0.95rem;
}
.offer-conditions-table th {
  width: 40%;
  font-weight: 600;
  color: #112a46;
  background-color: #f4f7f5;
  text-transform: uppercase;
  font-size: 0.8rem;
}
.offer-conditions-table input.form-control,
.offer-conditions-table textarea.form-control {
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
  resize: none;
  overflow: hidden;
  min-height: 2rem;
  font-size: 0.95rem;
}
.offer-conditions-table input.form-control:focus,
.offer-conditions-table textarea.form-control:focus {
  box-shadow: none;
}

.offer-commercial-table-wrapper {
  border: 1px solid rgba(36, 52, 71, 0.12);
  border-radius: 0.85rem;
  background-color: #fff;
  padding: 1.25rem 1.5rem;
}
.offer-commercial-table {
  width: 100%;
  border-collapse: collapse;
}
.offer-commercial-table thead th {
  background-color: #88c83c;
  color: #fff;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  padding: 0.75rem;
  border: 1px solid rgba(36, 52, 71, 0.12);
}
.offer-commercial-th-qty {
  text-align: right;
}
.offer-commercial-th-price,
.offer-commercial-th-discount,
.offer-commercial-th-total {
  text-align: right;
}
.offer-commercial-table tbody td {
  border: 1px solid rgba(36, 52, 71, 0.12);
  padding: 0.85rem;
  vertical-align: top;
  background-color: #fff;
}
.offer-table-cell--qty {
  width: 90px;
  text-align: right;
}
.offer-table-cell--price,
.offer-table-cell--total {
  width: 160px;
}
.offer-table-cell--discount {
  width: 110px;
  text-align: right;
}
.offer-table-cell--price,
.offer-table-cell--total {
  text-align: right;
}
.offer-discount-group {
  max-width: 110px;
  margin-left: auto;
}
.offer-discount-input {
  text-align: right;
  min-width: 0;
}
.offer-row-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}
.offer-row-toolbar .btn {
  font-size: 0.75rem;
}
.offer-row-editor {
  border: 1px solid rgba(36, 52, 71, 0.18);
  border-radius: 0.65rem;
  min-height: 140px;
  padding: 0.75rem;
  background-color: #fff;
}
.offer-row-editor:focus {
  outline: none;
  box-shadow: 0 0 0 0.1rem rgba(136, 200, 60, 0.35);
}
.offer-table-cell--qty input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
.offer-table-cell--qty input[type="number"]::-webkit-outer-spin-button,
.offer-table-cell--qty input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.offer-row-total-value {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: #112a46;
}
.offer-row-actions {
  display: inline-flex;
  gap: 0.35rem;
  justify-content: flex-end;
}
.offer-commercial-summary {
  border-top: 1px solid rgba(36, 52, 71, 0.12);
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.offer-summary-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: #112a46;
}
.offer-summary-row--grand {
  font-weight: 600;
  font-size: 1.05rem;
}
.offer-summary-label {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: right;
  min-width: 160px;
}
.offer-summary-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 110px;
}

.offer-row-editor {
  min-height: 56px;
  max-height: 320px;
  overflow-y: auto;
}
.offer-row-input-group {
  min-width: 0;
}
.offer-row-input,
.offer-row-total-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 150px;
}
.offer-row-input .form-control {
  min-width: 140px;
}

.offer-row-fields .form-label,
.offer-row-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 600;
  color: #979da3;
  margin-bottom: 0.35rem;
}

.offer-row-value {
  display: inline-block;
  font-weight: 600;
  font-size: 1rem;
  color: #112a46;
}
.offer-row-discount {
  font-weight: 600;
  color: #112a46;
}

.offer-total-line {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 0.45rem;
  font-weight: 600;
}

.offer-total-line:last-child {
  margin-bottom: 0;
}

.offer-total-value {
  display: inline-block;
  min-width: 110px;
  text-align: right;
}

.offer-totals-box {
  border: 1px solid rgba(36, 52, 71, 0.12);
  border-radius: 0.85rem;
  padding: 1rem 1.25rem;
  background-color: #fff;
  min-width: 260px;
}

.offer-row-position {
  letter-spacing: 0.06em;
}

.offer-total-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
  color: #243447;
}

.offer-totals {
  display: flex;
  justify-content: flex-end;
}
@media (max-width: 991.98px) {
  .offer-totals { margin-right: 0; }
}

/* Fascia colorata sotto la navbar */
.section-strip {
  height: 4px;
  margin-bottom: 1.5rem;
}
.section-strip--dashboard { background-color: #173477; }
.section-strip--clients { background-color: #173477; }
.section-strip--offers { background-color: #2c8c55; }
.section-strip--jobs { background-color: #caa10b; }
/* Striscia colorata sotto l'header delle card */
.card-stripe {
  height: 6px;
  border-radius: 1rem 1rem 0 0;
}

.card-stripe--clients { background-color: #0f2f6c; }
.card-stripe--offers  { background-color: #2c8c55; }
.card-stripe--jobs    { background-color: #caa10b; }

/* Pulsanti quadrati con icona */
.card-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.card-action-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  font-size: 1.1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.65rem 1.5rem rgba(0, 0, 0, 0.15);
  text-decoration: none;
}

.card-action-btn.clients { background-color: #0f2f6c; }
.card-action-btn.offers  { background-color: #2c8c55; }
.card-action-btn.jobs    { background-color: #caa10b; }

/* Striscia colorata sotto l'header delle card */
.card-stripe {
  height: 6px;
  border-radius: 1rem 1rem 0 0;
}
.card-stripe--clients { background-color: #0f2f6c; }
.card-stripe--offers { background-color: #2c8c55; }
.card-stripe--jobs { background-color: #caa10b; }

/* Lista anagrafiche */
.table-card {
  border: 1px solid rgba(15, 52, 108, 0.12);
  border-radius: 1rem;
  overflow: hidden;
}
.table-card__header {
  background-color: rgba(15, 52, 108, 0.08);
  border-bottom: 1px solid rgba(15, 52, 108, 0.12);
}
.table-card__toolbar .form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #0f2f6c;
}
.table-card__toolbar .btn-outline-secondary {
  border-color: rgba(15, 52, 108, 0.25);
  color: #0f2f6c;
}
.table-card__toolbar .btn-outline-secondary:hover {
  background-color: #0f2f6c;
  color: #fff;
}
.table-card .badge.bg-primary { background-color: #0f2f6c !important; }
.table-card .btn-outline-primary { border-color: #0f2f6c; color: #0f2f6c; }
.table-card .btn-outline-primary:hover { background-color: #0f2f6c; color: #fff; }
.table-card .btn-outline-secondary { border-color: rgba(15, 52, 108, 0.35); }
.table-card .btn-outline-secondary:hover { background-color: rgba(15, 52, 108, 0.1); }
.table-card .btn-outline-danger {
  border-color: rgba(179, 38, 30, 0.4);
}
.table-card .btn-outline-danger:hover {
  background-color: rgba(179, 38, 30, 0.85);
  color: #fff;
}

.section-strip--dashboard { background-color: #173477; }
.section-strip--clients { background-color: #173477; }
.section-strip--offers { background-color: #2c8c55; }
.section-strip--jobs { background-color: #caa10b; }


 .action-icon {
  display: inline-flex;
  text-decoration: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.action-icon__glyph {
  width: 18px;
  height: 18px;
}
.action-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.5rem 1.4rem rgba(0, 0, 0, 0.12);
}
.action-icon--view {
  background-color: rgba(15, 52, 108, 0.12);
  color: #0f2f6c;
}
.action-icon--view:hover {
  background-color: #0f2f6c;
  color: #fff;
}
.action-icon--edit {
  background-color: rgba(95, 102, 116, 0.15);
  color: #5f6674;
}
.action-icon--edit:hover {
  background-color: #5f6674;
  color: #fff;
}
.action-icon--duplicate {
  background-color: rgba(44, 140, 85, 0.12);
  color: #2c8c55;
}
.action-icon--duplicate:hover {
  background-color: #2c8c55;
  color: #fff;
}
.action-icon--add {
  background-color: rgba(23, 52, 119, 0.12);
  color: #173477;
}
.action-icon--add:hover {
  background-color: #173477;
  color: #fff;
}
.offers-table__subject-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 420px;
  min-width: 0;
}
.offers-table__subject {
  flex: 1;
  min-width: 0;
}
.offers-table__subject--collapsible {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.offers-table__row--expanded .offers-table__subject--collapsible {
  white-space: normal;
}
.offers-table__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background-color: rgba(44, 140, 85, 0.12);
  color: #2c8c55;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.offers-table__toggle:hover,
.offers-table__toggle:focus {
  background-color: #2c8c55;
  color: #fff;
  outline: none;
}
.offers-table__toggle-icon {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}
.offers-table__row--expanded .offers-table__toggle-icon {
  transform: rotate(90deg);
}
.offers-table__status-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 170px;
}
.offers-table__status-select {
  flex: 1 1 auto;
  min-width: 0;
}
.offers-table__status-feedback {
  font-size: 0.7rem;
  margin-top: 0.3rem;
  min-height: 1em;
}
.offers-table__status-feedback--success {
  color: #2c8c55;
}
.offers-table__status-feedback--error {
  color: #b3261e;
}
.jobs-table__row {
  cursor: pointer;
}
.jobs-table__status-cell {
  vertical-align: middle !important;
}
.jobs-table__status-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.35rem;
  min-height: 100%;
}
.jobs-table__status-form {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: 160px;
  margin: 0;
}
.jobs-table__status-select {
  flex: 0 0 auto;
  min-width: 140px;
}
.jobs-table__status-feedback {
  font-size: 0.7rem;
  min-height: 1em;
  text-align: center;
  width: 100%;
}
.jobs-table__status-feedback--success {
  color: #2c8c55;
}
.jobs-table__status-feedback--error {
  color: #b3261e;
}
.job-offer-items-table tbody td {
  vertical-align: top;
}
.job-offer-items-table tbody tr:not(:last-child) td {
  border-bottom: 1px solid rgba(17, 42, 70, 0.08);
}
#offersStatusChart {
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
  display: block;
  margin: 0 auto;
}
#jobsStatusChart {
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  display: block;
  margin: 0 auto;
}
.status-summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.status-summary-item {
  display: flex;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #eef0f4;
}
.status-summary-item:last-child {
  border-bottom: none;
}
.status-summary-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  font-size: 0.95rem;
  color: #112a46;
  flex-wrap: wrap;
}
.status-summary-label .status-dot {
  margin-right: 0;
}
.status-count {
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 400;
}
.status-summary-total {
  font-size: 0.9rem;
  color: #495057;
  line-height: 1.2;
}
.action-icon--delete {
  background-color: rgba(179, 38, 30, 0.12);
  color: #b3261e;
}
.action-icon--delete:hover {
  background-color: #b3261e;
  color: #fff;
}
