/* Light, in the manner of Apple's own dashboards: grouped grey background, white rounded
   cards, a segmented control for sections, the system font and system blue. */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.08);
  --separator: rgba(60, 60, 67, 0.12);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --tertiary: #86868b;
  --accent: #0071e3;
  --accent-tint: rgba(0, 113, 227, 0.1);
  --green: #248a3d;
  --green-tint: rgba(52, 199, 89, 0.14);
  --red: #d70015;
  --red-tint: rgba(255, 59, 48, 0.1);
  --orange: #c93400;
  --orange-tint: rgba(255, 149, 0, 0.14);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Arabic", "Geeza Pro", system-ui, sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
.num, td.num, .stat b { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; direction: ltr; unicode-bidi: isolate; letter-spacing: 0; }

/* Sidebar: a translucent source list on the leading (right) edge */
body.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 12px;
  background: rgba(236, 236, 240, 0.72);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-inline-end: 0.5px solid var(--separator);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; white-space: nowrap; }
.sidebar .brand { padding: 4px 8px 14px; }
.logo {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(180deg, #2b8cff, #0066d6); color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.tabs { display: flex; flex-direction: column; gap: 14px; flex: 1; overflow-y: auto; }
.group { display: flex; flex-direction: column; gap: 2px; }
.group-title { margin: 0 0 4px; padding: 0 10px; font-size: 11px; font-weight: 600; color: var(--tertiary); }
.tabs button, .logout {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; font-weight: 500;
  padding: 7px 10px; border-radius: 8px; cursor: pointer; text-align: start; text-decoration: none;
  transition: background-color 0.15s;
}
.tabs button:hover, .logout:hover { background: var(--fill-2); text-decoration: none; }
.tabs button[aria-selected="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.tabs button .label { flex: 1; }
.ico { width: 19px; height: 19px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-selected="true"] .ico { stroke: #fff; }
.count:not(:empty) {
  min-width: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--fill); color: var(--muted);
  font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums;
}
.tabs button[aria-selected="true"] .count:not(:empty) { background: rgba(255, 255, 255, 0.25); color: #fff; }
.logout { color: var(--muted); }
.logout .ico { stroke: var(--muted); }

/* Page */
main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 36px 40px 64px; }
h2 { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
.lede { color: var(--muted); font-size: 15px; margin: 0 0 24px; max-width: 64ch; }
h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 36px 0 12px; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.stat {
  background: var(--surface); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat span { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat b { display: block; font-size: 36px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 6px 0 2px; text-align: right; }
.stat small { color: var(--tertiary); font-size: 12px; }
.stat.link { cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.stat.link:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 10px 28px rgba(0, 0, 0, 0.08); }
.stat.link span::after { content: "‹"; float: left; color: var(--tertiary); font-size: 16px; line-height: 1; }

/* Cards and inset-grouped tables */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 18px; text-align: start; vertical-align: middle; }
td { border-top: 0.5px solid var(--separator); }
th { font-size: 12px; font-weight: 500; color: var(--tertiary); white-space: nowrap; padding-top: 14px; padding-bottom: 8px; }
tbody tr { transition: background-color 0.15s; }
tbody tr:hover { background: var(--fill-2); }
td.actions { white-space: nowrap; text-align: end; }
.wrap-text { white-space: pre-wrap; word-break: break-word; max-width: 560px; }
.masked { font-size: 14px; line-height: 1.7; }

/* Buttons: capsules, filled for the main action, tinted for the rest */
.btn {
  font: inherit; font-size: 13px; font-weight: 600; border-radius: 980px; padding: 6px 14px;
  border: 0; background: var(--accent-tint); color: var(--accent); cursor: pointer;
  transition: filter 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:hover { filter: brightness(0.96); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--red-tint); color: var(--red); }
.btn + .btn { margin-inline-start: 6px; }

input[type="text"], input[type="search"], select {
  font: inherit; font-size: 14px; padding: 7px 12px; border-radius: 10px;
  border: 0; background: var(--fill); color: var(--text);
}
input[type="search"] { min-width: 260px; }
select { appearance: none; padding-inline-end: 12px; background: var(--surface); box-shadow: var(--shadow); font-weight: 500; cursor: pointer; }
input:focus-visible, select:focus-visible, .btn:focus-visible, .tabs button:focus-visible, .stat.link:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.4); outline-offset: 1px;
}
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
label.check { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; cursor: pointer; }
label.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 980px; font-size: 12px; font-weight: 600; background: var(--fill); color: var(--muted); }
.pill.good { background: var(--green-tint); color: var(--green); }
.pill.warn { background: var(--orange-tint); color: var(--orange); }
.pill.bad { background: var(--red-tint); color: var(--red); }
.up { color: var(--red); font-weight: 600; }
.down { color: var(--green); font-weight: 600; }

.empty { padding: 44px 20px; text-align: center; color: var(--tertiary); }
.error { padding: 16px 20px; border-radius: var(--radius); background: var(--red-tint); color: var(--red); }
.loading { padding: 60px; text-align: center; color: var(--tertiary); }

/* Charts */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.chart { padding: 18px 20px; }
.chart h4 { margin: 0 0 10px; font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chart h4 small { color: var(--tertiary); font-weight: 400; }
.chart svg { width: 100%; height: 120px; display: block; }
.chart .axis { stroke: var(--separator); stroke-dasharray: 3 3; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .dot.spike { fill: var(--red); stroke: var(--red); }

.cmd {
  background: #1d1d1f; color: #f5f5f7; border-radius: 14px;
  padding: 16px 18px; overflow-x: auto; margin: 0; line-height: 1.7;
}
.kv { display: grid; grid-template-columns: max-content 1fr; margin: 0; }
.kv dt, .kv dd { padding: 12px 18px; border-top: 0.5px solid var(--separator); margin: 0; }
.kv dt { color: var(--muted); }
.kv dt:first-of-type, .kv dt:first-of-type + dd { border-top: 0; }
details.card { margin-bottom: 12px; }
details.card summary { padding: 14px 18px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "‹"; color: var(--tertiary); transition: transform 0.2s; margin-inline-start: 10px; }
details.card[open] summary::after { transform: rotate(-90deg); }
details.card summary > span:last-of-type { margin-inline-start: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.toast {
  position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translate(50%, 20px);
  background: rgba(29, 29, 31, 0.92); color: #fff; padding: 10px 18px; border-radius: 980px;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.toast.show { opacity: 1; transform: translate(50%, 0); }
.toast.bad { background: var(--red); }

/* Login */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); padding: 32px 28px; display: grid; gap: 14px; text-align: center; }
.login-card .brand { flex-direction: column; gap: 12px; font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.login-card .logo { width: 64px; height: 64px; border-radius: 15px; font-size: 26px; }
.login-card label { color: var(--muted); font-size: 13px; text-align: start; }
.login-card input {
  font: inherit; font-size: 17px; padding: 11px 14px; border-radius: 12px; border: 0;
  background: var(--fill); color: var(--text); direction: ltr; text-align: center;
}
.login-card input:focus-visible { outline: 3px solid rgba(0, 113, 227, 0.4); }
.login-card .btn { padding: 12px; font-size: 16px; border-radius: 12px; }
.wrong { margin: 0; color: var(--red); font-size: 14px; }


/* Banks: country buttons, segmented filter, grouped list, edit sheet */
.country-bar { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.country-bar button {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  border: 0; font: inherit; font-size: 14px; font-weight: 500; color: var(--text);
  padding: 8px 14px; border-radius: 980px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}
.country-bar button:hover { background: var(--fill-2); }
.country-bar button:active { transform: scale(0.97); }
.country-bar button .num { color: var(--tertiary); font-size: 12px; font-weight: 600; }
.country-bar button[aria-checked="true"] { background: var(--text); color: #fff; }
.country-bar button[aria-checked="true"] .num { color: rgba(255, 255, 255, 0.65); }
.country-bar button:focus-visible { outline: 3px solid rgba(0, 113, 227, 0.4); outline-offset: 1px; }
.title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.title-row .btn { margin-top: 8px; padding: 8px 16px; font-size: 14px; }
.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--fill); border-radius: 9px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button, .seg label span {
  display: inline-block; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 500; color: var(--text);
  padding: 5px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; transition: background-color 0.2s, box-shadow 0.2s;
}
.seg button .num { color: var(--tertiary); font-weight: 500; margin-inline-start: 2px; }
.seg button[aria-pressed="true"], .seg input:checked + span { background: var(--surface); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04); }
.seg label { display: contents; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:focus-visible + span { outline: 3px solid rgba(0, 113, 227, 0.4); }
.kind-title { display: flex; align-items: center; gap: 8px; }
.kind-title small { color: var(--tertiary); font-weight: 500; font-size: 15px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.card.list { display: flex; flex-direction: column; }
.row {
  display: grid; grid-template-columns: 40px minmax(160px, 1.2fr) minmax(120px, 1fr) minmax(0, 1.2fr) 16px;
  align-items: center; gap: 14px; padding: 11px 18px; cursor: pointer; transition: background-color 0.15s;
}
.row + .row { border-top: 0.5px solid var(--separator); }
.row:hover { background: var(--fill-2); }
.row:focus-visible { outline: 3px solid rgba(0, 113, 227, 0.4); outline-offset: -3px; }
.row.off { opacity: 0.55; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: #fff; font-weight: 700; font-size: 17px; }
.k-bank { background: linear-gradient(180deg, #2b8cff, #0066d6); }
.k-wallet { background: linear-gradient(180deg, #c36bf0, #9a3fd0); }
.k-savings { background: linear-gradient(180deg, #4cd471, #28a745); }
.k-investment { background: linear-gradient(180deg, #ffad33, #f08300); }
.k-network { background: linear-gradient(180deg, #6b7280, #3f4652); }
.k-bnpl { background: linear-gradient(180deg, #3ccf8e, #1f9a62); }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-main b { font-weight: 600; }
.row-main small { color: var(--tertiary); font-size: 12px; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.row-match { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; text-align: left; }
.chev { color: var(--tertiary); font-size: 18px; }

dialog.sheet {
  border: 0; border-radius: 22px; padding: 0; width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.25); backdrop-filter: blur(4px); }
dialog.sheet form { display: grid; gap: 18px; padding: 24px 26px; }
dialog.sheet h3 { margin: 0; font-size: 22px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fields label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.fields label.wide { grid-column: 1 / -1; }
.fields input { width: 100%; font-size: 15px; padding: 9px 12px; }
.fields input[readonly] { color: var(--tertiary); }
.fields small { color: var(--tertiary); font-size: 11.5px; font-weight: 400; }
fieldset.terms { border: 0; padding: 14px 0 0; margin: 0; border-top: 0.5px solid var(--separator); }
fieldset.terms[hidden] { display: none; }
fieldset.terms legend { font-size: 13px; color: var(--muted); font-weight: 600; padding: 0 0 6px; }
fieldset.countries { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.countries legend { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 8px; padding: 0; }
fieldset.countries legend small { color: var(--tertiary); font-weight: 400; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 6px 14px; border-radius: 980px; background: var(--fill); font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.chip input:checked + span { background: var(--accent); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid rgba(0, 113, 227, 0.4); }
.form-error { margin: 0; color: var(--red); font-size: 14px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sheet-actions .btn { padding: 9px 20px; font-size: 14px; }


/* One bank's page */
.back { display: inline-block; margin-bottom: 14px; font-size: 15px; font-weight: 500; }
.bank-head { display: flex; align-items: center; gap: 18px; padding: 22px 24px; margin-bottom: 20px; }
.bank-logo, .mark {
  display: grid; place-items: center; flex: none; color: #fff; font-weight: 700;
  background: var(--brand, var(--accent));
}
.bank-logo { width: 72px; height: 72px; border-radius: 18px; font-size: 32px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15); }
.bank-title { flex: 1; min-width: 0; }
.bank-title h2 { margin: 0; font-size: 28px; }
.bank-title p { margin: 2px 0 8px; color: var(--tertiary); font-size: 14px; text-align: right; }
.bank-actions { display: flex; align-items: center; gap: 10px; align-self: flex-start; }
.stat b.word { font-size: 30px; }
.share { display: inline-block; vertical-align: middle; width: 90px; height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.share span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.identity { display: flex; align-items: center; gap: 16px; padding: 16px 18px; }
.identity .kv { flex: 1; }
.identity .kv dt, .identity .kv dd { padding: 8px 12px; }
.swatch { width: 84px; height: 84px; border-radius: 18px; background: var(--brand); flex: none; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.1); }
.logo-pair { display: flex; gap: 8px; flex: none; }
.logo-tile { width: 84px; height: 84px; border-radius: 18px; display: grid; place-items: center; }
.logo-tile.light { background: var(--bg); box-shadow: inset 0 0 0 0.5px var(--separator); }
.logo-tile.dark { background: #1d1d1f; }
.logo-tile .mark { width: 48px; height: 48px; border-radius: 12px; font-size: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.trend { width: 120px; height: 32px; display: block; }
.trend polyline { fill: none; stroke: var(--red); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--tertiary); }
.mock-note { margin-top: 28px; color: var(--tertiary); font-size: 13px; text-align: center; }


/* Credit cards on a bank's page */
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.cc { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.cc-face {
  position: relative; aspect-ratio: 1.586; margin: 14px 14px 0; border-radius: 12px; padding: 14px 16px; color: #fff;
  background: linear-gradient(135deg, #3a7bd5, #1e4f9c); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  display: flex; flex-direction: column; justify-content: flex-end; direction: ltr; overflow: hidden;
}
.cc-face::after { content: ""; position: absolute; inset: -40% -20% auto auto; width: 70%; height: 120%; background: rgba(255, 255, 255, 0.08); transform: rotate(25deg); }
.cc-face.t-gold { background: linear-gradient(135deg, #d8b25a, #9c7a2c); }
.cc-face.t-platinum { background: linear-gradient(135deg, #9aa3ad, #5d6670); }
.cc-face.t-titanium { background: linear-gradient(135deg, #6b6f76, #33363b); }
.cc-face.t-world { background: linear-gradient(135deg, #24345a, #0f1a33); }
.cc-face.t-signature, .cc-face.t-infinite, .cc-face.t-world-elite { background: linear-gradient(135deg, #2b2b2e, #0b0b0c); }
.cc-chip { position: absolute; top: 16px; left: 16px; width: 34px; height: 25px; border-radius: 5px; background: linear-gradient(135deg, #f3dd9b, #c9a24a); }
.cc-net { position: absolute; top: 16px; right: 16px; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; opacity: 0.95; }
.cc-name { position: relative; z-index: 1; font-size: 15px; font-weight: 600; line-height: 1.3; }
.cc-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cc-ar { margin: 0; font-weight: 600; }
.cc-facts { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: 13px; }
.cc-facts dt { color: var(--muted); }
.cc-facts dd { margin: 0; font-weight: 600; text-align: left; }
.cc-note { margin: 0; font-size: 12px; color: var(--tertiary); }
.cc-rewards { margin: 0; font-size: 13px; color: var(--text); background: var(--fill-2); border-radius: 10px; padding: 8px 10px; }
.cc-country { margin: 22px 0 10px; font-size: 16px; font-weight: 600; }
.cc-link { margin-top: auto; font-size: 13px; font-weight: 600; }


/* Credit-card messages */
.sms-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
details .sms-list { padding: 4px 16px 16px; }
.sms { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
details .sms { box-shadow: none; background: var(--bg); }
.sms-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sms-head code { color: var(--muted); }
.sms-count { margin-inline-start: auto; color: var(--tertiary); font-size: 12px; font-weight: 600; }
.bubble {
  margin: 0; padding: 10px 14px; border-radius: 18px; background: #e9e9eb; color: var(--text);
  font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; max-width: 100%;
}
.bubble[dir="ltr"] { border-bottom-left-radius: 5px; text-align: left; }
.bubble[dir="rtl"] { border-bottom-right-radius: 5px; }
mark.tok { color: inherit; border-radius: 5px; padding: 0 3px; font-weight: 600; unicode-bidi: isolate; }
.tok-amount, .f-amount { background: rgba(0, 113, 227, 0.16); }
.tok-merchant, .f-merchant { background: rgba(175, 82, 222, 0.16); }
.tok-last4, .f-last4 { background: rgba(255, 149, 0, 0.2); }
.tok-date, .f-date, .tok-due, .f-due { background: rgba(52, 199, 89, 0.18); }
.tok-limit, .f-limit, .tok-balance, .f-balance, .tok-min, .f-min { background: rgba(90, 200, 250, 0.22); }
.tok-fx, .f-fx { background: rgba(255, 45, 85, 0.14); }
.tok-code, .f-code { background: rgba(142, 142, 147, 0.25); }
.sms-fields { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.field { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 980px; color: var(--text); }
.sms-card { font-size: 12px; color: var(--tertiary); margin-inline-start: auto; }
details.sms-bank { margin-bottom: 12px; }
details.sms-bank summary { display: flex; align-items: center; gap: 10px; }
details.sms-bank summary::after { content: none; }
.sms-bank .avatar { width: 34px; height: 34px; font-size: 14px; border-radius: 9px; }
.sms-bank-name { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sms-bank-name small { color: var(--tertiary); font-weight: 400; font-size: 12px; }
.sms-open { font-size: 13px; font-weight: 600; }
details.sms-bank summary > span:last-of-type { margin-inline-start: 0; }


/* A card's fees and exchange-rate sheet */
.cc[data-card] { cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.cc[data-card]:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 10px 28px rgba(0, 0, 0, 0.08); }
.cc[data-card]:focus-visible { outline: 3px solid rgba(0, 113, 227, 0.4); }
.cc-rate { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); direction: ltr; text-align: left; }
.cc-link { color: var(--accent); }
dialog.card-sheet { width: min(720px, calc(100vw - 32px)); }
.card-sheet h4 { margin: 4px 0 -8px; font-size: 17px; }
.cs-top { display: flex; gap: 18px; align-items: center; }
.cs-top h3 { margin: 0 0 2px; }
.cs-top p { margin: 0 0 8px; }
.cs-face { width: 190px; margin: 0; flex: none; }
.fees dd { display: flex; flex-direction: column; gap: 2px; }
.fees dd small { color: var(--tertiary); font-size: 12px; }
.small { font-size: 12.5px; margin: 0; }
.calc { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--bg); border-radius: 14px; padding: 12px 14px; }
.calc input { width: 120px; font: inherit; font-size: 16px; padding: 8px 12px; border: 0; border-radius: 10px; background: var(--surface); direction: ltr; }
.calc-out { margin: 0; flex-basis: 100%; font-size: 15px; }
.sheet-actions a.btn { text-decoration: none; display: inline-flex; align-items: center; }


/* Real logos */
.logo-img { background: #fff; box-shadow: inset 0 0 0 0.5px var(--separator); overflow: hidden; }
.logo-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-img.has-bg { background: var(--brand, #fff); box-shadow: none; }
.logo-img.on-dark { background: #1d1d1f; }
.avatar.logo-img { padding: 3px; }
.avatar.logo-img.wide { width: 72px; }
.row { grid-template-columns: 72px minmax(160px, 1.2fr) minmax(120px, 1fr) minmax(0, 1.2fr) 16px; }
.row > .avatar:not(.wide) { justify-self: center; }
.bank-logo.logo-img { padding: 6px; }
.bank-logo.logo-img.wide { width: 216px; }
.logo-view { display: block; width: 100%; height: 100%; }
.logo-view.logo-img { background: transparent; box-shadow: none; }
.logo-tile.dark .logo-view.logo-img:not(.has-bg):not(.on-dark) img { filter: drop-shadow(0 0 0.5px rgba(255, 255, 255, 0.6)); }
.logo-pair.wide { flex-direction: column; }
.logo-pair.wide .logo-tile { width: 210px; height: 70px; padding: 6px 10px; }
.logo-pair.square .logo-tile { padding: 12px; }
.swatches { display: flex; flex-direction: column; gap: 8px; flex: none; }
.swatch.small { height: 36px; }
.sms-bank .avatar.logo-img { width: 34px; height: 34px; }
.sms-bank .avatar.logo-img.wide { width: 72px; }


/* Bank page: linking senders, kinds of messages */
.link-sender { margin-top: 12px; }
.link-sender input { min-width: 260px; }
.kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.kinds .pill b { margin-inline-start: 4px; }
.tok-name, .f-name { background: rgba(142, 142, 147, 0.25); }
.fields select { font: inherit; font-size: 15px; padding: 9px 12px; border-radius: 10px; border: 0; background: var(--fill); box-shadow: none; }

/* Logos gallery */
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.logo-card {
  display: flex; flex-direction: column; gap: 3px; padding: 12px; border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: transform 0.2s, box-shadow 0.2s; min-width: 0;
}
.logo-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 10px 28px rgba(0, 0, 0, 0.08); }
.logo-card b { font-weight: 600; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo-card small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.logo-stage {
  height: 104px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 0.5px var(--separator);
  display: grid; place-items: center; padding: 12px; overflow: hidden;
  background-image: linear-gradient(45deg, #f4f4f6 25%, transparent 25%), linear-gradient(-45deg, #f4f4f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f4f4f6 75%), linear-gradient(-45deg, transparent 75%, #f4f4f6 75%);
  background-size: 14px 14px; background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}
.logo-stage img { max-width: 100%; max-height: 80px; object-fit: contain; }
.logo-stage.dark { background: #1d1d1f; box-shadow: none; }
.logo-stage.has-bg { background: var(--brand, #fff); }
.logo-stage.missing { border: 1.5px dashed var(--separator); background: var(--bg); box-shadow: none; color: var(--tertiary); gap: 2px; }
.logo-stage.missing span { font-size: 28px; font-weight: 700; }
.logo-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 6px; }
.dot-c { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.15); }


/* Spam */
.k-spam-scam { background: #ff3b30; fill: #ff3b30; }
.k-spam-bank { background: #0071e3; fill: #0071e3; }
.k-spam-telecom { background: #af52de; fill: #af52de; }
.k-spam-retail { background: #ff9500; fill: #ff9500; }
.k-spam-loan { background: #a2845e; fill: #a2845e; }
.k-spam-prize { background: #ffcc00; fill: #ffcc00; }
.k-spam-government { background: #34c759; fill: #34c759; }
.k-spam-other { background: #8e8e93; fill: #8e8e93; }
.spam-tabs { margin-bottom: 16px; }
.spam-tabs a { display: inline-block; padding: 5px 14px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none; }
.spam-tabs a[aria-pressed="true"] { background: var(--surface); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04); }
.spam-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.spam-cat {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 8px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: transform 0.2s, box-shadow 0.2s;
}
.spam-cat:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 10px 28px rgba(0, 0, 0, 0.08); }
.spam-cat .big { grid-column: 1 / -1; font-size: 28px; font-weight: 700; text-align: right; }
.spam-cat small { grid-column: 1 / -1; font-size: 12px; }
.spam-cat .bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--fill); overflow: hidden; margin-top: 4px; }
.spam-cat .bar span { display: block; height: 100%; }
.spam-cat.cat-scam { box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(255, 59, 48, 0.35); }
.big-dot { width: 14px; height: 14px; display: inline-block; vertical-align: middle; }
.spam-chart { margin-top: 20px; }
.spam-chart svg { height: 170px; }
.spam-chart .label { fill: var(--tertiary); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .dot { width: 9px; height: 9px; }
.spam-tops .card.list { margin-bottom: 0; }
.row.compact { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--text); text-decoration: none; }
.row.compact code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row.compact .seg.verdict { margin-inline-start: auto; }
.pill .dot { width: 8px; height: 8px; display: inline-block; margin-inline-end: 4px; vertical-align: middle; }
.seg.verdict button { font-size: 12px; padding: 4px 10px; }
.seg.verdict button[data-verdict="scam"][aria-pressed="true"] { color: var(--red); }
.seg.verdict button[data-verdict="safe"][aria-pressed="true"] { color: var(--green); }
.tok-link { background: rgba(255, 59, 48, 0.14); }
.f-link { background: rgba(255, 59, 48, 0.12); color: var(--red); text-decoration: none; direction: ltr; }
.spam-sender { text-decoration: none; }
.decide { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 18px; }
.decide p { flex-basis: 100%; margin: 0; font-size: 13px; }
.decide label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.decide input, .decide select { font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 10px; border: 0; background: var(--fill); }
.add-rule { margin-bottom: 16px; }
.add-rule input[name="value"] { min-width: 240px; }
.domain-title { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 26px; text-align: right; }

@media (max-width: 860px) {
  /* The sidebar becomes a bar across the top that scrolls sideways. */
  body.app { display: block; }
  .sidebar {
    position: sticky; height: auto; z-index: 5;
    flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px;
    border-inline-end: 0; border-bottom: 0.5px solid var(--separator);
  }
  .sidebar .brand { padding: 0; }
  .sidebar .brand span:last-child { display: none; }
  .tabs { flex-direction: row; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .group { flex-direction: row; }
  .group-title { display: none; }
  .tabs button { width: auto; white-space: nowrap; font-size: 13px; padding: 6px 10px; gap: 6px; }
  .tabs button .ico { width: 17px; height: 17px; }
  .logout span { display: none; }
  .logout { width: auto; padding: 6px; }
  main { padding: 20px 16px 48px; }
  h2 { font-size: 26px; }
  input[type="search"] { min-width: 0; width: 100%; }
  .tabs { min-width: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 14px 16px; }
  .stat b { font-size: 28px; }
  .row { grid-template-columns: 72px minmax(0, 1fr) 16px; }
  .row-tags, .row-match { display: none; }
  .fields { grid-template-columns: 1fr; }
  .title-row { flex-direction: column; gap: 0; }
  .bank-head { flex-wrap: wrap; padding: 18px; }
  .bank-logo { width: 56px; height: 56px; font-size: 24px; border-radius: 14px; }
  .bank-actions { width: 100%; justify-content: space-between; }
  .identity { flex-direction: column; align-items: stretch; }
  .sms-list { grid-template-columns: 1fr; }
  .cs-top { flex-direction: column; align-items: stretch; }
  .cs-face { width: 100%; }
  details.sms-bank summary { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* One shop's mapping (#queue/<id>) */
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: var(--fill-2); }
.shop-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shop-head h2 { margin: 0; }
.flow { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.flow .node { flex: 1 1 170px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.flow .node b { font-size: 17px; overflow-wrap: anywhere; }
.flow .node b.mono { font-size: 15px; font-weight: 700; }
.flow .node small { color: var(--muted); font-size: 12.5px; }
.flow .node.known { outline: 2px solid var(--green-tint); }
.flow .arrow { align-self: center; color: var(--tertiary); font-size: 20px; }
.step { font-size: 12px; font-weight: 600; color: var(--accent); }
.muted { color: var(--tertiary); font-weight: 400; }
.phone-preview { display: inline-flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.phone-preview .txn { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow);
  padding: 12px 16px; min-width: 260px; }
.phone-preview .txn div:last-child { display: flex; flex-direction: column; }
.phone-preview .txn small { color: var(--muted); }
.txn-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-tint); color: var(--accent); display: grid; place-items: center;
  font-weight: 700; font-size: 18px; }
.votes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.votes { padding: 16px; }
.votes h4 { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.vote { margin-bottom: 10px; }
.vote-line { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; }
.vote-line small { color: var(--tertiary); }
.vote.lead .vote-line span:first-child { font-weight: 700; }
.vote-bar { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; margin-top: 4px; }
.vote-bar span { display: block; height: 100%; background: var(--accent); }
.empty.small { padding: 8px 0; font-size: 13px; }
.weeks { display: flex; align-items: flex-end; gap: 18px; padding: 16px 20px; overflow-x: auto; min-height: 130px; }
.week { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; font-size: 12px; }
.week small { color: var(--tertiary); }
.wbar { width: 26px; border-radius: 6px 6px 2px 2px; background: var(--accent); flex: none; }
.shop-actions { margin-top: 20px; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 700px) { .flow .arrow { transform: rotate(-90deg); flex-basis: 100%; text-align: center; } }
.shop-head .btn[data-edit] { margin-inline-start: auto; }
.edit-shop { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; padding: 18px; margin: 14px 0 6px; }
.edit-shop[hidden] { display: none; }
.edit-shop label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.edit-shop input, .edit-shop select { font-size: 15px; color: var(--text); }
.edit-shop .lede, .edit-shop .actions { grid-column: 1 / -1; margin: 0; }
.edit-shop .actions { display: flex; gap: 8px; }

/* «الشركات»: one card per merchant, its square logo, colour, countries and links. */
.merchant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.merchant { background: var(--card, #fff); border-radius: 20px; padding: 16px; display: grid; gap: 10px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 6px 18px rgba(0, 0, 0, 0.05); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.merchant:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 10px 26px rgba(0, 0, 0, 0.08); }
.merchant:active { transform: scale(0.98); }
.merchant:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.merchant.off { opacity: 0.55; }
.merchant-head { display: flex; align-items: center; gap: 12px; }
.merchant-logo { width: 56px; height: 56px; border-radius: 14px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); font-weight: 700; font-size: 22px; }
.merchant-logo img { width: 84%; height: 84%; object-fit: contain; }
.merchant-logo.on-dark { background: #1c1c1e; }
.merchant-logo.has-bg { background: var(--brand, #fff); }
.merchant-names { display: grid; gap: 2px; min-width: 0; flex: 1; }
.merchant-names b { font-size: 17px; }
.merchant-names small { color: var(--muted, #6b7280); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merchant-colour { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted, #6b7280); }
.merchant-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pill.link { text-decoration: none; color: inherit; }
.pill.link:hover { text-decoration: underline; }
.pill.soft { opacity: 0.8; }
.colour-field { display: flex; gap: 8px; align-items: center; }
.colour-field input[type="color"] { width: 44px; height: 38px; padding: 2px; border-radius: 10px; flex: none; }

/* One company's page. */
.company-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 6px 0 18px; }
.company-head h2 { margin: 0; }
.company-head .merchant-names { gap: 6px; }
.merchant-logo.big { width: 88px; height: 88px; border-radius: 22px; }
.company-chip { margin-inline-start: 6px; font-size: 12px; }

/* A company's logo, added from the panel; and «انشر». */
.logo-card { display: grid; gap: 14px; margin-bottom: 18px; }
.logo-now { display: flex; align-items: center; gap: 14px; }
.logo-now h4 { margin: 0 0 4px; }
.logo-card form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.logo-card form label { display: grid; gap: 6px; flex: 1; min-width: 220px; font-size: 13px; }
.merchant-logo.icon img, .avatar.icon img { width: 100%; height: 100%; object-fit: cover; }
.publish-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.publish-card > div { flex: 1; min-width: 220px; }
.publish-card h4 { margin: 0 0 4px; }

/* «دعم الدول»: a country's flag at the start of its row. */
.row .flag { font-size: 20px; line-height: 1; width: 28px; text-align: center; flex: none; }
#countries .btn { margin: 0 0 12px; }

/* «القواعد» */
.rule-marks input { width: 100%; min-width: 0; font-size: 14px; padding: 7px 10px; border-radius: 10px; border: 0; background: var(--fill); }
.rule-marks td:nth-child(3) { width: 48%; }
.rule-text { width: 100%; font: inherit; font-size: 14px; padding: 9px 12px; border-radius: 10px; border: 0; background: var(--fill); resize: vertical; }
.rule-text.mono, .rule-marks .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.rule-title { text-align: end; }
.rule-row { cursor: pointer; }
.rule-row:hover td { background: var(--fill); }
.rule-actions { margin: 18px 0 6px; }
#try-result { flex-basis: 100%; }
#new-rule { margin-top: 16px; }
.rule-params { padding: 18px; }

/* «القائمة البريدية» */
.mail-actions { margin: 20px 0 12px; }
