/* Калькуляторы «Сколько можно отсутствовать»: форма-карточка, вердикт, шкала дней, поездки.
   Тот же виджет встраивается в статью, поэтому селекторы начинаются с .absc и перебивают .article-body
   (там свои отступы у p/li/a/img). Логические свойства — ради арабской версии. */

.absc {
  --absc-safe: #1f9d6c; --absc-safe-soft: #e3f4ec; --absc-safe-zone: #cbead9;
  --absc-caution: #d9770b; --absc-caution-soft: #fff1df; --absc-caution-zone: #fddcb2;
  --absc-permit: #2f6bd8; --absc-permit-soft: #e7eefc; --absc-permit-zone: #cbdaf7;
  --absc-danger: #d04a3d; --absc-danger-soft: #fce9e6; --absc-danger-zone: #f6c9c3;
  position: relative; margin: 0 0 24px; padding: 28px;
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 24px 60px -32px rgba(10,23,41,.28);
  color: var(--on-paper); font-family: var(--sans);
}
.absc *, .absc *::before, .absc *::after { box-sizing: border-box; }
.article-body .absc { margin: 2.2em 0; }
/* Только отступы: размер и цвет у каждого текста свои (иначе тёмный блок приложения получит тёмный текст) */
.article-body .absc p { margin: 0; }
.absc ol, .absc ul, .article-body .absc ol, .article-body .absc ul { margin: 0; padding: 0; }
.article-body .absc li { font-size: inherit; line-height: inherit; color: inherit; margin: 0; }
.article-body .absc a { text-decoration: none; color: inherit; }
.article-body .absc img { width: auto; height: auto; margin: 0; border-radius: 0; }
.absc fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }

/* Шапка блока в статье: тёмная полоса, чтобы калькулятор не выглядел частью текста */
.absc--embed { padding-top: 0; overflow: hidden; }
.absc-head {
  margin: 0 -28px 24px; padding: 24px 28px 22px;
  background: radial-gradient(120% 140% at 100% 0%, rgba(255,138,31,.22), transparent 55%), var(--navy);
  color: var(--ink);
}
.absc-eyebrow {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 9px;
  border-radius: 99px; background: rgba(255,138,31,.16); color: var(--accent);
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.absc-eyebrow svg { width: 15px; height: 15px; }
.article-body .absc .absc-title, .absc .absc-title {
  margin: 12px 0 6px; font-size: 24px; line-height: 1.25; font-weight: 800; letter-spacing: -.01em; color: var(--ink);
}
.article-body .absc .absc-sub, .absc .absc-sub { font-size: 15px; line-height: 1.55; color: var(--ink-dim); max-width: 60ch; }

/* Переключатель грин-карта ↔ ОАЭ над карточкой */
.absc-switch {
  display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 16px;
  background: var(--paper-2); border-radius: 99px; max-width: 100%; overflow-x: auto;
}
.absc-switch-item {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 99px; white-space: nowrap;
  font-size: 14px; font-weight: 700; color: var(--on-paper-dim); transition: background .2s, color .2s, box-shadow .2s;
}
.absc-switch-item:hover { color: var(--on-paper); }
.absc-switch-item.is-active { background: var(--card); color: var(--on-paper); box-shadow: 0 2px 10px -2px rgba(10,23,41,.18); }
.absc-switch-flag { font-size: 17px; line-height: 1; }

/* Форма */
.absc-form { display: grid; gap: 24px; }
.absc-step { display: grid; gap: 12px; }
.absc-step-title {
  display: flex; align-items: center; gap: 10px; padding: 0; margin: 0 0 2px;
  font-size: 16px; font-weight: 800; color: var(--on-paper);
}
.absc-step-num {
  display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--navy); color: var(--ink); font-family: var(--mono); font-size: 13px; font-weight: 700;
}
.article-body .absc .absc-hint, .absc .absc-hint { margin-top: -6px; font-size: 14px; line-height: 1.5; color: var(--on-paper-mute); }

.absc-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.absc-option { position: relative; display: block; cursor: pointer; }
.absc-option input { position: absolute; opacity: 0; pointer-events: none; }
.absc-option-body {
  display: grid; gap: 3px; height: 100%; padding: 14px 16px 14px 44px;
  background: var(--paper); border: 1.5px solid transparent; border-radius: 14px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
[dir='rtl'] .absc-option-body { padding: 14px 44px 14px 16px; }
.absc-option-body::before {
  content: ''; position: absolute; inset-block-start: 16px; inset-inline-start: 16px;
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--on-paper-mute); background: var(--card);
  transition: border-color .2s, box-shadow .2s;
}
.absc-option-body strong { font-size: 15px; font-weight: 700; color: var(--on-paper); }
.absc-option-body small { font-size: 13px; line-height: 1.4; color: var(--on-paper-mute); }
.absc-option:hover .absc-option-body { border-color: var(--line); }
.absc-option input:checked + .absc-option-body {
  background: var(--card); border-color: var(--navy); box-shadow: 0 6px 18px -10px rgba(10,23,41,.35);
}
.absc-option input:checked + .absc-option-body::before { border-color: var(--navy); box-shadow: inset 0 0 0 4px var(--card), inset 0 0 0 9px var(--navy); }
.absc-option input:focus-visible + .absc-option-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.absc-reveal[hidden] { display: none; }
.absc-reveal { max-width: 320px; }

