/*
 * OneLink Intel design system. Tokens for light and dark live under
 * html[data-theme] (set by theme.js before paint). Component names are the ones
 * the scripts render; feature screens add to this in details.css and intel.css.
 */

/* ---------- tokens ---------- */
:root, html[data-theme="light"] {
  --paper: #f4f5f8;          /* page */
  --paper-2: #eceef4;        /* quiet fill */
  --paper-3: #dde1ea;        /* tracks, skeleton */
  --card: #ffffff;
  --card-2: #fafbfd;
  --ink: #0c1221;
  --ink-2: #444c60;
  --ink-3: #6c7387;
  --line: rgba(12, 18, 33, .085);
  --line-strong: rgba(12, 18, 33, .16);
  --seal: #4350f0;           /* accent (kept name: scripts read it) */
  --seal-deep: #3440d8;
  --seal-soft: rgba(67, 80, 240, .09);
  --accent-2: #0e9fb8;
  --on-accent: #ffffff;
  --ok: #0c8a5c;   --ok-bg: rgba(12, 138, 92, .10);
  --bad: #d4313f;  --bad-bg: rgba(212, 49, 63, .09);
  --warn: #b26a00; --warn-bg: rgba(178, 106, 0, .11);
  --slate: #7246d8; --slate-bg: rgba(114, 70, 216, .10);
  --mute: #6c7387; --mute-bg: rgba(108, 115, 135, .11);
  --shadow: 0 1px 2px rgba(12, 18, 33, .05), 0 10px 30px -16px rgba(12, 18, 33, .16);
  --shadow-lg: 0 1px 2px rgba(12, 18, 33, .05), 0 30px 60px -30px rgba(30, 40, 120, .28);
  --glow-a: rgba(67, 80, 240, .13);
  --glow-b: rgba(14, 159, 184, .10);
  --bar-bg: rgba(244, 245, 248, .78);
  --input: #ffffff;
}
html[data-theme="dark"] {
  --paper: #090c13;
  --paper-2: #121827;
  --paper-3: #1d2436;
  --card: #0f1420;
  --card-2: #131927;
  --ink: #eef1f8;
  --ink-2: #b3bacb;
  --ink-3: #7f879b;
  --line: rgba(226, 232, 255, .075);
  --line-strong: rgba(226, 232, 255, .15);
  --seal: #8590ff;
  --seal-deep: #a3abff;
  --seal-soft: rgba(133, 144, 255, .14);
  --accent-2: #38cfe4;
  --on-accent: #0a0e1a;
  --ok: #3fd49a;   --ok-bg: rgba(63, 212, 154, .12);
  --bad: #ff6b79;  --bad-bg: rgba(255, 107, 121, .12);
  --warn: #f5b74a; --warn-bg: rgba(245, 183, 74, .12);
  --slate: #b69dff; --slate-bg: rgba(182, 157, 255, .13);
  --mute: #8a92a6; --mute-bg: rgba(138, 146, 166, .13);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px -18px rgba(0, 0, 0, .9);
  --shadow-lg: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 36px 80px -36px rgba(0, 0, 0, .95);
  --glow-a: rgba(99, 110, 255, .20);
  --glow-b: rgba(30, 190, 214, .12);
  --bar-bg: rgba(9, 12, 19, .72);
  --input: #0b101b;
}
:root {
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font-ui: "Geist", "IBM Plex Sans Arabic", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Geist", "IBM Plex Sans Arabic", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-ar: "IBM Plex Sans Arabic", "Geeza Pro", "Noto Sans Arabic", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --tabbar-h: 0px;
}
html[lang="ar"] {
  --font-ui: "IBM Plex Sans Arabic", "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-display: "IBM Plex Sans Arabic", "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "IBM Plex Sans Arabic", serif;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); scroll-padding-top: 80px; }
