/* sw.kytola.com - white/blue, following kytola.com. No framework, no web fonts. */

:root {
  --blue: #006bb7;          /* Kytola logo blue */
  --blue-600: #005a9c;
  --blue-700: #004a80;
  --blue-050: #eef6fc;
  --sky: #e6f1fa;
  --sky-2: #d3e6f5;
  --navy: #0b2540;
  --navy-2: #12324f;
  --ink: #16222f;
  --muted: #5b6b7c;
  --line: #dde6ef;
  --bg: #f5f8fb;
  --white: #fff;
  --ok: #1d7f49;
  --ok-bg: #e7f5ec;
  --warn: #9a6408;
  --warn-bg: #fdf3e0;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(11, 37, 64, .06), 0 6px 24px rgba(11, 37, 64, .07);
  --shadow-hover: 0 2px 4px rgba(11, 37, 64, .08), 0 12px 32px rgba(11, 37, 64, .12);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.6 var(--font);
  color: var(--ink);
  background: var(--white);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

img { max-width: 100%; height: auto; }

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-700); text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; color: var(--navy); }
h1 { font-size: clamp(1.9rem, 3.5vw, 2.6rem); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .88em; background: var(--blue-050); padding: .1em .35em; border-radius: 5px; }

.container { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(760px, 100% - 2.5rem); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--navy); color: #fff; padding: .5rem 1rem; border-radius: 6px; z-index: 20; }
.skip:focus { left: .5rem; }

:focus-visible { outline: 3px solid rgba(0, 107, 183, .45); outline-offset: 2px; }

/* ---- Icons ---------------------------------------------------------------------------------- */

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
.icon-sm { width: 1.05em; height: 1.05em; }
.icon-xs { width: .85em; height: .85em; vertical-align: -.1em; }

/* ---- Header --------------------------------------------------------------------------------- */

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 0 var(--blue);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-row { display: flex; align-items: center; gap: 1.5rem; min-height: 70px; }

.brand { display: flex; align-items: center; gap: .75rem; color: var(--navy); }
.brand:hover { text-decoration: none; color: var(--navy); }
.brand img { height: 30px; width: auto; }
.brand-sub {
  font-weight: 600; font-size: .95rem; letter-spacing: .02em;
  padding-left: .75rem; border-left: 1px solid var(--line); color: var(--muted);
}

.site-nav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.site-nav > a:not(.btn) {
  color: var(--ink); font-weight: 550; padding: .5rem .8rem; border-radius: 8px; display: inline-flex; align-items: center; gap: .4rem;
}
.site-nav > a:not(.btn):hover { background: var(--blue-050); color: var(--blue-700); text-decoration: none; }
.site-nav > a.is-active { color: var(--blue); background: var(--blue-050); }
.nav-spacer { flex: 1; }
.nav-user { color: var(--muted) !important; }
.inline-form { display: inline; margin: 0; }

.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .5rem; color: var(--navy); cursor: pointer; }

/* ---- Buttons -------------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 600; line-height: 1.2;
  padding: .7rem 1.2rem; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none !important; transition: background .15s, box-shadow .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); color: #fff; box-shadow: 0 4px 14px rgba(0, 107, 183, .3); }
.btn-outline { background: #fff; border-color: var(--blue); color: var(--blue); }
.btn-outline:hover { background: var(--blue-050); color: var(--blue-700); }
.btn-ghost { background: transparent; color: var(--blue); border-color: var(--line); }
.btn-ghost:hover { background: var(--blue-050); color: var(--blue-700); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f0c4bf; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-disabled { background: var(--bg); color: var(--muted); border-color: var(--line); cursor: default; }
.btn-small { padding: .45rem .8rem; font-size: .9rem; border-radius: 8px; }
.btn-large { padding: .95rem 1.5rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-meta { font-weight: 500; opacity: .8; font-size: .85em; padding-left: .5rem; border-left: 1px solid rgba(255, 255, 255, .35); }

/* ---- Hero & page heads ------------------------------------------------------------------------ */

.hero, .page-head {
  background:
    radial-gradient(1200px 400px at 85% -20%, rgba(0, 107, 183, .14), transparent 60%),
    radial-gradient(700px 300px at 0% 120%, rgba(0, 107, 183, .08), transparent 60%),
    linear-gradient(180deg, var(--sky) 0%, #f3f8fc 100%);
  border-bottom: 1px solid var(--sky-2);
}

.hero { padding: 4rem 0 7.5rem; }
.page-head { padding: 2.75rem 0 2.25rem; }
.page-head h1 { margin-bottom: .25rem; }

.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; color: var(--blue); margin-bottom: .5rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 44rem; margin: 0; }

