/* tools-shell.css — общая оболочка инструментов Serpmonn (как depreciation/fuel) */

.spn-tool {
  margin: 0;
  padding: 16px 12px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f3f4f6;
  color: #111827;
}

.spn-tool .ad-top-banner .mrg-tag {
  width: 100% !important;
  max-width: 800px !important;
  height: auto !important;
}

@media (max-width: 768px) {
  .spn-tool .ad-top-banner .mrg-tag {
    max-width: 320px !important;
  }
}

.spn-tool h1,
.spn-tool .tool-lead,
.spn-tool .tool-guide-card,
.spn-tool .ad-top-banner,
.spn-tool .calculator-container,
.spn-tool .history,
.spn-tool .conversion-history,
.spn-tool .info-tips,
.spn-tool .results {
  max-width: 800px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.spn-tool .tool-guide-card {
  margin: 0 auto 14px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #dc3545;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.spn-tool .tool-guide-card p {
  margin: 8px 0;
  color: #6b7280;
  font-size: 14px;
}

.spn-tool .tool-guide-card a {
  font-weight: 600;
  color: #dc3545;
  text-decoration: none;
}

.spn-tool .tool-guide-card a:hover {
  text-decoration: underline;
}

.spn-tool h1 {
  margin: 12px auto 10px;
  text-align: left;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  color: #111827;
}

.spn-tool .tool-lead {
  margin: 0 auto 12px;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
}

.spn-tool .calculator-container {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-top: 12px;
  margin-bottom: 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

.spn-tool .calculator-container h2 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  color: #111827;
  text-align: left;
}

.spn-tool .error-message {
  display: none;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.spn-tool .error-message:not(.hidden) {
  display: block;
}

.spn-tool .hidden {
  display: none !important;
}

.spn-tool .input-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.spn-tool .input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spn-tool label {
  font-size: 13px;
  color: #4b5563;
  font-weight: 600;
}

.spn-tool .input-group input,
.spn-tool .input-group select,
.spn-tool .input-group textarea,
.spn-tool textarea.tool-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px;
  background: #fff;
  color: #111827;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
  font-family: inherit;
}

.spn-tool textarea.tool-textarea {
  min-height: 220px;
  resize: vertical;
  margin-bottom: 14px;
}

.spn-tool .input-group input:focus,
.spn-tool .input-group select:focus,
.spn-tool textarea.tool-textarea:focus {
  outline: none;
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12);
}

.spn-tool .checkbox-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.spn-tool .checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #374151;
}

.spn-tool .checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #dc3545;
}

.spn-tool .checkbox-group label {
  font-weight: 500;
  color: #374151;
  margin: 0;
}

.spn-tool .action-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: flex-start;
  margin: 4px 0 14px;
  position: relative;
  z-index: 2;
}

.spn-tool .calculate-btn {
  flex: 1 1 auto;
  height: 44px;
  min-height: 44px;
  margin: 0;
  border: none;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(90deg, #dc3545, #ef4444);
  color: #fff;
  box-shadow: 0 6px 16px rgba(220, 53, 69, 0.28);
}

.spn-tool .calculate-btn:hover {
  background: linear-gradient(90deg, #b91c1c, #dc3545);
}

.spn-tool .calculate-btn:active {
  transform: scale(0.97);
}

.spn-tool .more-actions {
  flex: 0 0 120px;
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  height: 44px;
  box-sizing: border-box;
}

.spn-tool .more-actions > summary {
  list-style: none;
  cursor: pointer;
  height: 44px;
  line-height: 44px;
  padding: 0 14px;
  font-weight: 600;
  color: #6b7280;
  text-align: center;
  font-size: 14px;
  white-space: nowrap;
}

.spn-tool .more-actions > summary::-webkit-details-marker {
  display: none;
}

.spn-tool .more-actions__list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  z-index: 20;
}

.spn-tool .more-actions__list button {
  width: 100%;
  margin: 0;
  min-height: 40px;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #f9fafb;
  color: #111827;
  border: 1px solid #e5e7eb;
}

.spn-tool .more-actions__list button:hover {
  background: #f3f4f6;
}

.spn-tool .optional-fields {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}

.spn-tool .optional-fields > summary {
  cursor: pointer;
  font-weight: 600;
  color: #374151;
  list-style: none;
  padding: 4px 0;
  font-size: 14px;
}

.spn-tool .optional-fields > summary::-webkit-details-marker {
  display: none;
}

.spn-tool .optional-fields > summary::after {
  content: "▾";
  float: right;
  color: #9ca3af;
}

.spn-tool .optional-fields[open] > summary::after {
  content: "▴";
}

.spn-tool .results,
.spn-tool .history,
.spn-tool .conversion-history {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  margin-top: 14px;
}

.spn-tool .history,
.spn-tool .conversion-history {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.spn-tool .results h3,
.spn-tool .history h3,
.spn-tool .conversion-history h3 {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 600;
  color: #111827;
  text-align: left;
}

.spn-tool .result-hero {
  text-align: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
}

.spn-tool .result-hero .result-value,
.spn-tool .result-hero .out,
.spn-tool .result-hero .output {
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.spn-tool .result-disclaimer {
  margin: 0 0 12px;
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
}

.spn-tool .result-grid,
.spn-tool .stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.spn-tool .result-item,
.spn-tool .stats .card {
  text-align: center;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.spn-tool .result-value,
.spn-tool .stats .num {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.spn-tool .result-label,
.spn-tool .stats .label {
  color: #6b7280;
  font-size: 13px;
}

.spn-tool .category-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.spn-tool .category-btn {
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #4b5563;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.spn-tool .category-btn.active {
  border-color: #dc3545;
  background: linear-gradient(90deg, #dc3545, #ef4444);
  color: #fff;
}

.spn-tool .category-btn:hover:not(.active) {
  border-color: #dc3545;
  color: #dc3545;
}

.spn-tool .converter-form {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.spn-tool .swap-btn {
  height: 44px;
  width: 44px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
}

.spn-tool .swap-btn:hover {
  background: #f3f4f6;
}

.spn-tool .history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  color: #374151;
}

.spn-tool .history-item:last-child {
  border-bottom: none;
}

.spn-tool .history-time {
  color: #9ca3af;
  font-size: 12px;
  white-space: nowrap;
}

.spn-tool .clear-history {
  margin-top: 12px;
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
  font-weight: 600;
  cursor: pointer;
}

.spn-tool .clear-history:hover {
  background: #f3f4f6;
}

.spn-tool .formula-plain,
.spn-tool .result-line {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #374151;
  font-size: 14px;
  line-height: 1.45;
}

@media (max-width: 768px) {
  .spn-tool {
    padding: 12px;
  }

  .spn-tool .action-bar {
    flex-wrap: wrap;
  }

  .spn-tool .calculate-btn {
    flex: 1 1 calc(100% - 130px);
    min-width: 0;
  }

  .spn-tool .more-actions {
    flex: 0 0 110px;
  }

  .spn-tool .converter-form {
    grid-template-columns: 1fr;
  }

  .spn-tool .swap-btn {
    width: 100%;
  }

  .spn-tool .stats {
    grid-template-columns: 1fr 1fr;
  }
}
