:root {
    --bg: #0a0c0f;
    --panel: #111418;
    --panel-border: rgba(255, 255, 255, 0.07);
    --input-bg: #181c22;
    --text: #f0f2f5;
    --muted: #7a8494;
    --accent: #e63946;
    --accent-hover: #c62839;
    --danger: #ff6b6b;
    --danger-bg: #3a1d22;
    --ok: #16a34a;
    --ok-bg: #10331f;
    --radius: 14px;

    --font-display: "Syne", sans-serif;
    --font-body: "DM Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Fixed full-viewport texture behind every page — a faint grid plus a soft
   red glow in the top-right, matching the login hero's own background so
   the whole site reads as one consistent look. z-index:0 alone isn't enough
   to sit behind normal in-flow content (a fixed+z-index element paints in a
   later stacking step than static block content), so anything meant to sit
   above it (.topbar, .page, .footer, .login-hero-content) is explicitly
   given position:relative + z-index:1. */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px, 48px 48px;
}
.bg-glow {
    position: fixed;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    z-index: 0;
    background: radial-gradient(circle, rgba(230, 57, 70, 0.08) 0%, transparent 70%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.topbar {
    position: relative;
    z-index: 1;
    border-bottom: 1px solid var(--panel-border);
    background: var(--bg);
}

.topbar-inner, .footer-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--text); }
/* Crops just the icon mark out of wwwroot/img/callnexis-logo.png (the one
   source logo file — no separate icon-only asset) via background-position,
   since the full lockup's wordmark is illegible at nav-bar size and the
   image's own canvas is black outside the icon, which would otherwise show
   as a visible box. The icon sits at roughly x:25-519, y:236-735 of the
   1536x1024 source; the size/position numbers below are that region scaled
   to fit this element's box. */
.brand-icon {
    display: block;
    width: 40px;
    height: 40px;
    /*background-image: url('/img/callnexis-logo.png');*/
    background-repeat: no-repeat;
    background-size: 124px 83px;
    background-position: -2px -19px;
}

.topnav { display: flex; align-items: center; gap: 16px; }
.topnav-user { color: var(--muted); }
.topnav a:not(.button) { color: var(--muted); }
.topnav a:not(.button):hover { color: var(--text); }

.inline-form { display: inline; }

.link-button {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    padding: 0;
}
.link-button:hover { color: var(--accent-hover); }

.page {
    position: relative;
    z-index: 1;
    flex: 1;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

.footer { position: relative; z-index: 1; border-top: 1px solid var(--panel-border); color: var(--muted); font-size: 0.85rem; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; }
h1 { font-size: 1.7rem; margin: 0 0 6px; }
h2 { font-size: 1.1rem; margin: 28px 0 10px; }
p.lede { color: var(--muted); margin-top: 0; }

.card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 0.9rem; color: var(--muted); }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field textarea, .field select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
}
.field textarea { min-height: 72px; resize: vertical; }
.field small.hint { display: block; margin-top: 6px; color: var(--muted); font-size: 0.8rem; }
.field-error { color: var(--danger); font-size: 0.85rem; margin-top: 6px; }

/* A standalone input outside a .field wrapper — e.g. one per row in a table,
   where .field's width:100%/margin-bottom would fight the row layout. Same
   visual treatment as .field's inputs, just without those. */
.input-inline {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 20px; }
.stat-tile .stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-tile .stat-label { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.stat-tile .stat-value.ok { color: var(--ok); }
.stat-tile .stat-value.muted { color: var(--muted); }
.stat-tile .stat-value.danger { color: var(--danger); }

.plan-picker { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 20px; }
.plan-option { position: relative; }
.plan-option input { position: absolute; opacity: 0; }
.plan-option label {
    display: block;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    background: var(--input-bg);
}
.plan-option input:checked + label { border-color: var(--accent); background: var(--panel); }
.plan-option .plan-name { font-weight: 600; display: block; margin-bottom: 4px; }
.plan-option .plan-limits { color: var(--muted); font-size: 0.8rem; }

.feature-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--panel-border);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px 16px;
    font-size: 0.85rem;
}
/* The checkmark/cross is positioned relative to the element carrying the
   class itself (not a wrapper) so .feature-included/.feature-excluded work
   standalone anywhere — a plan-feature <li>, a status badge <span>, a nav
   link — not just inside .feature-list. */
.feature-included, .feature-excluded { position: relative; padding-left: 20px; }
.feature-included { color: var(--text); }
.feature-included::before { content: "✓"; position: absolute; left: 0; color: var(--ok); }
.feature-excluded { color: var(--muted); text-decoration: line-through; opacity: 0.65; }
.feature-excluded::before { content: "✕"; position: absolute; left: 0; }

.button {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px 20px;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    cursor: pointer;
}
.button:hover { background: var(--accent-hover); color: #fff; }
.button-secondary { background: transparent; border: 1px solid var(--panel-border); color: var(--text); }
.button-secondary:hover { border-color: var(--accent); color: var(--text); }
.button-small { padding: 6px 14px; }
.button-row { display: flex; gap: 10px; margin-top: 20px; }

/* AJAX form submit in flight — see wwwroot/js/site.js */
button.is-loading, input[type="submit"].is-loading {
    opacity: 0.6;
    cursor: default;
    position: relative;
    color: transparent !important;
}
button.is-loading::after, input[type="submit"].is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 15px;
    height: 15px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    animation: button-spin 0.6s linear infinite;
}
button.is-loading.button-secondary::after, button.is-loading.link-button::after {
    border-color: rgba(255, 255, 255, 0.25);
    border-top-color: var(--text);
}
@keyframes button-spin {
    to { transform: rotate(360deg); }
}

