/* whotool — lightweight, dependency-free stylesheet (light + dark themes, RTL aware) */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --border: #e2e7ef;
  --text: #1a2233;
  --muted: #5d6b82;
  --primary: #1f6feb;
  --primary-ink: #ffffff;
  --primary-soft: #e8f0fe;
  --ok: #138a4b;
  --ok-soft: #e4f6ec;
  --warn: #a96300;
  --warn-soft: #fff4dd;
  --danger: #c4302b;
  --danger-soft: #fdeaea;
  --info: #3b5bdb;
  --info-soft: #edf1ff;
  --code-bg: #0f1724;
  --code-text: #d7e1f3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #151b25; --surface-2: #1b2330; --border: #2a3444; --text: #e6ebf3; --muted: #9aa7bb;
    --primary: #4c8dff; --primary-soft: #16243d; --ok: #3fc07a; --ok-soft: #12291d; --warn: #f0b43c; --warn-soft: #2e2511;
    --danger: #ff6b66; --danger-soft: #331716; --info: #8ea6ff; --info-soft: #1a2140; --code-bg: #0a0e14;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #151b25; --surface-2: #1b2330; --border: #2a3444; --text: #e6ebf3; --muted: #9aa7bb;
  --primary: #4c8dff; --primary-soft: #16243d; --ok: #3fc07a; --ok-soft: #12291d; --warn: #f0b43c; --warn-soft: #2e2511;
  --danger: #ff6b66; --danger-soft: #331716; --info: #8ea6ff; --info-soft: #1a2140; --code-bg: #0a0e14;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { vertical-align: middle; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
code, pre, .mono { font-family: var(--mono); font-size: .9em; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 8px; top: -40px; background: var(--primary); color: var(--primary-ink); padding: 6px 12px; border-radius: 6px; z-index: 100; }
.skip-link:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; color: var(--text); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: .95rem; }
.main-nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.main-nav a { color: var(--muted); padding: 8px 10px; border-radius: 8px; white-space: nowrap; font-weight: 500; font-size: .92rem; }
.main-nav a:hover, .main-nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.icon-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; height: 36px; min-width: 36px; padding: 0 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: .9rem; }
.icon-btn:hover { border-color: var(--primary); }
.lang-switcher { position: relative; }
.lang-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; min-width: 200px; display: none; max-height: 70vh; overflow: auto; }
.lang-switcher.open .lang-menu { display: block; }
.lang-menu a { display: flex; justify-content: space-between; padding: 7px 10px; border-radius: 6px; color: var(--text); }
.lang-menu a:hover { background: var(--surface-2); text-decoration: none; }
.lang-menu a[aria-current="true"] { background: var(--primary-soft); font-weight: 600; }
.lang-menu small { color: var(--muted); text-transform: uppercase; }
.menu-toggle { display: none; }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: inline; }
:root[data-theme="dark"] .theme-icon-light { display: none; }

/* Search hero */
.hero { padding: 36px 0 20px; text-align: center; }
.hero p.lead { color: var(--muted); font-size: 1.05rem; max-width: 680px; margin: 0 auto 22px; }
.search-form { display: flex; gap: 8px; max-width: 820px; margin: 0 auto; background: var(--surface); padding: 8px; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.search-form select, .search-form input, .field input, .field select, .field textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px;
}
.search-form select { background: var(--surface-2); max-width: 210px; }
.search-form input { flex: 1; min-width: 0; font-size: 1.05rem; border-color: transparent; }
.search-form input:focus { border-color: var(--primary); outline: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border-radius: var(--radius-sm); border: 1px solid transparent; padding: 9px 18px; min-height: 44px; cursor: pointer; background: var(--primary); color: var(--primary-ink); white-space: nowrap; }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: .88rem; }
.btn-danger { background: var(--danger); }
.examples { margin-top: 12px; color: var(--muted); font-size: .9rem; }
.examples a { margin: 0 4px; }
.form-error { color: var(--danger); margin-top: 10px; }

