/* ===========================================
   KgiOne Design System — Portable Stylesheet
   =========================================== */

/* --- 1. CSS Variables --- */
:root {
    --primary-color: #003366;
    --primary-dark: #0D5A8E;
    --theme-primary: #20ACEA;
    --theme-secondary: #003366;
    --theme-accent: #B3CDE0;
    --theme-gold: #003366;
    --theme-background: linear-gradient(160deg, #fdfcfa 0%, #f9f7f3 40%, #f5f2ed 70%, #fbfaf7 100%);
    --theme-header: linear-gradient(135deg, #003366 0%, #0D5A8E 100%);
    --theme-button: #003366;
    --theme-text: #1f2937;
    --theme-muted: #6b7280;
    --theme-card-bg: #ffffff;
    --success-color: #228B22;
    --danger-color: #dc3545;
    --warning-color: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

/* --- 2. Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(160deg, #fdfcfa 0%, #f9f7f3 40%, #f5f2ed 70%, #fbfaf7 100%);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0;
    overflow-x: hidden;
}

/* --- 3. Background --- */
.bg-topo {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.15;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='25' fill='none' stroke='%23b0a898' stroke-width='0.5'/%3E%3Ccircle cx='30' cy='30' r='18' fill='none' stroke='%23b0a898' stroke-width='0.5'/%3E%3Ccircle cx='30' cy='30' r='11' fill='none' stroke='%23b0a898' stroke-width='0.5'/%3E%3Ccircle cx='30' cy='30' r='5' fill='none' stroke='%23b0a898' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 60px 60px;
}

/* --- 4. Layout --- */
.main-container {
    width: 100%;
    max-width: 480px;
    margin: 20px;
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
}

/* --- 5. Cards --- */
.auth-card,
.registration-card {
    width: 436px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 2px solid white;
    overflow: hidden;
    position: relative;
}

.dashboard-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 2px solid white;
    overflow: hidden;
    width: 100%;
    min-width: 767px;
    max-width: 1200px;
    margin: 0 auto;
}

.card-header {
    background: var(--theme-header);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
}

.card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="%23ffffff" opacity="0.15"/><circle cx="20" cy="80" r="0.5" fill="%23ffffff" opacity="0.15"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.card-body {
    padding: 2.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.card-subtitle {
    opacity: 0.9;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* --- 6. Logo & Header --- */
.logo {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.logo-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    margin-bottom: 10px;
}

.kgi-logo {
    width: 240px;
    height: auto;
    object-fit: contain;
    margin-bottom: 15px;
}

.logo-subtitle {
    margin: 0;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.2;
}

/* --- 7. Toolbar --- */
.toolbar {
    background: var(--theme-secondary);
    padding: 15px 30px;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.toolbar a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background-color 0.3s;
    font-weight: 500;
}

.toolbar a:hover {
    background-color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
    color: white;
}

.toolbar a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* --- 8. Buttons --- */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--theme-primary);
    border: 2px solid var(--theme-primary);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.88;
    background: var(--theme-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:disabled,
.btn-primary.disabled {
    background: var(--gray-300);
    border-color: var(--gray-300);
    color: var(--gray-500);
    opacity: 1;
}

.btn-success {
    background: var(--success-color);
    border: 2px solid var(--success-color);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    color: #fff;
}

.btn-success:hover {
    opacity: 0.88;
    background: var(--success-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-warning {
    background: var(--theme-gold);
    color: var(--theme-text);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.btn-warning:hover {
    background: var(--theme-button);
}

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

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: var(--gray-500);
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-outline-secondary {
    background: transparent;
    border: 2px solid var(--theme-secondary);
    color: var(--theme-secondary);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background: var(--theme-secondary);
    border-color: var(--theme-secondary);
    color: #fff;
}

.btn-outline-success {
    background: transparent;
    border: 2px solid var(--success-color);
    color: var(--success-color);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.btn-outline-success:hover {
    background: var(--success-color);
    border-color: var(--success-color);
    color: #fff;
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--theme-primary);
    color: var(--theme-primary);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* --- 9. Forms --- */
.form-floating {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    font-weight: 600;
    color: var(--theme-text);
    margin-bottom: 8px;
    display: block;
}

.form-control {
    width: 100%;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 1rem;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    background: var(--gray-50);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 51, 102, 0.1);
    background: white;
}

.form-control:disabled {
    background-color: #f8f9fa;
    color: var(--gray-500);
}

.form-text {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

#pin {
    text-align: center;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    padding: 1.25rem;
}

/* --- 10. Alerts --- */
.alert {
    border: none;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* --- 11. Badges --- */
.badge {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
}

.badge-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.verified-badge {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.unverified-badge {
    background: #ffc107;
    color: #212529;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.status-verified {
    background-color: #c6f6d5;
    color: #22543d;
}

.status-unverified {
    background-color: #fed7d7;
    color: #742a2a;
}

.status-active {
    background-color: #bee3f8;
    color: #2c5282;
}

/* --- 12. Steps --- */
.step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
}

.step.active {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.step.completed {
    background: var(--success-color);
    color: white;
}

.step-container {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- 12b. Registration Wizard --- */
.progress-container {
    margin-bottom: 2rem;
}

.progress-bar {
    background-color: var(--success-color);
}

.step-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.step-label {
    font-size: 0.8rem;
    color: var(--theme-muted);
    transition: color 0.3s ease;
}

.step-label.active {
    color: var(--primary-color);
    font-weight: 600;
}

.invite-summary {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.completion-summary,
.confirmation-summary {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.summary-section {
    margin-bottom: 1.5rem;
}

.summary-section:last-child {
    margin-bottom: 0;
}

.summary-section h5 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.summary-section p {
    margin: 0;
}

.acceptance-summary {
    margin: 2rem 0;
}

.summary-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.summary-card h5 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.error-icon {
    font-size: 4rem;
    color: var(--danger-color);
}

.passkey-type-btn {
    min-height: 120px;
    transition: all 0.3s ease;
}

.passkey-type-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.passkey-type-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.help-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary-color);
}

.help-section h5 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.help-section ul {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.help-section li {
    margin-bottom: 0.5rem;
}

.help-section p {
    margin-bottom: 1rem;
    color: var(--theme-text);
}

/* --- 13. Login-Specific --- */
.requesting-app-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: rgba(0, 51, 102, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(0, 51, 102, 0.1);
}

.app-logo {
    flex-shrink: 0;
}

.app-logo-img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px;
    border: 2px solid var(--theme-gold);
}

.app-details {
    flex-grow: 1;
    min-width: 0;
}

.app-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--theme-text);
    line-height: 1.2;
}

.app-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    color: var(--theme-muted);
    line-height: 1.3;
}

.login-separator {
    text-align: center;
    margin: 1rem 0;
    position: relative;
}

.login-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--theme-gold), transparent);
}

.separator-text {
    background: var(--theme-card-bg);
    padding: 0 1rem;
    font-size: 0.85rem;
    color: var(--theme-muted);
    position: relative;
    font-weight: 500;
}

.email-display {
    background: rgba(0, 51, 102, 0.05);
    border-radius: 8px;
    padding: 0.75rem;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--theme-muted);
    border: 1px solid rgba(0, 51, 102, 0.1);
}

.passkey-required {
    display: block;
}

.webauthn-fallback {
    display: none;
}

.no-webauthn .passkey-required {
    display: none;
}

.no-webauthn .webauthn-fallback {
    display: block;
}

/* --- 14. Dashboard — Welcome & Products --- */
.welcome-section {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.welcome-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--theme-secondary);
    margin-bottom: 15px;
}

.welcome-subtitle {
    color: var(--theme-muted);
    font-size: 1.1rem;
    margin-bottom: 0;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.product-tile {
    background: var(--theme-card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

.product-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: inherit;
}

.product-tile.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.product-tile.disabled:hover {
    transform: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
    cursor: pointer;
}

.product-image.placeholder {
    background: var(--theme-background);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.product-name {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--theme-secondary);
    text-decoration: none;
    display: block;
}

.product-name:hover {
    color: var(--theme-primary);
}

.product-description {
    color: var(--theme-muted);
    margin-bottom: 15px;
    line-height: 1.5;
}

.product-stores {
    border-top: 1px solid #e5e7eb;
    padding-top: 15px;
}

.stores-label {
    font-weight: bold;
    color: var(--theme-text);
    margin-bottom: 8px;
}

.stores-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.store-tag {
    background: var(--theme-accent);
    color: var(--theme-text);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.875rem;
    text-decoration: none;
}

a.store-tag:hover {
    background: var(--theme-primary);
    color: #fff;
    cursor: pointer;
}

.no-access-message {
    color: var(--theme-muted);
    font-style: italic;
    margin-top: 10px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--theme-muted);
}

.empty-state h3 {
    margin-bottom: 10px;
}

/* --- 15. Account Info --- */
.page-title-section {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.page-title-section h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--theme-secondary);
    margin-bottom: 5px;
}

.page-title-section p {
    color: var(--theme-muted);
    font-size: 1.05rem;
    margin: 0;
}

.info-section {
    background: var(--theme-card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
}

.info-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--theme-secondary);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--theme-secondary);
    padding-bottom: 10px;
}

