.tools-grid {
  display: grid;
  gap: 0;
}

.tools-card {
  display: grid;
  gap: 20px;
}

.tools-card-body h3 {
  margin: 0 0 12px;
  font-size: 1.4rem;
  line-height: 1.45;
}

.tools-card-body p {
  margin: 0 0 14px;
  padding-bottom: 0 !important;
}

.tools-card-body p:last-of-type {
  margin-bottom: 10px;
}

.tools-card-label {
  margin: 0 0 10px;
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tools-group-heading {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 58px;
  margin: 0 0 18px;
  padding: 14px 20px;
  border-left: 5px solid var(--color-primary);
  border-radius: 0 18px 18px 0;
  background: linear-gradient(90deg, rgba(239, 246, 253, 0.98) 0%, rgba(248, 251, 255, 0.92) 100%);
  color: var(--color-text);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 700;
  line-height: 1.5;
  box-shadow: 0 14px 30px rgba(15, 62, 103, 0.05);
}

.tool-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.tool-breadcrumbs a {
  color: var(--color-primary);
  text-decoration: none;
}

.tool-breadcrumbs a:hover,
.tool-breadcrumbs a:focus-visible {
  text-decoration: underline;
}

.tool-page-hero-wide {
  margin-bottom: 24px;
}

.tool-page-hero-wide p:last-child {
  margin-bottom: 0;
}

.invoice-tool-simple {
  min-width: 0;
}

.invoice-group {
  margin-top: 30px;
}

.invoice-group:first-of-type {
  margin-top: 0;
}

.invoice-group-head {
  margin-bottom: 14px;
}

.invoice-group-head h3 {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 10px 16px;
  border-left: 4px solid var(--color-primary);
  border-radius: 0 14px 14px 0;
  background: rgba(239, 246, 253, 0.92);
  font-size: 1.18rem;
  line-height: 1.5;
}

.invoice-group-last {
  margin-top: 26px;
}

.invoice-form-stack {
  display: grid;
  gap: 16px;
}

.invoice-form-stack-spaced {
  margin-top: 20px;
}

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

.invoice-field {
  display: grid;
  gap: 8px;
}

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

.invoice-field label {
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
}

.invoice-field input,
.invoice-field textarea,
.invoice-field select {
  width: 100%;
  min-height: 52px;
  padding: 13px 15px;
  border: 1px solid rgba(214, 227, 238, 0.96);
  border-radius: 14px;
  background: #fff;
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.6;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.invoice-field textarea {
  min-height: 120px;
  resize: vertical;
}

.invoice-field input:focus,
.invoice-field textarea:focus,
.invoice-field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(13, 118, 199, 0.12);
}

.invoice-items-section {
  margin-top: 30px;
}

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

.invoice-items-header h3 {
  margin: 0;
  font-size: 1.12rem;
}

.invoice-items-header h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.invoice-items-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.invoice-items-footer .button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

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

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.invoice-items-table th,
.invoice-items-table td {
  padding: 14px 8px;
  border-bottom: 1px solid rgba(214, 227, 238, 0.92);
  vertical-align: middle;
  text-align: left;
}

.invoice-items-table th {
  color: var(--color-text);
  font-size: 0.92rem;
  font-weight: 700;
}

.invoice-items-table td input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(214, 227, 238, 0.96);
  border-radius: 12px;
  background: #fff;
  color: var(--color-text);
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.invoice-items-table td input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(13, 118, 199, 0.12);
}

.invoice-items-table th:nth-child(1),
.invoice-items-table td:nth-child(1) {
  width: auto;
}

.invoice-items-table th:nth-child(2),
.invoice-items-table td:nth-child(2) {
  width: 96px;
}

.invoice-items-table th:nth-child(3),
.invoice-items-table td:nth-child(3) {
  width: 120px;
}

.invoice-items-table th:nth-child(4),
.invoice-items-table td:nth-child(4) {
  width: 116px;
}

.invoice-items-table th:nth-child(5),
.invoice-items-table td:nth-child(5) {
  width: 64px;
  text-align: center;
}

.invoice-items-table td:nth-child(2) input,
.invoice-items-table td:nth-child(3) input {
  max-width: 100%;
  padding-left: 10px;
  padding-right: 10px;
}

.invoice-item-total {
  display: inline-block;
  min-width: 88px;
  color: var(--color-text);
  font-weight: 700;
}