.absc-trips { display: grid; gap: 10px; }
.absc-trip {
  display: grid; grid-template-columns: 40px 1fr 1fr 40px; gap: 10px; align-items: end;
  padding: 12px; background: var(--paper); border-radius: 16px;
}
.absc-trip-icon {
  display: grid; place-items: center; width: 40px; height: 46px; border-radius: 12px;
  background: var(--card); color: var(--accent-deep);
}
.absc-trip-icon svg { width: 20px; height: 20px; }
[dir='rtl'] .absc-trip-icon svg { transform: scaleX(-1); }
.absc .tool-date-button { background: var(--card); }
.absc-back { position: relative; min-width: 0; }
.absc-clear {
  position: absolute; inset-block-end: 9px; inset-inline-end: 40px; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 8px; cursor: pointer; background: var(--paper-2);
  font-size: 18px; line-height: 1; color: var(--on-paper-dim);
}
.absc-clear[hidden] { display: none; }
.absc-clear:hover { color: var(--on-paper); }
.absc-remove {
  display: grid; place-items: center; width: 40px; height: 46px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--on-paper-mute);
  transition: color .2s, border-color .2s;
}
.absc-remove:hover { color: var(--negative); border-color: var(--negative); }
.absc-remove[hidden] { visibility: hidden; display: grid; }
.absc-remove svg { width: 18px; height: 18px; }
.absc-add {
  display: inline-flex; align-items: center; gap: 8px; justify-self: start; padding: 9px 14px;
  border: 1.5px dashed rgba(226,106,8,.45); border-radius: 12px; cursor: pointer; background: none;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--accent-deep); transition: background .2s;
}
.absc-add:hover { background: rgba(255,138,31,.08); }
.absc-add svg { width: 16px; height: 16px; }

.absc-submit-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end;
  padding-top: 20px; border-top: 1px solid var(--line-soft);
}
.absc-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 12px 26px;
  border: 0; border-radius: 14px; cursor: pointer; background: var(--navy); color: var(--ink);
  font: inherit; font-size: 16px; font-weight: 800; letter-spacing: -.005em;
  box-shadow: 0 12px 26px -14px rgba(10,23,41,.7); transition: background .2s, transform .2s;
}
.absc-submit:hover { background: var(--navy-3); transform: translateY(-1px); }
.absc-submit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.absc-submit svg { width: 18px; height: 18px; color: var(--accent); }
[dir='rtl'] .absc-submit svg { transform: scaleX(-1); }

