/* Kopal Control - Hardline palette: Black #16181B, Safety Amber #FFB000, Steel #6E757D, Concrete #ECE8E1 */
:root {
  --bg: #F3F1EC; --surface: #FFFFFF; --surface-2: #F9F8F5; --sunken: #EFECE6;
  --line: rgba(22,24,27,.09); --line-strong: rgba(22,24,27,.17);
  --text: #16181B; --text-2: #4D535A; --text-3: #7D838A;
  --accent: #FFB000; --accent-ink: #16181B; --accent-text: #8F6100; --accent-soft: rgba(255,176,0,.15);
  --good: #0ca30c; --warn: #fab219; --crit: #d03b3b;
  --good-text: #0A700A; --warn-text: #845500; --crit-text: #B02424;
  --good-bg: rgba(12,163,12,.10); --warn-bg: rgba(250,178,25,.18); --crit-bg: rgba(208,59,59,.10);
  --shadow: 0 1px 2px rgba(22,24,27,.04), 0 10px 28px -16px rgba(22,24,27,.16);
  --radius: 14px;
  --font: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0D0F; --surface: #16181B; --surface-2: #1B1D21; --sunken: #101113;
    --line: rgba(236,232,225,.07); --line-strong: rgba(236,232,225,.15);
    --text: #ECE8E1; --text-2: #A8ADB3; --text-3: #737A82;
    --accent-text: #FFB000; --accent-soft: rgba(255,176,0,.12);
    --good-text: #45D162; --warn-text: #FFC23D; --crit-text: #FF6F6F;
    --good-bg: rgba(12,163,12,.17); --warn-bg: rgba(250,178,25,.13); --crit-bg: rgba(208,59,59,.19);
    --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 16px 36px -20px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C0D0F; --surface: #16181B; --surface-2: #1B1D21; --sunken: #101113;
  --line: rgba(236,232,225,.07); --line-strong: rgba(236,232,225,.15);
  --text: #ECE8E1; --text-2: #A8ADB3; --text-3: #737A82;
  --accent-text: #FFB000; --accent-soft: rgba(255,176,0,.12);
  --good-text: #45D162; --warn-text: #FFC23D; --crit-text: #FF6F6F;
  --good-bg: rgba(12,163,12,.17); --warn-bg: rgba(250,178,25,.13); --crit-bg: rgba(208,59,59,.19);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 16px 36px -20px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex: none; }
code { font: 12.5px var(--mono); background: var(--sunken); padding: 1px 5px; border-radius: 5px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 244px minmax(0,1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 26px; padding: 20px 14px; border-right: 1px solid var(--line); background: var(--surface-2); }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; color: var(--text); text-decoration: none; }
.mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: #16181B; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 4px 12px -6px rgba(0,0,0,.5); }
.mark svg { width: 19px; height: 19px; }
.mark-lg { width: 46px; height: 46px; border-radius: 12px; margin-bottom: 20px; }
.mark-lg svg { width: 28px; height: 28px; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.brand-name b { font-weight: 500; color: var(--text-3); margin-left: 5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav a svg { width: 17px; height: 17px; }
.nav a:hover { background: var(--line); color: var(--text); }
.nav a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.host { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); font-size: 12px; color: var(--text-3); }
.host div { display: flex; justify-content: space-between; gap: 8px; }
.host b { font-weight: 500; color: var(--text-2); }
.host b.ok-t { color: var(--good-text); } .host b.fail-t { color: var(--crit-text); }
.side-actions { display: flex; gap: 6px; }

.main { min-width: 0; padding-inline: clamp(16px, 3.2vw, 44px); padding-block: 28px 72px; max-width: 1480px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
h1 { font-size: 25px; line-height: 1.2; letter-spacing: -.025em; margin: 0; font-weight: 650; }
.sub { margin: 5px 0 0; color: var(--text-3); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.live { display: inline-flex; align-items: center; gap: 8px; height: 30px; font-size: 12px; color: var(--text-2); padding: 0 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); white-space: nowrap; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); animation: pulse 2.4s infinite; }
.live.stale i { background: var(--warn); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(12,163,12,.45); } 70% { box-shadow: 0 0 0 7px rgba(12,163,12,0); } 100% { box-shadow: 0 0 0 0 rgba(12,163,12,0); } }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, filter .15s; }
.btn svg { width: 15px; height: 15px; }
a.btn { text-decoration: none; }
.btn:hover { border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 600; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 8px 20px -10px rgba(255,176,0,.75); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--line); color: var(--text); }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn svg { width: 16px; height: 16px; }
.spin svg { animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 0 12px; }
.section-title h2 { font-size: 14px; font-weight: 600; margin: 0; letter-spacing: -.005em; }
.section-title span { font-size: 12px; color: var(--text-3); }
.empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 13px; list-style: none; }
.empty svg { width: 22px; height: 22px; color: var(--good-text); }
.empty p { margin: 6px 0 0; }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px 0 6px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill svg { width: 13px; height: 13px; }
.pill.ok { background: var(--good-bg); color: var(--good-text); }
.pill.warn { background: var(--warn-bg); color: var(--warn-text); }
.pill.fail { background: var(--crit-bg); color: var(--crit-text); }
.pill.run { background: var(--accent-soft); color: var(--accent-text); padding-left: 9px; }
.pill.run i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }

/* ---------- overview ---------- */
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(230px, 300px) minmax(0,1fr); gap: 36px; padding: 26px 28px; }
.hero::after { content: ""; position: absolute; right: -90px; bottom: -150px; width: 360px; height: 360px; background: radial-gradient(closest-side, var(--accent-soft), transparent); pointer-events: none; }
.hero-fig { display: flex; align-items: baseline; gap: 10px; margin: 16px 0 4px; }
.big { font-size: 60px; font-weight: 650; letter-spacing: -.045em; line-height: 1; }
.of { font-size: 20px; color: var(--text-3); font-weight: 500; }
.hero-cap { margin: 0; color: var(--text-2); }
.hero-strip { position: relative; z-index: 1; min-width: 0; align-self: center; }
.strip-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-3); margin-bottom: 12px; flex-wrap: wrap; }
.legend { display: inline-flex; gap: 12px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend svg { width: 12px; height: 12px; }
.legend .ok { color: var(--good-text); } .legend .warn { color: var(--warn-text); } .legend .fail { color: var(--crit-text); }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); gap: 3px; height: 58px; }
.strip i { display: block; border-radius: 3px; background: var(--good); opacity: .9; transition: opacity .15s, transform .15s; cursor: default; }
.strip i:hover { opacity: 1; transform: scaleY(1.08); }
.strip i.s-warn { background: var(--warn); }
.strip i.s-fail { background: var(--crit); }
.strip-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 8px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-top: 14px; }
.tile { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-height: 124px; }
.t-label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.t-label svg { width: 15px; height: 15px; color: var(--text-3); }
.t-value { font-size: 29px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; }
.t-value small { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-right: 5px; }
.t-foot { font-size: 12px; color: var(--text-3); margin-top: auto; overflow-wrap: anywhere; }

