/*
 * ================================================================
 * CHEQBRAND DESIGN SYSTEM
 * Version: 1.0
 * Purpose: Production UI foundation for all CheqBrand applications
 * ================================================================
 *
 * Principles
 * ----------
 * 1. Professional, institutional and trustworthy.
 * 2. Mobile-first and responsive.
 * 3. Accessible keyboard/focus states.
 * 4. Brand colors are distinct from semantic status colors.
 * 5. Green = verified/valid/success.
 * 6. Amber = warning/pending.
 * 7. Red = invalid/revoked/error/destructive.
 * 8. Avoid page-specific arbitrary colors and spacing.
 *
 * IMPORTANT:
 * --cb-brand-blue and --cb-brand-red currently use the approved
 * working palette. Replace ONLY these values if authoritative
 * trademark artwork provides different RGB/HEX values.
 */

/* ================================================================
   1. DESIGN TOKENS
   ================================================================ */

:root {
    /* ------------------------------------------------------------
       Brand
       ------------------------------------------------------------ */

    --cb-brand-blue: #2589d8;
    --cb-brand-blue-deep: #1769aa;
    --cb-brand-navy: #123b5d;

    --cb-brand-red: #a70b08;

    /* ------------------------------------------------------------
       Semantic: success / verification / trust
       ------------------------------------------------------------ */

    --cb-success: #168a45;
    --cb-success-deep: #116b37;
    --cb-success-bg: #eaf7ef;
    --cb-success-border: #a9ddbc;

    /* ------------------------------------------------------------
       Semantic: danger / revoked / invalid
       ------------------------------------------------------------ */

    --cb-danger: #c62828;
    --cb-danger-deep: #9f1f1f;
    --cb-danger-bg: #fdecec;
    --cb-danger-border: #efb2b2;

    /* ------------------------------------------------------------
       Semantic: warning / pending
       ------------------------------------------------------------ */

    --cb-warning: #b76e00;
    --cb-warning-deep: #8f5600;
    --cb-warning-bg: #fff5db;
    --cb-warning-border: #ead19a;

    /* ------------------------------------------------------------
       Informational
       ------------------------------------------------------------ */

    --cb-info: #1769aa;
    --cb-info-bg: #eaf4fb;
    --cb-info-border: #acd2ec;

    /* ------------------------------------------------------------
       Neutral palette
       ------------------------------------------------------------ */

    --cb-white: #ffffff;

    --cb-gray-25: #fcfdfe;
    --cb-gray-50: #f8fafb;
    --cb-gray-100: #f5f7f9;
    --cb-gray-200: #e8edf1;
    --cb-gray-300: #d8e0e7;
    --cb-gray-400: #aab6c1;
    --cb-gray-500: #74818d;
    --cb-gray-600: #52606d;
    --cb-gray-700: #374550;
    --cb-gray-800: #25313b;
    --cb-gray-900: #17212b;

    /* ------------------------------------------------------------
       Text
       ------------------------------------------------------------ */

    --cb-text: var(--cb-gray-900);
    --cb-text-secondary: var(--cb-gray-600);
    --cb-text-muted: var(--cb-gray-500);
    --cb-text-inverse: var(--cb-white);

    /* ------------------------------------------------------------
       Surfaces
       ------------------------------------------------------------ */

    --cb-page-bg: var(--cb-gray-100);
    --cb-surface: var(--cb-white);
    --cb-surface-subtle: var(--cb-gray-50);
    --cb-border: var(--cb-gray-300);
    --cb-border-light: var(--cb-gray-200);

    /* ------------------------------------------------------------
       Typography
       System stack avoids external font dependency.
       ------------------------------------------------------------ */

    --cb-font-sans:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    --cb-font-mono:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        "Liberation Mono",
        monospace;

    --cb-font-size-xs: 0.75rem;
    --cb-font-size-sm: 0.875rem;
    --cb-font-size-md: 1rem;
    --cb-font-size-lg: 1.125rem;
    --cb-font-size-xl: 1.25rem;
    --cb-font-size-2xl: 1.5rem;
    --cb-font-size-3xl: 1.875rem;
    --cb-font-size-4xl: 2.25rem;

    --cb-line-tight: 1.2;
    --cb-line-normal: 1.5;
    --cb-line-relaxed: 1.7;

    /* ------------------------------------------------------------
       Spacing
       4px base scale
       ------------------------------------------------------------ */

    --cb-space-1: 0.25rem;
    --cb-space-2: 0.5rem;
    --cb-space-3: 0.75rem;
    --cb-space-4: 1rem;
    --cb-space-5: 1.25rem;
    --cb-space-6: 1.5rem;
    --cb-space-8: 2rem;
    --cb-space-10: 2.5rem;
    --cb-space-12: 3rem;
    --cb-space-16: 4rem;
    --cb-space-20: 5rem;

    /* ------------------------------------------------------------
       Radius
       ------------------------------------------------------------ */

    --cb-radius-sm: 0.375rem;
    --cb-radius-md: 0.625rem;
    --cb-radius-lg: 0.875rem;
    --cb-radius-xl: 1.25rem;
    --cb-radius-pill: 9999px;

    /* ------------------------------------------------------------
       Shadows
       ------------------------------------------------------------ */

    --cb-shadow-sm:
        0 1px 2px rgba(18, 59, 93, 0.06);

    --cb-shadow-md:
        0 4px 14px rgba(18, 59, 93, 0.08);

    --cb-shadow-lg:
        0 12px 32px rgba(18, 59, 93, 0.12);

    /* ------------------------------------------------------------
       Layout
       ------------------------------------------------------------ */

    --cb-container: 1200px;
    --cb-content: 800px;
    --cb-header-height: 4.25rem;

    /* ------------------------------------------------------------
       Motion
       ------------------------------------------------------------ */

    --cb-transition-fast: 120ms ease;
    --cb-transition: 180ms ease;

    /* ------------------------------------------------------------
       Focus
       ------------------------------------------------------------ */

    --cb-focus-ring:
        0 0 0 3px rgba(37, 137, 216, 0.24);
}