html.theme-anim, html.theme-anim *, html.theme-anim *::before { transition: background-color .3s var(--ease), border-color .3s var(--ease), color .2s !important; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  overflow-x: clip;
  position: relative;
}
html[lang="ar"] body { line-height: 1.65; font-feature-settings: normal; }
/* two soft lights at the top of every page: the brand's indigo and cyan */
body::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 560px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(520px 300px at 12% -60px, var(--glow-a), transparent 70%),
    radial-gradient(460px 280px at 88% -40px, var(--glow-b), transparent 70%);
}
html[dir="rtl"] body::before { transform: scaleX(-1); }
.wrap {
  position: relative; z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(18px, 3.4vw, 36px) max(clamp(16px, 3.4vw, 32px), env(safe-area-inset-right)) calc(28px + var(--tabbar-h) + env(safe-area-inset-bottom)) max(clamp(16px, 3.4vw, 32px), env(safe-area-inset-left));
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; border-radius: 8px; }
::selection { background: var(--seal-soft); }
input, select { accent-color: var(--seal); }
select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23868ea3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: right 10px center;
}
html[dir="rtl"] select { background-position: left 10px center; }

.skip {
  position: fixed; z-index: 100; top: 10px; inset-inline-start: 10px;
  padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--paper);
  font-weight: 600; text-decoration: none; transform: translateY(-160%); transition: transform .2s;
}
.skip:focus { transform: none; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
/* the frosted glass sits on a layer of its own: a filter on the bar itself would
   trap the phone tab bar (position: fixed) inside it */
.topbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
}
.topbar-in {
  max-width: 1120px; margin: 0 auto; height: 62px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 max(clamp(14px, 3.4vw, 32px), env(safe-area-inset-right)) 0 max(clamp(14px, 3.4vw, 32px), env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
a.brand { color: inherit; text-decoration: none; }
.mark { width: 32px; height: 32px; flex: none; border-radius: 9px; box-shadow: 0 6px 16px -6px rgba(67, 80, 240, .55); }
.brand-t { display: grid; min-width: 0; line-height: 1.15; }
.brand-t b { font-weight: 650; font-size: 15.5px; letter-spacing: -.015em; white-space: nowrap; }
.brand-t small { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[lang="ar"] .brand-t b { letter-spacing: 0; font-weight: 700; }

.nav { display: flex; align-items: center; gap: 2px; margin-inline: auto; }
.nav a {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 38px; padding: 0 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: none; white-space: nowrap;
  transition: background .2s, color .2s;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a.is-on { background: var(--seal-soft); color: var(--seal); }
.nav a.is-on svg { opacity: 1; }

.topbar-act { display: flex; align-items: center; gap: 6px; flex: none; margin-inline-start: auto; }
.nav + .topbar-act { margin-inline-start: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 40px; height: 40px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--card); color: var(--ink-2); font-size: 13.5px; font-weight: 500; text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
}
.icon-btn svg { width: 18px; height: 18px; flex: none; }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn.out:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
html[dir="rtl"] .icon-btn.out svg, html[dir="rtl"] .icon-btn .flip-rtl { transform: scaleX(-1); }
.i-moon { display: none; }
html[data-theme="dark"] .i-sun { display: none; }
html[data-theme="dark"] .i-moon { display: block; }
[data-theme-toggle] svg { transition: transform .45s var(--ease); }
[data-theme-toggle]:active svg { transform: rotate(40deg) scale(.9); }
.lang {
  flex: none; min-width: 40px; height: 40px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--card); color: var(--ink-2);
  font-family: "IBM Plex Sans Arabic", "Geist", sans-serif; font-size: 14px; font-weight: 600;
  transition: color .2s, border-color .2s;
}
.lang:hover { color: var(--ink); border-color: var(--ink-3); }
.signout { margin: 0; display: contents; }

/* phone: the sections move to a tab bar at the bottom, thumbs reach it */
@media (max-width: 899px) {
  body:has(.nav) { --tabbar-h: 64px; }
  .nav {
    position: fixed; z-index: 45; inset: auto 0 0 0; margin: 0;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0;
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: var(--bar-bg);
    -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
    border-top: 1px solid var(--line);
  }
  .nav a {
    flex-direction: column; justify-content: center; gap: 3px;
    min-height: 52px; padding: 4px 2px; border-radius: 12px;
    font-size: 11px; font-weight: 550; letter-spacing: .01em;
  }
  html[lang="ar"] .nav a { font-size: 11.5px; letter-spacing: 0; }
  .nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .nav a svg { width: 22px; height: 22px; }
  .nav a.is-on { background: transparent; }
  .nav a.is-on svg { filter: drop-shadow(0 4px 8px var(--seal-soft)); }
  .nav a:hover { background: transparent; }
  .icon-btn.out span { display: none; }
  .icon-btn.out { padding: 0; }
  .nav + .topbar-act { margin-inline-start: auto; }
}
@media (max-width: 420px) {
  .topbar-in { gap: 8px; height: 58px; }
  .brand-t small { display: none; }
  .topbar-act { gap: 5px; }
  .icon-btn, .lang { height: 38px; min-width: 38px; border-radius: 11px; }
}

/* ---------- page heads ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 10px;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--seal);
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: linear-gradient(135deg, var(--seal), var(--accent-2)); }
html[lang="ar"] .eyebrow { font-family: var(--font-ui); letter-spacing: 0; font-size: 13px; font-weight: 600; }
.eyebrow:empty { display: none; }
.pg-head { margin: 4px 0 22px; }
.pg-title {
  margin: 0;
  font-family: var(--font-display); font-weight: 650;
  font-size: clamp(28px, 6.4vw, 42px); line-height: 1.08; letter-spacing: -.032em;
  text-wrap: balance;
}
html[lang="ar"] .pg-title { letter-spacing: 0; font-weight: 700; line-height: 1.3; }
.pg-lead { margin: 10px 0 0; color: var(--ink-2); max-width: 62ch; font-size: clamp(14.5px, 1.6vw, 16px); text-wrap: pretty; }
.pg-lead:empty { display: none; }

/* ---------- search console ---------- */
.console {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 16px;
}
@media (min-width: 640px) { .console { padding: 18px; } }
.quick { display: grid; gap: 12px; }
@media (min-width: 900px) { .quick { grid-template-columns: auto minmax(0, 1fr); align-items: center; } }
.seg {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--paper-2); border-radius: 13px; padding: 4px; gap: 2px;
  max-width: 100%;
}
.seg-opt { position: relative; min-width: 0; }
.seg-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg-opt span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 40px; padding: 0 14px; border-radius: 10px;
  font-size: 13.5px; font-weight: 550; color: var(--ink-2); white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s;
}
.seg-opt:hover span { color: var(--ink); }
.seg-opt input:checked + span {
  background: var(--card); color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line);
}
html[data-theme="dark"] .seg-opt input:checked + span { background: var(--paper-3); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--seal); outline-offset: 1px; }
@media (max-width: 559px) {
  #modeSeg { display: grid; grid-auto-flow: row; grid-template-columns: 1fr 1fr; width: 100%; }
  #modeSeg .seg-opt span { padding: 0 8px; }
}
.field {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  border: 1px solid var(--line-strong); border-radius: 14px;
  padding: 5px; background: var(--input);
  transition: border-color .2s, box-shadow .2s;
}
.field:focus-within { border-color: var(--seal); box-shadow: 0 0 0 4px var(--seal-soft); }
.field-ico { width: 19px; height: 19px; flex: none; margin-inline-start: 9px; color: var(--ink-3); }
.input {
  flex: 1; min-width: 0; border: 0; background: transparent;
  padding: 0 6px; min-height: 46px;
  font-size: 17px;             /* ≥16px keeps iOS from zooming */
  font-family: var(--font-ui);
}
.input::-webkit-search-cancel-button { -webkit-appearance: none; }
.input:focus { outline: none; }
.input::placeholder { color: var(--ink-3); opacity: .85; }
.go {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border: 0; border-radius: 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--seal) 88%, #fff), var(--seal));
  color: var(--on-accent);
  font-weight: 600; font-size: 15px; letter-spacing: -.005em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 8px 20px -10px var(--seal);
  transition: filter .2s, transform .1s;
}
.go:hover { filter: brightness(1.06); }
.go:active { transform: translateY(1px); }
.go[disabled] { opacity: .6; cursor: progress; }
.go-sm { min-height: 42px; font-size: 14px; padding: 0 16px; }

