/* ==========================================================================
   Калькулятор НДС (calculate-nds.html)
   Scoped under .nds to avoid leaking onto other pages.
   Uses site design tokens: glass cards, --p1/--p2 gradient, dark inputs.
   ========================================================================== */
.nds {
  padding: clamp(28px, 5vw, 56px) 0 8px;
}

/* Glass cards (calculator + article) */
.nds .card {
  padding: clamp(20px, 3vw, 32px);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.nds .card + .card {
  margin-top: clamp(18px, 3vw, 28px);
}

/* Calculator title */
.nds h1 {
  margin: 0 0 18px;
  font-weight: 800;
  line-height: 1.15;
  font-size: clamp(1.9rem, 4.4vw, 2.6rem);
  background: linear-gradient(135deg, #f8fafc, #cbd5e1);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Field labels (direct children of the calculator card) */
.nds .card > label {
  display: block;
  margin: 18px 0 8px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}

/* Operation mode: two segmented pills */
.nds .mode {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nds .mode label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, .45);
  color: var(--muted);
  cursor: pointer;
  font-size: .92rem;
  font-weight: 600;
  transition: border-color .25s ease, background .25s ease, color .25s ease;
}

.nds .mode label:hover {
  border-color: rgba(139, 92, 246, .4);
}

.nds .mode label:has(input:checked) {
  border-color: var(--p1);
  color: #fff;
  background: rgba(139, 92, 246, .16);
}

.nds .mode input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--p1);
  cursor: pointer;
}

/* Inputs and selects */
.nds #amount,
.nds .row input,
.nds .row select {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 15px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: rgba(15, 23, 42, .6);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.nds #amount {
  font-size: 1.15rem;
  font-weight: 600;
}

.nds #amount:focus,
.nds .row input:focus,
.nds .row select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
}

.nds .row select {
  appearance: none;
  cursor: pointer;
  padding-right: 42px;
  background: rgba(15, 23, 42, .6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 14px center;
}

.nds .row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.nds .row > div {
  flex: 1;
  min-width: 180px;
}

/* Hide number spinners */
.nds input[type="number"]::-webkit-outer-spin-button,
.nds input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.nds input[type="number"] {
  -moz-appearance: textfield;
}

/* Result panel */
.nds .result {
  margin-top: 24px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(139, 92, 246, .10), rgba(34, 211, 238, .05));
}

.nds .result > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 8px 2px;
}

.nds .result > div + div {
  border-top: 1px dashed rgba(255, 255, 255, .08);
}

.nds .result span:first-child {
  color: var(--muted);
  font-size: .92rem;
}

.nds .result span:last-child {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.nds .result .vat {
  color: var(--p2);
}

.nds .result .total {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.nds .result .total span:first-child {
  color: var(--text);
  font-weight: 700;
}

.nds .result .total span:last-child {
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 800;
  letter-spacing: -.02em;
  background: linear-gradient(135deg, var(--p1), var(--p2));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nds p {
  color: rgba(229, 231, 235, .78);
  font-size: .95rem;
  line-height: 1.7;
  margin: 10px 0 12px;
}

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

.nds strong {
  color: #fff;
  font-weight: 700;
}

/* Article card: headings, lists, table, FAQ */
.nds h2 {
  margin: 0 0 14px;
  font-weight: 800;
  line-height: 1.25;
  font-size: clamp(1.35rem, 2.8vw, 1.7rem);
  color: #f8fafc;
}

.nds h3 {
  margin: 22px 0 8px;
  font-weight: 700;
  line-height: 1.3;
  font-size: 1.04rem;
  color: #e2e8f0;
}

.nds ul,
.nds ol {
  margin: 4px 0 16px;
  padding-left: 24px;
}

.nds li {
  margin-bottom: 7px;
  line-height: 1.65;
}

.nds li::marker {
  color: var(--p2);
}

/* Table: horizontal scroll on narrow screens */
.nds table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0 18px;
  font-size: .9rem;
}

.nds th {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  padding: 10px 12px;
  background: rgba(255, 255, 255, .03);
  border-bottom: 1px solid var(--border);
}

.nds td {
  padding: 10px 12px;
  color: var(--text);
  vertical-align: top;
  line-height: 1.55;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}

.nds tr:last-child td {
  border-bottom: 0;
}

/* FAQ accordion: uses the site-wide .faq__tab styles from main.css */
.nds .faq__tab-content p {
  margin: 0;
  font-size: .92rem;
}

@media (max-width: 720px) {
  .nds table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 560px;
  }
  .nds .mode label {
    min-width: 0;
  }
}
