/* FishPunk Ads - light SaaS theme: dark navigation on the left, calm light content. One stylesheet for admin, publisher, advertiser and the sign-in pages. */
:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --border: #e4e7f0;
  --border-strong: #d3d8e6;
  --text: #171a33;
  --text-dim: #667085;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0ff;
  --accent: #4f46e5;
  --success: #12805c;
  --success-soft: #e3f6ee;
  --warn: #b25e09;
  --warn-soft: #fdf1dc;
  --danger: #c5362d;
  --danger-soft: #fdeceb;
  --info: #1f6fb2;
  --info-soft: #e6f1fb;
  --side: #0e1126;
  --side-2: #171b3a;
  --side-text: #aab0cf;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
h1, h2, h3 { color: var(--text); letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; margin: 0; }
h2 { font-size: 17px; font-weight: 650; margin: 32px 0 12px; }
h3 { font-size: 15px; font-weight: 650; margin: 0 0 8px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: #eef0f6; padding: 1px 6px; border-radius: 5px; color: #343a5c; }
.muted { color: var(--text-dim); }
.ico { width: 18px; height: 18px; flex: none; }

/* ------------------------------------------------------------------ app shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--side) 0%, var(--side-2) 100%); color: var(--side-text);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6c63ff, #4f46e5 60%, #3b2fd0); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .02em;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .45);
}
.brand-text { font-weight: 700; font-size: 16px; line-height: 1.1; display: flex; flex-direction: column; }
.brand-text small { font-weight: 500; font-size: 11px; color: var(--side-text); letter-spacing: .14em; text-transform: uppercase; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #6c7396; padding: 16px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--side-text); font-weight: 500; text-decoration: none;
  transition: background .15s, color .15s; border: 0; background: none; width: 100%; font: inherit; cursor: pointer; text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-item.is-active { background: rgba(108, 99, 255, .22); color: #fff; box-shadow: inset 3px 0 0 #8b84ff; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 10px; margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.side-foot form { margin: 0; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-weight: 600; color: var(--text-dim); font-size: 14px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.chip-tenant { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 13px; }
.chip-tenant:hover { text-decoration: none; background: #e2e5ff; }
.chip-tenant .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #6c63ff, #4f46e5); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.page { padding: 28px; max-width: 1280px; width: 100%; margin: 0 auto; }
.menu-btn, .scrim, .nav-toggle { display: none; }
.menu-btn { cursor: pointer; color: var(--text); padding: 6px; border-radius: 8px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 20px; flex-wrap: wrap; }
.page-head > span, .page-head > div { display: flex; gap: 8px; flex-wrap: wrap; }
.subtitle { color: var(--text-dim); margin: -8px 0 18px; max-width: 78ch; }
.subnav { margin: 0 0 18px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; display: inline-flex; gap: 2px; flex-wrap: wrap; align-items: center; box-shadow: var(--shadow); }
.subnav a { padding: 6px 12px; border-radius: 7px; color: var(--text-dim); font-weight: 500; }
.subnav a:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }

/* ------------------------------------------------------------------ buttons */
.btn, .link-btn {
  font: inherit; cursor: pointer;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 15px; border-radius: 9px; font-weight: 600; font-size: 13.5px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow); text-decoration: none; line-height: 1.3;
  transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: #bfc6da; text-decoration: none; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 1px 2px rgba(79, 70, 229, .35); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 500; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--text-dim); }
.link-btn.danger:hover { color: var(--danger); }
.danger { color: var(--danger); }

/* ------------------------------------------------------------------ tables, cards */
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin: 10px 0 20px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); background: var(--surface-2); padding: 11px 16px; border-bottom: 1px solid var(--border); }
.table td { padding: 13px 16px; border-bottom: 1px solid #eef0f6; vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbff; }
.table-narrow { max-width: 340px; }
.table img, .thumb { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); background: #f1f3f9; }
.thumb { width: 64px; }
.thumb-preview { max-width: 320px; display: block; margin: 8px 0 16px; border-radius: 10px; border: 1px solid var(--border); }
.row-actions { white-space: nowrap; display: table-cell; }
.row-actions > * { margin-right: 10px; }
.row-actions form { display: inline; margin: 0; }
.bar-cell { width: 28%; }
.empty { color: var(--text-dim); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 28px; text-align: center; margin: 10px 0 20px; }
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 0 0 18px; }
.panel h2:first-child, .card h3:first-child { margin-top: 0; }