/* Layout */
.page { padding: 8px 0 48px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.layout.no-sidebar { grid-template-columns: minmax(0, 1fr); }
.sidebar { position: sticky; top: 76px; display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; }
.card-body { padding: 18px; }
.card-body > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 8px 0 16px; }
.result-head h1 { margin: 0; word-break: break-all; }
.result-head .meta { color: var(--muted); font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions form { margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.data th, table.data td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.kv th { width: 34%; text-transform: none; letter-spacing: 0; font-size: .92rem; background: transparent; }
table.data td.value { word-break: break-word; font-family: var(--mono); font-size: .88rem; }
.copy-cell { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.copy-btn { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 2px 8px; font-size: .78rem; cursor: pointer; flex-shrink: 0; font-family: var(--font); }
.copy-btn:hover { color: var(--primary); border-color: var(--primary); }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); }

/* Badges & stats */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-new { background: var(--primary); color: #fff; font-size: .68rem; padding: 1px 7px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; }
.stat .label { color: var(--muted); font-size: .82rem; }
.stat .value { font-size: 1.35rem; font-weight: 700; word-break: break-word; }
.stat .value.sm { font-size: 1rem; }
.banner { border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; display: flex; gap: 14px; align-items: center; border: 1px solid transparent; }
.banner h2 { margin: 0 0 2px; font-size: 1.15rem; }
.banner p { margin: 0; }
.banner-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.banner-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.banner-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.banner-info { background: var(--info-soft); color: var(--info); }
.banner .icon { font-size: 1.8rem; line-height: 1; }
.meter { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.meter.warn > span { background: var(--warn); }
.meter.danger > span { background: var(--danger); }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }

/* Raw output */
.raw { background: var(--code-bg); color: var(--code-text); border-radius: var(--radius-sm); padding: 16px; overflow: auto; max-height: 560px; font-size: .82rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; margin: 0; }
details.toggle > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }

/* Tool cards (home) */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tool-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; color: var(--text); transition: border-color .15s, transform .15s; }
.tool-card:hover { border-color: var(--primary); transform: translateY(-2px); text-decoration: none; }
.tool-card .tool-icon { font-size: 1.4rem; }
.tool-card h3 { margin: 6px 0 4px; display: flex; align-items: center; gap: 6px; }
.tool-card p { color: var(--muted); font-size: .88rem; margin: 0; }
.section-title { margin: 32px 0 14px; display: flex; align-items: center; gap: 8px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.feature { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.feature h3 { margin: 0 0 4px; }
.feature p { margin: 0; color: var(--muted); font-size: .9rem; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding-inline-start: 34px; padding-bottom: 18px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 3px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--primary); }
.timeline li.ev-expired::before, .timeline li.ev-dropped::before { border-color: var(--danger); }
.timeline li.ev-expires::before { border-color: var(--warn); }
.timeline li.ev-registered::before, .timeline li.ev-renewed::before { border-color: var(--ok); }
.timeline time { color: var(--muted); font-size: .85rem; display: block; }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .9rem; }
.field textarea { min-height: 180px; font-family: var(--mono); font-size: .9rem; resize: vertical; }
.field .hint { color: var(--muted); font-size: .82rem; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); outline: none; }
.form-row { display: grid; grid-template-columns: 2fr 1fr 2fr auto; gap: 12px; align-items: end; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.hp { position: absolute; inset-inline-start: -9999px; }

/* Ads */
.ad-slot { margin: 16px auto; text-align: center; min-height: 90px; overflow: hidden; }
.ad-slot .ad-label { display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.ad-slot.ad-vertical { min-height: 250px; }
.ad-slot ins { display: block; }

/* Prose (static pages) */
.prose { max-width: 820px; }
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-inline-start: 1.2em; }
.prose li { margin-bottom: .4em; }
.faq details { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 36px 0 24px; margin-top: 24px; color: var(--muted); font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 24px; }
.site-footer h3 { color: var(--text); font-size: .92rem; margin-bottom: 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Toast */
.toast { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; opacity: 0; transition: .2s; pointer-events: none; z-index: 200; font-weight: 600; }
[dir="rtl"] .toast { transform: translateX(50%) translateY(20px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
[dir="rtl"] .toast.show { transform: translateX(50%) translateY(0); }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-bar { position: fixed; top: 0; inset-inline-start: 0; height: 3px; background: var(--primary); width: 0; z-index: 300; transition: width .3s; }
.loading-bar.active { width: 80%; transition: width 8s cubic-bezier(.1, .7, .3, 1); }

/* Responsive */
@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; }
  .ad-desktop { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1001px) { .ad-mobile { display: none; } }
@media (max-width: 820px) {
  .menu-toggle { display: inline-flex; }
  .main-nav { display: none; position: absolute; top: 60px; inset-inline: 0; background: var(--surface); border-bottom: 1px solid var(--border); flex-direction: column; padding: 8px 16px 14px; }
  .site-header.nav-open .main-nav { display: flex; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .search-form { flex-direction: column; }
  .search-form select { max-width: none; }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  table.kv th { width: 40%; }
  .card-body { padding: 14px; }
  .lang-label { display: none; }
}
@media print {
  .site-header, .site-footer, .ad-slot, .actions, .sidebar, .search-form, .copy-btn { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .card { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