/* ================================================================
   2. RESET / DOCUMENT FOUNDATION
   ================================================================ */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;

    background: var(--cb-page-bg);
    color: var(--cb-text);

    font-family: var(--cb-font-sans);
    font-size: var(--cb-font-size-md);
    line-height: var(--cb-line-normal);

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
svg,
video,
canvas {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

button,
input,
select,
textarea {
    margin: 0;
    font: inherit;
}

button,
select {
    text-transform: none;
}

button,
[type="button"],
[type="submit"],
[type="reset"] {
    cursor: pointer;
}

a {
    color: var(--cb-brand-blue-deep);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

a:hover {
    color: var(--cb-brand-navy);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid transparent;
    box-shadow: var(--cb-focus-ring);
}

::selection {
    background: var(--cb-brand-blue);
    color: var(--cb-white);
}


/* ================================================================
   3. TYPOGRAPHY
   ================================================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    margin-bottom: var(--cb-space-4);

    color: var(--cb-brand-navy);

    font-weight: 700;
    line-height: var(--cb-line-tight);
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
    font-size: clamp(1.625rem, 4vw, 2.25rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

h4 {
    font-size: var(--cb-font-size-lg);
}

p {
    margin-top: 0;
    margin-bottom: var(--cb-space-4);
}

small {
    font-size: var(--cb-font-size-sm);
}

strong {
    font-weight: 700;
}

code,
pre,
kbd,
samp {
    font-family: var(--cb-font-mono);
}

.cb-text-secondary {
    color: var(--cb-text-secondary);
}

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

.cb-text-success {
    color: var(--cb-success-deep);
}

.cb-text-danger {
    color: var(--cb-danger-deep);
}

.cb-text-warning {
    color: var(--cb-warning-deep);
}


/* ================================================================
   4. ACCESSIBILITY
   ================================================================ */

.cb-sr-only {
    position: absolute !important;

    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;

    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;

    border: 0 !important;
}

.cb-skip-link {
    position: fixed;
    z-index: 10000;

    top: var(--cb-space-3);
    left: var(--cb-space-3);

    padding: var(--cb-space-3) var(--cb-space-4);

    background: var(--cb-brand-navy);
    color: var(--cb-white);

    border-radius: var(--cb-radius-md);

    transform: translateY(-200%);
}

.cb-skip-link:focus {
    transform: translateY(0);
}


/* ================================================================
   5. LAYOUT
   ================================================================ */

.cb-container {
    width: min(
        calc(100% - (var(--cb-space-6) * 2)),
        var(--cb-container)
    );

    margin-inline: auto;
}

.cb-content {
    width: min(100%, var(--cb-content));
    margin-inline: auto;
}

.cb-page {
    min-height: 100vh;
}

.cb-main {
    padding-block: var(--cb-space-8);
}

.cb-section {
    padding-block: var(--cb-space-12);
}

.cb-stack {
    display: flex;
    flex-direction: column;
    gap: var(--cb-space-4);
}

.cb-row {
    display: flex;
    align-items: center;
    gap: var(--cb-space-4);
}

.cb-wrap {
    flex-wrap: wrap;
}

.cb-between {
    justify-content: space-between;
}

.cb-grid {
    display: grid;
    gap: var(--cb-space-6);
}

.cb-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cb-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cb-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}


/* ================================================================
   6. HEADER / APPLICATION NAVIGATION
   ================================================================ */

.cb-header {
    position: sticky;
    z-index: 100;

    top: 0;

    min-height: var(--cb-header-height);

    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--cb-border-light);

    backdrop-filter: blur(10px);
}

