.tool-main {
  padding-bottom: 64px;
}

.tool-shell {
  display: grid;
  gap: 18px;
  align-items: start;
}

.tool-header-ad {
  width: 100%;
  min-height: 250px;
  margin: 14px 0 18px;
}

.tool-header-ad .adsbygoogle {
  width: 100%;
  min-height: 250px;
}

.tool-heading {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.tool-heading h1 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

.tool-heading p:last-child {
  margin-bottom: 0;
}

.tool-card,
.guide-section,
.privacy-note,
.result-box,
.document-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.tool-card {
  padding: 14px;
}

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

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 720;
}

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

.field input,
.field textarea,
.field select,
.items-table input,
.items-table select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.items-table input:focus,
.items-table select:focus {
  outline: 3px solid #bfdbfe;
  border-color: var(--accent);
}

.checkbox-field {
  align-content: end;
}

.checkbox-field input {
  width: auto;
  justify-self: start;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-actions .button {
  min-width: 132px;
}

.tool-message {
  min-height: 22px;
  color: var(--success);
  font-size: 0.9rem;
  font-weight: 700;
}

.tool-message.is-error {
  color: var(--error);
}

.privacy-note {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  padding: 12px;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.privacy-note span {
  color: #166534;
  font-size: 0.9rem;
}


.tool-ad-column .ad-box {
  width: 100%;
  min-height: 250px;
  margin-top: 0;
}

.tool-ad-column .ad-box .adsbygoogle {
  width: 100%;
  min-height: 250px;
}

.content-grid {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.guide-section {
  padding: 16px;
}

.guide-section h2 {
  margin-bottom: 10px;
}

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

.guide-section ol,
.guide-section ul {
  margin-bottom: 0;
}

.faq-section details {
  border-top: 1px solid var(--border);
  padding: 10px 0;
}

.faq-section details:first-of-type {
  border-top: 0;
}

.faq-section summary {
  cursor: pointer;
  font-weight: 750;
}

.faq-section p {
  margin: 8px 0 0;
}

.author-box a {
  font-weight: 750;
}

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

.inline-link-list li {
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.inline-link-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.inline-link-list a {
  font-weight: 750;
}

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

.related-tools {
  margin-top: 28px;
}

.related-tools h2 {
  margin-bottom: 12px;
}

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

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

.items-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.items-table th,
.items-table td {
  padding: 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.items-table th {
  color: var(--muted);
  font-size: 0.82rem;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.option-row legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 750;
}

.notice,
.upgrade-notice {
  margin: 0;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  background: #fffbeb;
  padding: 12px;
  color: #92400e;
}

.upgrade-notice p {
  margin: 6px 0 0;
  color: #92400e;
}

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

.stats-grid span {
  display: grid;
  gap: 2px;
  min-height: 66px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.stats-grid strong {
  color: var(--text);
  font-size: 1rem;
}

.result-box,
.document-preview {
  min-height: 64px;
  margin-top: 14px;
  padding: 14px;
}

.document-preview {
  overflow-x: auto;
}

.document-preview h2,
.document-preview h3 {
  margin-bottom: 6px;
}

.document-preview .doc-head {
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.document-preview .doc-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.document-preview th,
.document-preview td {
  padding: 7px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.canvas-panel {
  display: grid;
  place-items: center;
  min-height: 240px;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  overflow: hidden;
}

.canvas-panel canvas {
  width: min(100%, 360px);
  height: auto;
}

@media (min-width: 720px) {
  .tool-heading h1 {
    font-size: 2rem;
  }

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

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

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

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

@media (min-width: 980px) {
  .tool-shell {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .tool-ad-column {
    position: sticky;
    top: 78px;
  }

  .tool-header-ad {
    width: 100%;
    min-height: 250px;
    margin: 16px 0 22px;
  }

  .tool-header-ad .adsbygoogle {
    width: 100%;
    min-height: 250px;
  }
}
