/* ============================================================
   e4473 — 2nd Amendment Zone — Professional UI
   ============================================================ */

/* --- Reset & Base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #1e293b;
    background: #f1f5f9;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1.5rem 0;
}

code {
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.875em;
    background: #f1f5f9;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: #334155;
}

/* --- Utility Classes --------------------------------------- */
.hidden { display: none !important; }
.error { color: #dc2626; font-size: 0.875rem; margin-top: 0.5rem; }
.success { color: #16a34a; font-size: 0.875rem; margin-top: 0.5rem; }
.text-muted { color: #64748b; }
.text-center { text-align: center; }
.text-danger { color: #dc2626; font-weight: 600; }
.text-success { color: #16a34a; font-weight: 600; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* --- Header ------------------------------------------------ */
#app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #0f172a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 52px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3),
                0 4px 12px rgba(0, 0, 0, 0.15);
}

#app-header .header-left h1 {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

#app-header .header-left h1 a {
    color: #fff;
    text-decoration: none;
}

#app-header .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-name {
    font-size: 0.8125rem;
    color: #94a3b8;
    font-weight: 500;
}

/* --- Buttons ----------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 38px;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
.btn-primary:active:not(:disabled) { background: #1e40af; }

.btn-secondary {
    background: #fff;
    color: #334155;
    border-color: #cbd5e1;
}
.btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-success {
    background: #16a34a;
    color: #fff;
}
.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-outline {
    background: transparent;
    color: #2563eb;
    border-color: #2563eb;
}
.btn-outline:hover:not(:disabled) {
    background: #eff6ff;
}

.btn-full { width: 100%; }

.btn-large {
    min-height: 48px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-xl {
    min-height: 56px;
    padding: 0.875rem 2rem;
    font-size: 1.125rem;
    border-radius: 8px;
}

.btn-text {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    min-height: 32px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    font-family: inherit;
}
.btn-text:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* btn-text outside header context */
.form-list-page .btn-text,
.data-table .btn-text,
.pagination .btn-text {
    color: #2563eb;
}
.form-list-page .btn-text:hover,
.data-table .btn-text:hover,
.pagination .btn-text:hover {
    color: #1d4ed8;
    background: #eff6ff;
}

.btn-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* --- Forms & Inputs ---------------------------------------- */
.form-group {
    margin-bottom: 1rem;
    flex: 1;
    min-width: 0;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.35rem;
    letter-spacing: 0.01em;
}

.form-group-small { flex: 0 0 120px; }
.form-group-wide { flex: 2; }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #1e293b;
    min-height: 38px;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input[readonly],
input:disabled,
select:disabled {
    background: #f8fafc;
    color: #64748b;
    border-color: #e2e8f0;
    cursor: default;
}

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

.input-large {
    font-size: 1rem;
    padding: 0.625rem 1rem;
    min-height: 44px;
}

.input-filter {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #1e293b;
    min-height: 38px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input-filter:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Form Grid Layout */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-note {
    font-size: 0.8125rem;
    color: #64748b;
    margin-bottom: 1rem;
    font-style: italic;
}

/* Checkbox & Radio */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: #334155;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
    cursor: pointer;
    min-height: unset;
}

/* --- Login ------------------------------------------------- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.login-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04),
                0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
}

.login-box h1 {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    color: #0f172a;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.login-box h2 {
    font-size: 0.875rem;
    font-weight: 400;
    text-align: center;
    color: #64748b;
    margin-bottom: 2rem;
}

.login-box .form-group { margin-bottom: 1rem; }
.login-box .btn-primary { margin-top: 0.5rem; }

.login-box .error {
    text-align: center;
    margin-top: 1rem;
}

/* --- Form List Page ---------------------------------------- */
.form-list-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.list-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.list-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.list-filters input[type="text"],
.list-filters .input-filter {
    flex: 1;
    min-width: 180px;
}

.list-filters select.input-filter { flex: 0 0 auto; min-width: 160px; }

/* --- Status Badges ----------------------------------------- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-draft,
.badge-DRAFT             { background: #fef9c3; color: #a16207; }
.badge-in_progress,
.badge-IN_PROGRESS       { background: #dbeafe; color: #1d4ed8; }
.badge-active            { background: #dbeafe; color: #1d4ed8; }
.badge-completed,
.badge-COMPLETED         { background: #dcfce7; color: #15803d; }
.badge-stopped_eligibility,
.badge-STOPPED_ELIGIBILITY,
.badge-stopped           { background: #fee2e2; color: #dc2626; }
.badge-cancelled,
.badge-CANCELLED         { background: #f1f5f9; color: #64748b; }

/* --- Data Tables ------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06),
                0 1px 2px rgba(0, 0, 0, 0.04);
}

table { width: 100%; border-collapse: collapse; }

th {
    background: #f8fafc;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
    vertical-align: middle;
    color: #334155;
}

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

tbody tr {
    transition: background 0.1s;
}
tbody tr:hover td { background: #f8fafc; }
tbody tr:nth-child(even) td { background: #fafbfc; }
tbody tr:nth-child(even):hover td { background: #f1f5f9; }

td code {
    font-weight: 600;
    color: #0f172a;
}

.table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06),
                0 1px 2px rgba(0, 0, 0, 0.04);
    overflow-x: auto;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    color: #64748b;
    border-top: 1px solid #f1f5f9;
}

/* --- Wizard ------------------------------------------------ */
.wizard {
    max-width: 880px;
    margin: 0 auto;
    padding: 1.5rem;
}

.wizard-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.txn-number {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

.wizard-container {
    max-width: 880px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Step Indicator */
.wizard-steps {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
    gap: 0;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    flex: 0 0 auto;
    padding: 0.5rem 0;
}

.step-divider {
    flex: 1;
    height: 2px;
    background: #e2e8f0;
    margin: 0 0.25rem;
    min-width: 20px;
    align-self: center;
}

.wizard-step.done + .step-divider {
    background: #2563eb;
}

/* The divider AFTER a done step should be blue */
.wizard-step.done ~ .step-divider {
    background: #2563eb;
}

/* But only up to the active step — reset dividers after active */
.wizard-step.active ~ .step-divider {
    background: #e2e8f0;
}

.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.wizard-step.active .step-num {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.wizard-step.done .step-num {
    background: #16a34a;
    color: #fff;
}

.step-label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
    white-space: nowrap;
}

.wizard-step.active .step-label {
    color: #2563eb;
    font-weight: 700;
}

.wizard-step.done .step-label { color: #16a34a; }

.wizard-step[style*="cursor"] .step-num:hover {
    transform: scale(1.1);
}

/* Wizard Body */
.wizard-body {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06),
                0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 0.5rem;
}

/* Step Content */
.step-content {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06),
                0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 2rem;
    margin-bottom: 1rem;
}

.step-content h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.step-content h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.step-content > p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

/* Lookup Row (Customer & Serial) */
.lookup-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    max-width: 500px;
}

.lookup-row input { flex: 1; }

/* Customer Found Card */
.customer-found {
    margin-top: 1rem;
}

.customer-found h3 {
    color: #16a34a;
    margin-bottom: 0.75rem;
}

.customer-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.customer-card p { color: #334155; font-size: 0.9rem; }

/* Info Toggle */
.info-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.info-toggle p {
    color: #475569;
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 0.5rem;
    margin-bottom: 0 !important;
}

/* --- Firearm Cards ----------------------------------------- */
#firearms-list {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

#firearms-list h3 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.firearm-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: border-color 0.15s;
}

.firearm-card:hover { border-color: #cbd5e1; }

.firearm-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.firearm-info strong { font-size: 0.9rem; color: #0f172a; }
.firearm-info span { font-size: 0.8125rem; color: #64748b; }

.firearm-card .btn-text.btn-danger {
    color: #dc2626;
    font-size: 0.8125rem;
}
.firearm-card .btn-text.btn-danger:hover {
    background: #fef2f2;
}

#btn-add-another {
    margin-top: 1rem;
}

/* --- Eligibility Questions --------------------------------- */
.eligibility-question {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.question-progress {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.5rem;
}

.question-number {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.question-text {
    font-size: 1.0625rem;
    color: #334155;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.question-note {
    font-size: 0.875rem;
    color: #d97706;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    text-align: left;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* YES/NO Answer Buttons */
.answer-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.btn-answer {
    min-width: 160px;
    min-height: 56px;
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.btn-answer-yes {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #86efac;
}
.btn-answer-yes:hover:not(:disabled) {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
}
.btn-answer-yes.selected {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}

.btn-answer-no {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fca5a5;
}
.btn-answer-no:hover:not(:disabled) {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.btn-answer-no.selected {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

/* Text answer */
.text-answer {
    display: flex;
    gap: 0.75rem;
    max-width: 500px;
    margin: 1.5rem auto 0;
}

/* Exception section */
#exception-section {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    text-align: left;
}

#exception-section p {
    font-size: 0.9rem;
    color: #92400e;
    margin-bottom: 0.75rem;
}

#exception-section select {
    margin-bottom: 0.75rem;
}

/* --- Hard Stop Banner -------------------------------------- */
.hard-stop-banner {
    background: #dc2626;
    color: #fff;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    margin-top: 1.5rem;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3);
}

.hard-stop-banner h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    color: #fff;
}

.hard-stop-banner p {
    font-size: 1rem;
    opacity: 0.95;
    line-height: 1.6;
    color: #fff;
}

.eligibility-stopped {
    text-align: center;
}

/* --- Review Step ------------------------------------------- */
.review-step {}

.review-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.review-section:last-child { border-bottom: none; padding-bottom: 0; }

.review-section h3 {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 1rem;
}

.review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.review-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.review-item span {
    font-size: 0.9rem;
    color: #1e293b;
    line-height: 1.5;
}

.review-firearm {
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.review-firearm strong {
    display: block;
    font-size: 0.9rem;
    color: #0f172a;
    margin-bottom: 0.15rem;
}

.review-firearm span {
    font-size: 0.8125rem;
    color: #64748b;
}

.review-actions {
    margin-top: 1rem;
}

.signature-options {
    padding: 1rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
}

/* --- Session PIN Display ----------------------------------- */
.session-pin-display {
    max-width: 880px;
    margin: 0.75rem auto 0;
    padding: 1rem 1.5rem;
    background: #eff6ff;
    border: 2px solid #93c5fd;
    border-radius: 10px;
    text-align: center;
    font-size: 1rem;
}

.session-pin-display strong {
    color: #1e40af;
}

.pin-code {
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.35em;
    color: #1d4ed8;
    display: inline-block;
    margin-left: 0.75rem;
    user-select: all;
}

/* --- Location Selection ------------------------------------ */
.wizard-location {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    gap: 2rem;
}

.wizard-location h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.location-buttons {
    display: flex;
    gap: 1.5rem;
}

.location-buttons .btn {
    min-width: 180px;
    min-height: 80px;
    font-size: 1.25rem;
    border-radius: 12px;
}

/* --- Signature Canvas -------------------------------------- */
.signature-container {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    background: #fafbfc;
    position: relative;
    overflow: hidden;
    transition: border-color 0.15s;
}

.signature-container:hover { border-color: #94a3b8; }

.signature-container canvas {
    display: block;
    touch-action: none;
}

.signature-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Customer mode signature */
.cm-signature-container {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    background: #fff;
    padding: 0.5rem;
    margin-bottom: 1.5rem;
}

.cm-signature-canvas {
    display: block;
    touch-action: none;
    width: 100%;
}

/* --- Alerts / Info ----------------------------------------- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
    border-left: 4px solid transparent;
}

.alert-info    { background: #eff6ff; color: #1e40af; border-left-color: #2563eb; }
.alert-warning { background: #fffbeb; color: #92400e; border-left-color: #f59e0b; }
.alert-danger,
.alert-error   { background: #fef2f2; color: #991b1b; border-left-color: #dc2626; }
.alert-success { background: #f0fdf4; color: #14532d; border-left-color: #16a34a; }

/* --- Cards ------------------------------------------------- */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06),
                0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #0f172a;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.75rem;
}

/* --- Lookup / Search --------------------------------------- */
.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.search-bar input { flex: 1; min-width: 200px; }

.result-row {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
}

.result-row:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.result-row .result-name { font-weight: 600; color: #0f172a; }
.result-row .result-detail { font-size: 0.8125rem; color: #64748b; }

/* --- Loading Spinner --------------------------------------- */
.spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.loading-center {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

/* ============================================================
   Customer Mode (Tablet — large touch targets)
   ============================================================ */
.customer-mode {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.customer-mode h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    margin-bottom: 0.5rem;
}

.customer-mode h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1rem;
}

.cm-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    text-align: center;
    gap: 1rem;
}

.cm-subtitle {
    font-size: 1.0625rem;
    color: #64748b;
    line-height: 1.7;
    max-width: 500px;
    margin: 0 auto 1rem;
}

/* PIN Input */
.cm-pin-input {
    width: 100%;
    max-width: 320px;
    font-size: 2.5rem;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0.5em;
    padding: 0.75rem 1rem;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    min-height: 72px;
    text-transform: uppercase;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cm-pin-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.cm-pin-input::placeholder {
    color: #cbd5e1;
    letter-spacing: 0.3em;
}

/* Customer Info Card */
.cm-info-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.cm-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.cm-info-row:last-child { border-bottom: none; }

.cm-info-row label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    min-width: 100px;
}

.cm-info-row span {
    font-size: 1rem;
    color: #1e293b;
    text-align: right;
}

/* Customer Question */
.cm-question {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 1.25rem;
}

.cm-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 500px;
    margin: 0 auto;
}

/* Customer Eligibility */
.cm-progress {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.5rem;
    text-align: center;
}

.cm-question-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    margin-bottom: 0.75rem;
}

.cm-question-text {
    font-size: 1.25rem;
    color: #334155;
    line-height: 1.7;
    text-align: center;
    margin-bottom: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cm-question-note {
    font-size: 0.9375rem;
    color: #d97706;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 0.875rem 1.25rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    text-align: left;
}

.cm-answer-buttons {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    margin-top: 1rem;
}

.cm-answer-buttons .btn {
    min-width: 180px;
    min-height: 64px;
    font-size: 1.5rem;
    font-weight: 800;
    border-radius: 12px;
    letter-spacing: 0.08em;
}

.cm-text-input {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 1rem;
    display: block;
    font-size: 1.25rem;
    padding: 0.875rem 1.25rem;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    min-height: 56px;
    text-align: center;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cm-text-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* Customer Hard Stop */
.cm-stop-banner {
    background: #dc2626;
    color: #fff;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    text-align: center;
    margin-top: 2rem;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.3);
}

.cm-stop-banner h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #fff;
}

.cm-stop-banner p {
    font-size: 1.125rem;
    opacity: 0.95;
    line-height: 1.6;
    color: #fff;
}

/* Customer form controls */
.customer-mode .form-group label {
    font-size: 1rem;
    font-weight: 600;
}

.customer-mode input[type="text"],
.customer-mode input[type="date"],
.customer-mode input[type="number"],
.customer-mode select,
.customer-mode textarea {
    font-size: 1.125rem;
    padding: 0.75rem 1rem;
    min-height: 52px;
    border-radius: 8px;
}

.customer-mode .btn {
    min-height: 52px;
    font-size: 1.0625rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
}

.customer-mode .question-item {
    padding: 1rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.customer-mode .question-item:last-child { border-bottom: none; }

.customer-mode .question-text {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.customer-mode .radio-group {
    display: flex;
    gap: 1.5rem;
}

.customer-mode .radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 400;
    min-height: 48px;
}

.customer-mode .radio-group input[type="radio"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    min-height: unset;
}

/* ============================================================
   Page (generic container)
   ============================================================ */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

/* ============================================================
   Responsive
   ============================================================ */

/* Tablets and smaller desktops */
@media (max-width: 1024px) {
    .form-row {
        flex-wrap: wrap;
    }

    .form-group-small { flex: 0 0 calc(50% - 0.5rem); }
    .form-group-wide { flex: 1 1 100%; }

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

    .list-filters { flex-direction: column; }
    .list-filters input[type="text"],
    .list-filters .input-filter { min-width: 0; }
}

/* Mobile / small tablets */
@media (max-width: 600px) {
    #app-header { padding: 0 1rem; }

    .form-list-page { padding: 1rem; }
    .wizard { padding: 1rem; }
    .wizard-container { padding: 1rem; }
    .step-content { padding: 1.25rem; }
    .customer-mode { padding: 1rem; }

    .wizard-steps { overflow-x: auto; padding-bottom: 0.5rem; }
    .step-label { display: none; }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group-small,
    .form-group-wide {
        flex: 1 1 100%;
    }

    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; }

    td, th { padding: 0.6rem 0.75rem; font-size: 0.8125rem; }

    .answer-buttons { flex-direction: column; }
    .btn-answer { min-width: 100%; }

    .cm-answer-buttons { flex-direction: column; }
    .cm-answer-buttons .btn { min-width: 100%; }

    .location-buttons { flex-direction: column; }
    .location-buttons .btn { min-width: 100%; }

    .review-grid { grid-template-columns: 1fr; }

    .cm-pin-input {
        font-size: 2rem;
        max-width: 100%;
    }

    .pin-code {
        font-size: 1.5rem;
        display: block;
        margin-top: 0.5rem;
        margin-left: 0;
    }
}

/* Large screens */
@media (min-width: 1400px) {
    .form-list-page { max-width: 1400px; }
}
