:root { --bg:#0f1729; --panel:#fff; --ink:#1b2434; --muted:#6b7688; --line:#e3e8ef; --accent:#1f4e78; --accent2:#0563c1; }
* { box-sizing:border-box; }
body { margin:0; font:14px/1.5 -apple-system,Segoe UI,Arial,sans-serif; color:var(--ink); background:#f4f6fa; }
a { color:var(--accent2); text-decoration:none; } a:hover { text-decoration:underline; }
.muted { color:var(--muted); } .small { font-size:12px; font-weight:normal; }

header { display:flex; align-items:center; gap:18px; background:var(--bg); color:#fff; padding:10px 18px; flex-wrap:wrap; }
header .brand { color:#fff; font-weight:700; font-size:16px; }
header nav { display:flex; gap:14px; flex:1; flex-wrap:wrap; }
header nav a { color:#cdd7e6; }
header nav a:hover { color:#fff; }
header .user { color:#9fb0c7; font-size:13px; } header .user a { color:#cdd7e6; }

main { max-width:1200px; margin:22px auto; padding:0 18px; }
h1 { font-size:22px; margin:0 0 14px; } h2 { font-size:16px; margin:0 0 10px; }

.card { background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:16px; margin-bottom:18px; box-shadow:0 1px 2px rgba(16,24,40,.04); }
.cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:12px; margin-bottom:18px; }
.card.stat { text-align:center; } .card.stat b { display:block; font-size:26px; color:var(--accent); } .card.stat span { color:var(--muted); font-size:12px; }

.run-forms { display:flex; gap:12px; flex-wrap:wrap; }
.run-forms form { display:flex; gap:6px; align-items:center; }
input, select, button { font:inherit; padding:7px 10px; border:1px solid var(--line); border-radius:7px; }
button { background:var(--accent); color:#fff; border-color:var(--accent); cursor:pointer; }
button:hover { background:#163a5c; }
form.inline { display:inline; } form.inline select { padding:4px 6px; }

table { width:100%; border-collapse:collapse; font-size:13px; }
th, td { text-align:left; padding:7px 9px; border-bottom:1px solid var(--line); vertical-align:top; }
th { background:#eef2f8; color:#48566b; font-weight:600; position:sticky; top:0; z-index:5; box-shadow:0 1px 0 var(--line); }
tr:hover td { background:#fafbfd; }

.badge { padding:2px 8px; border-radius:20px; font-size:11px; font-weight:600; }
.badge.queued { background:#eef1f6; color:#5b6776; }
.badge.running { background:#fff4d6; color:#8a6d1a; }
.badge.done { background:#dcfce7; color:#16794a; }
.badge.error { background:#fde2e1; color:#b42318; }

body.login { background:var(--bg); display:flex; min-height:100vh; align-items:center; justify-content:center; }
.login-card { width:320px; }
.login-card h1 { text-align:center; }
.login-card label { display:block; margin-bottom:10px; font-size:13px; color:var(--muted); }
.login-card input { width:100%; margin-top:4px; }
.login-card button { width:100%; margin-top:6px; }
.error { color:#b42318; background:#fde2e1; padding:8px 10px; border-radius:7px; }

/* --- platform portal --- */
.portal-hero { text-align:center; padding:26px 0 6px; }
.portal-hero h1 { font-size:30px; margin-bottom:6px; }
.tool-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:18px; margin-top:18px; }
.tool-card { display:flex; flex-direction:column; gap:8px; padding:22px; border:1px solid var(--line); border-radius:14px;
  background:#fff; text-decoration:none; color:var(--ink); box-shadow:0 2px 8px rgba(16,24,40,.05); min-height:150px; }
a.tool-card:hover { border-color:var(--accent2); box-shadow:0 8px 22px rgba(16,24,40,.12); transform:translateY(-2px); transition:.15s; text-decoration:none; }
.tool-card.soon { opacity:.62; background:#f7f9fc; }
.tool-emoji { font-size:32px; }
.tool-card b { font-size:17px; }
.tool-go { margin-top:auto; color:var(--accent2); font-weight:700; font-size:13px; }
.tool-soon { margin-top:auto; color:var(--muted); font-weight:600; font-size:12px; }

/* --- dashboard --- */
.hero { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px; margin-bottom:20px; }
.stat-card { position:relative; overflow:hidden; border-radius:14px; padding:16px 18px; color:#fff; text-decoration:none;
  box-shadow:0 6px 18px rgba(16,24,40,.10); display:flex; flex-direction:column; gap:2px; }
.stat-card .ico { font-size:22px; opacity:.95; }
.stat-card b { font-size:30px; line-height:1.1; }
.stat-card span { font-size:12px; opacity:.92; }
.stat-card:hover { transform:translateY(-2px); transition:.15s; }
.s1 { background:linear-gradient(135deg,#1f4e78,#2a6db0); }
.s2 { background:linear-gradient(135deg,#0e7490,#22a3c3); }
.s3 { background:linear-gradient(135deg,#15803d,#34a853); }
.s4 { background:linear-gradient(135deg,#b45309,#f59e0b); }
.s5 { background:linear-gradient(135deg,#7c3aed,#a855f7); }
.s6 { background:linear-gradient(135deg,#be123c,#f43f5e); }

.run .run-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; }
.run-grid form { display:flex; flex-direction:column; gap:8px; }
.run-grid label { font-weight:600; font-size:13px; }
.run-grid textarea { resize:vertical; font:13px monospace; border:1px solid var(--line); border-radius:8px; padding:8px; }
.run-grid .weekly { justify-content:flex-start; }
.run-grid .row2 { display:flex; gap:8px; }
.run-grid .sub { display:flex; flex-direction:column; gap:3px; font-size:11px; color:var(--muted); font-weight:600; flex:1; }
.run-grid .sub input { width:100%; }
.run-grid .chk { display:flex; align-items:center; gap:7px; font-size:12px; font-weight:normal; color:var(--ink); cursor:pointer; }
.run-grid .chk input { width:auto; margin:0; }
@media (max-width:820px){ .run .run-grid { grid-template-columns:1fr; } }

.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
@media (max-width:820px){ .grid2 { grid-template-columns:1fr; } }

.bar-row { display:grid; grid-template-columns:160px 1fr 44px; align-items:center; gap:10px; margin:2px -8px; padding:5px 8px;
  border-radius:8px; text-decoration:none; color:var(--ink); }
.bar-row:hover { background:#f2f6fc; text-decoration:none; }
.bar-label { font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bar { background:#eef1f6; border-radius:6px; height:14px; overflow:hidden; }
.fill { display:block; height:100%; border-radius:6px; }
.c-status { background:linear-gradient(90deg,#2a6db0,#22a3c3); }
.c-geo { background:linear-gradient(90deg,#15803d,#34a853); }
.c-adv { background:linear-gradient(90deg,#7c3aed,#a855f7); }
.bar-val { text-align:right; font-size:13px; font-weight:600; color:#48566b; }

.chip-row { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:2px -8px; padding:5px 8px;
  border-radius:8px; text-decoration:none; color:var(--ink); }
.chip-row:hover { background:#f2f6fc; text-decoration:none; }
.chip { padding:3px 10px; border-radius:20px; font-size:12px; font-weight:600; background:#eef1f6; color:#1b2434; }
.chip.win { background:#fff4d6; color:#8a6d1a; }

/* --- filter bar --- */
.filters { display:flex; flex-wrap:wrap; gap:10px; align-items:center; padding:12px 14px; }
.filters select, .filters input { padding:7px 10px; max-width:230px; }
.filters input[name="q"] { flex:1; min-width:180px; max-width:none; }
.btn-clear { padding:7px 12px; border:1px solid var(--line); border-radius:7px; background:#fff; color:var(--muted); }
.btn-clear:hover { text-decoration:none; border-color:#c7d0dd; color:var(--ink); }
td.countries { max-width:340px; white-space:normal; font-size:12px; color:#48566b; line-height:1.45; }
td.wrapcell { max-width:260px; white-space:normal; font-size:12px; color:#48566b; line-height:1.4; }

/* scrollable table card with a frozen (sticky) header row */
.tablecard { padding:0; overflow:auto; max-height:78vh; }
.useractions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.mini { padding:4px 9px; font-size:12px; }
form.inline.pw { display:flex; gap:4px; }
form.inline.pw input { width:130px; padding:4px 7px; }
.saved-views { display:inline-flex; gap:6px; align-items:center; }
.saved-views select { padding:5px 8px; max-width:200px; }

/* integrations / connect page */
.kv { width:auto; }
.kv th { text-align:left; background:transparent; position:static; box-shadow:none; padding:6px 18px 6px 0; white-space:nowrap; color:#48566b; }
.kv td { padding:6px 0; }
pre { background:#0f1729; color:#e6edf6; padding:14px 16px; border-radius:10px; overflow:auto; font:12px/1.55 ui-monospace,Menlo,monospace; margin:8px 0; }
code { background:#eef2f8; padding:1px 6px; border-radius:5px; font:12px ui-monospace,Menlo,monospace; }
pre code { background:none; padding:0; color:inherit; }
.card ol, .card ul { margin:8px 0 8px 20px; }
.card li { margin:5px 0; }
.btn-export { padding:7px 12px; border:1px solid var(--accent2); border-radius:7px; background:var(--accent2); color:#fff; font-weight:600; font-size:13px; white-space:nowrap; }
.btn-export:hover { background:#0a4ea0; text-decoration:none; color:#fff; }

/* --- column picker + table tools --- */
.table-tools { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:8px 0 10px; flex-wrap:wrap; }
.col-picker { position:relative; }
.col-picker > summary { list-style:none; cursor:pointer; display:inline-flex; align-items:center; gap:6px;
  padding:7px 12px; border:1px solid var(--line); border-radius:7px; background:#fff; color:var(--ink); font-size:13px; font-weight:600; user-select:none; }
.col-picker > summary::-webkit-details-marker { display:none; }
.col-picker[open] > summary { border-color:var(--accent2); color:var(--accent2); }
.col-list { position:absolute; right:0; top:calc(100% + 6px); z-index:30; background:#fff; border:1px solid var(--line);
  border-radius:10px; box-shadow:0 10px 28px rgba(16,24,40,.16); padding:10px; min-width:210px; max-height:60vh; overflow:auto;
  display:flex; flex-direction:column; gap:2px; }
.col-list label { display:flex; align-items:center; gap:8px; font-size:13px; padding:5px 7px; border-radius:6px; cursor:pointer; white-space:nowrap; }
.col-list label:hover { background:#f2f6fc; }
.col-list input { width:auto; margin:0; }
.col-reset { margin-top:6px; background:#f4f6fa; color:var(--accent2); border:1px solid var(--line); font-size:12px; padding:7px; border-radius:6px; cursor:pointer; font-weight:600; }
.col-reset:hover { background:#e9eef6; }

/* visible keyboard focus (a11y) */
.col-picker > summary:focus-visible, .btn-clear:focus-visible, .col-reset:focus-visible,
button:focus-visible, .filters select:focus-visible, .filters input:focus-visible,
.bar-row:focus-visible, .chip-row:focus-visible, .col-list label:focus-within {
  outline:2px solid var(--accent2); outline-offset:2px; border-radius:6px;
}
