/**
 * Optimized Global Design System & Component Stylesheet
 * Consolidating workspace layout architectures, application workflows, 
 * identity verification templates, and scanner micro-viewports.
 */

/* ==========================================================================
   1. Design Tokens & Root Variables
   ========================================================================== */
:root {
    /* Brand Colors (Classic Navy & Corporate Tech) */
    --brand: #0f2b46;
    --brand-light: #163a5f;
    --accent: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.15);
    
    /* Emerald & Gold Theme Tokens (Identity Cards) */
    --emerald-dark: #0f3d2a;
    --emerald-mid: #165239;
    --emerald-light: #236c4d;
    --gold-accent: #b08d44;
    
    /* Surface Elements */
    --bg-main: #f8fafc;
    --surface: #ffffff;
    --surface-soft: #f1f5f9;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    
    /* Typography Hierarchy */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    
    /* Status & Alerts System */
    --success: #15803d;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --warn: #795b00;
    --warn-bg: #fff4d6;
    --warn-border: rgba(121, 91, 0, 0.15);

    /* Layout & Elevation Concrete Details */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    
    /* Animation Curve Definitions */
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   2. Base Structural Rules & Global Defaults
   ========================================================================== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ==========================================================================
   3. Header, Navigation & Footers
   ========================================================================== */
.site-header, header {
    background: var(--brand);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    padding: 0 32px;
}

.header-content {
    max-width: 1440px;
    margin: 0 auto;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 20px;
}

.brand h1, h1 {
    margin: 0;
    color: var(--text-inverse);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.brand p {
    margin: 2px 0 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.main-nav, nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.main-nav .link, nav .link {
    color: rgba(255, 255, 255, 0.75);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.main-nav .link:hover,
.main-nav .link:focus-visible,
nav .link:hover {
    color: var(--text-inverse);
    background: rgba(255, 255, 255, 0.08);
    opacity: 1;
}

.site-footer, footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    padding: 24px 32px;
    display: flex;
    justify-content: center;
    gap: 32px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

/* ==========================================================================
   4. Grid Core Architectures & Layout Scaffolding
   ========================================================================== */
.page-container, main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 40px 32px;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(360px, 0.9fr);
    gap: 32px;
    align-items: start;
}

.two, .grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.three-columns, .module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.four-columns, .steps, .stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.row > *:first-child {
    flex: 1;
}

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

/* ==========================================================================
   5. Card Components & Content Containers
   ========================================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition), transform var(--transition);
    margin-bottom: 24px;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.module-card {
    display: block;
    text-decoration: none;
    color: var(--text-main);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.module-card h2 {
    margin: 14px 0 8px;
}

.module-card p {
    min-height: 70px;
    color: var(--text-muted);
    margin: 0 0 12px;
}

.module-card b {
    color: var(--brand-light);
}

.module-icon {
    display: inline-flex;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: var(--text-inverse);
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.data-card, .qr-card {
    padding: 32px;
}

.qr-card {
    position: sticky;
    top: 104px;
}

/* ==========================================================================
   6. Typography Layouts & Structural Badges
   ========================================================================== */
.app-toolbar {
    margin-bottom: 32px;
    padding: 24px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-toolbar h2, h2 {
    margin: 0;
    color: var(--brand);
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.section-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
}

.section-icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    font-size: 18px;
    color: var(--brand-light);
}

.section-header h2 {
    margin: 0 0 4px;
    color: var(--text-main);
    font-size: 20px;
}

.section-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

/* Statistics Configurations */
.stat {
    background: var(--surface);
    padding: 22px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.stat b {
    display: block;
    font-size: 30px;
    color: var(--brand);
    letter-spacing: -0.03em;
}

.stat span {
    color: var(--text-muted);
    font-size: 14px;
}

/* Step Guides */
.steps div {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--surface-soft);
    padding: 16px;
    border-radius: var(--radius-sm);
}

.steps b {
    display: flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    color: var(--text-inverse);
    flex-shrink: 0;
}

.steps span {
    font-weight: 700;
    font-size: 14px;
}

/* ==========================================================================
   7. Forms, Data Inputs & Structural Controls
   ========================================================================== */
.form-group, .token-section {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
}

.required {
    color: var(--danger);
    margin-left: 2px;
}

input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

input:hover, select:hover, textarea:hover {
    border-color: var(--border-hover);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

input:invalid:not(:placeholder-shown) {
    border-color: var(--danger);
    background-color: #fffafb;
}

input[type="file"] {
    padding: 8px;
    background: var(--surface-soft);
    border: 1px dashed var(--border);
}

input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.token-section textarea {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
    background: var(--bg-main);
}

.field-help {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfe;
    margin: 0 0 28px;
    padding: 24px;
}

legend {
    padding: 0 10px;
    color: var(--brand);
    font-weight: 600;
    font-size: 14px;
}

.legend-number {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--text-inverse);
    font-size: 11px;
    font-weight: 600;
}

.input-with-unit {
    position: relative;
}

.input-with-unit input {
    padding-right: 55px;
}

.input-with-unit span {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

/* Coordinate Framework Tables & Containers */
.boundary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--surface-soft);
}

.boundary-header h3 {
    margin: 0 0 2px;
    color: var(--brand);
    font-size: 15px;
    font-weight: 600;
}

.point-counter {
    min-width: 80px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-align: center;
}

.point-counter strong {
    display: block;
    color: var(--brand-light);
    font-size: 16px;
}

.point-counter span {
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
}

.coordinate-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 1px solid var(--border);
    border-top: 0;
    background: #f4f7fa;
    color: var(--text-muted);
    font-size: 13px;
}