.quick-foot {
  display: flex; align-items: center; gap: 8px 14px;
  flex-wrap: wrap; margin-top: 12px; padding: 0 2px;
}
.hint { margin: 0; font-size: 13px; color: var(--ink-3); flex: 1 1 220px; }
.hint:empty { display: none; }
.hint.err { color: var(--bad); }
.adv-toggle {
  display: inline-flex; align-items: center; gap: 8px; margin-inline-start: auto;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--card); font-size: 13.5px; font-weight: 550; color: var(--ink-2);
  transition: background .2s, color .2s, border-color .2s;
}
.adv-toggle svg { width: 16px; height: 16px; }
.adv-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.adv-toggle.is-open { background: var(--seal-soft); border-color: transparent; color: var(--seal); }
.badge {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--seal); color: var(--on-accent);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
}

/* ---------- advanced panel ---------- */
.adv {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid; gap: 20px;
  animation: rise .35s var(--ease) both;
}
.grp {
  margin: 0; padding: 0; border: 0; min-width: 0;
  display: grid; gap: 12px 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}
.grp legend {
  grid-column: 1 / -1; float: none; width: 100%; padding: 0 0 2px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
}
html[lang="ar"] .grp legend { font-family: var(--font-ui); letter-spacing: 0; font-size: 12.5px; font-weight: 600; }
.fld { display: grid; gap: 6px; min-width: 0; position: relative; align-content: start; }
.fld > span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.fld input, .fld select {
  width: 100%; min-width: 0; min-height: 46px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background-color: var(--input); font-size: 16px;
  transition: border-color .18s, box-shadow .18s;
}
.fld select { padding-inline-end: 34px; text-overflow: ellipsis; }
.fld input:focus, .fld select:focus {
  outline: none; border-color: var(--seal); box-shadow: 0 0 0 4px var(--seal-soft);
}
.fld input::placeholder { color: var(--ink-3); opacity: .8; }
.fld input:disabled, .fld select:disabled { opacity: .5; cursor: not-allowed; }

