/* HubArabia console. Same identity as the site: Hub Ink + Volt, Alexandria, hairlines, no shadows. */
:root {
  --bg: #f7f8f7;
  --card: #ffffff;
  --ink: #0e1a20;
  --t2: #4b5b62;
  --t3: #7d8b91;
  --line: rgba(14, 26, 32, .09);
  --line-2: rgba(14, 26, 32, .16);
  --volt: #c5f03c;
  --volt-ink: #3d5200;
  --ok: #1f7a4a; --ok-bg: #e6f4ec;
  --warn: #9a5b00; --warn-bg: #fff3de;
  --bad: #b42318; --bad-bg: #fdecea;
  --mute-bg: #eef1f0;
  --r: 10px; --r-card: 14px;
  --font: 'Alexandria', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 300 15px/1.65 var(--font); font-variant-numeric: tabular-nums; }
[dir="rtl"] * { letter-spacing: 0 !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, b, strong, th { font-weight: 500; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--mono); font-weight: 400; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--t3); }
.skip { position: absolute; inset-inline-start: 16px; top: -64px; z-index: 60; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }
[hidden] { display: none !important; }

/* Top bar */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1200px; margin-inline: auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; flex: none; }
.brand img { display: block; height: 18px; width: auto; }
.nav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav a { text-decoration: none; padding: 7px 12px; border-radius: 8px; color: var(--t2); white-space: nowrap; font-weight: 400; }
.nav a:hover { background: var(--mute-bg); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; }
.top-end { display: flex; align-items: center; gap: 14px; flex: none; }
.who { color: var(--t3); font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { background: none; border: 0; padding: 4px; cursor: pointer; color: var(--t2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.link:hover { color: var(--ink); }

/* Layout */
.view { max-width: 1200px; margin-inline: auto; padding: 28px 20px 64px; outline: none; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { font-size: 24px; line-height: 1.3; }
.head p { color: var(--t2); margin-top: 4px; }
.crumb { display: inline-flex; gap: 6px; align-items: center; color: var(--t3); text-decoration: none; font-size: 13px; margin-bottom: 8px; }
.crumb:hover { color: var(--ink); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
.card-pad { padding: 20px; }
.card h2 { font-size: 15px; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r); border: 1px solid transparent; font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #1f3540; }
.btn-volt { background: var(--volt); color: var(--ink); border-color: rgba(14, 26, 32, .2); }
.btn-volt:hover { background: #d3f76a; }
.btn-line { background: var(--card); border-color: var(--line-2); }
.btn-line:hover { border-color: rgba(14, 26, 32, .32); }
.btn-bad { background: var(--card); border-color: rgba(180, 35, 24, .35); color: var(--bad); }
.btn-bad:hover { background: var(--bad-bg); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[dir="rtl"] .flip { transform: scaleX(-1); }

/* Forms */
.form { display: grid; gap: 16px; }
.f { display: grid; gap: 6px; }
.f > span { font-size: 13px; color: var(--t2); font-weight: 400; }
.f small { color: var(--t3); font-size: 12.5px; line-height: 1.5; }
.in { height: 42px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--card); padding: 0 12px; width: 100%; min-width: 0; }
textarea.in { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
.in:hover { border-color: rgba(14, 26, 32, .3); }
.in:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(14, 26, 32, .08); }
.in[aria-invalid="true"] { border-color: var(--bad); }
.in.code { font-family: var(--mono); letter-spacing: .3em !important; font-size: 18px; text-align: center; direction: ltr; }
.err { color: var(--bad); font-size: 13.5px; }
.ok { color: var(--ok); font-size: 13.5px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }

/* Module switches */
.mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mod { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; background: var(--card); }
.mod:hover { border-color: var(--line-2); }
.mod input { position: absolute; opacity: 0; pointer-events: none; }
.mod .sw { width: 34px; height: 20px; border-radius: 10px; background: var(--mute-bg); border: 1px solid var(--line-2); position: relative; flex: none; transition: background-color .15s; }
.mod .sw::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 1px solid var(--line-2); transition: inset-inline-start .15s; }
.mod input:checked + .sw { background: var(--volt); border-color: rgba(14, 26, 32, .35); }
.mod input:checked + .sw::after { inset-inline-start: 16px; border-color: rgba(14, 26, 32, .45); }
.mod input:focus-visible + .sw { outline: 2px solid var(--ink); outline-offset: 2px; }
.mod input:disabled + .sw { opacity: .6; }
.mod b { display: block; font-size: 14px; }
.mod small { display: block; color: var(--t3); font-size: 12.5px; line-height: 1.45; margin-top: 2px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 16px; text-decoration: none; display: block; }
a.stat:hover { border-color: var(--line-2); }
.stat b { display: block; font-size: 28px; line-height: 1.2; font-weight: 500; }
.stat span { color: var(--t2); font-size: 13px; }

/* Lists (table on wide screens, cards on phones) */
.list { width: 100%; border-collapse: collapse; }
.list th { text-align: start; font-size: 12.5px; color: var(--t3); font-weight: 400; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover td { background: #fbfcfb; }
.list a.rowlink { text-decoration: none; font-weight: 500; }
.list a.rowlink:hover { text-decoration: underline; text-underline-offset: 3px; }
.sub { display: block; color: var(--t3); font-size: 12.5px; }
.empty { padding: 40px 20px; text-align: center; color: var(--t2); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 400; white-space: nowrap; background: var(--mute-bg); color: var(--t2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.s-new { background: #fbffe9; color: var(--volt-ink); box-shadow: inset 0 0 0 1px rgba(61, 82, 0, .25); }
.pill.s-contacted { background: #eef4ff; color: #2350a8; }
.pill.s-meeting { background: var(--warn-bg); color: var(--warn); }
.pill.s-subscribed, .pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.s-rejected, .pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.s-spam { background: var(--mute-bg); color: var(--t3); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 12px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--t2); white-space: nowrap; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { color: var(--t3); font-size: 12px; }
.chip[aria-pressed="true"] .n { color: rgba(255, 255, 255, .65); }
.search { flex: 1; min-width: 200px; max-width: 360px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--t2); font-size: 13px; }

/* Detail */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; }
.kv dt { color: var(--t3); font-size: 13px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.note { padding: 12px 0; border-top: 1px solid var(--line); }
.note:first-child { border-top: 0; padding-top: 0; }
.note p { white-space: pre-wrap; overflow-wrap: anywhere; }
.note .sub { margin-top: 4px; }
.linkbox { display: flex; gap: 8px; align-items: stretch; }
.linkbox .in { font-family: var(--mono); font-size: 13px; direction: ltr; }
.callout { border: 1px solid rgba(61, 82, 0, .25); background: #fbffe9; border-radius: var(--r-card); padding: 18px 20px; }
.callout.warn { border-color: rgba(154, 91, 0, .25); background: var(--warn-bg); }
.mini { display: grid; gap: 0; }
.mini > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.mini > div:first-child { border-top: 0; padding-top: 0; }

/* Sign-in / setup */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); padding: 28px; }
.auth-card .brand img { height: 20px; }
.auth-card h1 { font-size: 22px; margin: 28px 0 24px; }
.auth-card > p { color: var(--t2); margin: -16px 0 24px; }
.auth-foot { margin-top: 18px; display: flex; justify-content: space-between; color: var(--t3); font-size: 13px; }
.qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); }
.qr img { width: 160px; height: 160px; image-rendering: pixelated; }
.secret { font-family: var(--mono); font-size: 13px; word-break: break-all; direction: ltr; unicode-bidi: isolate; }
.steps { display: grid; gap: 10px; margin-bottom: 18px; color: var(--t2); }

.loading { padding: 48px 0; color: var(--t3); text-align: center; }
.toast { position: fixed; inset-inline-start: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; }
[dir="rtl"] .toast { transform: translateX(50%); }
.toast.on { opacity: 1; }

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .top-in { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .nav { order: 3; flex-basis: 100%; }
  .top-end { margin-inline-start: auto; }
  .who { display: none; }
  .view { padding: 20px 16px 56px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two, .mods { grid-template-columns: minmax(0, 1fr); }
  .list thead { display: none; }
  .list, .list tbody, .list tr, .list td { display: block; width: 100%; }
  .list tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .list tr:last-child { border-bottom: 0; }
  .list td { padding: 3px 0; border: 0; }
  .list td[data-l]::before { content: attr(data-l); color: var(--t3); font-size: 12px; margin-inline-end: 8px; }
  .search { max-width: none; flex-basis: 100%; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
  .linkbox { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