.cb-header-inner {
    min-height: var(--cb-header-height);

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: var(--cb-space-6);
}

.cb-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--cb-space-3);

    color: var(--cb-text);
    text-decoration: none;
}

.cb-brand img {
    max-height: 2.5rem;
    width: auto;
}

.cb-nav {
    display: flex;
    align-items: center;
    gap: var(--cb-space-2);
}

.cb-nav a {
    padding: var(--cb-space-2) var(--cb-space-3);

    color: var(--cb-text-secondary);
    font-size: var(--cb-font-size-sm);
    font-weight: 600;

    text-decoration: none;

    border-radius: var(--cb-radius-md);
}

.cb-nav a:hover {
    background: var(--cb-gray-100);
    color: var(--cb-brand-navy);
}

.cb-nav a[aria-current="page"] {
    background: var(--cb-info-bg);
    color: var(--cb-brand-blue-deep);
}


/* ================================================================
   7. CARDS / PANELS
   ================================================================ */

.cb-card {
    background: var(--cb-surface);
    border: 1px solid var(--cb-border-light);
    border-radius: var(--cb-radius-lg);

    box-shadow: var(--cb-shadow-sm);
}

.cb-card-header,
.cb-card-body,
.cb-card-footer {
    padding: var(--cb-space-6);
}

.cb-card-header {
    border-bottom: 1px solid var(--cb-border-light);
}

.cb-card-footer {
    border-top: 1px solid var(--cb-border-light);
}

.cb-card-title {
    margin: 0;

    color: var(--cb-brand-navy);
    font-size: var(--cb-font-size-lg);
    font-weight: 700;
}


/* ================================================================
   8. BUTTONS
   ================================================================ */

.cb-btn {
    min-height: 2.75rem;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: var(--cb-space-2);

    padding: 0.625rem 1rem;

    border: 1px solid transparent;
    border-radius: var(--cb-radius-md);

    font-weight: 700;
    line-height: 1.2;

    text-decoration: none;

    transition:
        background-color var(--cb-transition-fast),
        border-color var(--cb-transition-fast),
        color var(--cb-transition-fast),
        box-shadow var(--cb-transition-fast),
        transform var(--cb-transition-fast);
}

.cb-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.cb-btn:disabled,
.cb-btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
}

.cb-btn-primary {
    background: var(--cb-brand-blue-deep);
    color: var(--cb-white);
}

.cb-btn-primary:hover:not(:disabled) {
    background: var(--cb-brand-navy);
    color: var(--cb-white);
}

.cb-btn-secondary {
    background: var(--cb-white);
    color: var(--cb-brand-navy);

    border-color: var(--cb-border);
}

.cb-btn-secondary:hover:not(:disabled) {
    background: var(--cb-gray-50);
    border-color: var(--cb-gray-400);
}

.cb-btn-success {
    background: var(--cb-success);
    color: var(--cb-white);
}

.cb-btn-success:hover:not(:disabled) {
    background: var(--cb-success-deep);
}

.cb-btn-danger {
    background: var(--cb-danger);
    color: var(--cb-white);
}

.cb-btn-danger:hover:not(:disabled) {
    background: var(--cb-danger-deep);
}