.combo > input { padding-inline-end: 38px; }
.combo-x {
  position: absolute; inset-inline-end: 6px; bottom: 8px;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-3); font-size: 20px; line-height: 1;
}
.combo-x:hover { background: var(--paper-2); color: var(--ink); }
.combo-list {
  position: absolute; z-index: 20; top: 100%; inset-inline: 0;
  margin: 6px 0 0; padding: 5px; list-style: none;
  max-height: 280px; overflow: auto; overscroll-behavior: contain;
  background: var(--card); border: 1px solid var(--line-strong);
  border-radius: 14px; box-shadow: var(--shadow-lg);
}
.combo-list li {
  display: flex; gap: 10px; align-items: baseline;
  padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 14px;
}
.combo-list li:hover, .combo-list li[aria-selected="true"] { background: var(--seal-soft); }
.combo-list code {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  color: var(--seal); flex: none;
}
.combo-empty { color: var(--ink-3); cursor: default; }

.adv-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 2px; flex-wrap: wrap; }
.ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--card); font-size: 14px; font-weight: 550; color: var(--ink-2); text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
}
.ghost:hover { color: var(--ink); border-color: var(--ink-3); }
.ghost.sm { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }

/* ---------- active filter chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip-f {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  min-height: 34px; padding: 2px 10px 2px 12px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--seal-soft); color: var(--ink); font-size: 13px; max-width: 100%;
}
.chip-f:hover { border-color: var(--seal); }
.chip-f .ck { color: var(--ink-3); font-size: 12px; flex: none; }
.chip-f b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30ch; min-width: 0; }
.chip-f svg { width: 12px; height: 12px; flex: none; opacity: .6; }
.chip-clear {
  min-height: 34px; padding: 0 10px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-3); font-size: 13px; text-decoration: underline;
  text-underline-offset: 3px;
}
.chip-clear:hover { color: var(--seal); }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 12px;
  flex-wrap: wrap; margin-bottom: 12px; padding: 0 2px;
}
.tool-count {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; min-width: 0;
  font-size: 13.5px; color: var(--ink-3);
}
.tool-count b { color: var(--ink); font-weight: 650; font-size: 16px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tool-count .sep { opacity: .5; }
.tool-act { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.view { display: inline-flex; background: var(--paper-2); border-radius: 11px; padding: 3px; }
.vbtn {
  width: 38px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-3);
}
.vbtn svg { width: 16px; height: 16px; }
.vbtn.is-on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 0 0 1px var(--line); }
html[data-theme="dark"] .vbtn.is-on { background: var(--paper-3); }
.psize {
  min-height: 38px; padding: 0 30px 0 10px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background-color: var(--card); font-size: 13px;
}
html[dir="rtl"] .psize { padding: 0 10px 0 30px; }
.rbtn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--card); color: var(--ink-2);
}
.rbtn svg { width: 16px; height: 16px; }
.rbtn:hover { border-color: var(--seal); color: var(--seal); }
.rbtn.spin svg { animation: spin .8s linear infinite; }
.age {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-3);
}
.age::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.age.is-live { color: var(--ok); }
.age.is-stale { color: var(--ink-3); }
.age.is-old { color: var(--warn); }

/* ---------- status mix ---------- */
.stats {
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  animation: rise .35s var(--ease) both;
}
.stats h3 {
  margin: 0 0 12px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 500;
}
html[lang="ar"] .stats h3 { font-family: var(--font-ui); letter-spacing: 0; font-size: 13px; font-weight: 600; }
.bars { display: grid; gap: 2px; }
.bar {
  display: grid; grid-template-columns: minmax(84px, 140px) minmax(0, 1fr) auto;
  align-items: center; gap: 12px; min-height: 38px;
  border: 0; background: transparent; padding: 4px 8px; border-radius: 10px; text-align: start;
}
.bar:hover { background: var(--paper-2); }
.bar-k { font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-t { height: 8px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.bar-t i { display: block; height: 100%; border-radius: 999px; background: currentColor; transition: width .6s var(--ease); }
.bar-v { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); }
.stats-err { margin: 0; color: var(--bad); font-size: 13.5px; }

/* ---------- results ---------- */
.results { display: grid; gap: 12px; min-width: 0; }
.results.view-table { display: block; }

.est {
  position: relative; min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
  animation: rise .5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 30ms);
  transition: border-color .2s;
}
@media (min-width: 640px) { .est { padding: 20px 20px 16px; } }
.est-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.names { min-width: 0; flex: 1; }
.name-pri {
  margin: 0;
  font-family: var(--font-display); font-weight: 650;
  font-size: 18px; line-height: 1.3; letter-spacing: -.015em;
  overflow-wrap: anywhere;
}
.name-pri[lang="ar"], .name-sec[lang="ar"] { font-family: var(--font-ar); letter-spacing: 0; }
.name-pri[lang="ar"] { font-size: 19px; font-weight: 700; line-height: 1.45; }
.name-sec { margin: 3px 0 0; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); overflow-wrap: anywhere; }
html[dir="ltr"] .name-pri, html[dir="ltr"] .name-sec { text-align: left; }
html[dir="rtl"] .name-pri, html[dir="rtl"] .name-sec { text-align: right; }
.name-sec[lang="ar"] { font-size: 15px; }
.name-sec.none { color: var(--ink-3); font-style: italic; font-size: 13px; }