/* ─── Результат ─── */
.absc-result { margin-top: 22px; }
.absc-result[hidden] { display: none; }
.absr { --state: var(--absc-safe); --state-soft: var(--absc-safe-soft); display: grid; gap: 18px; animation: absr-in .45s ease both; }
.absr[data-state='caution'] { --state: var(--absc-caution); --state-soft: var(--absc-caution-soft); }
.absr[data-state='permit'] { --state: var(--absc-permit); --state-soft: var(--absc-permit-soft); }
.absr[data-state='danger'] { --state: var(--absc-danger); --state-soft: var(--absc-danger-soft); }
.absr[data-state='error'] { --state: var(--accent-deep); --state-soft: #fff1df; }
@keyframes absr-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.absr-verdict {
  display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px;
  background: var(--state-soft); border-radius: 18px;
}
.absr-icon {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px;
  background: var(--state); color: #fff; box-shadow: 0 10px 20px -10px var(--state);
}
.absr-icon svg { width: 24px; height: 24px; }
.absr-verdict-text { min-width: 0; }
.absc .absr-title { font-size: 20px; line-height: 1.3; font-weight: 800; color: var(--on-paper); letter-spacing: -.01em; }
.absc .absr-text { margin-top: 4px; font-size: 15px; line-height: 1.55; color: var(--on-paper-dim); }

.absr-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.absr-stat {
  display: grid; align-content: start; gap: 4px; padding: 16px 18px;
  background: var(--paper); border-radius: 16px; min-width: 0;
}
.absr-stat-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--on-paper-mute); }
.absr-stat-value {
  font-family: var(--mono); font-size: 36px; line-height: 1.1; font-weight: 700; color: var(--on-paper);
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.absr-stat--caution .absr-stat-value, .absr-stat--safe .absr-stat-value,
.absr-stat--permit .absr-stat-value, .absr-stat--exempt .absr-stat-value { color: var(--state); }
.absr-stat--date .absr-stat-value { font-family: var(--sans); font-size: 22px; font-weight: 800; letter-spacing: -.01em; padding-top: 6px; }
.absr-stat-sub { font-size: 13px; color: var(--on-paper-mute); }

/* Шкала поездки */
.absr-track { padding: 18px 20px 6px; border: 1px solid var(--line); border-radius: 18px; }
.absr-track-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 34px; font-size: 13px; font-weight: 600; color: var(--on-paper-mute); }
.absr-bar { position: relative; height: 14px; border-radius: 99px; background: var(--absc-danger-zone); }
.absr-zone { position: absolute; inset-block: 0; }
.absr-zone:first-child { border-start-start-radius: 99px; border-end-start-radius: 99px; }
.absr-zone--safe, .absr-zone--exempt { background: var(--absc-safe-zone); }
.absr-zone--caution { background: var(--absc-caution-zone); }
.absr-zone--permit { background: var(--absc-permit-zone); }
.absr-zone--danger { background: var(--absc-danger-zone); border-start-end-radius: 99px; border-end-end-radius: 99px; }
.absr-fill {
  position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--absc-safe), var(--state));
  background-size: 100% 100%;
  transition: width .9s cubic-bezier(.22,1,.36,1);
}
[dir='rtl'] .absr-fill { background: linear-gradient(270deg, var(--absc-safe), var(--state)); }
.absr-fill::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px);
}
.absr-pin {
  position: absolute; inset-block-start: 50%; width: 22px; height: 22px; margin-inline-start: -11px; margin-top: -11px;
  border-radius: 50%; background: var(--card); border: 5px solid var(--state);
  box-shadow: 0 4px 12px -2px rgba(10,23,41,.35); transition: inset-inline-start .9s cubic-bezier(.22,1,.36,1);
}
.absr-pin-label {
  position: absolute; inset-block-end: calc(100% + 8px); inset-inline-start: 50%; transform: translateX(-50%);
  padding: 3px 9px; border-radius: 99px; background: var(--navy); color: var(--ink); white-space: nowrap;
  font-size: 12px; font-weight: 700;
}
[dir='rtl'] .absr-pin-label { transform: translateX(50%); }
.absr-tick { position: absolute; inset-block: -5px; width: 2px; margin-inline-start: -1px; background: var(--navy); opacity: .55; border-radius: 2px; }
.absr-ticks { position: relative; height: 46px; margin-top: 8px; }
.absr-ticks.has-low { height: 84px; }
.absr-tick-label {
  position: absolute; inset-block-start: 0; display: grid; gap: 1px; transform: translateX(-50%);
  font-size: 12px; line-height: 1.3; color: var(--on-paper-mute); white-space: nowrap; text-align: center;
}
.absr-tick-label.is-low { inset-block-start: 38px; }
.absr-tick-label.is-low::before {
  content: ''; position: absolute; inset-block-end: 100%; inset-inline-start: 50%; width: 1px; height: 34px;
  background: var(--line); transform: translateX(-50%);
}
.absr-tick-label strong { font-size: 12.5px; font-weight: 800; color: var(--on-paper); }
.absr-tick-label.is-end { transform: translateX(-100%); text-align: end; }
.absr-tick-label.is-start { transform: none; text-align: start; }
.absr-tick-label.is-end.is-low::before { inset-inline-start: auto; inset-inline-end: 0; transform: none; }
[dir='rtl'] .absr-tick-label { transform: translateX(50%); }
[dir='rtl'] .absr-tick-label.is-end { transform: translateX(100%); }
[dir='rtl'] .absr-tick-label.is-start { transform: none; }

