/* AllCalc – calculator UI. Colours are CSS variables so the theme (or Settings → AllCalc) can override them. */
:root {
  --ac-primary: #0f766e;
  --ac-primary-ink: #ffffff;
  --ac-primary-soft: #e6f4f2;
  --ac-text: #1f2937;
  --ac-muted: #6b7280;
  --ac-border: #e5e7eb;
  --ac-bg: #ffffff;
  --ac-bg-soft: #f8fafc;
  --ac-error: #b91c1c;
  --ac-warn-bg: #fff7ed;
  --ac-radius: 14px;
  --ac-c1: #0f766e; --ac-c2: #f59e0b; --ac-c3: #6366f1; --ac-c4: #ef4444; --ac-c5: #10b981; --ac-c6: #8b5cf6;
}

.allcalc { color: var(--ac-text); font-size: 16px; line-height: 1.5; margin: 0 0 2rem; }
.allcalc *, .allcalc *::before, .allcalc *::after { box-sizing: border-box; }
.allcalc .ac-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ac-card { background: var(--ac-bg); border: 1px solid var(--ac-border); border-radius: var(--ac-radius); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(15,23,42,.06); overflow: hidden; overflow: clip; }
.ac-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--ac-border); background: var(--ac-bg-soft); }
.ac-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-mode { appearance: none; border: 1px solid var(--ac-border); background: var(--ac-bg); color: var(--ac-text); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; cursor: pointer; line-height: 1.3; }
.ac-mode:hover { border-color: var(--ac-primary); }
.ac-mode.is-active { background: var(--ac-primary); border-color: var(--ac-primary); color: var(--ac-primary-ink); }
.ac-tools { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.ac-toggle { display: inline-flex; border: 1px solid var(--ac-border); border-radius: 999px; overflow: hidden; background: var(--ac-bg); }
.ac-toggle button { appearance: none; border: 0; background: transparent; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ac-muted); }
.ac-toggle button.is-active { background: var(--ac-primary-soft); color: var(--ac-primary); font-weight: 600; }
.ac-cur select { border: 1px solid var(--ac-border); border-radius: 999px; padding: 6px 10px; font: inherit; font-size: 13px; background: var(--ac-bg); }