.split { display: grid; grid-template-columns: minmax(0,1fr) 370px; gap: 22px; align-items: start; }
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.agent { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 4px; padding: 16px 16px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; min-width: 0; }
.agent:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.agent:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.a-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.a-name { font-weight: 600; }
.a-role { margin: 0; font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.a-head { margin: 8px 0 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-strong); font-size: 12px; color: var(--text-3); }
.a-foot span { display: inline-flex; align-items: center; gap: 5px; }
.a-foot svg { width: 13px; height: 13px; }

.attn { padding: 4px; }
.issue { display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 10px; padding: 12px; border-radius: 10px; }
.issue[data-agent] { cursor: pointer; }
.issue[data-agent]:hover { background: var(--surface-2); }
.issue + .issue { border-top: 1px solid var(--line); border-radius: 0; }
.issue svg { width: 16px; height: 16px; margin-top: 2px; }
.issue.ok svg { color: var(--good-text); } .issue.warn svg { color: var(--warn-text); } .issue.fail svg { color: var(--crit-text); }
.issue b { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); }
.issue p { margin: 2px 0 0; font-size: 13px; overflow-wrap: anywhere; }

/* ---------- agents table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
.t-name { font-weight: 600; white-space: nowrap; }
.t-role { font-size: 12px; color: var(--text-3); }
.t-sum { color: var(--text-2); min-width: 260px; }

/* ---------- drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-back { position: absolute; inset: 0; background: rgba(8,9,10,.5); backdrop-filter: blur(3px); animation: fade .2s; }
.drawer-panel { position: absolute; top: 0; right: 0; height: 100%; width: min(580px, 100%); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -30px 0 70px -30px rgba(0,0,0,.55); overflow-y: auto; padding: 24px 24px 40px; animation: slide .28s cubic-bezier(.2,.8,.2,1); }
@keyframes slide { from { transform: translateX(28px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.d-head h2 { margin: 3px 0 4px; font-size: 21px; letter-spacing: -.02em; }
.d-head p { margin: 0; color: var(--text-3); }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-3); font-weight: 600; }
.d-status { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; padding: 12px 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; color: var(--text-2); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; margin: 0 0 14px; }
.facts div { background: var(--surface); padding: 11px 13px; }
.facts dt { font-size: 11.5px; color: var(--text-3); }
.facts dd { margin: 2px 0 0; font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.facts small { display: block; font-weight: 400; color: var(--text-3); font-size: 11.5px; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.metric { padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; }
.metric span { font-size: 12px; color: var(--text-3); }
.metric b { display: block; font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.d-sec { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 22px 0 8px; font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; }
.d-sec a { text-transform: none; letter-spacing: 0; color: var(--accent-text); text-decoration: none; font-weight: 500; font-size: 12.5px; }
.d-list { border: 1px solid var(--line); border-radius: 11px; padding: 2px; }

.log { margin: 0; padding: 14px 16px; background: var(--sunken); border: 1px solid var(--line); border-radius: 11px; font: 12px/1.7 var(--mono); color: var(--text-2); overflow: auto; max-height: 380px; white-space: pre-wrap; word-break: break-word; }
.log.big { max-height: calc(100vh - 250px); min-height: 320px; }
.log .l-err { color: var(--crit-text); } .log .l-warn { color: var(--warn-text); } .log .l-ok { color: var(--good-text); }
.log-path { font: 11.5px var(--mono); color: var(--text-3); margin: 6px 2px 0; overflow-wrap: anywhere; }

/* ---------- command ---------- */
.cmd { display: grid; grid-template-columns: minmax(0,1fr) 310px; gap: 22px; align-items: start; }
.cmd-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.composer { padding: 24px; position: relative; overflow: hidden; }
.composer::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), transparent 70%); }
.composer h2 { margin: 0; font-size: 18px; letter-spacing: -.015em; }
.composer > p { margin: 6px 0 18px; color: var(--text-2); max-width: 66ch; }
textarea { display: block; width: 100%; min-height: 160px; resize: vertical; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: 15px/1.65 var(--font); transition: border-color .15s, box-shadow .15s; }
textarea:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea::placeholder { color: var(--text-3); }
.c-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--text-3); display: inline-flex; gap: 5px; align-items: center; }
kbd { font: 500 11px var(--mono); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface); color: var(--text-2); }
.result { overflow: hidden; }
.r-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.r-title { display: flex; align-items: center; gap: 10px; font-weight: 600; flex-wrap: wrap; }
.asked { margin: 0; padding: 12px 22px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.asked summary { cursor: pointer; color: var(--text-3); font-size: 12px; }
.asked p { margin: 8px 0 2px; white-space: pre-wrap; }
.brief { padding: 20px 24px 26px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.7; }
.brief h4 { margin: 20px 0 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-text); }
.brief h4:first-child { margin-top: 0; }
.skel { padding: 22px 24px; display: grid; gap: 11px; }
.skel i { display: block; height: 11px; border-radius: 6px; background: linear-gradient(90deg, var(--sunken) 0%, var(--line-strong) 50%, var(--sunken) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.dots::after { content: ""; animation: dots 1.5s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.history { padding: 6px; position: sticky; top: 24px; }
.history h3 { font-size: 11.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; margin: 12px 12px 6px; }
.history ul { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow-y: auto; }
.history li button { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 10px 12px; border-radius: 9px; cursor: pointer; }
.history li button:hover, .history li button.on { background: var(--surface-2); }
.h-text { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.h-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.h-meta .fail-t { color: var(--crit-text); }

/* ---------- logs ---------- */
.logs-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.chip { height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font: 500 12.5px var(--font); cursor: pointer; }
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }
.logs-tools { margin-left: auto; display: flex; gap: 10px; align-items: center; }
select { height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 0 8px; font: 13px var(--font); }
.logs-meta { font-size: 12px; color: var(--text-3); margin: 0 0 8px; overflow-wrap: anywhere; }

/* ---------- login, tooltip, toast ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding-inline: 16px; background: radial-gradient(900px 520px at 50% -12%, var(--accent-soft), transparent 70%), var(--bg); }
.login-card { width: min(390px, 100%); padding: 34px 32px 26px; }
.login-card h1 { font-size: 23px; }
.login-card > p { color: var(--text-2); margin: 6px 0 24px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field span { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field input { height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); padding: 0 14px; font: 15px var(--font); letter-spacing: .05em; }
.login .btn { width: 100%; justify-content: center; height: 44px; font-size: 14px; }
.err { color: var(--crit-text); font-size: 13px; min-height: 20px; margin: 10px 0 0; }
.tip { position: fixed; z-index: 80; pointer-events: none; padding: 7px 10px; border-radius: 8px; background: #16181B; color: #ECE8E1; font-size: 12px; line-height: 1.4; box-shadow: 0 10px 28px rgba(0,0,0,.35); max-width: 280px; border: 1px solid rgba(255,255,255,.08); }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 90; padding: 10px 16px; border-radius: 10px; background: #16181B; color: #ECE8E1; font-size: 13px; box-shadow: 0 14px 34px rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.08); animation: fade .2s; }

/* ---------- buyer preview (always a light, marketplace-like page) ---------- */
.pv { margin-top: 12px; background: #fff; color: #0f1111; border-radius: 12px; padding: 20px 22px 26px; font-family: Arial, "IBM Plex Sans Arabic", "Segoe UI", sans-serif; font-size: 14px; line-height: 1.45; }
.pv[dir="rtl"] { font-family: "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif; }
.pv hr { border: 0; border-top: 1px solid #e7e7e7; margin: 10px 0; }
.pv-crumb { font-size: 12px; color: #565959; margin-bottom: 12px; }
.pv-grid { display: grid; grid-template-columns: minmax(260px, 1.1fr) minmax(0, 1.3fr) 220px; gap: 22px; align-items: start; }
.pv-gal { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 10px; }
.pv-thumbs { display: flex; flex-direction: column; gap: 8px; }
.pv-thumbs button { width: 48px; height: 48px; padding: 2px; border: 1px solid #d5d9d9; border-radius: 6px; background: #fff; cursor: pointer; }
.pv-thumbs button.on { border-color: #e77600; box-shadow: 0 0 3px 2px rgba(228,121,17,.4); }
.pv-thumbs img { width: 100%; height: 100%; object-fit: contain; }
.pv-main { aspect-ratio: 1; display: grid; place-items: center; border-radius: 6px; }
.pv-main img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pv-noimg { background: #f5f5f5; color: #777; font-size: 13px; }
.pv-title { font-size: 22px; line-height: 1.3; font-weight: 400; margin: 0 0 4px; color: #0f1111; }
.pv-brand { font-size: 13px; color: #007185; }
.pv-price { font-size: 26px; font-weight: 500; margin: 4px 0; }
.pv-cur { font-size: 13px; vertical-align: top; position: relative; top: 4px; }
.pv-na { font-size: 15px; color: #b12704; font-weight: 400; }
.pv-hl { margin: 6px 0; color: #333; }
.pv-attrs table, .pv-sec table { border-collapse: collapse; font-size: 13px; }
.pv-attrs th, .pv-attrs td, .pv-sec th, .pv-sec td { text-align: start; padding: 4px 12px 4px 0; vertical-align: top; border: 0; background: none; }
.pv-attrs th, .pv-sec th { font-weight: 700; color: #0f1111; white-space: nowrap; }
.pv h3 { font-size: 16px; margin: 8px 0 6px; }
.pv-bullets { margin: 0; padding-inline-start: 18px; }
.pv-bullets li { margin: 4px 0; }
.pv-buy { border: 1px solid #d5d9d9; border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.pv-stock { color: #007600; font-size: 17px; }
.pv-buy button, .pv-noon-cart { border: 0; border-radius: 20px; height: 34px; font: 13px Arial, sans-serif; color: #0f1111; cursor: default; }
.pv-cart { background: #ffd814; } .pv-now { background: #ffa41c; }
.pv-small { font-size: 11.5px; color: #565959; }
.pv-sec { margin-top: 22px; padding-top: 14px; border-top: 1px solid #e7e7e7; }
.pv-sec h2 { font-size: 20px; font-weight: 700; margin: 0 0 8px; }
.pv-sec p { margin: 0; white-space: pre-wrap; }
/* noon */
.pv-noon { font-family: "Proxima Nova", Arial, "IBM Plex Sans Arabic", sans-serif; }
.pv-grid-noon { grid-template-columns: minmax(260px, 1fr) minmax(0, 1fr); }
.pv-gal-noon { grid-template-columns: 1fr; }
.pv-gal-noon .pv-thumbs { flex-direction: row; order: 2; flex-wrap: wrap; }
.pv-gal-noon .pv-thumbs button.on { border-color: #3866df; box-shadow: none; }
.pv-brand-noon { color: #3866df; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.pv-noon .pv-title { font-size: 20px; font-weight: 600; }
.pv-price-noon { font-size: 24px; font-weight: 700; }
.pv-noon-cart { background: #3866df; color: #fff; border-radius: 6px; height: 44px; font-weight: 700; margin: 12px 0 4px; width: 100%; }
.pv-noon-tabs { display: flex; gap: 22px; margin-top: 22px; border-bottom: 1px solid #e2e5f1; }
.pv-noon-tabs span { padding: 10px 0; font-weight: 700; color: #7e859b; }
.pv-noon-tabs span.on { color: #0f1111; border-bottom: 3px solid #feee00; }
.pv-noon .pv-sec { border-top: 0; margin-top: 12px; }
@media (max-width: 980px) { .pv-grid, .pv-grid-noon { grid-template-columns: minmax(0,1fr); } }

/* ---------- restock ---------- */
.rs-search { flex: 1; min-width: 200px; height: 34px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); padding: 0 12px; font: 13px var(--font); }
.rs-search:focus, .rs-in:focus, .rs-qty input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.rs-rule { margin: 12px 2px 0; }
.rs-split { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 16px; align-items: start; margin-top: 12px; }
.rs-table { max-height: 72vh; }
.rs-table table { table-layout: auto; }
.rs-table td, .rs-table th { padding: 8px 10px; }
.rs-table .inv-prod { min-width: 180px; max-width: 300px; }
.rs-table td:nth-child(5), .rs-table td:nth-child(6) { width: 1%; }
.rs-in { width: 84px; height: 32px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); padding: 0 8px; font: 600 13px var(--font); text-align: right; font-variant-numeric: tabular-nums; }
.rs-qbtn { min-width: 44px; justify-content: center; }
tr.rs-queued td { background: var(--accent-soft); }
.rs-queue { position: sticky; top: 24px; padding: 14px 12px 10px; max-height: 80vh; display: flex; flex-direction: column; }
.rs-qhead { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 0 4px 12px; border-bottom: 1px solid var(--line); }
.rs-qhead h2 { margin: 0; font-size: 15px; }
/* Read marked sheet on its own full-width row, the two print buttons side by side under it */
.rs-print { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
.rs-print .btn { justify-content: center; width: 100%; min-width: 0; }
.rs-print label.btn { grid-column: 1 / -1; }
.rs-print .btn:only-child, .rs-print label.btn + .btn:last-child { grid-column: 1 / -1; }
.rs-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.rs-list li { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 10px; align-items: start; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.rs-list li img, .rs-list .inv-ph { width: 44px; height: 44px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.rs-list li.approved { opacity: .8; }
.rs-li { min-width: 0; }
.rs-qty { display: flex; align-items: center; gap: 6px 8px; margin-top: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.rs-qty > span { margin-inline-end: 4px; }
.rs-qty label { white-space: nowrap; }
.rs-qty b { color: var(--text); font-size: 13px; }
.rs-qty label { display: inline-flex; align-items: center; gap: 6px; }
.rs-qty input { width: 64px; height: 28px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); padding: 0 6px; font: 600 12.5px var(--font); text-align: right; }
.rs-foot { padding: 10px 4px 0; }
.sr-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; align-items: start; margin-top: 12px; }
.sr-photo img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.sr-counts { grid-template-columns: repeat(4, minmax(0,1fr)); margin: 0 0 10px; }
.sr-actions { justify-content: flex-end; margin-top: 12px; }
.win-table select { height: 30px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); padding: 0 6px; font: 13px var(--font); }
@media (max-width: 900px) { .sr-grid { grid-template-columns: minmax(0,1fr); } }
.rs-ok, .rs-no { min-width: 34px; justify-content: center; font-size: 15px; font-weight: 700; }
.rs-ok { color: var(--good-text); } .rs-no { color: var(--crit-text); }
.rs-ar { font-family: "IBM Plex Sans Arabic", Tahoma, sans-serif; font-weight: 600; text-align: right; }
@media (max-width: 1180px) { .rs-split { grid-template-columns: minmax(0,1fr); } .rs-queue { position: static; max-height: none; } }

/* ---------- overview tile windows ---------- */
.tile-btn { all: unset; box-sizing: border-box; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-height: 124px; transition: border-color .15s, transform .15s; }
.tile-btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tile-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.t-open { margin-left: auto; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--sunken); color: var(--text-3); transition: background .15s, color .15s; }
.t-open svg { width: 13px; height: 13px; }
.tile-btn:hover .t-open { background: var(--accent-soft); color: var(--accent-text); }
.drawer-panel.wide { width: min(1080px, 100%); }
.win-tools { display: flex; align-items: flex-start; gap: 8px; }
.win-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 10px; }
.win-filter input { flex: 1; min-width: 200px; height: 34px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); padding: 0 12px; font: 13px var(--font); }
.win-filter input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.metrics-5 { grid-template-columns: repeat(5, minmax(0,1fr)); margin-top: 12px; }
.metric.m-fail b { color: var(--crit-text); } .metric.m-warn b { color: var(--warn-text); }
.win-table { border: 1px solid var(--line); border-radius: 11px; max-height: 60vh; overflow: auto; }
.win-table th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.win-table td { padding: 10px 14px; }
.win-table td small { display: block; font-size: 11px; color: var(--text-3); font-weight: 400; }
.win-list { display: grid; gap: 10px; }
.w-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.w-row + .w-row { border-top: 1px solid var(--line); }
.w-main { flex: 1; min-width: 0; }
.w-main p { margin: 0; font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.w-main small { font-size: 11.5px; color: var(--text-3); }
.w-name { font-weight: 500; min-width: 220px; }
.inv-prod { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 360px; }
.inv-prod img, .inv-ph { width: 40px; height: 40px; flex: none; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.inv-ph { display: grid; place-items: center; background: var(--sunken); color: var(--text-3); }
.inv-ph svg { width: 16px; height: 16px; }
.inv-prod > div { min-width: 0; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; gap: 6px; }
.btn.small svg { width: 13px; height: 13px; }
.nowrap { white-space: nowrap; }
.nowrap .btn + .btn { margin-left: 6px; }
.fail-t { color: var(--crit-text); } .warn-t { color: var(--warn-text); }
@media (max-width: 900px) { .metrics-5 { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* ---------- creation ---------- */
.creation { display: grid; grid-template-columns: minmax(340px, 460px) minmax(0,1fr); gap: 22px; align-items: start; }
.cform { position: sticky; top: 24px; }
.cqueue .section-title { margin-top: 0; }
.fl { display: grid; gap: 6px; margin-bottom: 14px; }
.fl > span { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.fl em { font-style: normal; font-weight: 400; color: var(--text-3); margin-left: 4px; }
.fl input, .fl textarea { width: 100%; min-height: 0; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: 14px/1.5 var(--font); padding: 9px 12px; }
.fl input { height: 40px; }
.fl textarea { resize: vertical; }
.fl input:focus, .fl textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drop { position: relative; display: grid; justify-items: center; gap: 4px; padding: 20px 14px; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); color: var(--text-2); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop svg { width: 22px; height: 22px; color: var(--text-3); }
.drop b { font-size: 13px; font-weight: 600; color: var(--text); }
.drop small { font-size: 11.5px; color: var(--text-3); }
.c-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.c-thumbs:empty { display: none; }
.c-thumb { position: relative; width: 64px; height: 64px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: var(--sunken); }
.c-thumb img { width: 100%; height: 100%; object-fit: cover; }
.c-thumb button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; display: grid; place-items: center; border: 0; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.c-thumb button svg { width: 12px; height: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); font-size: 13px; cursor: pointer; }
.check input { accent-color: #FFB000; width: 15px; height: 15px; }
.check em { font-style: normal; font-size: 11.5px; color: var(--text-3); margin-left: 4px; }
#cq { display: grid; gap: 12px; }
.cq-item { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 16px; padding: 16px; }
.cq-thumb { width: 76px; height: 76px; border-radius: 11px; overflow: hidden; display: grid; place-items: center; background: var(--sunken); border: 1px solid var(--line); color: var(--text-3); }
.cq-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cq-thumb svg { width: 24px; height: 24px; }
.cq-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cq-top b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.cq-meta { margin-top: 3px; font-size: 12px; color: var(--text-3); }
.pf { display: inline-flex; align-items: center; }
.pf .sw { margin-right: 4px; }
.cq-err { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; font-size: 12.5px; color: var(--crit-text); overflow-wrap: anywhere; }
.cq-err svg { width: 14px; height: 14px; margin-top: 2px; }
.cq-note { margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.cq-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cq-actions:empty { display: none; }
.cq-confirm { margin: 12px 0 0; border: 0; border-radius: 10px; }
.d-feed { margin: 0; }
.d-brief { padding: 14px 4px; }
@media (max-width: 1100px) { .creation { grid-template-columns: minmax(0,1fr); } .cform { position: static; } }
@media (max-width: 520px) { .row2 { grid-template-columns: minmax(0,1fr); } .cq-item { grid-template-columns: 56px minmax(0,1fr); gap: 12px; } .cq-thumb { width: 56px; height: 56px; } .cq-top { flex-direction: column; } }

/* ---------- approve & run ---------- */
.confirm { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 14px 18px; background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.confirm > svg { width: 18px; height: 18px; margin-top: 2px; color: var(--accent-text); }
.confirm p { margin: 0 0 10px; font-size: 13px; color: var(--text-2); max-width: 70ch; }
.confirm b { color: var(--text); }
.confirm .c-actions { justify-content: flex-start; margin: 0; }
.edtext { min-height: 420px; margin: 16px 0 0; border-radius: 0; border: 0; border-top: 1px solid var(--line); font: 13px/1.65 var(--mono); }
.runbox { overflow: hidden; }
.r-sub { padding: 14px 18px 6px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }
.run-note { margin: 12px 18px 0; }
.feed { list-style: none; margin: 0 12px; padding: 4px 0; max-height: 380px; overflow-y: auto; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.ev { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 8px; padding: 8px 12px; }
.ev + .ev { border-top: 1px dashed var(--line); }
.ev-ic { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); color: var(--text-3); }
.ev-ic svg { width: 13px; height: 13px; }
.ev b { font-size: 12px; font-weight: 600; color: var(--text-2); }
.ev p { margin: 1px 0 0; font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.ev.tool p { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }
.ev.error .ev-ic { color: var(--crit-text); } .ev.error b { color: var(--crit-text); }
.ev.end .ev-ic { color: var(--good-text); }
.ev.text .ev-ic { color: var(--accent-text); }
.rb { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 600; background: var(--sunken); color: var(--text-2); }
.rb.running, .rb.queued { background: var(--accent-soft); color: var(--accent-text); }
.rb.done { background: var(--good-bg); color: var(--good-text); }
.rb.failed { background: var(--crit-bg); color: var(--crit-text); }
.rb.stopped { background: var(--warn-bg); color: var(--warn-text); }

/* ---------- sales ---------- */
/* series colours: validated categorical slots 1-2, stepped per theme; they follow the platform, never its rank */
:root { --s-amazon: #2a78d6; --s-noon: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s-amazon: #3987e5; --s-noon: #d95926; } }
:root[data-theme="dark"] { --s-amazon: #3987e5; --s-noon: #d95926; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; flex: none; vertical-align: 0; }
.sw-amazon { background: var(--s-amazon); } .sw-noon { background: var(--s-noon); }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line); }
.seg button { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 0 0 1px var(--line); }
.seg.small button { height: 24px; padding: 0 10px; font-size: 12px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper select { height: 34px; min-width: 190px; max-width: 100%; border-radius: 9px; border: 1px solid var(--line-strong); padding: 0 10px; font-weight: 500; }
.icon-btn[disabled] { opacity: .4; cursor: default; }
.fresh { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.fresh svg { width: 13px; height: 13px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; margin-bottom: 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--text-2); }
.note svg { width: 16px; height: 16px; margin-top: 2px; color: var(--text-3); }
.note p { margin: 0; } .note b { color: var(--text); font-weight: 600; }
.note.warn { background: var(--warn-bg); border-color: transparent; }
.note.warn svg { color: var(--warn-text); }

.t-delta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.delta svg { width: 12px; height: 12px; stroke-width: 2.4; }
.delta.good { color: var(--good-text); } .delta.bad { color: var(--crit-text); }
.delta.flat, .delta.none { color: var(--text-3); font-weight: 500; }
.vs { color: var(--text-3); }

.chart-card { margin-top: 14px; padding: 18px 20px 12px; }
.c-head2 { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.c-head2 h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; }
.c-head2 p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-3); }
.c-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.legend2 { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.legend2 span { display: inline-flex; align-items: center; }
.chart { width: 100%; min-height: 220px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .yl, .chart .xl { fill: var(--text-3); font: 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dl { fill: var(--text-2); font: 600 12px var(--font); }
.chart .xh { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart [data-chart] { cursor: crosshair; }
th.r, td.r { text-align: right; }
tbody tr.static { cursor: default; }
.tip.rich { min-width: 190px; padding: 10px 12px; }
.tip .th { font-weight: 600; margin-bottom: 6px; color: #fff; }
.tip .tr { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; color: #C9CDD2; }
.tip .tr span { display: inline-flex; align-items: center; }
.tip .tr b { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .tt { margin-top: 4px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.12); }

.plats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.plat { padding: 18px 20px; }
.p-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.p-name { display: inline-flex; align-items: center; font-weight: 600; font-size: 14px; }
.p-share { font-size: 12px; color: var(--text-3); }
.p-val { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 10px 0 10px; }
.p-bar { height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.p-bar i { display: block; height: 100%; border-radius: 99px; }
.p-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin: 16px 0 14px; }
.p-stats dt { font-size: 11.5px; color: var(--text-3); }
.p-stats dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.spark { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); gap: 4px; height: 52px; align-items: end; }
.spark i { display: block; background: var(--line-strong); border-radius: 3px 3px 1px 1px; min-height: 0; }
.spark i:hover { filter: brightness(1.15); }
.spark-cap { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 6px; }

.best-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.best { padding: 18px 8px 8px; }
.best .c-head2 { padding: 0 12px; }
.rank { list-style: none; margin: 4px 0 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 26px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 10px; }
.rank li:hover { background: var(--surface-2); }
.rank li + li { border-top: 1px solid var(--line); }
.r-n { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--sunken); font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rank li:nth-child(-n+3) .r-n { background: var(--accent-soft); color: var(--accent-text); }
.r-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-meta { font-size: 11.5px; color: var(--text-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-bar { height: 4px; margin-top: 7px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.r-bar i { display: block; height: 100%; border-radius: 99px; }
.r-val { text-align: right; white-space: nowrap; }
.r-val b { display: block; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.r-val small { font-size: 11px; color: var(--text-3); }

@media (max-width: 1180px) { .plats { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 700px) {
  .fresh { margin-left: 0; width: 100%; }
  .stepper { width: 100%; } .stepper select { flex: 1; min-width: 0; }
  .filters .seg { max-width: 100%; overflow-x: auto; }
  .p-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .best-grid { grid-template-columns: minmax(0,1fr); }
  .rank li { grid-template-columns: 24px minmax(0,1fr); }
  .r-val { grid-column: 2; text-align: left; display: flex; gap: 8px; align-items: baseline; }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .tiles { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split, .cmd { grid-template-columns: minmax(0,1fr); }
  .history { position: static; }
  .hero { grid-template-columns: minmax(0,1fr); gap: 22px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0,1fr); }
  .side { position: fixed; inset: auto 0 0 0; height: auto; z-index: 40; flex-direction: row; align-items: center; gap: 4px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 90%, transparent); backdrop-filter: blur(14px); }
  .brand, .host { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 8px; }
  .nav a.on { background: transparent; box-shadow: none; color: var(--accent-text); }
  .nav a.on::before { display: none; }
  .side-foot { margin: 0; }
  .main { padding-block: 20px 100px; }
  .drawer-panel { padding: 20px 16px 40px; }
}
@media (max-width: 520px) {
  .tiles, .metrics { grid-template-columns: minmax(0,1fr); }
  .big { font-size: 50px; }
  .facts { grid-template-columns: 1fr 1fr; }
  #logout { display: none; }
  .top-actions .btn span { display: none; }
}

/* ---------- tasks inbox ---------- */
.tk { display: grid; gap: 16px; }
.tk .composer textarea { min-height: 110px; }
.tk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tk-actions .hint { margin-left: auto; }
.tk-field { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.tk-field select { height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: 13px var(--font); }
.tk-cards { display: grid; gap: 12px; }
.tk-card { padding: 16px 18px; display: grid; gap: 10px; border-left: 3px solid transparent; }
.tk-card.urgent { border-left-color: var(--crit); }
.tk-card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.tk-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-3); font-size: 12.5px; }
.tk-id { font: 12px var(--mono); color: var(--text-3); }
.tk-text { margin: 0; white-space: pre-wrap; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.tk-route { font-size: 13px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.tk-route b { color: var(--text); text-transform: capitalize; }
.tk-route > span:last-child { color: var(--text-3); }
.tk-sum, .tk-needs, .tk-md { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; line-height: 1.6; overflow-wrap: anywhere; }
.tk-needs { background: var(--warn-bg); border-color: transparent; }
.tk-needs b { display: block; margin-bottom: 2px; }
.tk-md h4 { margin: 10px 0 2px; font-size: 14px; }
.tk-card footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 640px) { .tk-actions .hint { display: none; } .tk-actions .btn.primary { margin-left: auto; } }
/* ---------- task attachments ---------- */
.tk-drop { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--text-3); font-size: 13px; transition: border-color .15s, background .15s; }
.tk-drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.tk-chips { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tk-chips:empty { display: none; }
.tk-chips li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; max-width: 100%; }
.tk-chips li svg { width: 14px; height: 14px; flex: none; color: var(--text-3); }
.tk-chips li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.tk-chips li small { color: var(--text-3); }
.tk-chips button { border: 0; background: transparent; color: var(--text-3); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 7px; border-radius: 999px; }
.tk-chips button:hover { background: var(--line); color: var(--text); }
.tk-files { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-file { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); text-decoration: none; font-size: 12.5px; max-width: 260px; }
.tk-file:hover { border-color: var(--line-strong); }
.tk-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-file small { color: var(--text-3); flex: none; }
.tk-file svg { width: 14px; height: 14px; flex: none; color: var(--text-3); }
.tk-file.img { padding: 0; overflow: hidden; width: 72px; height: 72px; }
.tk-file.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* ---------- restock photo sizes (Details / Large / Tiles) and zoom ---------- */
img[data-rszoom] { cursor: zoom-in; }
.rs-size-large .inv-prod, .rs-size-tiles .inv-prod { max-width: 440px; gap: 14px; }
.rs-size-large .inv-prod img, .rs-size-large .inv-prod .inv-ph,
.rs-size-tiles .inv-prod img, .rs-size-tiles .inv-prod .inv-ph { width: 104px; height: 104px; border-radius: 10px; }
.rs-size-large .rs-list li, .rs-size-tiles .rs-list li { grid-template-columns: 80px minmax(0,1fr) auto; }
.rs-size-large .rs-list li img, .rs-size-large .rs-list .inv-ph,
.rs-size-tiles .rs-list li img, .rs-size-tiles .rs-list .inv-ph { width: 80px; height: 80px; }
.rs-size-large .rs-table .r-title, .rs-size-large .rs-ar { font-size: 14.5px; }
.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 12px; max-height: 76vh; overflow: auto; align-content: start; }
.rs-grid > .empty { grid-column: 1 / -1; }
.rs-tile { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.rs-tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.rs-tile-img { aspect-ratio: 1 / 1; background: #fff; display: grid; place-items: center; border-bottom: 1px solid var(--line); overflow: hidden; }
.rs-tile-img img { width: 100%; height: 100%; object-fit: contain; }
.rs-tile-img .inv-ph { width: 72px; height: 72px; }
.rs-tile-body { padding: 10px 12px 12px; display: grid; gap: 6px; min-width: 0; }
.rs-tile-body .r-title { font-weight: 600; font-size: 13.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rs-tile-body .rs-ar { font-size: 15px; }
.rs-stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; margin: 4px 0 0; }
.rs-stats div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 6px 4px; text-align: center; min-width: 0; }
.rs-stats div.sugg { background: var(--accent-soft); border-color: transparent; }
.rs-stats dt { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.rs-stats dd { margin: 2px 0 0; font: 700 17px var(--font); font-variant-numeric: tabular-nums; }
.rs-stats small { display: block; font-size: 10.5px; color: var(--text-3); }
.rs-tile-q { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.rs-tile-q .rs-in { flex: 1; width: auto; min-width: 0; }
.rs-lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(12,13,15,.84); display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top, 0px)) 16px; cursor: zoom-out; animation: fade .15s ease-out; }
.rs-lightbox figure { margin: 0; max-width: min(94vw, 960px); display: grid; gap: 12px; justify-items: center; }
.rs-lightbox img { max-width: 100%; max-height: 82vh; background: #fff; border-radius: 14px; object-fit: contain; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.rs-lightbox figcaption { color: #ECE8E1; font-size: 15px; text-align: center; max-width: 70ch; line-height: 1.5; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 640px) { .rs-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } .rs-stats dd { font-size: 15px; } }
/* ---------- shipments (Restock > Shipments) ---------- */
.sh-table { max-height: 74vh; }
.sh-table .sw { display: inline-block; vertical-align: middle; }
tr.sh-row { cursor: pointer; }
tr.sh-row:hover td, tr.sh-row.on td { background: var(--surface-2); }
tr.sh-alert td { background: var(--crit-bg); }
tr.sh-alert:hover td { background: var(--crit-bg); filter: brightness(.98); }
tr.sh-items > td { background: var(--surface-2); padding: 6px 14px 14px; }
.sh-sub { width: 100%; border-collapse: collapse; }
.sh-sub th { position: static; background: transparent; }
.accent-t { color: var(--accent-text) !important; font-weight: 600; }
/* ---------- Amazon investigations ---------- */
.inv-panel { padding: 12px 14px; margin-bottom: 10px; display: grid; gap: 10px; border-left: 3px solid var(--accent); }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.inv-head .pill { margin-left: 6px; }
.inv-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inv-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.inv-steps li { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 10px; font-size: 13px; }
.inv-steps li span { color: var(--text-3); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .inv-steps li { grid-template-columns: minmax(0,1fr); gap: 0; } }
.inv-prep { display: grid; gap: 6px; }
.inv-weight { padding: 8px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.inv-weight.bad { background: var(--crit-bg); border-color: transparent; }
.inv-weight.good { background: var(--good-bg); border-color: transparent; }
.inv-missing { background: var(--warn-bg); border-radius: 9px; padding: 8px 10px; font-size: 13px; }
.inv-missing ul { margin: 4px 0 0; padding-inline-start: 18px; }
.inv-evidence { display: grid; gap: 6px; }
.inv-evhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inv-evhead .btn { margin-inline-start: auto; }
.inv-claim summary { cursor: pointer; font-size: 13px; }
.inv-claim textarea { min-height: 160px; margin-top: 6px; font-size: 14px; }


/* ---------- team: users, permissions, activity ---------- */
:root { --av-owner: #FFB000; --av-manager: #5B7CFA; --av-staff: #16A394; --av-viewer: #8A8F98; --av-custom: #B25BD6; }
.team { display: grid; gap: 16px; }
.tm-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tm-bar .seg button { gap: 7px; height: 32px; padding: 0 14px; font-weight: 550; }
.tm-bar .seg svg { width: 15px; height: 15px; }
.tm-tools { display: flex; gap: 8px; }
.tm-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tm-stats .metric { background: var(--surface); box-shadow: var(--shadow); padding: 14px 16px; }
.tm-stats .metric b { font-size: 24px; margin-top: 2px; }
.tm-card { overflow: hidden; }
.tm-table { font-size: 13px; }
.tm-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 600; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tm-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tm-table tbody tr:last-child td { border-bottom: 0; }
.tm-table tbody tr[data-tmedit] { cursor: pointer; transition: background .12s; }
.tm-table tbody tr[data-tmedit]:hover { background: var(--surface-2); }
.tm-table tr.tm-off td { opacity: .62; }
.tm-table tr.tm-off td:last-child { opacity: 1; }
.tm-who { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.tm-who b { display: block; font-weight: 600; font-size: 13.5px; }
.tm-who small { color: var(--text-3); font-size: 12px; }
.tm-who em { font-style: normal; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-text); background: var(--accent-soft); padding: 1px 6px; border-radius: 99px; margin-left: 4px; }
.tm-av { --c: var(--av-custom); flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-size: 12.5px; font-weight: 650; letter-spacing: .02em; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent); }
.tm-av.sm { width: 24px; height: 24px; font-size: 9.5px; }
.tm-av.owner { --c: var(--av-owner); color: var(--accent-text); }
.tm-av.manager { --c: var(--av-manager); } .tm-av.staff { --c: var(--av-staff); } .tm-av.viewer { --c: var(--av-viewer); }
.tm-role { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 600; background: var(--sunken); color: var(--text-2); border: 1px solid var(--line); }
.tm-role svg { width: 13px; height: 13px; }
.tm-role.owner { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.tm-access { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.tm-meter { flex: 1; max-width: 90px; height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.tm-meter i { display: block; height: 100%; border-radius: inherit; background: var(--text-2); }
.tm-access small { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12px; }
.tm-when { color: var(--text-2); border-bottom: 1px dotted var(--line-strong); cursor: default; }
.tm-muted { color: var(--text-3); }
.tm-foot-note { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text-3); font-size: 12.5px; }
.tm-foot-note svg { width: 15px; height: 15px; flex: none; }

/* editor drawer */
.tm-form { display: grid; gap: 4px; margin-top: 20px; }
.tm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tm-form .field { margin-bottom: 8px; }
.tm-form .field input { height: 40px; }
.tm-form .field input:disabled { opacity: .6; }
.tm-sec { padding: 18px 0 4px; border-top: 1px solid var(--line); margin-top: 10px; }
.tm-sec > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.tm-sec h3 { margin: 0; font-size: 13.5px; font-weight: 650; letter-spacing: -.005em; }
.tm-sec > header span { color: var(--text-3); font-size: 12px; }
.tm-roles { display: flex; flex-wrap: wrap; width: 100%; }
.tm-roles button { flex: 1; justify-content: center; min-width: 76px; }
.tm-hint { margin: 10px 0 0; color: var(--text-3); font-size: 12.5px; line-height: 1.5; }
.tm-mt { margin-top: 12px; }
.tm-perms { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tm-perm { position: relative; display: flex; align-items: flex-start; gap: 11px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); cursor: pointer; transition: border-color .12s, background .12s; }
.tm-perm:hover { border-color: var(--line-strong); }
.tm-perm input { position: absolute; opacity: 0; pointer-events: none; }
.tm-perm:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); }
.tm-perm:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.tm-perm.locked { cursor: default; }
.tm-switch { flex: none; position: relative; width: 30px; height: 18px; margin-top: 1px; border-radius: 99px; background: var(--line-strong); transition: background .15s; }
.tm-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.tm-perm input:checked + .tm-switch { background: var(--accent); }
.tm-perm input:checked + .tm-switch::after { transform: translateX(12px); }
.tm-pl b { display: block; font-size: 13px; font-weight: 600; }
.tm-pl small { display: block; margin-top: 2px; color: var(--text-3); font-size: 11.5px; line-height: 1.4; }
.tm-check { display: flex; align-items: center; gap: 9px; margin-top: 12px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.tm-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.tm-actbar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.tm-form > .tm-actbar { position: sticky; bottom: -24px; padding: 14px 0; margin: 6px 0 0; background: var(--surface); border-top: 1px solid var(--line); }
.tm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.danger { color: var(--crit-text); }
.btn.danger:hover { border-color: var(--crit-text); background: var(--crit-bg); }
.btn.danger-solid { background: var(--crit); border-color: transparent; color: #fff; font-weight: 600; }
.btn.danger-solid:hover { filter: brightness(1.08); }
.tm-confirm { display: flex; gap: 12px; margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-strong); }
.tm-confirm > svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--warn-text); }
.tm-confirm.danger { background: var(--crit-bg); border-color: transparent; }
.tm-confirm.danger > svg { color: var(--crit-text); }
.tm-confirm > div { flex: 1; }
.tm-confirm p { margin: 4px 0 0; color: var(--text-2); font-size: 12.5px; }
.tm-confirm .err { margin: 8px 0 0; }
.tm-secret { margin-top: 18px; padding: 16px; border-radius: 13px; background: var(--good-bg); border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); }
.tm-secret-head { display: flex; gap: 11px; }
.tm-secret-head svg { flex: none; width: 18px; height: 18px; color: var(--good-text); margin-top: 1px; }
.tm-secret-head p { margin: 3px 0 0; color: var(--text-2); font-size: 12.5px; }
.tm-secret-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.tm-secret code { font: 500 13.5px var(--mono); padding: 6px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); user-select: all; }
.tm-secret .tm-pw { letter-spacing: .04em; }
.tm-link { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; color: var(--accent-text); text-decoration: none; font-weight: 550; }
.tm-link svg { width: 13px; height: 13px; }
.tm-recent { display: grid; }
.tm-ev { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.tm-ev:last-child { border-bottom: 0; }
.tm-ev > i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); transform: translateY(-1px); }
.tm-ev.failed > i { background: var(--warn); } .tm-ev.denied > i { background: var(--crit); }
.tm-ev b { font-weight: 550; font-size: 13px; }
.tm-ev small { display: block; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
.tm-ev time { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* password strength */
.tm-strength { display: flex; align-items: center; gap: 10px; margin: -2px 0 10px; }
.tm-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; flex: 1; max-width: 180px; }
.tm-bars i { height: 4px; border-radius: 99px; background: var(--line-strong); transition: background .2s; }
.tm-strength span { font-size: 12px; color: var(--text-3); }
.tm-strength[data-s="0"] .tm-bars i:nth-child(-n+1) { background: var(--crit); }
.tm-strength[data-s="1"] .tm-bars i:nth-child(-n+1) { background: var(--crit); }
.tm-strength[data-s="2"] .tm-bars i:nth-child(-n+2) { background: var(--warn); }
.tm-strength[data-s="3"] .tm-bars i:nth-child(-n+3) { background: var(--good); }
.tm-strength[data-s="4"] .tm-bars i { background: var(--good); }
.tm-strength[data-s="0"] span, .tm-strength[data-s="1"] span { color: var(--crit-text); }

/* activity log */
.tm-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tm-filters select, .tm-filters input[type=date] { height: 34px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); padding: 0 10px; font: 13px var(--font); }
.tm-search { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; height: 34px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); }
.tm-search svg { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.tm-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 13px var(--font); }
.tm-date { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.tm-day td { padding: 8px 16px !important; background: var(--sunken); font-size: 11.5px; font-weight: 600; color: var(--text-2); letter-spacing: .02em; }
.tm-logtable td { padding: 10px 16px; }
.tm-logtable td.num { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.tm-userlink { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; color: var(--text); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; }
.tm-userlink:hover span { text-decoration: underline; text-underline-offset: 3px; }
.tm-act { display: flex; flex-direction: column; gap: 2px; min-width: 170px; }
.tm-act b { font-weight: 550; }
.tm-cat { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.tm-detail { color: var(--text-2); max-width: 420px; overflow-wrap: anywhere; font-size: 12.5px; }
.tm-detail code { font: 12px var(--mono); padding: 1px 6px; border-radius: 6px; background: var(--sunken); color: var(--text); }
.tm-ip { font: 12px var(--mono); color: var(--text-3); white-space: nowrap; }
.tm-more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12.5px; }

@media (max-width: 900px) {
  .tm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tm-perms, .tm-grid2 { grid-template-columns: 1fr; }
  .tm-table:not(.tm-logtable) th:nth-child(3), .tm-table:not(.tm-logtable) td:nth-child(3) { display: none; }
  .tm-logtable th:nth-child(6), .tm-logtable td:nth-child(6) { display: none; }
}

/* restock: sortable columns */
.rs-sortable button { display: inline-flex; align-items: center; gap: 4px; margin: -4px -6px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.rs-sortable button:hover { background: var(--line); color: var(--text); }
.rs-sortable.on button { color: var(--text); font-weight: 600; }
.rs-arrow { display: inline-flex; }
.rs-arrow svg { width: 12px; height: 12px; }
.rs-sortable:not(.on) .rs-arrow { opacity: 0; }
.rs-sortable:not(.on) button:hover .rs-arrow { opacity: .45; }
.rs-sortseg { align-items: center; }
.rs-sortseg > span { padding: 0 6px 0 8px; font-size: 12px; color: var(--text-3); }
.rs-sortseg button { gap: 4px; }
.rs-sortseg button svg { width: 12px; height: 12px; }


/* buyer preview: edit mode */
.pv-desc p { margin: 0 0 8px; white-space: normal; }
.pv-desc ul, .pv-desc ol { margin: 0 0 8px; padding-inline-start: 20px; }
.pv.editing { box-shadow: 0 0 0 2px var(--accent); }
.pv-ed { width: 100%; box-sizing: border-box; font: inherit; color: inherit; background: #fffdf5; border: 1px dashed #d9b85c; border-radius: 6px; padding: 5px 8px; resize: none; outline: none; transition: border-color .12s, box-shadow .12s; }
.pv-ed:hover { border-color: #c79a2a; }
.pv-ed:focus { border-style: solid; border-color: #e7a300; box-shadow: 0 0 0 3px rgba(255,176,0,.22); background: #fff; }
textarea.pv-ed { overflow: hidden; line-height: 1.4; }
.pv-ed.pv-title { font-size: 20px; line-height: 1.3; }
.pv-edwrap { position: relative; margin: 2px 0 8px; }
.pv-edlabel { font-size: 11.5px; font-weight: 700; color: #565959; margin: 6px 0 3px; }
.pv-count { display: block; text-align: end; font: 11px Arial, sans-serif; color: #8a8f98; margin-top: 2px; }
.pv-count.over { color: #b12704; font-weight: 700; }
.pv-edbullets { margin: 0; padding-inline-start: 22px; }
.pv-edbullets li { margin: 0 0 8px; }
.pv-edside { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.pv-edside .pv-count { margin: 0; }
.pv-x { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #8a8f98; cursor: pointer; }
.pv-x:hover { background: #fde8e6; color: #b12704; }
.pv-x svg { width: 13px; height: 13px; }
.pv-add { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 0; padding: 6px 10px; border: 1px dashed #c7cbd1; border-radius: 7px; background: #fff; color: #007185; font: 13px Arial, sans-serif; cursor: pointer; }
.pv-add:hover { border-color: #007185; background: #f2fafb; }
.pv-add svg { width: 13px; height: 13px; }
.pv-edtools { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.pv-edtools button { height: 26px; padding: 0 9px; border: 1px solid #d5d9d9; border-radius: 6px; background: #fff; color: #0f1111; font: 12.5px Arial, sans-serif; cursor: pointer; }
.pv-edtools button:hover { background: #f3f3f3; }
.pv-edhint { font: 11.5px Arial, sans-serif; color: #8a8f98; margin-inline-start: 4px; }
.pv-rich { min-height: 120px; padding: 10px 12px; }
.pv-rich:empty::before { content: "Write the product description"; color: #9aa0a6; }
.pv-ed-price { display: inline-flex; align-items: baseline; gap: 6px; }
.pv-ed-price input { width: 150px; font-size: 22px; padding: 3px 8px; }
.pv td .pv-ed { min-width: 180px; padding: 3px 7px; font-size: 13px; }
.pv-dirty { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; background: var(--warn-bg); color: var(--warn-text); font-size: 12px; font-weight: 600; }
.pv-dirty svg { width: 13px; height: 13px; }
.pv-editnote { margin-top: 14px; }
#pv-editerr:empty { display: none; }



/* ---------- language switch and right-to-left layout ---------- */
.i18n-wait body { visibility: hidden; }
.lang-link { position: absolute; top: 14px; inset-inline-end: 14px; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface); color: var(--text-2); font: 500 12.5px var(--font); cursor: pointer; }
.lang-link:hover { color: var(--text); border-color: var(--text-3); }
.lang-link svg { width: 14px; height: 14px; }
.login-card { position: relative; }

[dir="rtl"] { --font: "IBM Plex Sans Arabic", "Inter", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif; }
[dir="rtl"] body { font-family: var(--font); }
[dir="rtl"] * { letter-spacing: 0 !important; }
[dir="rtl"] .side { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .brand-name b { margin-left: 0; margin-right: 5px; }
[dir="rtl"] .nav a.on::before { left: auto; right: -14px; border-radius: 3px 0 0 3px; }
[dir="rtl"] th, [dir="rtl"] .tm-table th { text-align: right; }
[dir="rtl"] th.r, [dir="rtl"] td.r, [dir="rtl"] .r-val { text-align: left; }
[dir="rtl"] .drawer-panel { right: auto; left: 0; border-left: 0; border-right: 1px solid var(--line); }
[dir="rtl"] .drawer-panel { animation-name: slide-rtl; }
@keyframes slide-rtl { from { transform: translateX(-28px); opacity: 0; } }
[dir="rtl"] .hero::after { right: auto; left: -90px; }
[dir="rtl"] .t-value small { margin-right: 0; margin-left: 5px; }
[dir="rtl"] .logs-tools, [dir="rtl"] .t-open, [dir="rtl"] .fresh, [dir="rtl"] .tk-actions .hint { margin-left: 0; margin-right: auto; }
[dir="rtl"] .nowrap .btn + .btn { margin-left: 0; margin-right: 6px; }
[dir="rtl"] .fl em, [dir="rtl"] .check em, [dir="rtl"] .inv-head .pill { margin-left: 0; margin-right: 4px; }
[dir="rtl"] .pill.run { padding-left: 6px; padding-right: 9px; }
[dir="rtl"] .pf .sw { margin-right: 0; margin-left: 4px; }
[dir="rtl"] .sw { margin-right: 0; margin-left: 7px; }
[dir="rtl"] .rb { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .c-thumb button { right: auto; left: 3px; }
[dir="rtl"] .tk-card { border-left: 0; border-right: 3px solid transparent; }
[dir="rtl"] .tk-card.urgent { border-right-color: var(--crit); }
[dir="rtl"] .inv-panel { border-left: 0; border-right: 3px solid var(--accent); }
[dir="rtl"] .tm-who em { margin-left: 0; margin-right: 4px; }
[dir="rtl"] .tm-switch::after { left: auto; right: 2px; }
[dir="rtl"] .tm-perm input:checked + .tm-switch::after { transform: translateX(-12px); }
[dir="rtl"] .tm-link svg, [dir="rtl"] .t-open svg { transform: scaleX(-1); }
[dir="rtl"] .rs-ar { text-align: right; }
[dir="rtl"] .num, [dir="rtl"] .mono, [dir="rtl"] code, [dir="rtl"] .tm-ip, [dir="rtl"] input[type=number], [dir="rtl"] input[type=date] { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] td.num.r, [dir="rtl"] th.r { text-align: left; }
@media (max-width: 640px) { [dir="rtl"] .tk-actions .btn.primary { margin-left: 0; margin-right: auto; } }
@media (max-width: 900px) { [dir="rtl"] .r-val { text-align: right; } }
[dir="rtl"] .brand-name { direction: ltr; }
[dir="rtl"] .brand-name b { margin-right: 0; margin-left: 5px; }
