/* iPhone Security Check - Comm-Breakdown preview */
:root {
    --cb-bg: #0f172a;
    --cb-surface: #1e293b;
    --cb-surface-hover: #334155;
    --cb-text: #f1f5f9;
    --cb-muted: #94a3b8;
    --cb-green: #22c55e;
    --cb-green-dim: rgba(34, 197, 94, 0.2);
    --cb-amber: #f59e0b;
    --cb-amber-dim: rgba(245, 158, 11, 0.2);
    --cb-red: #ef4444;
    --cb-red-dim: rgba(239, 68, 68, 0.2);
    --cb-blue: #3b82f6;
    --cb-radius: 12px;
    --cb-safe-top: env(safe-area-inset-top);
    --cb-safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cb-bg);
    color: var(--cb-text);
    min-height: 100vh;
    padding-top: 56px;
    padding-bottom: calc(24px + var(--cb-safe-bottom));
}

/* Header */
.cb-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--cb-surface);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 10px 16px;
    padding-top: calc(10px + var(--cb-safe-top));
}
.cb-header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}
.cb-hamburger {
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--cb-text);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    border-radius: 8px;
}
.cb-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}
.cb-logo { display: flex; align-items: center; }
.cb-logo-img { height: 32px; width: auto; }
.cb-brand { font-weight: 700; font-size: 1rem; }

/* Drawer */
.cb-drawer { position: fixed; inset: 0; z-index: 1100; pointer-events: none; }
.cb-drawer[aria-hidden="false"] { pointer-events: auto; }
.cb-drawer-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.25s;
}
.cb-drawer[aria-hidden="false"] .cb-drawer-backdrop { opacity: 1; }
.cb-drawer-panel {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: min(320px, 85vw);
    background: var(--cb-surface);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    transform: translateX(-100%);
    transition: transform 0.25s;
    padding: calc(16px + var(--cb-safe-top)) 16px 24px;
}
.cb-drawer[aria-hidden="false"] .cb-drawer-panel { transform: translateX(0); }
.cb-drawer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cb-drawer-title { font-weight: 600; }
.cb-drawer-close {
    width: 40px; height: 40px;
    border: none; background: transparent; color: var(--cb-text);
    font-size: 1.5rem; cursor: pointer; border-radius: 8px;
}
.cb-technician-msg {
    background: var(--cb-amber-dim);
    border-left: 4px solid var(--cb-amber);
    padding: 12px 14px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 16px;
    font-size: 0.95rem;
}
.cb-drawer-body p { margin: 0 0 12px; color: var(--cb-muted); font-size: 0.9rem; }
.cb-drawer-body a { color: var(--cb-blue); }

/* Main */
.cb-main { max-width: 480px; margin: 0 auto; padding: 0 16px 24px; }
.cb-section { padding: 16px 0; }
.cb-card {
    background: var(--cb-surface);
    border-radius: var(--cb-radius);
    padding: 16px;
    margin-bottom: 16px;
}
.cb-card h2 {
    margin: 0 0 10px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cb-icon { font-size: 1.2rem; }
.cb-desc { margin: 0 0 12px; font-size: 0.85rem; color: var(--cb-muted); }

/* Intro */
.cb-intro-card { text-align: center; padding: 24px 20px; }
.cb-intro-icon { font-size: 3rem; margin-bottom: 12px; }
.cb-intro-card h1 { margin: 0 0 12px; font-size: 1.5rem; }
.cb-scan-id-label {
    margin: 16px 0 4px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cb-muted);
}
.cb-scan-id-value {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--cb-text);
    font-variant-numeric: tabular-nums;
}
.cb-scan-id-hint {
    margin: 8px 0 16px;
    font-size: 0.85rem;
    color: var(--cb-muted);
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}
.cb-intro-lead { margin: 0 0 8px; font-size: 1rem; color: var(--cb-text); }
.cb-intro-sub { margin: 0 0 20px; font-size: 0.9rem; color: var(--cb-muted); }
.cb-intro-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.cb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}
.cb-btn-primary { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); color: #fff; }
.cb-btn-secondary { background: var(--cb-surface-hover); color: var(--cb-text); }
.cb-btn-ghost { background: transparent; color: var(--cb-muted); border: 1px solid var(--cb-muted); }
.cb-btn:active { opacity: 0.9; }