.page-body { padding: 2.5rem 0 4rem; }

/* ---- Cards ---------------------------------------------------------------------------------- */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem;
  margin-bottom: 1.5rem;
}
.card > :last-child { margin-bottom: 0; }

/* ---- Products ------------------------------------------------------------------------------- */

.products { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin-top: -5rem; position: relative; }
.product { display: flex; flex-direction: column; padding: 2rem; margin: 0; border-top: 4px solid var(--blue); transition: box-shadow .2s, border-color .2s; }
.product:hover { box-shadow: var(--shadow-hover); }

/* Four products: two rows of two instead of three plus one */
.products-n4 { grid-template-columns: repeat(2, 1fr); }

.product-legacy { border-top-color: #8fa3b6; }
.product-legacy .product-icon { background: #eef1f4; color: #5b6b7c; }
.badge-legacy { background: #eef1f4; color: #5b6b7c; font-size: .68rem; vertical-align: .25em; }

.product-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.product-head h2 { font-size: 1.4rem; margin-bottom: .2rem; }
.product-head p { margin: 0; }
.product-icon {
  display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 12px;
  background: var(--blue-050); color: var(--blue);
}
.product-icon .icon { width: 28px; height: 28px; }

.chips { list-style: none; padding: 0; margin: 0 0 .5rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; gap: .4rem; align-items: center; font-size: .82rem; font-family: var(--mono);
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem; color: var(--navy);
}
.chip span { font-family: var(--font); font-weight: 600; color: var(--muted); }
.released { font-size: .9rem; color: var(--muted); margin-bottom: 1.25rem; }

.product-actions { margin-top: auto; display: flex; flex-direction: column; gap: 1rem; }
.product-actions .btn-large { align-self: flex-start; }
.product-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; font-size: .93rem; }
.product-links a { display: inline-flex; gap: .35rem; align-items: center; }

/* ---- Steps ---------------------------------------------------------------------------------- */

.steps { padding: 3.5rem 0 3rem; }
.section-title { font-size: 1.5rem; margin-bottom: 1.25rem; }
.step-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; counter-reset: step; }
.step-list li { position: relative; padding: 1.5rem 1.5rem 1.25rem; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); counter-increment: step; }
.step-list li::after {
  content: counter(step); position: absolute; top: 1.1rem; right: 1.25rem;
  font-size: 2.2rem; font-weight: 800; color: var(--sky-2); line-height: 1;
}
.step-list p { color: var(--muted); margin: 0; font-size: .95rem; }
.step-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--blue); color: #fff; margin-bottom: .9rem; }

/* ---- News ----------------------------------------------------------------------------------- */