.coordinates-container {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-top: 0;
    background: var(--surface);
}

.coordinate-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr) 40px;
    gap: 16px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

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

.coordinate-row .form-group {
    margin-bottom: 0;
}

.point-number {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-soft);
    color: var(--brand-light);
    font-size: 12px;
    font-weight: 600;
}

/* ==========================================================================
   8. Button Engines & User Actions
   ========================================================================== */
button {
    border: 0;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

button:active {
    transform: scale(0.98);
}

.primary-btn, .generate-btn {
    width: 100%;
    padding: 12px 18px;
    background: var(--brand-light);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.primary-btn:hover, .generate-btn:hover {
    background: var(--brand);
}

.secondary-btn {
    padding: 10px 16px;
    background: var(--surface);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.secondary-btn:hover {
    background: var(--surface-soft);
    border-color: var(--border-hover);
}

.remove-point-btn {
    width: 36px;
    height: 36px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
}

.remove-point-btn:hover {
    background: #fee2e2;
}

.add-point-btn {
    margin-top: 16px;
    padding: 10px 18px;
    border: 1px dashed var(--success-border);
    background: var(--success-bg);
    color: var(--success);
}

.add-point-btn:hover {
    background: #dcfce7;
}

.reset-btn {
    padding: 12px 18px;
    background: var(--surface-soft);
    color: var(--text-muted);
}

.reset-btn:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

.form-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    margin-top: 16px;
}

/* ==========================================================================
   9. Identity Cards & Landscape Templates
   ========================================================================== */
.land-card-container {
    width: 850px;
    height: 540px;
    background: radial-gradient(circle at bottom, #f7f9f6 40%, #ffffff 80%);
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    position: relative;
    overflow: hidden;
    border: 1px solid #dcdcdc;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 25px 0 5px 0;
    background: var(--emerald-dark);
}

.header-logo-wrap {
    position: absolute;
    left: 40px;
    top: 20px;
}

.header-logo {
    width: 70px;
    height: 70px;
    border: 2px solid var(--emerald-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.header-title-block h1 {
    font-size: 36px;
    color: #ffffff;
    margin: 0;
    letter-spacing: 4px;
    font-weight: 800;
}

.header-subtitle {
    font-size: 14px;
    color: var(--gold-accent);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 3px;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-subtitle::before,
.header-subtitle::after {
    content: "";
    display: inline-block;
    width: 60px;
    height: 2px;
    background-color: var(--gold-accent);
}

.card-body-grid {
    display: grid;
    grid-template-columns: 240px 1fr 240px;
    padding: 20px 40px;
    height: calc(100% - 160px);
    position: relative;
    z-index: 2;
}

.profile-column {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-frame {
    width: 180px;
    height: 210px;
    border: 2px solid #333;
    border-radius: 16px;
    overflow: hidden;
    background: #e3e3e3;
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.label-badge {
    background-color: var(--emerald-dark);
    color: #fff;
    width: 190px;
    text-align: center;
    padding: 8px 0;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    border-radius: 20px;
    margin-top: -15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 3;
    position: relative;
}

.owner-details-text {
    text-align: center;
    margin-top: 15px;
}

.owner-name-val {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0;
}

.parent-relation-lbl {
    font-size: 12px;
    color: #666;
    margin: 2px 0 0 0;
}

.data-table-column {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 235px;
}

.data-row {
    display: flex;
    font-size: 15px;
    line-height: 22px;
}

.data-label {
    width: 120px;
    font-weight: 600;
    color: #444;
}

.data-separator {
    width: 25px;
    font-weight: bold;
    color: #444;
}

.data-value {
    font-weight: bold;
    color: var(--text-main);
    flex: 1;
}

.verification-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.qr-outer-frame {
    border: 2px solid #333;
    padding: 12px;
    border-radius: 16px;
    background: #fff;
    display: inline-block;
}

.scan-action-banner {
    background-color: var(--emerald-dark);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 8px 16px;
    border-radius: 6px;
    margin-top: 15px;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.card-footer-landscape {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 95px;
    background: linear-gradient(to top, #113f2a 0%, #1c5e40 40%, rgba(255, 255, 255, 0) 100%);
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 12px;
}

/* ==========================================================================
   10. System Alerts, Status Indicators & Tables
   ========================================================================== */
.status, .notice {
    padding: 12px 16px;
    margin: 14px 0;
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    min-height: 20px;
    font-size: 14px;
    font-weight: 500;
}

.status.ok {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.status.bad {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.status.warn {
    background: var(--warn-bg);
    color: var(--warn);
    border: 1px solid var(--warn-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th, td {
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
}

th {
    background: var(--surface-soft);
    font-weight: 600;
    color: var(--text-muted);
}

tr {
    border-bottom: 1px solid var(--border);
}

tr:last-child {
    border-bottom: none;
}

tr:nth-child(even) {
    background: var(--bg-main);
}

/* QR Code Canvas Layouts */
#qrcode, #reader {
    margin: 20px auto;
    width: 256px;
}

.qrcode img {
    display: block;
    max-width: 100%;
    border: 12px solid var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 0.8s ease-in-out infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   11. Technical Code Representation Blocks
   ========================================================================== */
pre, .result {
    white-space: pre-wrap;
    word-break: break-all;
    background: #0f1d26;
    color: #d7f5ff;
    padding: 16px;
    border-radius: 10px;
    min-height: 80px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
}

.result dl {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 8px;
    margin: 0;
}

.result dt {
    font-weight: 800;
    color: #b6d8e5;
}

.result dd {
    margin: 0;
    color: #fff;
}

/* ==========================================================================
   12. Responsive Design Framework
   ========================================================================== */
@media (max-width: 1150px) {
    .workspace-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .qr-card {
        position: static;
    }
}

@media (max-width: 900px) {
    .header-content {
        min-height: auto;
        padding: 16px 24px;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .main-nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .page-container, main {
        padding: 24px 20px;
    }
    .three-columns, .module-grid {
        grid-template-columns: 1fr;
    }
    .four-columns, .steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .two, .grid {
        grid-template-columns: 1fr;
    }
    .four-columns, .steps, .stats {
        grid-template-columns: 1fr;
    }
    .coordinate-row {
        grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr) 36px;
        gap: 10px;
        padding: 12px 14px;
    }
}

@media (max-width: 600px) {
    .coordinate-row {
        grid-template-columns: 32px 1fr;
        align-items: start;
    }
    .coordinate-row .form-group:nth-child(2),
    .coordinate-row .form-group:nth-child(3) {
        grid-column: 2;
    }
    .remove-point-btn {
        grid-column: 2;
        margin-top: 4px;
    }
    .boundary-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }
    .result dl {
        grid-template-columns: 1fr;
    }
    .result dt {
        margin-top: 6px;
    }
}

/* Handheld QR Scanner & Receipt Micro-Viewport Optimizations */
@media (max-width: 480px) {
    main, .page-container {
        margin: 10px auto;
        padding: 0 8px;
    }
    .card, .stat, .module-card {
        padding: 16px !important;
        margin-bottom: 12px;
        border-radius: 12px;
    }
    .stat b {
        font-size: 24px;
    }
    .result dt {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-top: 8px;
    }
    .result dd {
        font-size: 13px;
        padding-left: 4px;
        border-left: 2px solid var(--accent);
    }
    #qrcode, #reader {
        width: 100% !important;
        max-width: 280px !important;
        margin: 10px auto !important;
    }
    input, select, textarea, button {
        padding: 14px 12px !important;
        font-size: 16px !important;
    }
    header, .site-header {
        padding: 16px;
        text-align: center;
    }
    .brand {
        flex-direction: column;
    }
}

/* ==========================================================================
   13. High-Fidelity Print Engine
   ========================================================================== */
@media print {
    body * {
        visibility: hidden;
    }
    #qrcode, #qrcode * {
        visibility: visible;
    }
    #qrcode {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        display: flex;
        justify-content: center;
    }
}


/* ==========================================================================
   14. Professional Enterprise UI Refinements
   --------------------------------------------------------------------------
   Visual-only refinement layer. Existing component names and functionality
   are preserved so HTML/JS/PHP integrations do not need to change.
   ========================================================================== */

:root {
    --brand-deep: #0b1f33;
    --brand-hover: #123c61;
    --accent-hover: #1d4ed8;
    --focus-ring: rgba(37, 99, 235, 0.18);
    --surface-elevated: #ffffff;
    --surface-muted: #f8fafc;
    --text-heading: #ebedef;
    --text-body: #334155;
    --border-strong: #d5dee8;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow-card: 0 1px 2px rgba(15, 23, 42, .04),
                   0 8px 24px rgba(15, 23, 42, .06);
    --shadow-card-hover: 0 2px 4px rgba(15, 23, 42, .05),
                          0 14px 32px rgba(15, 23, 42, .09);
}

body {
    color: var(--text-body);
    background:
        radial-gradient(circle at 50% -10%, rgba(37, 99, 235, .035), transparent 35%),
        var(--bg-main);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    line-height: 1.25;
}

h2 {
    font-weight: 650;
}

a {
    transition: color var(--transition), background-color var(--transition),
                border-color var(--transition), opacity var(--transition);
}

/* Header */
.site-header,
header {
    background: linear-gradient(135deg, var(--brand-deep), var(--brand));
    border-bottom-color: rgba(255, 255, 255, .10);
    box-shadow: 0 4px 18px rgba(11, 31, 51, .12);
}

.header-content {
    min-height: 70px;
}

.brand-icon {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .15);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

.brand h1 {
    font-weight: 650;
}

.main-nav .link,
nav .link {
    position: relative;
    border: 1px solid transparent;
}

.main-nav .link:hover,
.main-nav .link:focus-visible,
nav .link:hover,
nav .link:focus-visible {
    background: rgba(255,255,255,.09);
    border-color: rgba(255,255,255,.10);
}

/* Main content */
.page-container,
main {
    padding-top: 36px;
    padding-bottom: 48px;
}

/* Cards */
.card,
.module-card,
.stat {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card);
}

.card {
    border-radius: var(--radius-lg);
}

.card:hover,
.module-card:hover {
    box-shadow: var(--shadow-card-hover);
}

.module-card {
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    opacity: 0;
    transition: opacity var(--transition);
}

.module-card:hover::before,
.module-card:focus-visible::before {
    opacity: 1;
}

.module-card h2 {
    color: var(--text-heading);
    font-weight: 650;
}

.module-card p {
    color: var(--text-muted);
}

/* Toolbar / section hierarchy */
.app-toolbar {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,.86);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.eyebrow {
    font-size: 10px;
    letter-spacing: .12em;
}

.section-header {
    margin-bottom: 22px;
}

.section-icon {
    border: 1px solid var(--border);
    background: linear-gradient(145deg, #f8fafc, #eef3f8);
}

/* Stats */
.stat {
    border-radius: var(--radius-lg);
    background: var(--surface-elevated);
}

.stat b {
    font-weight: 700;
}

/* Forms */
.form-group,
.token-section {
    margin-bottom: 18px;
}

label {
    letter-spacing: .01em;
}

input,
select,
textarea {
    min-height: 42px;
    border-color: var(--border-strong);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .025);
}

input:hover,
select:hover,
textarea:hover {
    border-color: #b9c7d6;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--focus-ring),
                inset 0 1px 2px rgba(15, 23, 42, .025);
}

fieldset {
    border-color: var(--border-strong);
    background: rgba(248,250,252,.72);
    border-radius: var(--radius-lg);
}

input[type="file"] {
    border-color: #c7d3df;
    background: var(--surface-muted);
}

/* Buttons */
button {
    min-height: 40px;
    letter-spacing: .005em;
}

.primary-btn,
.generate-btn {
    background: linear-gradient(135deg, var(--brand-light), var(--brand));
    box-shadow: 0 3px 8px rgba(15, 43, 70, .16);
}

.primary-btn:hover,
.generate-btn:hover {
    background: linear-gradient(135deg, var(--brand-hover), var(--brand-deep));
    box-shadow: 0 5px 12px rgba(15, 43, 70, .20);
}

.secondary-btn {
    box-shadow: var(--shadow-sm);
}

.secondary-btn:hover {
    box-shadow: 0 2px 6px rgba(15, 23, 42, .06);
}

.reset-btn {
    border: 1px solid var(--border);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Tables */
table {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

th {
    background: #f6f8fb;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .045em;
}

th,
td {
    padding: 13px 16px;
}

tr:hover {
    background: #f8fbff;
}

/* Status / notices */
.status,
.notice {
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .025);
}

/* Technical output */
pre,
.result {
    border: 1px solid #1c3444;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.18);
}

/* QR / scanner */
#qrcode,
#reader {
    border-radius: var(--radius-lg);
}

.qrcode img {
    border: 10px solid #fff;
    box-shadow: 0 8px 24px rgba(15,23,42,.10);
}

/* Identity card: refine without changing its dimensions */
.land-card-container {
    box-shadow: 0 20px 45px rgba(15, 23, 42, .16);
    border-color: #d2d9df;
}

.photo-frame,
.qr-outer-frame {
    border-color: #b8c2cc;
    box-shadow: 0 3px 10px rgba(15,23,42,.07);
}

/* Footer */
.site-footer,
footer {
    background: #fff;
    border-top-color: var(--border);
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Small-screen refinements */
@media (max-width: 768px) {
    .app-toolbar {
        padding: 20px;
    }

    .page-container,
    main {
        padding-top: 24px;
        padding-bottom: 32px;
    }

    .card {
        padding: 20px;
    }
}