.cb-btn-sm {
    min-height: 2.25rem;
    padding: 0.45rem 0.75rem;

    font-size: var(--cb-font-size-sm);
}

.cb-btn-lg {
    min-height: 3.125rem;
    padding: 0.75rem 1.25rem;
}


/* ================================================================
   9. FORMS
   ================================================================ */

.cb-form-group {
    margin-bottom: var(--cb-space-5);
}

.cb-label {
    display: block;

    margin-bottom: var(--cb-space-2);

    color: var(--cb-gray-800);

    font-size: var(--cb-font-size-sm);
    font-weight: 700;
}

.cb-required {
    color: var(--cb-danger);
}

.cb-input,
.cb-select,
.cb-textarea {
    width: 100%;

    background: var(--cb-white);
    color: var(--cb-text);

    border: 1px solid var(--cb-gray-400);
    border-radius: var(--cb-radius-md);

    transition:
        border-color var(--cb-transition-fast),
        box-shadow var(--cb-transition-fast);
}

.cb-input,
.cb-select {
    min-height: 2.75rem;
    padding: 0.625rem 0.75rem;
}

.cb-textarea {
    min-height: 7.5rem;
    padding: 0.75rem;

    resize: vertical;
}

.cb-input:hover,
.cb-select:hover,
.cb-textarea:hover {
    border-color: var(--cb-gray-500);
}

.cb-input:focus,
.cb-select:focus,
.cb-textarea:focus {
    border-color: var(--cb-brand-blue);
    outline: none;
    box-shadow: var(--cb-focus-ring);
}

.cb-input::placeholder,
.cb-textarea::placeholder {
    color: var(--cb-gray-500);
}

.cb-input:disabled,
.cb-select:disabled,
.cb-textarea:disabled {
    cursor: not-allowed;

    background: var(--cb-gray-100);
    color: var(--cb-gray-500);
}

.cb-help {
    display: block;

    margin-top: var(--cb-space-2);

    color: var(--cb-text-secondary);

    font-size: var(--cb-font-size-sm);
}

.cb-field-error {
    display: block;

    margin-top: var(--cb-space-2);

    color: var(--cb-danger-deep);

    font-size: var(--cb-font-size-sm);
    font-weight: 600;
}

.cb-input[aria-invalid="true"],
.cb-select[aria-invalid="true"],
.cb-textarea[aria-invalid="true"] {
    border-color: var(--cb-danger);
}


/* ================================================================
   10. ALERTS
   ================================================================ */

.cb-alert {
    display: flex;
    gap: var(--cb-space-3);

    padding: var(--cb-space-4);

    border: 1px solid;
    border-radius: var(--cb-radius-md);

    line-height: var(--cb-line-normal);
}

.cb-alert-success {
    background: var(--cb-success-bg);
    border-color: var(--cb-success-border);
    color: var(--cb-success-deep);
}

.cb-alert-danger {
    background: var(--cb-danger-bg);
    border-color: var(--cb-danger-border);
    color: var(--cb-danger-deep);
}

.cb-alert-warning {
    background: var(--cb-warning-bg);
    border-color: var(--cb-warning-border);
    color: var(--cb-warning-deep);
}

.cb-alert-info {
    background: var(--cb-info-bg);
    border-color: var(--cb-info-border);
    color: var(--cb-brand-navy);
}


/* ================================================================
   11. STATUS BADGES
   ================================================================ */

.cb-badge {
    display: inline-flex;
    align-items: center;

    gap: var(--cb-space-1);

    padding: 0.3rem 0.55rem;

    border: 1px solid transparent;
    border-radius: var(--cb-radius-pill);

    font-size: var(--cb-font-size-xs);
    font-weight: 800;

    line-height: 1;
    letter-spacing: 0.02em;

    white-space: nowrap;
}

.cb-badge-valid,
.cb-badge-verified,
.cb-badge-active,
.cb-badge-success {
    background: var(--cb-success-bg);
    border-color: var(--cb-success-border);
    color: var(--cb-success-deep);
}

.cb-badge-pending,
.cb-badge-warning {
    background: var(--cb-warning-bg);
    border-color: var(--cb-warning-border);
    color: var(--cb-warning-deep);
}