.band { background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 3rem 0 1.5rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.link-arrow { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; }
.link-back { display: inline-block; margin-bottom: 1rem; font-weight: 600; }

.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.news-card { margin: 0 0 1.5rem; display: flex; flex-direction: column; }
.news-card h3 { font-size: 1.1rem; margin: .6rem 0 .4rem; }
.news-card h3 a { color: var(--navy); }
.news-card h3 a:hover { color: var(--blue); }
.news-card p { color: var(--muted); font-size: .95rem; margin: 0; }

.news-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; font-size: .85rem; color: var(--muted); }
.tag { font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; padding: .2rem .6rem; border-radius: 999px; background: var(--blue-050); color: var(--blue-700); }
.tag-suite { background: #e3f0fb; color: #064f86; }
.tag-config { background: #e6f6f3; color: #0d6a5a; }
.tag-tools { background: #f1ecfb; color: #5a3d99; }
.version { font-family: var(--mono); color: var(--navy); }

.post h1 { margin-top: .75rem; }
.prose { font-size: 1.05rem; }
.prose h3 { margin-top: 1.6em; font-size: 1.2rem; }
.prose ul { padding-left: 1.3rem; margin: 0 0 1em; }
.prose li { margin-bottom: .3em; }

.others { padding: 2.5rem 0 3.5rem; }
.other-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .75rem; }
.other-list a { display: inline-flex; gap: .5rem; align-items: center; padding: .6rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 600; }
.other-list a:hover { border-color: var(--blue); background: var(--blue-050); text-decoration: none; }

.empty { color: var(--muted); padding: 2rem 0; }

/* ---- Packages ------------------------------------------------------------------------------- */

.kind-explainer { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.kind-explainer .card { background: var(--bg); box-shadow: none; }
.kind-explainer h3 { display: flex; gap: .5rem; align-items: center; color: var(--blue-700); }
.kind-explainer p { color: var(--muted); margin: 0; }

.package-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: 1rem; }
.package-head h2 { margin: 0; }

/* ---- Tables --------------------------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: .6rem .75rem; border-bottom: 2px solid var(--line); }
.table td { padding: .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcfe; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * + * { margin-left: .35rem; }
.sub-row td { padding-top: 0; border-top: 0; }

/* ---- Forms ---------------------------------------------------------------------------------- */

.form { display: flex; flex-direction: column; gap: 1rem; }
.form label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .92rem; color: var(--navy); }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=tel],
.form input[type=date], .form input[type=number], .form input[type=search], .form select, .form textarea,
.search-row input, .key-edit input, .copy-row input {
  font: inherit; font-weight: 400; color: var(--ink);
  width: 100%; padding: .65rem .8rem; border: 1px solid #c9d6e2; border-radius: var(--radius-sm); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form textarea { resize: vertical; min-height: 12rem; font-family: var(--mono); font-size: .92rem; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue) !important; box-shadow: 0 0 0 3px rgba(0, 107, 183, .15); }
.form .check { flex-direction: row; align-items: center; gap: .6rem; font-weight: 500; }
.form .check input { width: 1.1rem; height: 1.1rem; accent-color: var(--blue); }
.hint { font-weight: 400; font-size: .82rem; color: var(--muted); }
.optional { font-weight: 400; font-size: .8rem; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.25rem; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-actions { display: flex; gap: .75rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Auth pages ----------------------------------------------------------------------------- */

.auth {
  padding: 3.5rem 1.25rem 4.5rem;
  background: linear-gradient(180deg, var(--sky) 0, #fff 22rem);
}
.auth-card { max-width: 440px; margin: 0 auto; padding: 2.25rem; }
.auth-wide { max-width: 760px; }
.auth-card h1 { font-size: 1.7rem; }
.auth-foot { margin-top: 1.25rem; font-size: .93rem; }
.auth-foot p { margin: 0 0 .4rem; }

/* ---- Flash & badges ------------------------------------------------------------------------- */

.flashes { padding-top: 1.25rem; }
.flash { padding: .85rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid; font-size: .95rem; }
.flash ul { margin: 0; padding-left: 1.2rem; }
.flash-ok { background: var(--ok-bg); border-color: #bfe3cc; color: #145c34; }
.flash-error { background: var(--danger-bg); border-color: #f2c6c1; color: #8c1d17; }
.flash-info { background: var(--blue-050); border-color: var(--sky-2); color: var(--blue-700); }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .2rem .55rem; border-radius: 6px; vertical-align: middle; }
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-disabled { background: #eef1f4; color: #677585; }
.badge-admin { background: var(--navy); color: #fff; }

/* ---- Account / facts ------------------------------------------------------------------------ */

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.two-col > .card { margin-bottom: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 1.5rem 0 0; font-size: .93rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* ---- Admin ---------------------------------------------------------------------------------- */

.admin { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; padding: 2rem 0 4rem; align-items: start; }
.admin-nav { position: sticky; top: 90px; display: flex; flex-direction: column; gap: .2rem; }
.admin-nav a { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-radius: 8px; color: var(--ink); font-weight: 550; }
.admin-nav a:hover { background: var(--blue-050); text-decoration: none; }
.admin-nav a.is-active { background: var(--blue); color: #fff; }
.admin-main { min-width: 0; }
.admin-main h1 { font-size: 1.8rem; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat { margin: 0; display: flex; flex-direction: column; gap: .2rem; color: var(--muted); padding: 1.25rem 1.4rem; }
.stat:hover { text-decoration: none; border-color: var(--blue); }
.stat-value { font-size: 2rem; font-weight: 750; color: var(--navy); line-height: 1.1; }
.stat-alert { border-color: #f2d6a6; background: var(--warn-bg); }
.stat-alert .stat-value { color: var(--warn); }

.small-head { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1rem 0 .4rem; }
.count-list { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.count-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.count-list span { font-weight: 700; color: var(--navy); }

.audit-list { list-style: none; margin: 0 0 1rem; padding: 0; font-size: .88rem; }
.audit-list li { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.audit-event { font-weight: 700; color: var(--navy); text-transform: capitalize; }
.audit-event.ev-login_failed, .audit-event.ev-license_admin_bad_key, .audit-event.ev-login_blocked,
.audit-event.ev-license_activation_blocked, .audit-event.ev-license_admin_refused { color: var(--danger); }
.audit-who { color: var(--blue-700); font-weight: 600; }
.audit-kv { color: var(--muted); font-family: var(--mono); font-size: .82rem; }
.audit-time { margin-left: auto; color: var(--muted); white-space: nowrap; }

.action-stack { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; }
.reset-box { border-color: var(--blue); background: var(--blue-050); }
.copy-row { display: flex; gap: .5rem; }
.copy-row input { font-family: var(--mono); font-size: .85rem; }

.editor { max-width: 900px; }
.danger-zone { margin-top: -.5rem; }

.add-key summary { cursor: pointer; list-style: none; }
.add-key summary::-webkit-details-marker { display: none; }
.add-key summary h2 { display: inline; }
.add-key summary::after { content: "+"; float: right; font-size: 1.4rem; line-height: 1; color: var(--blue); }
.add-key[open] summary::after { content: "−"; }
.add-key[open] summary { margin-bottom: 1rem; }

.search-row { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-row input { max-width: 340px; }
.key-edit { display: flex; gap: .4rem; align-items: center; }
.key-edit input[type=number] { width: 5.5rem; }
.key-edit input[type=text] { min-width: 8rem; }

/* ---- Product card extras ------------------------------------------------------------------- */

.product-links a .link-meta { color: var(--muted); font-size: .82em; margin-left: .15rem; }
.card-note { margin: 0; font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }

/* ---- Products catalog ------------------------------------------------------------------------ */

.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem; }
.catalog-item { margin: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, border-color .2s; }
.catalog-item:hover { box-shadow: var(--shadow-hover); border-color: var(--sky-2); }
.catalog-media {
  display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden;
  background: linear-gradient(135deg, var(--sky) 0%, #f5f9fc 100%); border-bottom: 1px solid var(--line);
}
.catalog-media img { width: 100%; height: 100%; object-fit: cover; }
.catalog-icon { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 18px; background: #fff; color: var(--blue); box-shadow: var(--shadow); }
.catalog-icon .icon { width: 40px; height: 40px; }
.catalog-body { padding: 1.3rem 1.5rem 1.5rem; display: flex; flex-direction: column; flex: 1; }
.catalog-body h2 { font-size: 1.25rem; margin-bottom: .35rem; }
.catalog-body h2 a { color: var(--navy); }
.catalog-body p { color: var(--muted); font-size: .95rem; flex: 1; }

.product-hero-row { display: flex; gap: 1.25rem; align-items: flex-start; margin-bottom: 1.5rem; }
.product-icon-lg { width: 64px; height: 64px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.product-icon-lg .icon { width: 34px; height: 34px; }
.cover-image { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); margin: 0 0 2rem; }
.prose img { display: block; max-width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); margin: .5rem 0; }

.news-card.has-image { padding-top: 0; overflow: hidden; }
.news-thumb { display: block; margin: 0 -1.6rem 1rem; aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid var(--line); }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Admin: products & images ------------------------------------------------------------- */

.order-col { width: 1%; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.public-toggle { margin-top: 1rem; }
.order-form { display: flex; gap: .25rem; }
.btn-icon { padding: .35rem .45rem; }
.btn:disabled { opacity: .35; cursor: default; box-shadow: none; }
.form textarea.short { min-height: 0; font-family: var(--font); }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span {
  display: flex; align-items: center; padding: 0 .6rem; font-weight: 400; font-family: var(--mono); font-size: .85rem;
  color: var(--muted); background: var(--bg); border: 1px solid #c9d6e2; border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.input-prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important; }

.image-field { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem 1.1rem 1.1rem; margin: 0; display: flex; flex-direction: column; gap: .9rem; }
.image-field legend { font-weight: 600; font-size: .92rem; color: var(--navy); padding: 0 .35rem; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .6rem; max-height: 330px; overflow-y: auto; padding: .15rem; }
.image-cell { display: flex; flex-direction: column; gap: .3rem; }
.image-choice { position: relative; display: block !important; cursor: pointer; }
.image-choice input { position: absolute; opacity: 0; }
.image-choice img, .image-none {
  display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border: 2px solid var(--line); border-radius: 8px; background: var(--bg);
}
.image-none { gap: .2rem; align-content: center; font-weight: 500; font-size: .82rem; color: var(--muted); }
.image-choice input:checked + img, .image-choice input:checked + .image-none { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 107, 183, .2); }
.image-choice input:focus-visible + img, .image-choice input:focus-visible + .image-none { outline: 3px solid rgba(0, 107, 183, .45); outline-offset: 2px; }
.image-field.has-upload .image-grid { opacity: .45; }
.copy-code { font: inherit; font-size: .75rem; color: var(--blue); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.copy-code:hover { text-decoration: underline; }

.upload-form { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.upload-form label { flex: 1; min-width: 240px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.media-item { margin: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.media-item > a { display: block; aspect-ratio: 4 / 3; background: var(--bg); border-bottom: 1px solid var(--line); }
.media-item img { width: 100%; height: 100%; object-fit: contain; }
.media-item figcaption { padding: .8rem 1rem 1rem; display: flex; flex-direction: column; gap: .2rem; font-size: .9rem; overflow-wrap: anywhere; }
.media-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }

/* ---- Statistics --------------------------------------------------------------------------- */

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--bg); }
.segmented a { padding: .4rem .85rem; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.segmented a:hover { color: var(--blue-700); text-decoration: none; }
.segmented a.is-active { background: #fff; color: var(--blue); box-shadow: 0 1px 2px rgba(11, 37, 64, .12); }
.stat-note { display: block; font-size: .8rem; color: var(--muted); }

.chart-card h2 { margin-bottom: 1rem; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-base { stroke: #b9c7d5; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-bar { fill: var(--blue); }
.chart-hit { fill: transparent; }
.chart-col:hover .chart-bar { fill: var(--blue-700); }
.chart-col:hover .chart-hit { fill: rgba(0, 107, 183, .06); }
.chart-table { margin-top: 1rem; font-size: .9rem; }
.chart-table summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.chart-table table { margin-top: .75rem; }

.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.num { text-align: right; }
.share-col { width: 28%; }
.share-bar { display: block; width: 100%; height: 8px; }
.share-track { fill: var(--bg); }
.share-fill { fill: var(--blue); }
.stats-table td { padding-top: .55rem; padding-bottom: .55rem; }

/* ---- Error page ----------------------------------------------------------------------------- */

.error-page { text-align: center; padding: 5rem 0; }
.error-code { font-size: 4.5rem; font-weight: 800; color: var(--sky-2); margin: 0; line-height: 1; }

/* ---- Footer --------------------------------------------------------------------------------- */

.site-footer { background: var(--navy); color: #c6d4e2; margin-top: 3rem; font-size: .93rem; }
.site-footer a { color: #fff; }
.site-footer h2 { color: #fff; font-size: .95rem; text-transform: uppercase; letter-spacing: .08em; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2.5rem; padding: 3rem 0 2rem; }
.footer-logo { height: 28px; width: auto; margin-bottom: 1rem; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: .45rem; }
.footer-bottom { border-top: 1px solid var(--navy-2); padding: 1.2rem 0 1.5rem; color: #8ea4ba; font-size: .85rem; }

/* ---- Responsive ----------------------------------------------------------------------------- */

@media (max-width: 960px) {
  .news-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .admin { grid-template-columns: 1fr; gap: 1rem; }
  .admin-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 70px; background: #fff;
    flex-direction: column; align-items: stretch; padding: .75rem 1.25rem 1.25rem; border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(11, 37, 64, .1);
  }
  .nav-open .site-nav { display: flex; }
  .nav-spacer { display: none; }
  .site-nav .btn, .site-nav .inline-form button { width: 100%; margin-top: .25rem; }

  .hero { padding: 2.75rem 0 6rem; }
  .products, .products.products-n4, .step-list, .news-grid, .kind-explainer, .two-col, .form-grid, .form-grid-3, .footer-grid { grid-template-columns: 1fr; }
  .product { padding: 1.5rem; }
  .product-actions .btn-large { align-self: stretch; }

  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
  .table td { border: 0; padding: .3rem 0; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
  .table .actions { text-align: left; }
  .key-edit { flex-wrap: wrap; }
  .segmented a { padding: .4rem .55rem; font-size: .85rem; }
  .chart-scroll { overflow-x: auto; margin: 0 -.5rem; padding: 0 .5rem; }
  .chart-scroll .chart { min-width: 640px; }

  /* Statistics tables stay tables on phones: page, views, visitors */
  .table.stats-table { display: table; width: 100%; }
  .stats-table tbody { display: table-row-group; }
  .stats-table thead { display: table-header-group; }
  .stats-table tr { display: table-row; padding: 0; }
  .stats-table td, .stats-table th { display: table-cell; width: auto; padding: .5rem .35rem; border-bottom: 1px solid var(--line); }
  .stats-table td[data-label]::before { content: none; }
  .stats-table .share-col { display: none; }
}

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