/* ============================================================================
   MetisAI Shared Stylesheet  (v2 multi-page architecture)
   ----------------------------------------------------------------------------
   Section 1: original styles lifted verbatim from metisai-dashboard.html
              lines 17-350 (the <style>...</style> block).
   Section 2: new v2 styles - tile grid, companion page chrome, placeholders.
   ============================================================================ */

/* ==========  SECTION 1 - ORIGINAL STYLES (pasted from live dashboard)  ========== */
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            background: url('https://metis.sustensis.co.uk/metisai-bgd.png') center center fixed;
            background-size: cover;
            min-height: 100vh;
            padding: 20px;
            position: relative;
        }

        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(102, 126, 234, 0.1);
            z-index: -1;
        }

        .container {
            max-width: 560px;
            margin: 0 auto;
        }

        .header {
            background: white;
            border-radius: 15px;
            padding: 24px 22px;
            margin-bottom: 30px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            gap: 14px;
        }

        .header-content {
            width: 100%;
            text-align: center;
        }

        .header-content .user-info {
            justify-content: center;
            flex-wrap: wrap;
        }

        .header-icon {
            width: 64px;
            height: 64px;
        }

        .header-icon img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .header-content h1 {
            font-size: 18px;
            line-height: 1.35;
            color: #1f2937;
            margin-bottom: 8px;
            white-space: nowrap;
        }

        .header-content .user-info {
            color: #6b7280;
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .status-badge {
            background: #10b981;
            color: white;
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 600;
        }

        .grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }

        .card {
            background: white;
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
        }

        .card.compact {
            padding: 20px;
        }

        .card-icon {
            font-size: 32px;
            margin-right: 10px;
            display: inline-block;
            vertical-align: middle;
        }

        .card h2 {
            font-size: 20px;
            color: #1f2937;
            margin-bottom: 10px;
            display: inline-block;
            vertical-align: middle;
        }

        .card-header {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
        }

        .card p {
            color: #6b7280;
            font-size: 14px;
            line-height: 1.6;
            margin-bottom: 20px;
        }

        .card.compact p {
            margin-bottom: 15px;
        }

        .btn {
            display: block;
            width: 100%;
            padding: 12px 20px;
            border: none;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
            text-decoration: none;
            margin: 8px 0;
        }

        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .btn-primary:hover {
            transform: scale(1.02);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }

        /* Dark navy button for downloads and actions */
        .btn-navy {
            background: #1e3a8a;
            color: white;
            text-align: center;
        }
        
        /* Narrow variant for compact cards */
        .btn-navy.narrow {
            padding: 8px 15px;
            font-size: 13px;
            margin: 5px 0;
        }

        /* Left-aligned variant for download buttons */
        .btn-navy.download {
            text-align: left;
            padding-left: 20px;
        }

        .btn-navy:hover {
            background: #1e40af;
            transform: scale(1.02);
        }

        .btn-secondary {
            background: #f3f4f6;
            color: #1f2937;
        }

        .btn-secondary:hover {
            background: #e5e7eb;
        }

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

        .download-checklist {
            background: #f0f9ff;
            border-radius: 8px;
            padding: 10px;
            margin: 10px 0;
        }
        
        .compact-row {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 10px;
        }

        .download-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 5px 0;
        }

        .download-item input[type="checkbox"] {
            width: 20px;
            height: 20px;
            cursor: not-allowed;
        }

        .download-item input[type="checkbox"]:checked {
            accent-color: #10b981;
        }

        .download-item label {
            font-size: 14px;
            color: #1f2937;
            flex: 1;
        }

        .success-message {
            display: none;
            margin-top: 20px;
            padding: 15px;
            background: #1e3a8a;
            color: white;
            border-radius: 8px;
            font-size: 14px;
        }

        .success-message strong {
            display: block;
            margin-bottom: 5px;
            color: white;
        }

        .success-message p {
            color: #fde047 !important;
            margin: 5px 0 0 0 !important;
        }

        .info-box {
            background: #eff6ff;
            border-left: 4px solid #3b82f6;
            padding: 12px;
            margin: 12px 0;
            border-radius: 4px;
        }

        .info-box p {
            margin: 0;
            color: #1e40af;
            font-size: 13px;
            line-height: 1.5;
        }

        .footer {
            text-align: center;
            color: white;
            margin-top: 40px;
            font-size: 14px;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

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

        /* Responsive */
        /* Pending Voice Session Banner */
        .voice-pending-banner {
            background: linear-gradient(135deg, #14532d 0%, #166534 100%);
            border-radius: 15px;
            padding: 20px 25px;
            margin-bottom: 20px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            display: none;
            align-items: center;
            justify-content: space-between;
            gap: 20px;
            flex-wrap: wrap;
        }
        .voice-pending-banner.visible { display: flex; }
        .voice-pending-banner .banner-text { color: white; }
        .voice-pending-banner .banner-text strong { font-size: 16px; display: block; margin-bottom: 4px; }
        .voice-pending-banner .banner-text span { font-size: 13px; opacity: 0.85; }
        .btn-apply-voice {
            background: white;
            color: #14532d;
            border: none;
            padding: 12px 24px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }
        .btn-apply-voice:hover { background: #f0fdf4; transform: scale(1.02); }
        .btn-apply-voice:disabled { opacity: 0.6; cursor: not-allowed; }

        /* Mobile download confirmation hint */
        @media (max-width: 768px) {
            .btn-navy.download.narrow::after {
                content: 'If prompted, tap the Download button again';
                display: block;
                font-size: 10px;
                font-weight: 400;
                color: #fde047;
                margin-top: 4px;
                text-align: left;
                padding-left: 20px;
            }
        }

        @media (max-width: 768px) {
            .grid {
                grid-template-columns: 1fr;
            }

            .header {
                flex-direction: column;
                text-align: center;
            }
        }

/* ==========  SECTION 2 - NEW V2 STYLES  ========== */

/* Tile grid on the operator page */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
    margin-bottom: 30px;
}

.tile {
    display: block;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 22px 18px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

.tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(30, 58, 138, 0.12);
    border-color: #3b82f6;
}

.tile-icon {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 10px;
}

.tile-title {
    font-weight: 700;
    font-size: 15px;
    color: #1e3a5f;
    margin-bottom: 4px;
}

.tile-sub {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

/* Companion page chrome */
.companion-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: #ffffff;
    border-radius: 12px;
    margin: 0 auto 18px auto;
    max-width: 560px;
    flex-wrap: wrap;
}

.companion-header .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.companion-header .back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.companion-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    flex: 1;
    color: #ffffff;
}

.companion-header .user-badge {
    font-size: 13px;
    opacity: 0.9;
    color: #ffffff;
}

/* Companion pages render a single card at comfortable reading width */
.companion-page .card {
    max-width: 560px;
    margin: 0 auto;
}


/* ==========  COMPANION HELP BLOCK  ========== */
/* Sits at the top of each companion card, just below the card header.
   Introduces the workflow in user-friendly language, with the warning/
   formatting-preserving content from the author's help text. */
.companion-help {
    margin: 14px 0 18px 0;
    padding: 16px 20px;
    background: #f8fafc;
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.65;
    color: #1f2937;
}

.companion-help-title {
    display: block;
    margin: 0 0 14px 0;
    padding: 0 0 8px 0;
    font-size: 15px;
    font-weight: 700;
    color: #1e3a8a;
    border: none;
    border-bottom: 2px solid #cbd5e1;
}

.companion-help p {
    margin: 0 0 10px 0;
}

.companion-help p:last-child {
    margin-bottom: 0;
}

.companion-help em {
    color: #4b5563;
}

.companion-help strong {
    color: #111827;
}

/* Monospace-style emphasis for filename patterns */
.companion-help .filename {
    display: inline-block;
    margin: 2px 0;
    padding: 2px 6px;
    background: #e0e7ff;
    border-radius: 3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    color: #1e3a8a;
}
