/* relink — dashboard styles. Bootstrap 5 underneath; this file sets the look. */
@font-face { font-family: "Red Hat Display"; src: url("../fonts/RedHatDisplay.fec248bc7f64.ttf") format("truetype"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Medium.8540f35bf8ac.ttf") format("truetype"); font-weight: 400 600; font-display: swap; }

:root {
  --ink: #16212a;
  --ink-2: #4b5a66;
  --line: #e4e8ec;
  --paper: #f5f7f9;
  --card: #ffffff;
  --brand: #314655;
  --brand-2: #8f6b1f;
  --accent: #1f6feb;
  --ok: #1a7f4b; --ok-bg: #e5f5ec;
  --bad: #b42318; --bad-bg: #fdecea;
  --info: #1d4f91; --info-bg: #e8f0fb;
  --muted-bg: #eef1f4;
  /* Corner rounding. Change these two to round the whole app more or less. Was 14px / 10px. */
  --radius: 10px;     /* cards, panels, boxes */
  --radius-sm: 7px;   /* buttons, inputs, small boxes */
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-color: var(--ink);
  --bs-primary: var(--brand);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 31, 111, 235;
}
body { background: var(--paper); font-size: .94rem; }
h1, h2, h3, .brand, .big-number, .kpi b { font-family: "Red Hat Display", "Inter", system-ui, sans-serif; }
h1 { font-size: 1.45rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
code { color: var(--brand); background: var(--muted-bg); padding: .05rem .35rem; border-radius: 6px; font-size: .85em; }

.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: #253642; --bs-btn-hover-border-color: #253642; --bs-btn-active-bg: #1d2b35; }
.btn-ghost { background: transparent; border: 0; color: var(--ink-2); }
.btn-ghost:hover { background: var(--muted-bg); color: var(--ink); }
.btn { border-radius: var(--radius-sm); font-weight: 500; }
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--line); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(49, 70, 85, .15); }

/* Shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.rail { background: var(--brand); color: #dfe7ec; display: flex; flex-direction: column; padding: 1.25rem .9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-size: 1.35rem; font-weight: 800; color: #fff; text-decoration: none; display: flex; align-items: center; gap: 0; margin: 0 .5rem 1.5rem; letter-spacing: -.02em; }
.brand-dark { color: var(--ink); margin: 0; }
.brand-mark { background: var(--brand-2); color: #fff; border-radius: 8px; padding: 0 .35rem; margin-right: .06rem; }
.rail-nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.rail-nav a { color: #cfdae1; text-decoration: none; padding: .55rem .7rem; border-radius: var(--radius-sm); display: flex; gap: .6rem; align-items: center; }
.rail-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail-nav a.active { background: #fff; color: var(--brand); font-weight: 600; }
.rail-section { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; color: #93a6b3; margin: 1.1rem .7rem .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-bottom { flex: none; border-top: 1px solid rgba(255,255,255,.12); padding-top: .8rem; margin-top: 1rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-2); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.version { display: block; color: #7d909d; margin-top: .6rem; font-size: .72rem; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .7rem 2rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.switcher { flex: none; min-width: 0; max-width: 50%; margin-left: auto; position: relative; }
.switcher-btn { display: inline-flex; align-items: center; gap: .55rem; max-width: 100%; height: 34px; padding: 0 .55rem 0 .3rem; gap: .45rem; font-size: .88rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font-weight: 600; }
button.switcher-btn:hover, button.switcher-btn[aria-expanded="true"] { background: var(--muted-bg); }
.switcher-btn > .bi-grid-1x2 { width: 28px; text-align: center; color: var(--ink-2); }
.switcher-btn .bi-chevron-down { font-size: .75rem; color: var(--ink-2); }
.switcher-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo-xs { width: 28px; height: 28px; border-radius: 50%; font-size: .72rem; }
.switcher .dropdown-menu { max-height: 70vh; overflow-y: auto; min-width: 240px; }
.switcher .dropdown-item { display: flex; align-items: center; gap: .55rem; }
.switcher .dropdown-item .logo-xs { width: 24px; height: 24px; font-size: .65rem; }
.avatar-btn { border: 0; cursor: pointer; }
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { box-shadow: 0 0 0 3px rgba(143, 107, 31, .25); }
.account-head { padding: .4rem 1rem .5rem; display: flex; flex-direction: column; gap: .15rem; max-width: 280px; }
.account-head small { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.account-head .pill { align-self: flex-start; margin-top: .25rem; }
.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head:has(.page-title:empty):has(.page-actions:empty) { display: none; }
.page-title { flex: 1; min-width: 0; }
.page-title small { color: var(--ink-2); display: block; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.page-actions form { margin: 0; }
.content { padding: 1.5rem 2rem 3rem; }
.crumb a { color: var(--ink-2); text-decoration: none; font-size: .82rem; }

/* Company banner and logos */
.company-banner { display: flex; align-items: center; gap: .9rem; }
.company-banner small { color: var(--ink-2); }
.logo { width: 44px; height: 44px; border-radius: var(--radius-sm); object-fit: contain; background: #fff; border: 1px solid var(--line); flex: none; }
.logo-lg { width: 112px; height: 112px; border-radius: calc(var(--radius) * 1.6); font-size: 2.2rem; }
.logo-initials { display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; border: 0; font-family: "Red Hat Display", sans-serif; }
.logo-preview { margin-bottom: 1rem; }
/* Uploaded logos sit bare (no border, box or background) and keep their own shape: same height as the placeholder,
   as wide as the logo needs. */
img.logo { box-sizing: border-box; width: auto; min-width: 0; max-width: 132px; padding: 0; border: 0; border-radius: 0; background: none; }
img.logo-xs { height: 28px; max-width: 84px; }
/* Inside the switcher pill and its menu the logo sits bare: no second border inside the pill. */
.switcher img.logo-xs { border: 0; padding: 0; border-radius: 0; background: none; height: 20px; min-width: 0; max-width: 72px; }
.switcher-btn:has(> img.logo-xs) { padding-left: .6rem; }
.switcher-btn > .logo-xs { width: 24px; height: 24px; font-size: .62rem; }
.switcher-btn > img.logo-xs { width: auto; height: 20px; }
.switcher .dropdown-item img.logo-xs { height: 24px; min-width: 24px; max-width: 72px; }
img.logo-lg { height: 96px; max-width: 300px; }

/* Panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.panel.p-0 { overflow: hidden; }
.panel-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1.25rem; }
.split > .panel { margin-bottom: 0; }
.split + .panel, .split + .split, .panel + .split { margin-top: 1.25rem; }
.split { margin-bottom: 1.25rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--ink-2); }
.empty .bi { font-size: 2rem; display: block; margin-bottom: .5rem; color: #9aa8b2; }
.note { color: var(--ink-2); font-size: .85rem; margin-bottom: 1rem; }
.footnote { color: var(--ink-2); font-size: .8rem; margin-top: 1rem; }
.label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin-bottom: .35rem; font-weight: 600; }

/* Period picker */
.period { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: .35rem; }
.seg { display: inline-flex; background: var(--muted-bg); border-radius: var(--radius-sm); padding: 3px; flex-wrap: wrap; }
.seg button, .seg label { border: 0; background: transparent; padding: .35rem .8rem; border-radius: calc(var(--radius-sm) - 2px); color: var(--ink-2); font-weight: 500; cursor: pointer; margin: 0; }
.seg button.on, .seg label.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg-wide { display: flex; }
.seg-wide label { flex: 1; text-align: center; }
.custom-range { display: inline-flex; gap: .4rem; align-items: center; }
.custom-range input { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .3rem .5rem; background: #fff; }
.period-label { color: var(--ink-2); font-size: .8rem; margin-bottom: 1rem; }

/* KPIs and cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; }
.kpi span { color: var(--ink-2); font-size: .8rem; display: block; }
.kpi b { font-size: 1.7rem; display: block; font-weight: 700; line-height: 1.25; margin: .2rem 0; }
.kpi small { color: var(--ink-2); font-size: .75rem; }
.kpi-lead { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpi-lead span, .kpi-lead small { color: #c9d6de; }
.kpis-small .kpi b { font-size: 1.2rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.25rem; }
.company-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: .9rem; transition: border-color .15s, box-shadow .15s, transform .15s; }
.company-card:hover { border-color: #c9d2d9; box-shadow: 0 8px 24px rgba(22, 33, 42, .07); transform: translateY(-1px); }
.company-head { display: flex; gap: .8rem; align-items: center; }
/* On the cards an uploaded logo is smaller than the two text lines beside it. */
.company-head img.logo { height: 30px; max-width: 110px; }
.company-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.company-head small { color: var(--ink-2); }
.big-number { font-size: 2.1rem; font-weight: 800; line-height: 1; }
.big-number small { display: block; font-family: "Inter", sans-serif; font-size: .78rem; font-weight: 400; color: var(--ink-2); margin-top: .35rem; }
.big-number .nr { font-size: 1.2rem; color: var(--ink-2); font-weight: 600; }
.mini-stats { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .8rem; color: var(--ink-2); }
.mini-stats b { color: var(--ink); }

/* Tables */
.table-clean { --bs-table-bg: transparent; margin: 0; }
.table-clean thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-clean td, .table-clean th { padding: .7rem .9rem; border-color: var(--line); }
.panel.p-0 .table-clean td:first-child, .panel.p-0 .table-clean th:first-child { padding-left: 1.4rem; }
.table-clean tbody tr:last-child td { border-bottom: 0; }
.table-clean tbody tr:hover { background: #fafbfc; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.path { color: var(--ink-2); font-size: .78rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.link-name { font-weight: 600; color: var(--ink); text-decoration: none; }
.link-name:hover { color: var(--accent); }
.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; background: var(--dot, #314655); margin-right: .45rem; vertical-align: middle; }

/* Pills */
.pill { display: inline-block; padding: .18rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-muted { background: var(--muted-bg); color: var(--ink-2); }
h1 .pill { font-family: "Inter", sans-serif; font-size: .75rem; margin-left: .4rem; }

/* Flash */
.flash-stack { padding: 1rem 2rem 0; display: grid; gap: .5rem; }
.flash { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .7rem 1rem; border-radius: var(--radius); font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-bad { background: var(--bad-bg); color: var(--bad); }
.flash-info { background: var(--info-bg); color: var(--info); }
.flash-close { background: none; border: 0; font-size: 1.3rem; color: inherit; line-height: 1; cursor: pointer; }

/* Filters, tabs, forms */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.filters .form-control { flex: 1 1 240px; }
.filters .form-select { flex: 0 1 190px; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: .6rem 1rem; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--brand-2); }
.field { display: block; margin-bottom: 1rem; }
.field > span { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.field small { display: block; color: var(--ink-2); font-size: .78rem; margin-top: .3rem; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; position: sticky; bottom: 0; padding: 1rem 0; background: linear-gradient(transparent, var(--paper) 35%); }
.rows { list-style: none; padding: 0; margin: 0 0 1rem; }
.rows > li { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.rows summary { cursor: pointer; list-style: none; }
.rows summary::-webkit-details-marker { display: none; }
.rows summary::after { content: "Edit"; float: right; color: var(--accent); font-size: .8rem; }
.row-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; }
.row-form .form-control, .row-form .form-select { flex: 1 1 140px; width: auto; }
.row-form.add { border-top: 1px dashed var(--line); padding-top: .9rem; }
.row-form:has(.rf) { align-items: flex-end; }
.rf { display: flex; flex-direction: column; gap: .25rem; flex: 1 1 140px; min-width: 0; margin: 0; }
.rf > span { font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.row-form .rf .form-control, .row-form .rf .form-select { flex: none; width: 100%; }
.rf:has(.colour-input) { flex: 0 1 170px; }
.rf .colour-input { max-width: none; }
.rf:has(select) { flex: 0 1 130px; }
.colour-input { max-width: 170px; font-family: ui-monospace, monospace; }
.issued { border-color: var(--brand-2); background: #fffaf0; }

/* Link detail */
.url-strip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; margin-bottom: 1rem; overflow-wrap: anywhere; }
.url-strip code { background: none; padding: 0; font-size: .95rem; }
.facts { display: grid; grid-template-columns: 150px 1fr; gap: .55rem 1rem; margin: 0; }
.facts dt { color: var(--ink-2); font-weight: 500; font-size: .85rem; }
.facts dd { margin: 0; min-width: 0; }
.wrap-anywhere { overflow-wrap: anywhere; word-break: break-word; }
.pre { white-space: pre-wrap; }
.wa-preview { margin-top: 1.2rem; background: #efeae2; border-radius: var(--radius); padding: .9rem; }
.wa-label { font-size: .8rem; font-weight: 600; color: #075e54; margin-bottom: .4rem; }
.wa-bubble { background: #d9fdd3; border-radius: 10px 10px 2px 10px; padding: .55rem .75rem; margin-left: auto; max-width: 90%; width: fit-content; margin-bottom: .4rem; overflow-wrap: anywhere; }
.timeline { list-style: none; padding: 0; margin: 0; max-height: 520px; overflow-y: auto; }
.timeline > li { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.changes { list-style: none; padding: 0; margin: .3rem 0 0; font-size: .8rem; }
.changes span { color: var(--ink-2); display: inline-block; min-width: 110px; }
.changes del { color: var(--bad); overflow-wrap: anywhere; }
.changes ins { color: var(--ok); text-decoration: none; overflow-wrap: anywhere; }
.qr-preview { width: 280px; max-width: 100%; image-rendering: pixelated; }

/* Charts */
.chart-box { position: relative; height: 260px; }
.chart-small { height: 200px; margin-bottom: 1rem; }

/* Plain pages (sign-in, unavailable) */
body.plain { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 10%, #e7edf1, var(--paper) 60%); padding: 1rem; }
.plain-card { background: var(--card); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); padding: 2.25rem; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(22, 33, 42, .08); }

/* Small screens */
@media (max-width: 991.98px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .rail.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.3); }
  .topbar, .content, .flash-stack { padding-left: 1rem; padding-right: 1rem; }
  .split { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Table row actions: one visible button plus a "more" menu */
.row-actions { display: inline-flex; gap: .4rem; align-items: center; justify-content: flex-end; white-space: nowrap; }
.btn-icon { border: 1px solid var(--line); background: var(--card); color: var(--ink-2); width: 2rem; height: 2rem; padding: 0; display: inline-grid; place-items: center; }
.btn-icon:hover, .btn-icon[aria-expanded="true"] { background: var(--muted-bg); color: var(--ink); }
.dropdown-menu { border-color: var(--line); box-shadow: 0 10px 30px rgba(22, 33, 42, .08); padding: .35rem; min-width: 12rem; }
.dropdown-item { border-radius: calc(var(--radius-sm) - 2px); padding: .45rem .7rem; display: flex; gap: .55rem; align-items: center; }
.dropdown-menu form { margin: 0; }
.person-email { color: var(--ink-2); font-size: .82rem; overflow-wrap: anywhere; }

/* Placeholders must never look like real data: very light grey, not italic so they stay readable. */
::placeholder, .form-control::placeholder { color: #b4bec7; opacity: 1; }

/* Company link domain (Settings → Company) */
.domain-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .75rem; }
.domain-name { font-size: 1rem; color: var(--ink); }
.dns-record { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1rem; }
.domain-actions { display: flex; align-items: flex-end; gap: .75rem 1rem; flex-wrap: wrap; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.domain-actions form { margin: 0; }
.domain-actions .row-form { flex: 1 1 320px; }