.cb-badge-revoked,
.cb-badge-invalid,
.cb-badge-failed,
.cb-badge-danger {
    background: var(--cb-danger-bg);
    border-color: var(--cb-danger-border);
    color: var(--cb-danger-deep);
}

.cb-badge-neutral {
    background: var(--cb-gray-100);
    border-color: var(--cb-gray-300);
    color: var(--cb-gray-700);
}


/* ================================================================
   12. VERIFICATION RESULT
   ================================================================ */

.cb-verification {
    overflow: hidden;

    background: var(--cb-white);
    border: 1px solid var(--cb-border-light);
    border-radius: var(--cb-radius-xl);

    box-shadow: var(--cb-shadow-md);
}

.cb-verification-status {
    padding: var(--cb-space-8) var(--cb-space-6);

    text-align: center;

    border-bottom: 1px solid;
}

.cb-verification-status-valid {
    background: var(--cb-success-bg);
    border-color: var(--cb-success-border);
    color: var(--cb-success-deep);
}

.cb-verification-status-revoked,
.cb-verification-status-invalid {
    background: var(--cb-danger-bg);
    border-color: var(--cb-danger-border);
    color: var(--cb-danger-deep);
}

.cb-verification-status-pending {
    background: var(--cb-warning-bg);
    border-color: var(--cb-warning-border);
    color: var(--cb-warning-deep);
}

.cb-verification-icon {
    width: 4rem;
    height: 4rem;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin-bottom: var(--cb-space-4);

    border: 3px solid currentColor;
    border-radius: 50%;

    font-size: var(--cb-font-size-3xl);
    font-weight: 800;
}

.cb-verification-title {
    margin: 0;

    color: inherit;

    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 800;

    letter-spacing: 0.01em;
}

.cb-verification-body {
    padding: var(--cb-space-6);
}


/* ================================================================
   13. TABLES
   ================================================================ */

.cb-table-wrap {
    width: 100%;
    overflow-x: auto;

    background: var(--cb-white);

    border: 1px solid var(--cb-border-light);
    border-radius: var(--cb-radius-lg);

    -webkit-overflow-scrolling: touch;
}

.cb-table {
    width: 100%;
    min-width: 640px;

    border-collapse: collapse;
}

.cb-table th,
.cb-table td {
    padding: var(--cb-space-3) var(--cb-space-4);

    text-align: left;
    vertical-align: middle;

    border-bottom: 1px solid var(--cb-border-light);
}

.cb-table th {
    background: var(--cb-gray-50);
    color: var(--cb-gray-700);

    font-size: var(--cb-font-size-xs);
    font-weight: 800;

    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cb-table tbody tr:hover {
    background: var(--cb-gray-50);
}

.cb-table tbody tr:last-child td {
    border-bottom: 0;
}


/* ================================================================
   14. DESCRIPTION / DOCUMENT METADATA
   ================================================================ */

.cb-details {
    margin: 0;
}

.cb-details-row {
    display: grid;
    grid-template-columns: minmax(9rem, 0.35fr) 1fr;

    gap: var(--cb-space-4);

    padding-block: var(--cb-space-3);

    border-bottom: 1px solid var(--cb-border-light);
}

.cb-details-row:last-child {
    border-bottom: 0;
}

.cb-details dt {
    color: var(--cb-text-secondary);

    font-size: var(--cb-font-size-sm);
    font-weight: 600;
}

.cb-details dd {
    margin: 0;

    color: var(--cb-text);
    font-weight: 600;

    overflow-wrap: anywhere;
}


/* ================================================================
   15. AUTHENTICATION
   ================================================================ */

.cb-auth-page {
    min-height: 100vh;

    display: grid;
    place-items: center;

    padding: var(--cb-space-6);

    background:
        linear-gradient(
            180deg,
            var(--cb-gray-50) 0%,
            var(--cb-gray-100) 100%
        );
}

.cb-auth-card {
    width: min(100%, 28rem);

    padding: clamp(
        var(--cb-space-6),
        5vw,
        var(--cb-space-8)
    );

    background: var(--cb-white);

    border: 1px solid var(--cb-border-light);
    border-radius: var(--cb-radius-xl);

    box-shadow: var(--cb-shadow-lg);
}

.cb-auth-logo {
    max-width: 13rem;

    margin-inline: auto;
    margin-bottom: var(--cb-space-8);
}

.cb-auth-title {
    margin-bottom: var(--cb-space-2);

    text-align: center;
}

.cb-auth-subtitle {
    margin-bottom: var(--cb-space-8);

    color: var(--cb-text-secondary);
    text-align: center;
}


/* ================================================================
   16. EMPTY STATES
   ================================================================ */

.cb-empty {
    padding: var(--cb-space-12) var(--cb-space-6);

    text-align: center;

    background: var(--cb-white);

    border: 1px dashed var(--cb-gray-300);
    border-radius: var(--cb-radius-lg);
}

.cb-empty-title {
    margin-bottom: var(--cb-space-2);

    color: var(--cb-brand-navy);
}

.cb-empty-text {
    max-width: 32rem;

    margin-inline: auto;
    margin-bottom: var(--cb-space-6);

    color: var(--cb-text-secondary);
}


/* ================================================================
   17. PAGINATION
   ================================================================ */

.cb-pagination {
    display: flex;
    flex-wrap: wrap;

    gap: var(--cb-space-2);

    align-items: center;
}

.cb-page-link {
    min-width: 2.5rem;
    min-height: 2.5rem;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: var(--cb-space-2);

    background: var(--cb-white);
    color: var(--cb-gray-700);

    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-md);

    text-decoration: none;
}