/* Все поездки */
.absc .absr-section-title { font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--on-paper-mute); }
.absr-trips { display: grid; gap: 8px; }
.absr-trip {
  display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: var(--paper);
}
.absr-trip.is-focus { box-shadow: inset 0 0 0 1.5px var(--navy); background: var(--card); }
.absr-trip-meta { display: grid; min-width: 0; }
.absr-trip-name { font-size: 14px; font-weight: 800; }
.absr-trip-dates { font-size: 12.5px; color: var(--on-paper-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.absr-trip-bar { position: relative; height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.absr-trip-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 99px; }
.absr-trip-fill.absr-fill--safe, .absr-trip-fill.absr-fill--exempt { background: var(--absc-safe); }
.absr-trip-fill.absr-fill--caution { background: var(--absc-caution); }
.absr-trip-fill.absr-fill--permit { background: var(--absc-permit); }
.absr-trip-fill.absr-fill--danger { background: var(--absc-danger); }
.absr-trip-days { font-family: var(--mono); font-size: 15px; font-weight: 700; min-width: 3ch; text-align: end; }
.absr-chip { padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.absr-chip--safe, .absr-chip--exempt { background: var(--absc-safe-soft); color: var(--absc-safe); }
.absr-chip--caution { background: var(--absc-caution-soft); color: var(--absc-caution); }
.absr-chip--permit { background: var(--absc-permit-soft); color: var(--absc-permit); }
.absr-chip--danger { background: var(--absc-danger-soft); color: var(--absc-danger); }

/* Гражданство: дни вне США за 5 лет */
.absr-n400 { display: grid; gap: 10px; padding: 16px 18px; border-radius: 16px; background: var(--paper); }
.absr-n400-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.absr-n400-count { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--on-paper); white-space: nowrap; }
.absr-meter { height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.absr-meter-fill { display: block; height: 100%; border-radius: inherit; background: var(--navy); }
.absr-n400.is-over .absr-meter-fill { background: var(--absc-danger); }
.absc .absr-n400-text { font-size: 14px; line-height: 1.55; color: var(--on-paper-dim); }

/* Что делать */
.absr-steps { display: grid; gap: 10px; }
.absc .absr-steps-list { list-style: none; counter-reset: absr-step; display: grid; gap: 8px; }
.absc .absr-steps-list li {
  position: relative; counter-increment: absr-step; padding: 12px 14px; padding-inline-start: 48px;
  border-radius: 12px; background: var(--paper); font-size: 15px; line-height: 1.5; color: var(--on-paper-dim);
}
.absc .absr-steps-list li::before {
  content: counter(absr-step); position: absolute; inset-inline-start: 14px; inset-block-start: 12px;
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px;
  background: var(--state-soft); color: var(--state); font-family: var(--mono); font-size: 13px; font-weight: 700;
}

/* Блок приложения под результатом (классы .tool-result-cta — из tools.css) */
.absc-cta { margin-top: 20px; }
/* Под вердиктом внутри результата (residence-absence.js переносит блок туда после расчёта) */
.absr .absc-cta { margin: 16px 0 20px; }
.article-body .absc .tool-cta-title { font-size: 19px; font-weight: 800; line-height: 1.3; color: var(--ink); margin: 0 0 4px; }
.article-body .absc .tool-cta-sub { font-size: 14px; line-height: 1.55; color: var(--ink-dim); }
.article-body .absc .qr-panel-code { width: 168px; height: 168px; padding: 8px; border-radius: 12px; background: #fff; }
.article-body .absc .qr-panel-title { font-size: 17px; font-weight: 800; line-height: 1.3; color: var(--ink); margin: 0 0 6px; }
.article-body .absc .qr-panel-hint { font-size: 14px; line-height: 1.5; color: var(--ink-dim); margin: 0 0 10px; }
.article-body .absc .qr-panel-link { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: underline; }
.article-body .absc .store-btn { color: var(--ink); }
.absc-full {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 18px;
  font-size: 14px; font-weight: 700; color: var(--accent-deep);
}
.article-body .absc .absc-full { color: var(--accent-deep); }
.absc-full:hover { text-decoration: underline; text-underline-offset: 3px; }

.tool-sources { display: grid; gap: 6px; padding-inline-start: 1.2em; }

@media (max-width: 640px) {
  .absc { padding: 20px 16px; border-radius: 20px; }
  .absc--embed { padding-top: 0; }
  .absc-head { margin: 0 -16px 20px; padding: 20px 16px 18px; }
  .article-body .absc .absc-title, .absc .absc-title { font-size: 21px; }
  .absc-options { grid-template-columns: 1fr; }
  .absc-trip { grid-template-columns: 1fr 1fr 40px; padding: 10px; }
  .absc-trip-icon { display: none; }
  .absc-submit-row { grid-template-columns: 1fr; }
  .absc-submit { width: 100%; }
  .absr-verdict { padding: 16px; }
  .absr-stats { grid-template-columns: 1fr 1fr; }
  .absr-stat:first-child, .absr-stat:nth-child(2):last-child { grid-column: 1 / -1; }
  .absr-stat-value { font-size: 32px; }
  .absr-stat--date .absr-stat-value { font-size: 18px; }
  .absr-track { padding: 16px 14px 4px; }
  .absr-trip { grid-template-columns: minmax(0, 1fr) auto; }
  .absr-trip-bar { grid-column: 1 / -1; grid-row: 2; }
  .absr-trip-days { display: none; }
}
@media (max-width: 400px) {
  .absc-trip { grid-template-columns: 1fr 40px; }
  .absc-trip .tool-field:first-of-type { grid-column: 1 / -1; }
  .absc-back { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .absr, .absr-fill, .absr-pin { animation: none; transition: none; }
}