/* status label: a quiet pill with a dot (login pages use it as a tag) */
.stamp {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; line-height: 1.4;
  background: color-mix(in srgb, currentColor 11%, transparent);
}
.stamp::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
html[lang="ar"] .stamp { font-family: var(--font-ui); letter-spacing: 0; font-size: 12px; }
.tone-ok    { color: var(--ok); }
.tone-bad   { color: var(--bad); }
.tone-warn  { color: var(--warn); }
.tone-slate { color: var(--slate); }
.tone-mute  { color: var(--mute); }
.tone-ink   { color: var(--ink); }

.meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 10px 16px; margin: 14px 0 0; padding: 12px 0 0;
  border-top: 1px solid var(--line);
}
.m { min-width: 0; }
.m dt { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.m dd { margin: 0; font-size: 14.5px; }

.cr {
  display: inline-flex; align-items: center; gap: 6px;
  margin: -4px -6px; padding: 4px 6px;
  border: 0; border-radius: 8px; background: transparent;
  font-family: var(--font-mono); font-size: 14px; font-weight: 600;
  letter-spacing: .02em; direction: ltr; color: var(--ink);
}
.cr:hover { background: var(--seal-soft); color: var(--seal); }
.cr svg { width: 14px; height: 14px; opacity: .55; }
.cr.copied { color: var(--ok); }
.cr.copied svg { opacity: 1; }

.chip {
  display: inline-block; padding: 2px 8px; border-radius: 7px;
  background: var(--paper-2); color: var(--ink-2);
  font-family: var(--font-mono); font-weight: 600; font-size: 12px; letter-spacing: .04em;
  margin-inline-end: 6px; vertical-align: 1px;
}
.rel { color: var(--ink-3); }
.rel.tone-warn, .rel.tone-bad { font-weight: 550; }
time { font-variant-numeric: tabular-nums; }

/* ---------- table view ---------- */
.tbl-wrap {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-x: auto; overscroll-behavior-x: contain;
}
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  padding: 12px 14px; text-align: start; white-space: nowrap;
  background: var(--card-2); border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--ink-3); font-weight: 550;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--card-2); }