/* Results */
.cb-results { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.cb-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}
.cb-result-row.ok { background: var(--cb-green-dim); color: var(--cb-green); }
.cb-result-row.warn { background: var(--cb-amber-dim); color: var(--cb-amber); }
.cb-result-row.bad { background: var(--cb-red-dim); color: var(--cb-red); }
.cb-result-label { font-weight: 500; }
.cb-result-value { font-size: 0.85rem; }

/* Checklist */
.cb-checklist { list-style: none; margin: 0; padding: 0; }
.cb-checklist li { margin-bottom: 8px; }
.cb-check-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--cb-surface-hover);
    border-radius: 8px;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    color: var(--cb-text);
    font-size: 0.9rem;
}
.cb-check-item-num {
    flex-shrink: 0;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--cb-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}
.cb-check-item.done .cb-check-item-num { background: var(--cb-green); }
.cb-check-item strong { display: block; margin-bottom: 2px; }
.cb-check-item span { color: var(--cb-muted); font-size: 0.85rem; }

/* Signs */
.cb-signs { margin: 0; padding-left: 1.2rem; font-size: 0.9rem; line-height: 1.6; color: var(--cb-muted); }
.cb-signs li { margin-bottom: 6px; }

/* Ticket + conversation */
.cb-ticket-status { margin: 0 0 12px; font-size: 0.9rem; color: var(--cb-muted); }
.cb-chat-rep-btn { margin-bottom: 12px; }
.cb-conversation-wrap { border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; overflow: hidden; }
.cb-conversation {
    max-height: 320px;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cb-msg {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 90%;
    font-size: 0.9rem;
    line-height: 1.4;
}
.cb-msg.customer { background: rgba(100,116,139,0.2); margin-right: auto; }
.cb-msg.staff { background: rgba(59,130,246,0.15); margin-left: auto; }
.cb-msg-meta { font-size: 0.75rem; color: var(--cb-muted); margin-bottom: 4px; }
.cb-msg-body { white-space: pre-wrap; }
.cb-msg-attachment { margin-top: 8px; }
.cb-msg-attachment img { max-width: 100%; border-radius: 8px; }
.cb-delivery-status { margin-top: 6px; font-size: 0.7rem; text-align: right; }
.cb-ds-sending { color: var(--cb-amber); }
.cb-ds-sent { color: var(--cb-blue); }
.cb-ds-delivered { color: var(--cb-green); }
.cb-reply-area { padding: 12px; border-top: 1px solid rgba(255,255,255,0.08); background: rgba(0,0,0,0.2); }
.cb-reply-area textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: var(--cb-surface);
    color: var(--cb-text);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 10px;
}
.cb-reply-actions { display: flex; gap: 10px; align-items: center; }
.cb-upload-screenshot input { display: none; }
.cb-why-manual-card .cb-desc { line-height: 1.5; }
.cb-screen-share-card .cb-desc { margin-bottom: 12px; }
.cb-btn-screen-share { margin-bottom: 8px; }
.cb-screen-share-confirm {
    margin: 12px 0 0;
    padding: 12px;
    background: var(--cb-green-dim);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--cb-green);
    font-weight: 500;
}
.cb-complete-wrap { margin-top: 16px; }
.cb-certificate-card .cb-desc { margin-bottom: 12px; }
.cb-certificate-paper {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    text-align: center;
}
.cb-cert-inner { color: var(--cb-text); }
.cb-cert-logo { font-size: 0.9rem; color: var(--cb-muted); margin-bottom: 8px; }
.cb-cert-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 4px; }
.cb-cert-subtitle { font-size: 0.95rem; color: var(--cb-muted); margin-bottom: 20px; }
.cb-cert-body p { margin: 10px 0; font-size: 0.95rem; line-height: 1.5; }
.cb-cert-note { font-size: 0.8rem; color: var(--cb-muted); margin-top: 16px; }
.cb-submit-card p { margin: 0 0 12px; color: var(--cb-muted); }
.cb-error { color: var(--cb-red); font-size: 0.85rem; margin-top: 8px; }