.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: var(--danger-bg); color: #ffb3b3; border: 1px solid #5c2b31; }
.alert-ok { background: var(--ok-bg); color: #8bf0b4; border: 1px solid #1f5c3a; }
.alert-info { background: #14213d; color: #a9c0ff; border: 1px solid #2a3a63; }

table.simple { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
table.simple th, table.simple td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--panel-border); font-size: 0.92rem; }
table.simple th { color: var(--muted); font-weight: 500; }

.credential-box {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 10px 12px;
    display: inline-block;
}

.summary-list { list-style: none; padding: 0; margin: 0 0 20px; }
.summary-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--panel-border); }
.summary-list li:last-child { border-bottom: none; font-weight: 600; }
.summary-list .label { color: var(--muted); }

.masked { letter-spacing: 1px; }

.also-ring { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 8px; }
.also-ring label { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 0.9rem; }

.hero { text-align: center; padding: 40px 0 8px; }
.hero h1 { font-size: 2.2rem; margin-bottom: 12px; }
.hero .lede { font-size: 1.05rem; max-width: 560px; margin: 0 auto 24px; }
.hero .button-row { justify-content: center; }

.section-intro { text-align: center; max-width: 560px; margin: 0 auto 8px; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin: 24px 0 40px; }
.feature-card { background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 20px; }
.feature-card .feature-icon { font-size: 1.6rem; margin-bottom: 8px; }
.feature-card h3 { margin: 0 0 6px; font-size: 1rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: 0.88rem; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 24px 0 40px; display: grid; gap: 18px; }
.steps li { position: relative; padding-left: 46px; }
.steps li::before {
    counter-increment: step; content: counter(step);
    position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
    background: var(--accent); color: #fff; font-family: var(--font-display); display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem;
}
.steps li h3 { margin: 0 0 4px; font-size: 1rem; }
.steps li p { margin: 0; color: var(--muted); font-size: 0.88rem; }

.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 24px 0 40px; }
.plan-cards .card { margin-bottom: 0; }
.plan-cards .card h3 { margin-top: 0; }
.plan-cards .plan-limits { color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
/* .feature-list's own grid columns (min 220px each) are sized for the full
   page width; a plan card is narrower than that, so force one column here
   rather than letting the columns overflow the card. */
.plan-cards .feature-list { grid-template-columns: 1fr; }

.legal h2 { margin-top: 32px; }
.legal h2:first-child { margin-top: 0; }
.legal p, .legal li { color: var(--muted); font-size: 0.92rem; line-height: 1.6; }

.footer-inner { flex-wrap: wrap; gap: 8px 20px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-size: 0.85rem; }
.footer-links a:hover { color: var(--text); }

.powered-by {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.8rem;
}
.powered-by img { height: 20px; display: block; }

@media (max-width: 560px) {
    .plan-picker { grid-template-columns: 1fr; }
}

/* ---- Login hero (full-bleed page, see _Layout.cshtml's FullBleed flag) --- */

.login-hero {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}
.login-hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Same crop as .brand-icon above, just scaled up for this page — see that
   comment for where these numbers come from. */
.login-brand-mark {
    display: block;
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    /*background-image: url('/img/callnexis-logo.png');*/
    background-repeat: no-repeat;
    background-size: 249px 166px;
    background-position: -4px -38px;
}
.login-brand-title {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
    margin: 0;
}
.login-brand-title span { color: var(--accent); }
.login-brand-sub {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin: 4px 0 0;
}

.login-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
}
.login-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 8px rgba(22, 163, 74, 0.6);
}
.login-status-text {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
}

.ext-status { font-weight: 600; font-size: 0.85rem; }
.ext-status-online { color: var(--ok); }
.ext-status-offline { color: var(--danger); }

.apk-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #000;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 10px 20px;
    text-decoration: none;
    line-height: 1.15;
}
.apk-badge:hover { background: #1a1a1a; }
.apk-badge-icon { width: 30px; height: 30px; flex-shrink: 0; }
.apk-badge-text { display: flex; flex-direction: column; }
.apk-badge-small { font-size: 0.7rem; color: #b7b7b7; text-transform: uppercase; letter-spacing: 0.5px; }
.apk-badge-large { font-size: 1.05rem; font-weight: 700; }

.apk-badge-disabled {
    cursor: not-allowed;
    opacity: 0.55;
    pointer-events: none;
}
.apk-badge-disabled:hover { background: #000; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal-panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    width: 420px;
    max-width: 100%;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--panel-border);
}
.modal-header h2 { margin: 0; font-size: 1.1rem; }
.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.modal-body .apk-badge { justify-content: center; }

.login-card {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 32px;
    margin-top: 32px;
}
.login-card h2 {
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 20px;
}
.login-field { margin-bottom: 16px; }
.login-field label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    margin-bottom: 6px;
}
.login-field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
}
.login-btn { width: 100%; margin-top: 8px; }
.login-links {
    margin-top: 20px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
}
.login-links a { color: #b9c2d0; }
.login-links a:hover { color: var(--text); }