.invoice-row-remove {
  border: 0;
  background: transparent;
  color: #7a8fa7;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.invoice-row-remove:hover,
.invoice-row-remove:focus-visible {
  color: var(--color-primary);
}

.invoice-form-grid-bottom {
  margin-top: 24px;
}

.invoice-template-picker {
  margin-top: 6px;
}

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

.invoice-template-option {
  position: relative;
  display: flex;
  min-height: 112px;
  padding: 18px 18px 18px 52px;
  border: 1px solid rgba(214, 227, 238, 0.96);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.invoice-template-option::before {
  content: "";
  position: absolute;
  top: 22px;
  left: 18px;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(107, 133, 162, 0.7);
  border-radius: 50%;
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.invoice-template-option::after {
  content: "";
  position: absolute;
  top: 27px;
  left: 23px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.invoice-template-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.invoice-template-option span {
  display: grid;
  gap: 8px;
}

.invoice-template-option strong {
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.4;
}

.invoice-template-option small {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.invoice-template-option-alt {
  background: linear-gradient(180deg, #f7fbff 0%, #f0f6ff 100%);
}

.invoice-template-option:has(input:checked) {
  border-color: rgba(13, 118, 199, 0.32);
  box-shadow: 0 14px 30px rgba(15, 62, 103, 0.08);
  transform: translateY(-1px);
}

.invoice-template-option:has(input:checked)::before {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(13, 118, 199, 0.12);
}

.invoice-template-option:has(input:checked)::after {
  opacity: 1;
  transform: scale(1);
}

.invoice-template-option:hover,
.invoice-template-option:focus-within {
  border-color: rgba(13, 118, 199, 0.24);
  box-shadow: 0 14px 28px rgba(15, 62, 103, 0.06);
}

.invoice-theme-picker {
  margin-top: 26px;
}

.invoice-theme-picker-label {
  margin: 0 0 12px;
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
}

.invoice-theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.invoice-theme-option {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 76px;
  padding: 16px 18px 16px 52px;
  border: 1px solid rgba(214, 227, 238, 0.96);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.invoice-theme-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.invoice-theme-option span {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.invoice-theme-option::before {
  content: "";
  position: absolute;
  top: 28px;
  left: 18px;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(107, 133, 162, 0.7);
  border-radius: 50%;
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.invoice-theme-option::after {
  content: "";
  position: absolute;
  top: 33px;
  left: 23px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.invoice-theme-option-swatch {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(22, 49, 79, 0.08);
  flex: 0 0 auto;
}

.invoice-theme-option-charcoal {
  background: linear-gradient(180deg, #ffffff 0%, #f7f4ef 100%);
}

.invoice-theme-option-navy {
  background: linear-gradient(180deg, #ffffff 0%, #f2f7fd 100%);
}

.invoice-theme-option-green {
  background: linear-gradient(180deg, #ffffff 0%, #f1f7f2 100%);
}

.invoice-theme-option-wine {
  background: linear-gradient(180deg, #ffffff 0%, #f8f3f4 100%);
}

.invoice-theme-option-orange {
  background: linear-gradient(180deg, #ffffff 0%, #fbf4ec 100%);
}

.invoice-theme-option-black {
  background: linear-gradient(180deg, #ffffff 0%, #f2f3f5 100%);
}

.invoice-theme-option:has(input:checked) {
  transform: translateY(-1px);
  border-color: rgba(13, 118, 199, 0.32);
  box-shadow: 0 14px 30px rgba(15, 62, 103, 0.08);
}

.invoice-theme-option:has(input:checked)::before {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(13, 118, 199, 0.12);
}

.invoice-theme-option:has(input:checked)::after {
  opacity: 1;
  transform: scale(1);
}

.invoice-theme-option:hover,
.invoice-theme-option:focus-within {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 62, 103, 0.06);
}

.invoice-tool-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.invoice-tool-actions .button {
  min-width: 220px;
  min-height: 56px;
}

.invoice-tool-disclaimer {
  margin: 20px auto 0;
  padding-bottom: 0 !important;
  max-width: 680px;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  line-height: 1.8;
  text-align: center;
}

.invoice-advanced {
  margin-top: 28px;
  border: 1px solid rgba(214, 227, 238, 0.96);
  border-radius: 20px;
  background: rgba(249, 252, 255, 0.7);
}

.invoice-advanced summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

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

.invoice-advanced summary::after {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.invoice-advanced[open] summary::after {
  transform: rotate(225deg);
}

.invoice-advanced-body {
  padding: 0 18px 18px;
}

@media (max-width: 860px) {
  .tool-breadcrumbs {
    margin-bottom: 14px;
    font-size: 0.85rem;
  }

  .tool-page-hero-wide {
    margin-bottom: 18px;
  }

  .invoice-form-grid {
    grid-template-columns: 1fr;
  }

  .invoice-items-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .invoice-items-table {
    min-width: 620px;
  }

  .invoice-template-options {
    grid-template-columns: 1fr;
  }

  .invoice-template-option {
    min-height: 98px;
    padding: 16px 16px 16px 48px;
  }

  .invoice-items-header,
  .invoice-tool-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .invoice-items-footer {
    justify-content: stretch;
  }

  .invoice-items-footer .button {
    width: 100%;
  }

  .invoice-theme-options {
    grid-template-columns: 1fr;
  }

  .invoice-theme-option {
    width: 100%;
    min-height: 70px;
    padding: 14px 16px 14px 48px;
  }

  .invoice-items-header .button,
  .invoice-tool-actions .button {
    width: 100%;
  }

  .invoice-tool-actions .button {
    min-width: 0;
  }

  .invoice-tool-disclaimer {
    margin-top: 18px;
    padding-bottom: 0 !important;
    font-size: 0.76rem;
    text-align: left;
  }
}