.user-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.user-detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--theme-text);
    flex: 1;
}

.detail-value {
    flex: 2;
    text-align: right;
    color: #2d3748;
}

.store-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.store-card:last-child {
    margin-bottom: 0;
}

.store-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
}

.store-card-header:hover {
    background-color: #edf2f7;
}

.store-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.store-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.store-role {
    font-size: 0.9rem;
    color: var(--theme-muted);
    background: #edf2f7;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.collapse-icon {
    color: var(--theme-muted);
    transition: transform 0.3s ease;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-left: 12px;
}

.store-card-header[aria-expanded="true"] .collapse-icon {
    transform: rotate(180deg);
}

.store-details-body {
    padding: 0 20px 20px;
}

.store-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.store-detail {
    display: flex;
    flex-direction: column;
}

.store-detail-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.store-detail-value {
    color: #2d3748;
    font-weight: 500;
}

.permissions-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.permissions-title {
    font-weight: 600;
    color: var(--theme-text);
    margin-bottom: 10px;
}

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

.permission-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.permission-granted {
    background-color: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.permission-denied {
    background-color: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

.permission-icon {
    margin-right: 6px;
    font-size: 0.8rem;
}

.no-stores {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.no-stores i {
    font-size: 3rem;
    color: #cbd5e0;
    margin-bottom: 15px;
    display: block;
}

.no-stores h4 {
    color: var(--theme-text);
}

/* --- 16. Account Management --- */
.account-section {
    margin-bottom: 40px;
    padding: 30px;
    background: var(--theme-card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--theme-secondary);
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #e5e7eb;
}

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

.info-label {
    font-weight: 600;
    color: var(--theme-text);
}

.info-value {
    color: var(--theme-muted);
    display: flex;
    align-items: center;
    gap: 10px;
}

.add-passkey-item {
    flex-wrap: wrap;
}

.add-passkey-item .passkey-blurb {
    flex-basis: 100%;
    font-size: 0.85em;
    margin-top: 4px;
}

.passkey-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.passkey-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.3s;
}

.passkey-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.passkey-info {
    flex: 1;
}

.passkey-name {
    font-weight: 600;
    color: var(--theme-text);
    margin-bottom: 5px;
}

.passkey-details {
    color: var(--theme-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.passkey-actions {
    display: flex;
    gap: 10px;
}

/* --- 17. Modals --- */
/* Custom modal overlay pattern (non-Bootstrap) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay .modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.modal-overlay .modal-header {
    background: var(--theme-header);
    color: white;
    padding: 1rem 1.5rem;
}

.modal-overlay .modal-header .btn-close {
    filter: invert(1);
}

.modal-overlay .modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0;
}

.modal-overlay .modal-body {
    margin-bottom: 20px;
}

.modal-overlay .modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-overlay .modal-footer .btn {
    flex: 1;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
}

/* --- 18. PIN Input --- */
.pin-input {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.pin-digit {
    width: 50px;
    height: 50px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s;
}

.pin-digit:focus {
    outline: none;
    border-color: var(--theme-primary);
}

/* --- 19. QR Code --- */
.qr-code-container {
    display: inline-block;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.qr-code-container img {
    display: block;
    border-radius: 5px;
}

/* --- 19b. Mobile Backup --- */
.recommendation-card {
    background: linear-gradient(135deg, rgba(0, 51, 102, 0.1) 0%, rgba(0, 51, 102, 0.05) 100%);
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid rgba(0, 51, 102, 0.2);
}

.benefits-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.benefits-list li {
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
}

.mobile-illustration {
    padding: 1rem;
}

.qr-code {
    max-width: 250px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* --- 20. Invite Details --- */
.invite-details {
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    margin-bottom: 2rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

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

.detail-row-stacked {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.detail-row-stacked:last-child {
    border-bottom: none;
}

.detail-row-stacked .detail-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.detail-row-stacked .detail-value {
    text-align: left;
    font-size: 1.05rem;
    flex: unset;
    width: 100%;
}

/* --- 21. Home Page --- */
.home-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 2px solid white;
    overflow: hidden;
    position: relative;
    max-width: 600px;
    margin: 20px auto;
}

.home-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
}

.home-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="%23ffffff" opacity="0.15"/><circle cx="20" cy="80" r="0.5" fill="%23ffffff" opacity="0.15"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.home-logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.home-title {
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    margin-bottom: 0;
}

.home-body {
    padding: 2.5rem;
}

.info-card {
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--gray-200);
    margin-bottom: 2rem;
    text-align: center;
}

.info-icon {
    font-size: 3rem;
    color: var(--theme-primary);
    margin-bottom: 1rem;
}

.info-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.info-text {
    color: var(--gray-600);
    margin-bottom: 1.5rem;
}

/* --- 22. Utilities --- */
.text-muted {
    color: var(--gray-500);
}

.text-center h3 {
    color: var(--gray-800);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.success-icon {
    color: var(--success-color);
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 1s ease-in-out;
}

.spinner-border {
    width: 1.25rem;
    height: 1.25rem;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--theme-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-group .btn {
    flex: 1;
    min-width: 100px;
    font-size: 0.875rem;
    padding: 0.375rem 0.5rem;
}

/* --- 23. Animations --- */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% { transform: translate3d(0, 0, 0); }
    40%, 43% { transform: translate3d(0, -20px, 0); }
    70% { transform: translate3d(0, -10px, 0); }
    90% { transform: translate3d(0, -4px, 0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- 24. Dark Mode --- */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(160deg, #0F0A0B 0%, #1F1518 100%);
    }
    .bg-topo {
        opacity: 0.1;
        background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='25' fill='none' stroke='%23ffffff' stroke-width='0.5'/%3E%3Ccircle cx='30' cy='30' r='18' fill='none' stroke='%23ffffff' stroke-width='0.5'/%3E%3Ccircle cx='30' cy='30' r='11' fill='none' stroke='%23ffffff' stroke-width='0.5'/%3E%3Ccircle cx='30' cy='30' r='5' fill='none' stroke='%23ffffff' stroke-width='0.5'/%3E%3C/svg%3E");
    }
}

/* --- 25. Responsive — Tablet (768px) --- */
@media (max-width: 768px) {
    .main-container {
        padding: 10px;
        align-items: flex-start;
        padding-top: 10px;
    }

    .dashboard-card {
        min-width: unset;
        max-width: 100%;
    }

    .card-header {
        padding: 20px;
    }

    .kgi-logo {
        width: 200px;
    }

    .logo-subtitle {
        font-size: 1rem;
    }

    .toolbar {
        padding: 10px 20px;
        gap: 15px;
    }

    .toolbar a {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    .card-body {
        padding: 20px;
    }

    .welcome-title {
        font-size: 1.5rem;
    }

    .welcome-subtitle {
        font-size: 1rem;
    }

    .welcome-section {
        margin-bottom: 30px;
        padding-bottom: 20px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .product-tile {
        padding: 15px;
    }

    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    .info-icon {
        font-size: 2.5rem;
    }

    .step-container {
        min-height: 250px;
    }

    .requesting-app-info {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
        padding: 1rem;
    }

    .app-logo-img {
        width: 48px;
        height: 48px;
    }

    .app-title {
        font-size: 1.1rem;
    }

    .app-subtitle {
        font-size: 0.8rem;
    }

    .page-title-section h1 {
        font-size: 1.5rem;
    }

    .info-section {
        padding: 20px;
        margin-bottom: 20px;
    }

    .info-section-title {
        font-size: 1.3rem;
    }

    .user-detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .detail-value {
        text-align: left;
    }

    .store-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .store-card-header {
        padding: 12px 16px;
    }

    .store-details-body {
        padding: 0 16px 16px;
    }

    .store-details {
        grid-template-columns: 1fr;
        gap: 10px;
    }

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

    .account-section {
        padding: 20px;
        margin-bottom: 20px;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .info-value {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }

    .add-passkey-item .info-value {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .add-passkey-buttons {
        margin-top: 10px;
        width: 100%;
    }

    .passkey-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .passkey-actions {
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        margin: 20px;
    }

    .pin-input {
        flex-wrap: wrap;
        gap: 8px;
    }

    .pin-digit {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        width: 100%;
    }

    .qr-code-container {
        padding: 15px;
    }

    .qr-code-container img {
        width: 200px;
        height: 200px;
    }

    .recommendation-card {
        padding: 1.5rem;
    }

    .mobile-illustration {
        margin-top: 1rem;
    }

    .qr-code {
        max-width: 200px;
    }

    .step-labels {
        font-size: 0.7rem;
    }

    .btn-lg {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .passkey-type-btn {
        min-height: 100px;
    }

    .success-icon,
    .error-icon {
        font-size: 3rem;
    }
}

/* --- 26. Responsive — Mobile (576px) --- */
@media (max-width: 576px) {
    body {
        align-items: flex-start;
        padding-top: 0;
    }

    .main-container {
        margin: 10px;
    }

    .auth-card,
    .registration-card {
        width: 100%;
    }

    .card-body {
        padding: 1.5rem;
    }

    .card-header {
        padding: 1.5rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .card-title {
        font-size: 1.25rem;
    }

    .home-header {
        padding: 2rem 1.5rem;
    }

    .home-logo {
        font-size: 2rem;
    }

    .home-body {
        padding: 1.5rem;
    }
}