.ac-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ac-body.ac-custom-body { display: block; }
@media (max-width: 860px) { .ac-body { grid-template-columns: 1fr; } }
.ac-form { padding: 20px; border-right: 1px solid var(--ac-border); }
@media (max-width: 860px) { .ac-form { border-right: 0; border-bottom: 1px solid var(--ac-border); } }
.ac-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 12px; }
.ac-field { grid-column: span 3; min-width: 0; }
.ac-field[hidden] { display: none; }
.ac-w-full { grid-column: span 6; }
.ac-w-third { grid-column: span 2; }
.ac-w-half { grid-column: span 3; }
@media (max-width: 520px) { .ac-w-half, .ac-w-third { grid-column: span 6; } }
.ac-field > label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px; color: var(--ac-text); }
.ac-help { display: block; color: var(--ac-muted); font-size: 12.5px; margin-top: 4px; }
.ac-input { display: flex; align-items: stretch; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.ac-input:focus-within { border-color: var(--ac-primary); box-shadow: 0 0 0 3px var(--ac-primary-soft); }
.ac-input input { flex: 1 1 auto; min-width: 0; border: 0 !important; outline: 0; padding: 10px 12px !important; font: inherit; background: transparent !important; box-shadow: none !important; margin: 0 !important; height: auto !important; color: var(--ac-text); }
.ac-pre, .ac-suf { display: flex; align-items: center; padding: 0 10px; background: var(--ac-bg-soft); color: var(--ac-muted); font-size: 14px; white-space: nowrap; }
.ac-pre { border-right: 1px solid var(--ac-border); }
.ac-suf { border-left: 1px solid var(--ac-border); }
.ac-unit { border: 0 !important; border-left: 1px solid var(--ac-border) !important; background: var(--ac-bg-soft) !important; padding: 0 8px !important; font: inherit; font-size: 14px; max-width: 45%; border-radius: 0 !important; height: auto !important; margin: 0 !important; }
.ac-form select:not(.ac-unit), .ac-form textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: 10px 12px; font: inherit; background: #fff; color: var(--ac-text); }
.ac-form select:focus, .ac-form textarea:focus { outline: 0; border-color: var(--ac-primary); box-shadow: 0 0 0 3px var(--ac-primary-soft); }
.ac-check { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; margin-top: 26px; }
.ac-note { font-size: 13px; color: var(--ac-muted); margin: 14px 0 0; }
.ac-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.ac-btn { appearance: none; border: 1px solid var(--ac-primary); background: var(--ac-primary); color: var(--ac-primary-ink); border-radius: 10px; padding: 10px 20px; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; line-height: 1.2; }
.ac-btn:hover { filter: brightness(1.08); }
.ac-btn-ghost { background: transparent; color: var(--ac-primary); border-color: var(--ac-border); font-weight: 500; }
.ac-btn-ghost:hover { border-color: var(--ac-primary); filter: none; }

.ac-out { padding: 20px; background: var(--ac-bg-soft); min-width: 0; }
.ac-empty { color: var(--ac-muted); font-size: 15px; padding: 24px 0; text-align: center; }
.ac-error { color: var(--ac-error); background: #fef2f2; border: 1px solid #fecaca; padding: 12px 14px; border-radius: 10px; font-size: 14.5px; }
.ac-warn { background: var(--ac-warn-bg); border: 1px solid #fed7aa; padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-top: 14px; }
.ac-main { background: var(--ac-bg); border: 1px solid var(--ac-border); border-left: 5px solid var(--ac-primary); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.ac-main-label { font-size: 13px; color: var(--ac-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.ac-main-value { font-size: clamp(26px, 4vw, 34px); font-weight: 700; color: var(--ac-primary); line-height: 1.2; word-break: break-word; margin-top: 2px; }
.ac-main-note { font-size: 14px; color: var(--ac-muted); margin-top: 4px; }
.ac-list { margin: 0 0 12px; background: var(--ac-bg); border: 1px solid var(--ac-border); border-radius: 12px; overflow: hidden; }
.ac-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 14px; border-top: 1px solid var(--ac-border); }
.ac-list > div:first-child { border-top: 0; }
.ac-list > div.ac-hl { background: var(--ac-primary-soft); }
.ac-list dt { color: var(--ac-muted); font-size: 14px; margin: 0; }
.ac-list dd { margin: 0; font-weight: 600; text-align: right; font-size: 15px; word-break: break-word; }
.ac-list dd small { display: block; font-weight: 400; color: var(--ac-muted); font-size: 12px; }
.ac-steps { background: var(--ac-bg); border: 1px solid var(--ac-border); border-radius: 12px; padding: 10px 14px; margin: 12px 0; }
.ac-steps summary { cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--ac-text); }
.ac-steps ol { margin: 10px 0 4px 1.2em; padding: 0; font-size: 14.5px; }
.ac-steps li { margin: 0 0 6px; }
.ac-steps code, .ac-result code { background: var(--ac-bg-soft); padding: 1px 5px; border-radius: 4px; font-size: 13.5px; }
.ac-extra { margin: 0 0 12px; font-size: 14.5px; }
.ac-out-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ac-out-actions .ac-btn { padding: 7px 12px; font-size: 13.5px; }

.ac-table-wrap { margin: 12px 0; }
.ac-table-cap { font-weight: 600; font-size: 14px; margin: 0 0 6px; }
.ac-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ac-table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--ac-bg); border: 1px solid var(--ac-border); border-radius: 10px; }
.ac-table th { background: var(--ac-bg-soft); text-align: left; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--ac-border); white-space: nowrap; }
.ac-table td { padding: 7px 10px; border-top: 1px solid var(--ac-border); white-space: nowrap; }
.ac-table tr.ac-hl td { background: var(--ac-primary-soft); font-weight: 600; }
.ac-table-wrap .ac-btn { margin-top: 8px; padding: 6px 12px; font-size: 13px; }

.ac-rows table { width: 100%; border-collapse: collapse; }
.ac-rows th { font-size: 12.5px; text-align: left; color: var(--ac-muted); font-weight: 600; padding: 0 4px 4px; }
.ac-rows td { padding: 3px 4px; }
.ac-rows td input, .ac-rows td select { width: 100%; min-width: 70px; border: 1px solid #cbd5e1 !important; border-radius: 8px !important; padding: 7px 8px !important; font: inherit; font-size: 14px; background: #fff; margin: 0 !important; height: auto !important; }
.ac-row-del { appearance: none; border: 0; background: transparent; color: var(--ac-muted); font-size: 20px; cursor: pointer; padding: 0 6px; line-height: 1; }
.ac-row-del:hover { color: var(--ac-error); }
.ac-rows .ac-btn { margin-top: 6px; padding: 6px 12px; font-size: 13.5px; }

.ac-chart { background: var(--ac-bg); border: 1px solid var(--ac-border); border-radius: 12px; padding: 12px; margin: 12px 0; }
.ac-chart svg { width: 100%; height: auto; display: block; }
.ac-chart-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.ac-donut { display: flex; align-items: center; gap: 16px; }
.ac-donut svg { width: 140px; flex: 0 0 140px; }
@media (max-width: 420px) { .ac-donut { flex-direction: column; } }
.ac-legend { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.ac-legend li { display: flex; align-items: center; gap: 6px; margin: 3px 0; flex-wrap: wrap; }
.ac-legend li i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex: 0 0 11px; }
.ac-legend li span { color: var(--ac-muted); }
.ac-legend-row { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; margin-top: 6px; }
.ac-grid-line, .ac-grid { stroke: var(--ac-border); stroke-width: 1; }
.ac-axis { font-size: 11px; fill: var(--ac-muted); }
.ac-needle { stroke: var(--ac-text); stroke-width: 4; stroke-linecap: round; }
.ac-needle-hub { fill: var(--ac-text); }

/* Custom UIs */
.ac-sci { padding: 16px; max-width: 560px; margin: 0 auto; }
.ac-sci-screen { background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 12px 14px; text-align: right; margin-bottom: 12px; min-height: 86px; }
.ac-sci-expr { font-size: 15px; color: #94a3b8; min-height: 22px; word-break: break-all; }
.ac-sci-val { font-size: 32px; font-weight: 700; word-break: break-all; }
.ac-sci-keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ac-sci-keys button { appearance: none; border: 1px solid var(--ac-border); background: var(--ac-bg); border-radius: 10px; padding: 11px 0; font: inherit; font-size: 15px; cursor: pointer; color: var(--ac-text); }
.ac-sci-keys button:hover { border-color: var(--ac-primary); }
.ac-sci-keys .k-num { background: var(--ac-bg-soft); font-weight: 600; }
.ac-sci-keys .k-op { color: var(--ac-primary); font-weight: 700; }
.ac-sci-keys .k-eq { background: var(--ac-primary); color: var(--ac-primary-ink); border-color: var(--ac-primary); font-weight: 700; }
.ac-sci-keys .k-fn { font-size: 13.5px; }
.ac-sci-keys .is-on { background: var(--ac-primary-soft); color: var(--ac-primary); border-color: var(--ac-primary); }
.ac-sci-hist { font-size: 13px; color: var(--ac-muted); margin-top: 10px; max-height: 120px; overflow: auto; }
.ac-sci-hist div { cursor: pointer; padding: 2px 0; }

/* ------- Directory, group grid, related, breadcrumbs, search ------- */
.ac-dir-search, .ac-quick { position: relative; max-width: 640px; margin: 0 auto 28px; }
.ac-dir-search input, .ac-quick input { width: 100%; border: 2px solid var(--ac-border); border-radius: 999px; padding: 14px 20px 14px 48px !important; font-size: 17px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%236b7280' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 18px center; outline: 0; }
.ac-dir-search input:focus, .ac-quick input:focus { border-color: var(--ac-primary); }
.ac-quick-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--ac-border); border-radius: 14px; box-shadow: 0 12px 32px rgba(15,23,42,.14); list-style: none; margin: 0; padding: 6px; z-index: 50; max-height: 360px; overflow: auto; }
.ac-quick-list[hidden] { display: none; }
.ac-quick-list a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ac-text); }
.ac-quick-list a:hover, .ac-quick-list a.is-active { background: var(--ac-primary-soft); }
.ac-quick-list small { color: var(--ac-muted); }
.ac-dir-group { margin: 0 0 34px; }
.ac-dir-group[hidden], .ac-dir-group li[hidden] { display: none; }
.ac-dir-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ac-dir-head h2 { margin: 0; font-size: 22px; }
.ac-dir-head a { margin-left: auto; font-size: 14px; }
.ac-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; background: var(--ac-primary-soft); color: var(--ac-primary); font-size: 20px; }
.ac-dir-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.ac-dir-list a { display: block; padding: 10px 14px; border: 1px solid var(--ac-border); border-radius: 10px; text-decoration: none; color: var(--ac-text); background: #fff; font-size: 15px; transition: border-color .15s, transform .15s; }
.ac-dir-list a:hover { border-color: var(--ac-primary); color: var(--ac-primary); transform: translateY(-1px); }
.ac-noresults { text-align: center; color: var(--ac-muted); }
.ac-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 0 0 32px; }
.ac-group-card { display: block; border: 1px solid var(--ac-border); border-radius: var(--ac-radius); padding: 18px; background: #fff; text-decoration: none !important; color: var(--ac-text) !important; transition: box-shadow .15s, border-color .15s; }
.ac-group-card:hover { border-color: var(--ac-primary); box-shadow: 0 10px 28px rgba(15,23,42,.08); }
.ac-group-card .ac-icon { margin-bottom: 10px; }
.ac-group-card h3 { margin: 0 0 4px; font-size: 18px; }
.ac-group-card p { margin: 0 0 8px; font-size: 14px; color: var(--ac-muted); }
.ac-group-card span.ac-count { font-size: 13px; font-weight: 600; color: var(--ac-primary); }
.ac-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 0 0 28px; }
.ac-calc-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--ac-border); border-radius: 12px; padding: 14px; background: #fff; text-decoration: none !important; color: var(--ac-text) !important; }
.ac-calc-card:hover { border-color: var(--ac-primary); }
.ac-calc-card .ac-icon { width: 36px; height: 36px; flex-basis: 36px; font-size: 17px; border-radius: 10px; }
.ac-calc-card b { display: block; font-size: 15px; }
.ac-calc-card small { color: var(--ac-muted); font-size: 13px; line-height: 1.4; display: block; margin-top: 2px; }
.ac-related { margin: 32px 0; }
.ac-related h2 { font-size: 20px; margin: 0 0 12px; }
.ac-crumbs { font-size: 14px; color: var(--ac-muted); margin: 0 0 12px; }
.ac-crumbs a { color: var(--ac-muted); text-decoration: none; }
.ac-crumbs a:hover { color: var(--ac-primary); }
.ac-crumbs span { margin: 0 6px; }
.ac-intro { font-size: 17px; color: var(--ac-muted); margin: 0 0 18px; }
.ac-custom-body .ac-out { display: none; }
.ac-custom-body .ac-form { border: 0; padding: 0; }
.ac-gauge svg { max-width: 340px; margin: 0 auto; }
@media (min-width: 861px) { .ac-body:not(.ac-custom-body) .ac-form { position: sticky; top: 90px; align-self: start; } }
.ac-quick .screen-reader-text, .ac-dir-search .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }

/* ---------- Right-to-left languages (Arabic, Urdu …): WordPress sets <html dir="rtl"> ---------- */
[dir="rtl"] .ac-form { border-right: 0; border-left: 1px solid var(--ac-border); }
@media (max-width: 860px) { [dir="rtl"] .ac-form { border-left: 0; } }
[dir="rtl"] .ac-pre { border-right: 0; border-left: 1px solid var(--ac-border); }
[dir="rtl"] .ac-suf { border-left: 0; border-right: 1px solid var(--ac-border); }
[dir="rtl"] .ac-unit { border-left: 0 !important; border-right: 1px solid var(--ac-border) !important; }
[dir="rtl"] .ac-tools { margin-left: 0; margin-right: auto; }
[dir="rtl"] .ac-main { border-left: 1px solid var(--ac-border); border-right: 5px solid var(--ac-primary); }
[dir="rtl"] .ac-list dd { text-align: left; }
[dir="rtl"] .ac-steps ol { margin: 10px 1.2em 4px 0; }
[dir="rtl"] .ac-table th, [dir="rtl"] .ac-rows th { text-align: right; }
[dir="rtl"] .ac-dir-head a { margin-left: 0; margin-right: auto; }
[dir="rtl"] .ac-dir-search input, [dir="rtl"] .ac-quick input { padding: 14px 48px 14px 20px !important; background-position: calc(100% - 18px) center; }
[dir="rtl"] .ac-main-value, [dir="rtl"] .ac-list dd, [dir="rtl"] .ac-table td { unicode-bidi: plaintext; }
[dir="rtl"] .ac-sci-screen, [dir="rtl"] .ac-sci-keys { direction: ltr; }

/* ---------- Block themes (Twenty Twenty-Four/Five etc.): give calculators the theme's wide width
   instead of the narrow text column. Guide text keeps the normal reading width. ---------- */
.is-layout-constrained > .allcalc,
.is-layout-constrained > .ac-related,
.is-layout-constrained > .ac-crumbs,
.is-layout-constrained > .ac-groups,
.is-layout-constrained > .ac-cards,
.is-layout-constrained > .ac-directory,
.is-layout-constrained > .ac-intro {
  max-width: var(--wp--style--global--wide-size, 1200px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.ac-draft { display: inline-block; font-style: normal; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #92400e; background: #fef3c7; border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