.cb-page-link:hover {
    background: var(--cb-gray-50);
}

.cb-page-link[aria-current="page"] {
    background: var(--cb-brand-blue-deep);
    border-color: var(--cb-brand-blue-deep);
    color: var(--cb-white);
}


/* ================================================================
   18. MODALS
   ================================================================ */

.cb-modal-backdrop {
    position: fixed;
    z-index: 1000;

    inset: 0;

    display: grid;
    place-items: center;

    padding: var(--cb-space-4);

    background: rgba(23, 33, 43, 0.65);
}

.cb-modal {
    width: min(100%, 36rem);
    max-height: calc(100vh - (var(--cb-space-8) * 2));

    overflow-y: auto;

    background: var(--cb-white);

    border-radius: var(--cb-radius-xl);

    box-shadow: var(--cb-shadow-lg);
}

.cb-modal-header,
.cb-modal-body,
.cb-modal-footer {
    padding: var(--cb-space-6);
}

.cb-modal-header {
    border-bottom: 1px solid var(--cb-border-light);
}

.cb-modal-footer {
    display: flex;
    justify-content: flex-end;

    gap: var(--cb-space-3);

    border-top: 1px solid var(--cb-border-light);
}


/* ================================================================
   19. FOOTER
   ================================================================ */

.cb-footer {
    margin-top: auto;

    padding-block: var(--cb-space-8);

    background: var(--cb-white);

    border-top: 1px solid var(--cb-border-light);

    color: var(--cb-text-secondary);

    font-size: var(--cb-font-size-sm);
}


/* ================================================================
   20. UTILITIES
   Keep deliberately small. Avoid utility-class sprawl.
   ================================================================ */

.cb-hidden {
    display: none !important;
}

.cb-block {
    display: block !important;
}

.cb-w-full {
    width: 100% !important;
}

.cb-text-center {
    text-align: center !important;
}

.cb-text-right {
    text-align: right !important;
}

.cb-mt-0 {
    margin-top: 0 !important;
}

.cb-mb-0 {
    margin-bottom: 0 !important;
}

.cb-mt-4 {
    margin-top: var(--cb-space-4) !important;
}

.cb-mt-6 {
    margin-top: var(--cb-space-6) !important;
}

.cb-mb-4 {
    margin-bottom: var(--cb-space-4) !important;
}

.cb-mb-6 {
    margin-bottom: var(--cb-space-6) !important;
}


/* ================================================================
   21. RESPONSIVE: TABLET / SMALL DESKTOP
   ================================================================ */

@media (max-width: 900px) {

    .cb-grid-3,
    .cb-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cb-header-inner {
        gap: var(--cb-space-4);
    }

}


/* ================================================================
   22. RESPONSIVE: MOBILE
   ================================================================ */

