:root {
    --royal: #1747ff;
    --royal-dark: #0d2fb8;
    --royal-soft: #eef3ff;
    --ink: #111827;
    --muted: #667085;
    --line: #dbe4f0;
    --paper: #ffffff;
    --canvas: #f7faff;
    --success: #0f9f6e;
    --coral: #ff6b4a;
}

body.app-shell {
    background:
        radial-gradient(circle at 12% 0%, rgba(23, 71, 255, 0.08), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, var(--canvas) 58%, #ffffff 100%);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main > .app-container {
    padding: 96px 15px 40px;
}

.admin-container {
    padding: 116px 24px 34px;
}

.admin-shell {
    background: #f7faff;
}

.admin-shell .kv-grid-container,
.admin-shell .table-responsive {
    width: 100%;
}

.admin-shell .panel,
.admin-shell .card {
    border-radius: 8px;
}

.app-navbar {
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(219, 228, 240, 0.9);
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
    backdrop-filter: blur(18px);
}

.app-brand {
    align-items: center;
    color: var(--ink);
    display: inline-flex;
    font-weight: 900;
    gap: 10px;
}

.brand-mark {
    align-items: center;
    background: var(--royal);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.app-navbar .nav-link {
    color: var(--muted);
    font-weight: 700;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
    color: var(--royal);
}

.btn,
.card,
.form-control,
.form-select,
.input-group-text {
    border-radius: 8px;
}

.btn-primary {
    background: var(--royal);
    border-color: var(--royal);
    box-shadow: 0 12px 22px rgba(23, 71, 255, 0.18);
    font-weight: 800;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--royal-dark);
    border-color: var(--royal-dark);
}

.btn-outline-primary {
    border-color: rgba(23, 71, 255, 0.35);
    color: var(--royal);
    font-weight: 800;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary.active {
    background: var(--royal);
    border-color: var(--royal);
    color: #fff;
}

.nav-login {
    color: #fff !important;
    padding: 9px 18px;
}

.nav-login:hover,
.nav-login:focus,
.nav-login:visited {
    color: #fff !important;
}

.profile-link {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.profile-link:hover,
.profile-link:focus {
    border-color: rgba(23, 71, 255, 0.35);
}

.profile-icon {
    display: block;
}

.nav-logout-form {
    margin: 0;
}

.nav-logout {
    padding: 9px 14px;
}

.footer {
    background-color: var(--paper);
    border-top: 1px solid var(--line);
    font-size: .9em;
}

.footer > .container {
    padding-right: 15px;
    padding-left: 15px;
}

.not-set {
    color: #c55;
    font-style: italic;
}

a.asc:after, a.desc:after {
    content: '';
    left: 3px;
    display: inline-block;
    width: 0;
    height: 0;
    border: solid 5px transparent;
    margin: 4px 4px 2px 4px;
    background: transparent;
}

a.asc:after {
    border-bottom: solid 7px #212529;
    border-top-width: 0;
}

a.desc:after {
    border-top: solid 7px #212529;
    border-bottom-width: 0;
}

.grid-view th {
    white-space: nowrap;
}

.hint-block {
    display: block;
    margin-top: 5px;
    color: #999;
}

.error-summary {
    color: #a94442;
    background: #fdf7f7;
    border-left: 3px solid #eed3d7;
    padding: 10px 20px;
    margin: 0 0 15px 0;
}

.nav li > form > button.logout {
    color: var(--muted);
    font-weight: 700;
    padding-top: 7px;
}

.nav > li > form > button.logout:focus,
.nav > li > form > button.logout:hover {
    color: var(--royal);
    text-decoration: none;
}

.nav > li > form > button.logout:focus {
    outline: none;
}

.form-group {
    margin-bottom: 1rem;
}

.abitlink-home,
.auth-page {
    display: grid;
    gap: 28px;
}

.hero-shell,
.dashboard-shell,
.metrics-band {
    border-radius: 8px;
}

.hero-shell {
    background: linear-gradient(135deg, rgba(23, 71, 255, 0.16) 0%, rgba(23, 71, 255, 0.08) 48%, rgba(23, 71, 255, 0) 100%);
    border: 1px solid rgba(23, 71, 255, 0.12);
    box-shadow: 0 24px 70px rgba(17, 24, 39, 0.08);
    overflow: hidden;
    padding: clamp(28px, 5vw, 58px);
    position: relative;
}

.hero-shell > .row {
    position: relative;
    z-index: 1;
}

.hero-badge {
    color: var(--royal) !important;
    margin-bottom: 18px;
    padding: 9px 14px;
}

.hero-shell h1,
.auth-intro h1 {
    color: var(--ink);
    font-size: clamp(2.35rem, 5vw, 5.2rem);
    font-weight: 950;
    letter-spacing: 0;
    line-height: 0.96;
    margin: 0 0 22px;
}

.builder-lead,
.auth-intro p {
    color: var(--muted);
    font-size: 1.12rem;
    line-height: 1.75;
    max-width: 680px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.app-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(219, 228, 240, 0.95);
    box-shadow: 0 18px 44px rgba(17, 24, 39, 0.08);
}

.builder-card {
    border-top: 4px solid var(--royal);
}

.section-label {
    color: var(--royal);
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.form-label {
    color: var(--ink);
    font-weight: 800;
}

.form-control,
.form-select {
    border-color: var(--line);
    min-height: 48px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--royal);
    box-shadow: 0 0 0 .2rem rgba(23, 71, 255, 0.12);
}

.form-text {
    color: var(--muted);
}

.dashboard-shell {
    background: transparent;
}

.link-list {
    display: grid;
    gap: 12px;
}

.link-item {
    align-items: center;
    background: #fbfdff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 16px;
}

.link-item strong {
    color: var(--ink);
    display: block;
    overflow-wrap: anywhere;
}

.link-item span {
    color: var(--muted);
}

.link-item small {
    color: var(--muted);
    display: block;
    margin-top: 4px;
}

.metric-pill {
    background: var(--royal-soft);
    border-radius: 999px;
    color: var(--royal) !important;
    flex: 0 0 auto;
    font-weight: 900;
    padding: 8px 12px;
}

.empty-state {
    background: #fbfdff;
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 22px;
}

.empty-state strong,
.empty-state span {
    display: block;
}

.empty-state span {
    color: var(--muted);
    margin-top: 4px;
}

.insight-panel {
    border-radius: 8px;
    min-height: 100%;
    overflow: hidden;
    position: relative;
}

.insight-panel img,
.auth-visual img {
    display: block;
    height: 100%;
    min-height: 360px;
    object-fit: cover;
    width: 100%;
}

.insight-card,
.auth-visual-note {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(219, 228, 240, 0.9);
    border-radius: 8px;
    bottom: 18px;
    left: 18px;
    padding: 16px;
    position: absolute;
}

.insight-card strong {
    color: var(--royal);
    display: block;
    font-size: 2.4rem;
    font-weight: 950;
    line-height: 1;
    margin: 6px 0;
}

.insight-card p {
    color: var(--muted);
    margin: 0;
}

.feature-grid h2 {
    font-size: 1.2rem;
    font-weight: 900;
    margin: 14px 0 10px;
}

.feature-grid p {
    color: var(--muted);
    line-height: 1.7;
    margin: 0;
}

.feature-number {
    color: var(--coral);
    font-weight: 950;
}

.metrics-band {
    background: var(--royal);
    box-shadow: 0 18px 44px rgba(23, 71, 255, 0.22);
    color: #fff;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 28px;
}

.metric-tile {
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    padding: 18px;
}

.metric-tile strong {
    display: block;
    font-size: 2.25rem;
    font-weight: 950;
    line-height: 1;
}

.metric-tile span {
    color: rgba(255, 255, 255, 0.82);
}

.auth-visual {
    border-radius: 8px;
    margin-top: 24px;
    overflow: hidden;
    position: relative;
}

.auth-panel {
    margin-left: auto;
    max-width: 520px;
}

.auth-submit {
    min-height: 50px;
    width: 100%;
}

.auth-help {
    background: var(--royal-soft);
    border: 1px solid rgba(23, 71, 255, 0.12);
    border-radius: 8px;
    color: var(--muted);
    line-height: 1.6;
    margin-top: 18px;
    padding: 14px;
}

.auth-help strong {
    color: var(--ink);
}

.profile-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(17, 24, 39, 0.08);
    padding: clamp(22px, 4vw, 42px);
}

.profile-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

.profile-header h1 {
    color: var(--ink);
    font-size: clamp(2rem, 4vw, 3.4rem);
    font-weight: 950;
    letter-spacing: 0;
    line-height: 1;
    margin: 6px 0 0;
}

.profile-data {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin: 0 0 28px;
}

.profile-data div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.profile-data dt {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.profile-data dd {
    color: var(--ink);
    font-weight: 800;
    margin: 0;
    overflow-wrap: anywhere;
}

.api-token-panel {
    max-width: 780px;
}

.clicks-break-cell {
    max-width: 280px;
    overflow-wrap: anywhere;
}

.qr-print-builder {
    min-height: 70vh;
}

.qr-controls {
    position: sticky;
    top: 12px;
}

.qr-preview-shell {
    background: #eef1f7;
    border: 1px solid var(--line);
    border-radius: 8px;
    max-height: 72vh;
    overflow: auto;
    padding: 18px;
}

.qr-a4-preview {
    display: grid;
    gap: 18px;
    justify-content: center;
}

.qr-a4-page {
    background: #fff;
    box-shadow: 0 14px 34px rgba(17, 24, 39, 0.18);
    box-sizing: border-box;
    display: grid;
    gap: 0;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    height: 297mm;
    padding: 5mm;
    page-break-after: always;
    width: 210mm;
}

.qr-a4-page:last-child {
    page-break-after: auto;
}

.qr-print-card {
    align-items: center;
    border: 1px dashed #9ca3af;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 3mm;
}

.qr-code-box {
    align-items: center;
    display: flex;
    height: 80mm;
    justify-content: center;
    width: 80mm;
}

.qr-code-box canvas,
.qr-code-box img {
    height: 80mm !important;
    image-rendering: crisp-edges;
    width: 80mm !important;
}

.qr-code-label {
    color: #111827;
    font-size: 11pt;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.2;
    margin-top: 2mm;
    max-width: 80mm;
    overflow-wrap: anywhere;
    text-align: center;
}

@media (max-width: 991px) {
    .auth-panel {
        margin-left: 0;
        max-width: none;
    }
}

@media (max-width: 767px) {
    main > .app-container {
        padding-top: 84px;
    }

    .hero-shell,
    .metrics-band {
        padding: 22px;
    }

    .hero-shell h1,
    .auth-intro h1 {
        font-size: 2.45rem;
    }

    .link-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .metrics-band {
        grid-template-columns: 1fr;
    }
}