.tbl .dtl-row td, .tbl .dtl-row:hover td { padding: 0; border-bottom: 0; background: transparent; }
.tbl .dtl-row .dtl:not([hidden]) { padding: 0 14px 16px; border-bottom: 1px solid var(--line); }
.c-cr { width: 1%; white-space: nowrap; }
.c-name { min-width: 220px; }
.c-name b { display: block; font-weight: 600; font-size: 14.5px; }
.c-name i { display: block; font-style: normal; color: var(--ink-3); font-size: 13px; }
html[dir="ltr"] .c-name b, html[dir="ltr"] .c-name i { text-align: left; }
html[dir="rtl"] .c-name b, html[dir="rtl"] .c-name i { text-align: right; }
.c-exp { white-space: nowrap; font-size: 13px; }
.c-act { width: 1%; }
.tbl .dtl-btn {
  width: auto; margin: 0; min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  font-size: 12.5px; white-space: nowrap;
}
.tbl .dtl-btn:hover { border-color: var(--seal); color: var(--seal); }
.tbl .dtl { margin: 0; border-radius: 0; }
.dot { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 13px; }
.dot::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; flex: none; }

/* ---------- pager ---------- */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 16px 2px 0; font-size: 13.5px; color: var(--ink-2);
}
.pager-ctl { display: flex; align-items: center; gap: 8px; }
.pbtn {
  width: 46px; height: 46px; display: inline-grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); color: var(--ink);
}
.pbtn:hover:not([disabled]) { border-color: var(--seal); color: var(--seal); }
.pbtn[disabled] { opacity: .35; cursor: default; }
.pbtn svg { width: 18px; height: 18px; }
.pbtn .flip { display: inline-flex; transform: scaleX(-1); }
html[dir="rtl"] .pbtn svg { transform: scaleX(-1); }

/* ---------- notices ---------- */
.notice {
  padding: 34px 20px; border-radius: var(--radius);
  border: 1px dashed var(--line-strong); background: color-mix(in srgb, var(--card) 55%, transparent);
  text-align: center;
  animation: rise .5s var(--ease) both;
}
.notice h2 {
  margin: 0 0 6px;
  font-family: var(--font-display); font-weight: 650; font-size: 19px; letter-spacing: -.015em;
}
html[lang="ar"] .notice h2 { letter-spacing: 0; }
.notice p { margin: 0 auto; max-width: 52ch; color: var(--ink-2); }
.notice .sub { margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.notice.error { border-style: solid; border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-bg); }
.notice.error h2 { color: var(--bad); }
.notice.warn { border-style: solid; border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-bg); }
.notice.warn h2 { color: var(--warn); }
.notice ul { margin: 8px 0 0; padding: 0; list-style: none; color: var(--ink-2); }

/* ---------- skeleton ---------- */
.sk { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.sk-line {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--paper-2) 0%, var(--paper-3) 50%, var(--paper-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.sk-line + .sk-line { margin-top: 10px; }
.slow-note { margin: 0 2px 2px; font-size: 13px; color: var(--ink-3); }

/* ---------- footer ---------- */
.foot { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); }
.foot p { margin: 0; font-size: 12.5px; color: var(--ink-3); }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .est, .notice, .adv, .stats { animation: none !important; }
  .sk-line { animation: none; }
  .rbtn.spin svg { animation: none; }
  .bar-t i { transition: none; }
}