@media (max-width: 640px) {

    :root {
        --cb-header-height: 3.75rem;
    }

    .cb-container {
        width: min(
            calc(100% - (var(--cb-space-4) * 2)),
            var(--cb-container)
        );
    }

    .cb-main {
        padding-block: var(--cb-space-6);
    }

    .cb-section {
        padding-block: var(--cb-space-8);
    }

    .cb-grid-2,
    .cb-grid-3,
    .cb-grid-4 {
        grid-template-columns: 1fr;
    }

    .cb-row.cb-mobile-stack {
        flex-direction: column;
        align-items: stretch;
    }

    .cb-header-inner {
        min-height: var(--cb-header-height);
    }

    .cb-brand img {
        max-height: 2.1rem;
    }

    /*
     * Full navigation should eventually be controlled by the
     * application menu component on mobile. Do not squeeze a large
     * desktop navigation horizontally.
     */
    .cb-nav-desktop {
        display: none;
    }

    .cb-card-header,
    .cb-card-body,
    .cb-card-footer {
        padding: var(--cb-space-4);
    }

    .cb-btn-mobile-full {
        width: 100%;
    }

    .cb-details-row {
        grid-template-columns: 1fr;
        gap: var(--cb-space-1);
    }

    .cb-verification-status {
        padding: var(--cb-space-6) var(--cb-space-4);
    }

    .cb-verification-body {
        padding: var(--cb-space-4);
    }

    .cb-verification-icon {
        width: 3.5rem;
        height: 3.5rem;
    }

    .cb-auth-page {
        padding: var(--cb-space-4);
    }

    .cb-auth-card {
        padding: var(--cb-space-6) var(--cb-space-4);
    }

    .cb-modal-backdrop {
        align-items: end;
        padding: 0;
    }

    .cb-modal {
        width: 100%;
        max-height: 92vh;

        border-radius:
            var(--cb-radius-xl)
            var(--cb-radius-xl)
            0
            0;
    }

    .cb-modal-header,
    .cb-modal-body,
    .cb-modal-footer {
        padding: var(--cb-space-4);
    }

    .cb-modal-footer {
        flex-direction: column-reverse;
    }

    .cb-modal-footer .cb-btn {
        width: 100%;
    }

}


/* ================================================================
   23. TOUCH DEVICES
   ================================================================ */

@media (pointer: coarse) {

    .cb-btn,
    .cb-input,
    .cb-select {
        min-height: 2.875rem;
    }

    .cb-page-link {
        min-width: 2.75rem;
        min-height: 2.75rem;
    }

}


/* ================================================================
   24. REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

}


/* ================================================================
   25. HIGH-CONTRAST / FORCED COLORS
   ================================================================ */

@media (forced-colors: active) {

    .cb-btn,
    .cb-card,
    .cb-alert,
    .cb-badge,
    .cb-input,
    .cb-select,
    .cb-textarea {
        border: 1px solid CanvasText;
    }

}


/* ================================================================
   26. PRINT
   ================================================================ */

@media print {

    body {
        background: var(--cb-white);
        color: #000000;
    }

    .cb-header,
    .cb-footer,
    .cb-no-print,
    .cb-btn {
        display: none !important;
    }

    .cb-card,
    .cb-verification,
    .cb-table-wrap {
        box-shadow: none;
    }

    .cb-container {
        width: 100%;
        max-width: none;
    }

}

/* ================================================================
   PUBLIC DOCUMENT VERIFICATION PAGE
   ================================================================ */

.cb-public-verification-page {
    min-height: 100vh;
    padding: var(--cb-space-6);
    background: var(--cb-gray-50);
}

.cb-public-verification-shell {
    width: min(100%, 80rem);
    margin-inline: auto;
}

.cb-public-issuer {
    margin-bottom: var(--cb-space-5);
    text-align: center;
}

.cb-public-issuer-label {
    margin-bottom: var(--cb-space-1);
    color: var(--cb-text-muted);
    font-size: var(--cb-font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.cb-public-issuer-name {
    color: var(--cb-text);
    font-size: clamp(1.35rem, 3vw, 2rem);
    font-weight: 800;
}

.cb-public-verification-lead {
    font-size: var(--cb-font-size-lg);
}

.cb-public-record-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--cb-space-4);
    margin-top: var(--cb-space-6);
}

.cb-public-record-details > div {
    padding: var(--cb-space-4);
    background: var(--cb-gray-50);
    border: 1px solid var(--cb-border-light);
    border-radius: var(--cb-radius-lg);
}