/* KPI tiles (dashboard) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin: 0 0 22px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 18px 16px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); opacity: .85; }
.kpi.is-warn::before { background: #e8a33a; }
.kpi.is-good::before { background: #25a77a; }
.kpi-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; line-height: 1.1; }
.kpi-note { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }

/* ------------------------------------------------------------------ badges */
.badge, .chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; background: #eceff6; color: #4a5272; }
.badge-active, .badge-review-approved, .badge-enf-strict, .chip-fit { background: var(--success-soft); color: var(--success); }
.badge-inactive, .badge-review-draft, .badge-enf-off { background: #eceff6; color: #5b6482; }
.badge-review-checking { background: var(--info-soft); color: var(--info); }
.badge-review-flagged, .badge-enf-warn { background: var(--warn-soft); color: var(--warn); }
.badge-review-rejected, .chip-nofit { background: var(--danger-soft); color: var(--danger); }
.chip { margin: 1px 4px 1px 0; cursor: default; font-size: 11.5px; }

/* ------------------------------------------------------------------ forms */
.form { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.form-narrow { max-width: 420px; }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; max-width: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin: 10px 0 18px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: #343a5c; }
.form label.checkbox-label, .checkbox-label { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--text); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: #fff; border: 1px solid var(--border-strong); border-radius: 9px; padding: 9px 12px; width: 100%; min-width: 0;
  transition: border-color .12s, box-shadow .12s;
}
.form-inline input[type="text"], .form-inline input[type="number"], .form-inline input[type="date"], .form-inline select { width: auto; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); }
input[type="file"] { font: inherit; font-size: 13px; }
fieldset, .fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px 16px; background: var(--surface); display: flex; flex-direction: column; gap: 12px; margin: 0; }
legend, .fieldset legend { color: var(--text-dim); padding: 0 8px; font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr .4fr; gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.checks > span { font-weight: 600; font-size: 13px; color: #343a5c; }

/* ------------------------------------------------------------------ messages */
.flash { background: var(--info-soft); border: 1px solid #c4def4; color: #174f80; border-radius: 10px; padding: 11px 15px; margin: 0 0 16px; }
.flash-error { background: var(--danger-soft); border-color: #f5c6c2; color: #8f2620; }
.flash-secret { background: var(--warn-soft); border-color: #f0d49b; color: #6f4108; }
.secret-value { display: block; margin-top: 6px; padding: 10px 12px; background: #fff; border: 1px solid #ecd8aa; border-radius: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; color: #3a2a05; user-select: all; }
.callout { border: 1px solid #cbd3f5; border-left: 4px solid var(--primary); background: var(--primary-soft); padding: 12px 16px; margin: 14px 0; border-radius: 10px; color: #28306b; }
.callout-bad { border-color: #f1c5c1; border-left-color: var(--danger); background: var(--danger-soft); color: #7a241f; }

/* ------------------------------------------------------------------ charts */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding: 14px 14px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar { width: 100%; min-height: 3px; background: linear-gradient(180deg, #7b73ff, #4f46e5); border-radius: 4px 4px 0 0; }
.bar-label { font-size: 9px; color: var(--text-dim); margin-top: 4px; writing-mode: vertical-rl; }
.hbar-chart { display: flex; flex-direction: column; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: 160px 1fr 70px; align-items: center; gap: 12px; font-size: 13.5px; }
.hbar-label { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.hbar-track { background: #edeff7; border-radius: 999px; height: 10px; overflow: hidden; }
.hbar-fill { height: 100%; background: linear-gradient(90deg, #7b73ff, #4f46e5); border-radius: 999px; }
.hbar-count { text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ preview editor */
.preview-tools { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin: 10px 0; }
.preview-tools label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 12.5px; color: #343a5c; }
.preview-wrap { max-width: 1100px; margin: 12px 0; background: #14162b; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.stage { display: block; width: 100%; touch-action: none; cursor: crosshair; }

/* impersonation: impossible to miss */
.impersonation-bar { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 9px 28px; background: #f59e0b; color: #2a1a00; font-size: 13.5px; }
.impersonation-bar form { margin: 0; }
.impersonation-bar .muted-on-warn { opacity: .75; }
.impersonation-bar .btn { background: #fff; border-color: #fff; color: #2a1a00; padding: 5px 12px; }
.impersonation-bar ~ .topbar { top: 41px; }

/* ------------------------------------------------------------------ sign-in and invitation pages (no sidebar) */
.auth-body { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1.05fr) minmax(360px, 1fr); }
.auth-brand {
  background: radial-gradient(1200px 600px at 10% 0%, #3a35b8 0%, transparent 60%), linear-gradient(160deg, #0e1126 0%, #1b1f4a 100%);
  color: #cfd3f0; padding: 56px 56px; display: flex; flex-direction: column; justify-content: center;
}
.auth-brand .brand-mark { width: 48px; height: 48px; font-size: 17px; border-radius: 14px; margin-bottom: 22px; }
.auth-brand h2 { color: #fff; font-size: 34px; letter-spacing: -.02em; margin: 0 0 12px; }
.auth-brand p { font-size: 17px; line-height: 1.55; max-width: 38ch; margin: 0 0 26px; }
.auth-brand ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-brand li { padding-left: 28px; position: relative; font-size: 15px; }
.auth-brand li::before { content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: rgba(139, 132, 255, .3); box-shadow: inset 0 0 0 4px #8b84ff; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 48px 56px; max-width: 560px; width: 100%; margin: 0 auto; }
.auth-card h1 { font-size: 28px; margin: 0 0 6px; }
.auth-card .page-head { margin: 0 0 18px; }
.auth-card .form { max-width: none; }
.auth-card .btn-primary { padding: 11px 16px; font-size: 15px; }

/* ------------------------------------------------------------------ narrow screens */
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { padding: 32px 28px; }
  .auth-brand h2 { font-size: 26px; }
  .auth-brand ul { display: none; }
  .auth-card { padding: 32px 28px 48px; }
}
/* medium windows (half a screen, side panels open): the menu stays, as a narrow rail with icons only */
@media (max-width: 1100px) {
  .sidebar { width: 68px; padding: 14px 8px; align-items: stretch; }
  .brand { justify-content: center; padding: 4px 0 14px; }
  .brand-text, .nav-section, .nav-item span { display: none; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-item.is-active { box-shadow: none; }
  .nav { gap: 4px; }
  .page { padding: 22px 20px; }
}
/* small windows: the menu is a drawer behind the menu button */
@media (max-width: 640px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; width: var(--sidebar-w); padding: 18px 12px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .brand { justify-content: flex-start; padding: 4px 8px 18px; }
  .brand-text { display: flex; }
  .nav-section { display: block; }
  .nav-item { justify-content: flex-start; padding: 9px 10px; }
  .nav-item span { display: inline; }
  .nav-toggle:checked ~ .app .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 12, 30, .45); z-index: 20; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .nav-toggle:checked ~ .app .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-flex; }
  .page { padding: 18px 16px; }
  .topbar { padding: 0 14px; }
  .table { display: block; overflow-x: auto; }
  .hbar-row { grid-template-columns: 100px 1fr 56px; }
}
}

/* package cards */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.pkg { position: relative; display: flex !important; flex-direction: column; gap: 5px; padding: 16px 16px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; font-weight: 400 !important; color: var(--text) !important; transition: border-color .12s, box-shadow .12s; }
.pkg:hover { border-color: #aab1e8; }
.pkg:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .14); background: #fbfbff; }
.pkg input { position: absolute; top: 14px; right: 14px; }
.pkg-name { font-weight: 700; font-size: 16px; }
.pkg-price { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin: 2px 0 6px; color: var(--primary); }
.pkg-line { font-size: 13px; color: var(--text-dim); }
.pkg-line strong { color: var(--text); }
.pkg-panel .pkg-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 10px; font-size: 13.5px; color: var(--text-dim); }
.pkg-panel .pkg-facts strong { color: var(--text); }