.cb-public-record-details span,
.cb-public-record-details strong {
    display: block;
}

.cb-public-record-details span {
    margin-bottom: var(--cb-space-1);
    color: var(--cb-text-muted);
    font-size: var(--cb-font-size-sm);
}

.cb-public-document {
    margin-top: var(--cb-space-6);
    padding: var(--cb-space-6);
    background: var(--cb-white);
    border: 1px solid var(--cb-border-light);
    border-radius: var(--cb-radius-xl);
    box-shadow: var(--cb-shadow-md);
}

.cb-public-document-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--cb-space-6);
    margin-bottom: var(--cb-space-5);
}

.cb-public-document-header h2 {
    margin-bottom: var(--cb-space-1);
}

.cb-public-document-header p {
    margin-bottom: 0;
    color: var(--cb-text-muted);
}

.cb-public-document-viewer {
    display: block;
    width: 100%;
    height: 78vh;
    min-height: 40rem;
    border: 1px solid var(--cb-border-light);
    border-radius: var(--cb-radius-lg);
    background: var(--cb-gray-100);
}

.cb-public-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--cb-space-3);
    padding: var(--cb-space-6);
    color: var(--cb-text-muted);
    font-size: var(--cb-font-size-sm);
}

.cb-public-trust img {
    display: block;
    width: auto;
    max-width: 9rem;
    max-height: 2.5rem;
}

@media (max-width: 48rem) {
    .cb-public-verification-page {
        padding: var(--cb-space-4);
    }

    .cb-public-record-details {
        grid-template-columns: 1fr;
    }

    .cb-public-document {
        padding: var(--cb-space-4);
    }

    .cb-public-document-header {
        align-items: stretch;
        flex-direction: column;
    }

    .cb-public-document-viewer {
        height: 70vh;
        min-height: 28rem;
    }
}


/* Public verification platform branding */

.cb-public-platform-brand {
    display: flex;
    align-items: center;
    min-height: 3rem;
    margin-bottom: var(--cb-space-4);
}

.cb-public-platform-brand img {
    display: block;
    width: auto;
    max-width: 9rem;
    max-height: 3rem;
}

@media (max-width: 48rem) {
    .cb-public-platform-brand img {
        max-width: 7.5rem;
        max-height: 2.5rem;
    }
}


/* CheqBrand letterhead sizing override */

.cb-public-platform-brand {
    min-height: 0;
    margin-bottom: var(--cb-space-5);
}

.cb-public-platform-brand img {
    width: 11rem;
    max-width: 35vw;
    height: auto;
    max-height: none;
}

@media (max-width: 48rem) {
    .cb-public-platform-brand img {
        width: 9rem;
        max-width: 45vw;
        height: auto;
        max-height: none;
    }
}


/* ================================================================
   PUBLIC VERIFICATION — FINAL PLATFORM ATTRIBUTION
   ================================================================ */

/*
 * CheqBrand is deliberately secondary to the issuer and document.
 * Platform attribution appears only after the registered document.
 */

.cb-powered-by {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: var(--cb-space-2);

    padding: var(--cb-space-6) var(--cb-space-4);

    text-align: center;
}

.cb-powered-by-label {
    color: var(--cb-text-muted);
    font-size: var(--cb-font-size-sm);
    font-weight: 500;
}

.cb-powered-by-logo {
    display: block;

    width: auto;
    height: 2rem;
    max-width: 10rem;
}

.cb-powered-by-link {
    color: var(--cb-text-muted);
    font-size: var(--cb-font-size-sm);
    text-align: center;
}


/* Public verification — powered-by logo visual sizing */
.cb-powered-by-logo {
    width: 10rem;
    height: auto;
    max-width: 40vw;
}


/* Public verification — tightly cropped horizontal CheqBrand mark */
.cb-powered-by-logo {
    width: 10rem;
    height: auto;
    max-width: 55vw;
}

/* Public verification — crop transparent square around horizontal logo */
.cb-powered-by-logo-crop {
    position: relative;
    width: 11rem;
    max-width: 60vw;
    height: 3rem;
    overflow: hidden;
}

.cb-powered-by-logo-crop .cb-powered-by-logo {
    position: absolute;
    width: 11rem;
    max-width: none;
    height: 11rem;

    left: 50%;
    top: 50%;

    transform: translate(-50%, -50%);
}
