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

:root {
    --sidebar-width: 230px;
}

body {
    font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #2d3748;
    line-height: 1.6;
    min-height: 100vh;
}

/* === Landing Page (unauthenticated) === */
.landing-page {
    min-height: 100vh;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang TC", sans-serif;
    color: #1a202c;
    overflow-x: hidden;
}

/* ===== NAV ===== */
.landing-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.landing-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 60px;
}
.landing-logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: #0a1f3f; font-weight: 800; font-size: 1.1em;
}
.landing-logo-icon {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    color: #fff; border-radius: 8px; font-size: 0.85em;
}
.landing-nav-right {
    display: flex; align-items: center; gap: 24px;
}
.landing-nav-links { display: flex; gap: 4px; }
.landing-nav-links a {
    text-decoration: none; color: #475569; padding: 8px 16px;
    border-radius: 8px; font-size: 0.9em; font-weight: 500; transition: all 0.2s;
}
.landing-nav-links a:hover,
.landing-nav-links a.active { color: #1e40af; background: rgba(37,99,235,0.06); }
.landing-nav-actions { display: flex; align-items: center; gap: 12px; }
.landing-btn-text {
    background: none; border: none; color: #475569; font-size: 0.9em;
    font-weight: 500; cursor: pointer; padding: 8px 16px; border-radius: 8px; transition: all 0.2s;
}
.landing-btn-text:hover { color: #1e40af; background: rgba(37,99,235,0.05); }
.landing-btn-primary {
    padding: 8px 20px; background: #2563eb; color: #fff; border: none;
    border-radius: 8px; font-size: 0.9em; font-weight: 600; cursor: pointer;
    transition: all 0.2s; box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}
.landing-btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); }

/* ===== LANDING TAB PANELS ===== */
.landing-tab-panel { display: none; }
.landing-tab-panel.active { display: block; }

/* ===== SECTION HEAD shared ===== */
.section-head { text-align: center; margin-bottom: 48px; }
.section-title {
    font-size: 1.8em; font-weight: 800; color: #0f172a; margin: 0 0 12px;
}
.section-desc { color: #64748b; font-size: 1.05em; margin: 0; }

/* ================================================================ */
/*  HOME — HERO (dark navy background with illustration)             */
/* ================================================================ */
.hero-section {
    background: linear-gradient(170deg, #060e1f 0%, #0b1e3d 40%, #0f2747 100%);
    padding: 80px 32px 100px;
    position: relative;
    overflow: hidden;
}
.hero-inner {
    max-width: 1100px; margin: 0 auto;
    display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center;
    position: relative; z-index: 2;
}

/* Abstract geometric shapes on the left */
.hero-illustration {
    position: relative; width: 100%; height: 380px;
    display: flex; align-items: center; justify-content: center;
}
.hero-geo { position: absolute; }
.geo-circle-1 {
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(37,99,235,0.35) 0%, rgba(37,99,235,0.05) 70%);
    border-radius: 50%; top: 20px; left: 30px;
}
.geo-circle-2 {
    width: 140px; height: 140px;
    background: radial-gradient(circle, rgba(59,130,246,0.3) 0%, transparent 70%);
    border-radius: 50%; bottom: 40px; right: 40px;
}
.geo-rect-1 {
    width: 160px; height: 160px;
    background: linear-gradient(135deg, rgba(37,99,235,0.2), rgba(59,130,246,0.08));
    border-radius: 24px; top: 60px; right: 60px;
    transform: rotate(12deg);
}
.geo-rect-2 {
    width: 100px; height: 100px;
    background: linear-gradient(135deg, rgba(96,165,250,0.25), rgba(147,197,253,0.06));
    border-radius: 20px; bottom: 80px; left: 80px;
    transform: rotate(-8deg);
}
.geo-dots {
    width: 120px; height: 120px;
    background-image: radial-gradient(rgba(255,255,255,0.15) 2px, transparent 2px);
    background-size: 16px 16px; top: 10px; right: 100px;
}
.geo-ring {
    width: 180px; height: 180px;
    border: 2px solid rgba(255,255,255,0.08); border-radius: 50%;
    bottom: 20px; right: 100px;
}

/* Floating document card on the left illustration */
.hero-card {
    position: absolute; top: 70px; left: 50px;
    width: 220px; background: rgba(255,255,255,0.95);
    border-radius: 14px; padding: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3); z-index: 3;
}
.hero-card-bars {
    display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px;
}
.hc-bar {
    display: block; height: 6px; background: #e2e8f0; border-radius: 3px;
}
.hc-bar-1 { width: 85%; }
.hc-bar-2 { width: 55%; background: #cbd5e0; }
.hc-bar-3 { width: 75%; }
.hc-bar-4 { width: 40%; }
.hero-card-chart { display: flex; align-items: flex-end; gap: 6px; height: 48px; }
.hcc-col { flex: 1; background: linear-gradient(180deg, #3b82f6, #2563eb); border-radius: 3px 3px 0 0; opacity: 0.7; }

/* Hero text on the right */
.hero-text { color: #fff; }
.hero-title {
    font-size: 2.8em; font-weight: 900; line-height: 1.25; margin: 0 0 20px;
    letter-spacing: 0.02em; color: #fff;
}
.hero-sub {
    font-size: 1.1em; color: rgba(255,255,255,0.7); line-height: 1.7; margin: 0 0 28px;
}
.hero-features { display: flex; flex-direction: column; gap: 14px; margin-bottom: 32px; }
.hf-item {
    display: flex; align-items: flex-start; gap: 12px;
    font-size: 0.95em; color: rgba(255,255,255,0.85); line-height: 1.5;
}
.hf-check {
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; background: #22c55e; color: #fff;
    border-radius: 50%; font-size: 0.7em; font-weight: 700;
}
.hero-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.hero-cta {
    padding: 14px 32px; background: #2563eb; color: #fff; border: none;
    border-radius: 12px; font-size: 1em; font-weight: 700; cursor: pointer;
    transition: all 0.2s; box-shadow: 0 4px 16px rgba(37,99,235,0.4);
}
.hero-cta:hover { background: #1d4ed8; transform: translateY(-1px); }
.hero-cta-secondary {
    padding: 13px 28px; background: transparent; color: rgba(255,255,255,0.85);
    border: 1.5px solid rgba(255,255,255,0.3); border-radius: 12px;
    font-size: 0.95em; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.hero-cta-secondary:hover { border-color: rgba(255,255,255,0.6); color: #fff; }

/* ===== TRUST BAR ===== */
.trust-bar {
    background: #fff; border-bottom: 1px solid #f1f5f9;
    padding: 32px 0;
}
.trust-inner {
    max-width: 700px; margin: 0 auto;
    display: flex; align-items: center; justify-content: center; gap: 0;
}
.trust-stat {
    flex: 1; text-align: center; padding: 0 24px;
}
.trust-num { display: block; font-size: 1.8em; font-weight: 800; color: #0f172a; }
.trust-label { display: block; font-size: 0.88em; color: #64748b; margin-top: 4px; }
.trust-divider { width: 1px; height: 40px; background: #e2e8f0; flex-shrink: 0; }

/* ===== FEATURES SECTION ===== */
.features-section { padding: 80px 32px; background: #f8fafc; }
.features-inner { max-width: 1000px; margin: 0 auto; }
.feat-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.feat-card {
    background: #fff; border: 1px solid #e8ecf1; border-radius: 16px;
    padding: 32px 24px; text-align: center; transition: all 0.3s;
}
.feat-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.06); }
.feat-icon-wrap {
    width: 64px; height: 64px; margin: 0 auto 20px;
    display: flex; align-items: center; justify-content: center;
    background: #eff6ff; border-radius: 16px; font-size: 1.6em;
}
.feat-card h3 { font-size: 1.1em; font-weight: 700; color: #0f172a; margin: 0 0 8px; }
.feat-card p { font-size: 0.9em; color: #64748b; line-height: 1.7; margin: 0; }

/* ===== HOW IT WORKS ===== */
.how-section { padding: 80px 32px; background: #fff; }
.how-inner { max-width: 900px; margin: 0 auto; }
.steps-row {
    display: flex; align-items: flex-start; justify-content: center; gap: 0;
}
.step-item { flex: 1; text-align: center; padding: 0 20px; }
.step-num {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; margin: 0 auto 16px;
    background: #2563eb; color: #fff; border-radius: 50%;
    font-size: 1.2em; font-weight: 800;
}
.step-item h4 { font-size: 1em; font-weight: 700; color: #0f172a; margin: 0 0 6px; }
.step-item p { font-size: 0.88em; color: #64748b; margin: 0; line-height: 1.6; }
.step-arrow {
    font-size: 1.5em; color: #cbd5e0; padding-top: 12px; flex-shrink: 0;
}

/* ===== CTA SECTION ===== */
.cta-section {
    padding: 80px 32px; background: linear-gradient(170deg, #060e1f, #0b1e3d);
    text-align: center;
}
.cta-inner { max-width: 600px; margin: 0 auto; }
.cta-inner h2 {
    font-size: 2em; font-weight: 800; color: #fff; margin: 0 0 12px;
}
.cta-inner p { font-size: 1.05em; color: rgba(255,255,255,0.65); margin: 0 0 28px; }
.cta-btn {
    padding: 14px 40px; background: #2563eb; color: #fff; border: none;
    border-radius: 12px; font-size: 1.05em; font-weight: 700; cursor: pointer;
    transition: all 0.2s; box-shadow: 0 4px 16px rgba(37,99,235,0.4);
}
.cta-btn:hover { background: #1d4ed8; transform: translateY(-1px); }

/* ================================================================ */
/*  PLANS / PRICING                                                 */
/* ================================================================ */
.plans-hero {
    background: linear-gradient(170deg, #060e1f, #0b1e3d);
    padding: 60px 32px; text-align: center;
}
.plans-hero-inner { max-width: 600px; margin: 0 auto; }
.plans-hero h1 { font-size: 2.2em; font-weight: 800; color: #fff; margin: 0 0 12px; }
.plans-hero p { font-size: 1.05em; color: rgba(255,255,255,0.6); margin: 0; }

/* Billing toggle */
.plans-toggle-wrap {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 32px 0 8px; background: #fff;
}
.plans-tgl-label { font-size: 0.95em; font-weight: 600; color: #94a3b8; transition: color 0.2s; }
.plans-tgl-label.active { color: #0f172a; }
.plans-tgl-switch {
    width: 48px; height: 26px; background: #cbd5e0; border: none;
    border-radius: 13px; cursor: pointer; position: relative; transition: background 0.25s;
}
.plans-tgl-switch.yearly { background: #2563eb; }
.plans-tgl-knob {
    position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px; background: #fff; border-radius: 50%;
    transition: transform 0.25s; box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.plans-tgl-switch.yearly .plans-tgl-knob { transform: translateX(22px); }
.plans-tgl-badge {
    font-size: 0.8em; font-weight: 700; color: #166534; background: #dcfce7;
    padding: 3px 10px; border-radius: 12px;
}

/* Pricing cards */
.plans-cards {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
    max-width: 1050px; margin: 0 auto; padding: 40px 32px 60px;
}
.plan-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 16px;
    padding: 32px 24px; position: relative; transition: all 0.3s; cursor: pointer;
}
.plan-card:focus-visible { outline: 3px solid rgba(37,99,235,.22); outline-offset: 3px; }
.plan-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,0.08); }
.plan-card.featured {
    border-color: #2563eb;
    box-shadow: 0 8px 32px rgba(37,99,235,0.12);
    transform: scale(1.03);
}
.plan-card.featured:hover { transform: scale(1.03) translateY(-4px); }
.plan-card.selected { border-color: #1769e8; box-shadow: 0 0 0 3px rgba(23,105,232,.14),0 14px 34px rgba(37,99,235,.12); }
.plan-card.selected:not(.featured):hover { transform: translateY(-4px); }
.plan-selected-mark { position:absolute;top:14px;right:14px;display:none;padding:5px 9px;border-radius:999px;background:#e8f1ff;color:#1769e8;font-size:.72rem;font-weight:800; }
.plan-card.selected .plan-selected-mark { display:inline-flex; }
.plan-card.featured .plan-selected-mark { top:54px; }
.plan-badge {
    display: block; text-align: center; padding: 8px;
    background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff;
    font-weight: 700; font-size: 0.85em; margin: -32px -24px 20px;
    border-radius: 16px 16px 0 0;
}
.plan-card-title { font-size: 1.2em; font-weight: 800; color: #0f172a; margin: 0 0 6px; }
.plan-card-desc { font-size: 0.88em; color: #64748b; line-height: 1.6; margin: 0 0 20px; }
.plan-card-price { display: flex; align-items: baseline; margin-bottom: 4px; }
.plan-currency { font-size: 0.9em; font-weight: 700; color: #475569; }
.plan-amount { font-size: 2.4em; font-weight: 800; color: #0f172a; line-height: 1; }
.plan-period { font-size: 0.9em; color: #94a3b8; }
.plan-price-note { font-size: 0.82em; color: #94a3b8; margin: 0 0 20px; }
.plan-card-btn {
    display: block; width: 100%; padding: 12px; border: none; border-radius: 10px;
    background: #2563eb; color: #fff; font-size: 0.95em; font-weight: 700;
    cursor: pointer; margin-bottom: 24px; transition: all 0.2s;
}
.plan-card-btn:hover { background: #1d4ed8; }
.plan-card-btn.outline { background: #fff; color: #2563eb; border: 1.5px solid #2563eb; }
.plan-card-btn.outline:hover { background: #eff6ff; }
.plan-card-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.plan-card-features li { font-size: 0.88em; color: #334155; }

/* Feature comparison table */
.compare-section { padding: 60px 32px 80px; background: #f8fafc; }
.compare-inner { max-width: 900px; margin: 0 auto; }
.compare-table-wrap { overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.compare-table th, .compare-table td {
    padding: 14px 20px; text-align: center; border-bottom: 1px solid #f1f5f9;
    font-size: 0.9em;
}
.compare-table th {
    background: #f8fafc; font-weight: 700; color: #0f172a;
}
.compare-table th:first-child, .compare-table td:first-child { text-align: left; font-weight: 600; color: #334155; }
.compare-table .col-featured { background: rgba(37,99,235,0.03); }
.compare-table tbody tr:hover { background: #fafbfc; }

/* ================================================================ */
/*  FAQ                                                              */
/* ================================================================ */
.faq-hero {
    background: linear-gradient(170deg, #060e1f, #0b1e3d);
    padding: 60px 32px; text-align: center;
}
.faq-hero-inner { max-width: 600px; margin: 0 auto; }
.faq-hero h1 { font-size: 2.2em; font-weight: 800; color: #fff; margin: 0 0 12px; }
.faq-hero p { font-size: 1.05em; color: rgba(255,255,255,0.6); margin: 0; }

.faq-body { padding: 40px 32px 80px; background: #fff; }
.faq-body-inner { max-width: 720px; margin: 0 auto; }

/* Search */
.faq-search-wrap {
    height: 50px; display: flex; align-items: center; gap: 12px;
    margin-bottom: 24px; padding: 0 10px 0 16px;
    border: 1px solid #d8e0ea; border-radius: 8px; background: #fff;
    box-shadow: 0 2px 8px rgba(15,23,42,0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.faq-search-wrap:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1), 0 4px 12px rgba(15,23,42,0.06);
}
.faq-search-icon {
    position: relative; width: 18px; height: 18px; flex: 0 0 18px; color: #64748b;
}
.faq-search-icon::before {
    content: ''; position: absolute; left: 1px; top: 1px; width: 11px; height: 11px;
    border: 2px solid currentColor; border-radius: 50%; box-sizing: border-box;
}
.faq-search-icon::after {
    content: ''; position: absolute; left: 11px; top: 11px; width: 7px; height: 2px;
    border-radius: 1px; background: currentColor; transform: rotate(45deg); transform-origin: left center;
}
.faq-search-input {
    min-width: 0; height: 100%; flex: 1; padding: 0; border: 0; outline: 0;
    border-radius: 0; background: transparent; box-shadow: none;
    color: #0f172a; font: inherit; font-size: 0.95em;
}
.faq-search-input:focus { outline: none; box-shadow: none; }
.faq-search-input::placeholder { color: #94a3b8; }
.faq-search-input::-webkit-search-cancel-button { display: none; }
.faq-search-clear {
    width: 30px; height: 30px; flex: 0 0 30px; display: inline-flex;
    align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 6px;
    background: transparent; color: #64748b; cursor: pointer; font-size: 20px; line-height: 1;
    transition: color 0.15s, background-color 0.15s;
}
.faq-search-clear:hover { color: #0f172a; background: #f1f5f9; }
.faq-search-clear:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }
.faq-search-clear[hidden] { display: none; }

/* Category tabs */
.faq-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; justify-content: center; }
.faq-cat-btn {
    padding: 8px 20px; border: 1px solid #e2e8f0; background: #fff;
    border-radius: 20px; font-size: 0.88em; font-weight: 500; color: #475569;
    cursor: pointer; transition: all 0.2s;
}
.faq-cat-btn:hover { border-color: #93c5fd; color: #2563eb; }
.faq-cat-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* FAQ items */
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
    background: #fff; border: 1px solid #e8ecf1; border-radius: 12px; overflow: hidden;
    transition: box-shadow 0.2s;
}
.faq-item:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.faq-item.open { border-color: #bfdbfe; box-shadow: 0 4px 16px rgba(37,99,235,0.06); }
.faq-question {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 16px 20px; background: none; border: none; cursor: pointer;
    font-size: 0.95em; font-weight: 600; color: #0f172a; text-align: left; transition: background 0.15s;
}
.faq-question:hover { background: #f8fafc; }
.faq-arrow {
    flex-shrink: 0; font-size: 0.8em; color: #94a3b8; transition: transform 0.25s;
}
.faq-item.open .faq-arrow { transform: rotate(180deg); color: #2563eb; }
.faq-answer { display: none; }
.faq-item.open .faq-answer { display: block; }
.faq-answer-inner { padding: 0 20px 18px; }
.faq-answer p {
    font-size: 0.9em; color: #475569; line-height: 1.8; margin: 0;
    padding-top: 14px; border-top: 1px solid #f1f5f9;
}
.faq-item.hidden { display: none; }
.faq-no-results { text-align: center; padding: 40px; color: #94a3b8; font-size: 0.95em; }

/* ===== FOOTER ===== */
.landing-footer { background: #060e1f; color: rgba(255,255,255,0.6); padding: 60px 32px 0; }
.landing-footer-inner {
    max-width: 1000px; margin: 0 auto; display: grid;
    grid-template-columns: 2fr 1fr 1fr; gap: 40px;
    padding-bottom: 40px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-col h4 { font-size: 0.95em; font-weight: 700; color: #fff; margin: 0 0 14px; }
.footer-col p { font-size: 0.88em; margin: 0 0 6px; line-height: 1.7; }
.footer-col a {
    display: block; font-size: 0.88em; color: rgba(255,255,255,0.5);
    text-decoration: none; margin-bottom: 8px; transition: color 0.2s;
}
.footer-col a:hover { color: #fff; }
.footer-bottom { text-align: center; padding: 20px 0; font-size: 0.82em; color: rgba(255,255,255,0.35); }
.footer-bottom p { margin: 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .hero-inner { grid-template-columns: 1fr; gap: 32px; }
    .hero-illustration { height: 280px; }
    .hero-title { font-size: 2em; }
    .plans-cards { grid-template-columns: 1fr; max-width: 400px; }
    .plan-card.featured { transform: none; }
    .plan-card.featured:hover { transform: translateY(-4px); }
    .feat-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
    .steps-row { flex-direction: column; align-items: center; gap: 16px; }
    .step-arrow { transform: rotate(90deg); padding-top: 0; }
    .landing-footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
    .landing-nav-links { display: none; }
    .landing-nav-inner { padding: 0 16px; }
    .hero-section { padding: 40px 16px 60px; }
    .hero-illustration { display: none; }
    .hero-title { font-size: 1.6em; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-cta-secondary { text-align: center; }
    .trust-inner { flex-direction: column; gap: 16px; }
    .trust-divider { width: 60px; height: 1px; }
    .features-section, .how-section, .cta-section, .compare-section { padding: 40px 16px 60px; }
    .plans-cards { padding: 24px 16px 40px; }
    .faq-body { padding: 24px 16px 60px; }
    .plans-hero, .faq-hero { padding: 40px 16px; }
    .faq-categories { gap: 6px; }
    .faq-cat-btn { padding: 6px 14px; font-size: 0.82em; }
    .landing-footer-inner { grid-template-columns: 1fr; gap: 24px; }
}

/* ================================================================ */
/*  AUTH PAGE — split-screen (left: dark navy / right: white form)   */
/* ================================================================ */
.auth-page {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000;
    display: flex;
    animation: authFadeIn 0.3s ease;
}
@keyframes authFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- Right panel top bar (same right-edge position as landing page nav) ---- */
.auth-right-top {
    position: absolute; top: 0; left: 0; right: 0; z-index: 5;
    display: flex; align-items: center; justify-content: flex-end;
    height: 60px;
    /* Use the right panel's rendered width so browser scrollbars cannot shift
       this group away from the landing navigation's 1200px container edge. */
    padding-right: max(32px, calc(100% - 568px));
}
@media (max-width: 720px) {
    .auth-right-top { padding-right: 16px; }
    .auth-right-top .landing-nav-links { display: none; }
}

/* ---- Left panel ---- */
.auth-left {
    width: 50%; min-height: 100vh;
    background: linear-gradient(170deg, #060e1f 0%, #0b1e3d 50%, #0f2a52 100%);
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.auth-left-inner {
    position: relative; z-index: 2;
    padding: 60px 48px;
    display: flex; flex-direction: column;
}
.auth-left-logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: #fff; font-weight: 800; font-size: 1.2em;
    margin-bottom: 48px;
}
.auth-logo-icon {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff; border-radius: 10px; font-size: 0.85em;
}
.auth-left-content { margin-bottom: 48px; }
.auth-left-title {
    font-size: 2em; font-weight: 800; color: #fff; margin: 0 0 16px;
    line-height: 1.3;
}
.auth-left-desc {
    font-size: 1em; color: rgba(255,255,255,0.55); line-height: 1.8; margin: 0;
}
.auth-left-footer {
    font-size: 0.82em; color: rgba(255,255,255,0.25); margin-top: auto;
}

/* Abstract art on left */
.auth-left-art { position: absolute; bottom: 0; left: 0; right: 0; height: 50%; z-index: 1; }
.auth-art-circle {
    position: absolute; width: 240px; height: 240px;
    background: radial-gradient(circle, rgba(37,99,235,0.2) 0%, transparent 70%);
    border-radius: 50%; bottom: 60px; left: -60px;
}
.auth-art-rect {
    position: absolute; width: 140px; height: 140px;
    background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(96,165,250,0.04));
    border-radius: 20px; bottom: 100px; right: 40px;
    transform: rotate(10deg);
}
.auth-art-dots {
    position: absolute; width: 100px; height: 100px;
    background-image: radial-gradient(rgba(255,255,255,0.08) 2px, transparent 2px);
    background-size: 14px 14px; bottom: 200px; right: 100px;
}
.auth-art-ring {
    position: absolute; width: 160px; height: 160px;
    border: 1.5px solid rgba(255,255,255,0.06); border-radius: 50%;
    bottom: 20px; right: 120px;
}

/* ---- Right panel ---- */
.auth-right {
    width: 50%; min-height: 100vh;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.auth-right-inner {
    width: 100%; max-width: 400px; padding: 80px 40px;
}
.auth-form-title {
    font-size: 1.6em; font-weight: 800; color: #0f172a; margin: 0 0 8px;
}
.auth-form-sub {
    font-size: 0.95em; color: #64748b; margin: 0 0 32px;
}
.auth-form-group { margin-bottom: 20px; }
.auth-form-group label {
    display: block; font-size: 0.85em; font-weight: 600; color: #334155; margin-bottom: 8px;
}
.auth-form-group input {
    width: 100%; padding: 12px 16px;
    border: 1.5px solid #e2e8f0; border-radius: 10px;
    font-size: 0.95em; color: #0f172a;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafbfc;
}
.auth-form-group input:focus {
    outline: none; border-color: #2563eb; background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.auth-form-group input::placeholder { color: #94a3b8; }

/* Submit button */
.auth-submit-btn {
    width: 100%; padding: 13px; margin-top: 8px;
    border: none; border-radius: 10px;
    background: #2563eb; color: #fff;
    font-size: 1em; font-weight: 700; cursor: pointer;
    transition: all 0.2s; box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}
.auth-submit-btn:hover { background: #1d4ed8; transform: translateY(-1px); }
.auth-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Google sign-in */
.auth-divider {
    display: flex; align-items: center; gap: 12px; margin: 20px 0;
    color: #94a3b8; font-size: 0.82em;
}
.auth-divider::before, .auth-divider::after {
    content: ''; height: 1px; flex: 1; background: #e2e8f0;
}
.auth-divider[hidden], .auth-google-btn[hidden] { display: none; }
.auth-google-btn {
    width: 100%; height: 46px; display: flex; align-items: center; justify-content: center; gap: 11px;
    padding: 0 16px; border: 1px solid #d7dee8; border-radius: 8px;
    background: #fff; color: #263548; font-size: 0.95em; font-weight: 600; cursor: pointer;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.auth-google-btn:hover { border-color: #b7c2d0; background: #f8fafc; box-shadow: 0 2px 6px rgba(15,23,42,0.07); }
.auth-google-btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.auth-google-mark {
    width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
    color: #4285f4; font-family: Arial, sans-serif; font-size: 18px; font-weight: 700;
}

/* Switch row */
.auth-switch-row {
    text-align: center; margin-top: 20px;
    font-size: 0.9em; color: #64748b;
}
.auth-switch-link {
    background: none; border: none; color: #2563eb; cursor: pointer;
    font-size: 0.9em; font-weight: 600; text-decoration: none; margin-left: 6px;
    transition: color 0.2s;
}
.auth-switch-link:hover { color: #1d4ed8; }

/* Message */
.auth-message {
    padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 0.88em;
}
.auth-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.auth-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ---- Responsive: stack vertically on mobile ---- */
@media (max-width: 720px) {
    .auth-page { flex-direction: column; }
    .auth-left {
        width: 100%; min-height: auto; padding: 40px 24px 32px;
    }
    .auth-left-inner { padding: 0; }
    .auth-left-logo { margin-bottom: 20px; }
    .auth-left-content { margin-bottom: 0; }
    .auth-left-title { font-size: 1.4em; }
    .auth-left-desc { font-size: 0.9em; }
    .auth-left-art { display: none; }
    .auth-left-footer { display: none; }
    .auth-right { width: 100%; min-height: auto; }
    .auth-right-inner { padding: 32px 24px; max-width: 100%; }
}

/* Sidebar footer / logout */
.sidebar-footer {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: auto;
}
.sidebar-footer .nav-item {
    margin-bottom: 0;
}
.btn-logout {
    width: 100%;
    padding: 9px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: #92a5bb;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    transition: background 0.2s;
}
.btn-logout:hover {
    background: rgba(48,121,241,0.18);
    color: white;
}

/* === App Layout === */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: #f5f7fa;
}

/* === Left Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    flex-shrink: 0;
    background: #071a32;
    color: white;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 10;
}

.sidebar-brand {
    height: 76px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-brand .brand-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #3183ff, #1758ce);
    color: #fff;
    font-weight: 900;
    font-size: 17px;
}

.sidebar-brand strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.sidebar-brand small {
    display: block;
    margin-top: 3px;
    color: #6f86a2;
    font-size: 9px;
    letter-spacing: 0.12em;
}

.sidebar-brand h2::after { display: none; }

.sidebar-nav {
    flex: 1;
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 5px;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: #8ea1b8;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    border-radius: 9px;
}

.nav-item:hover {
    background: rgba(48,121,241,0.18);
    color: #fff;
}

.nav-item.active {
    background: rgba(48,121,241,0.18);
    color: #fff;
    font-weight: 400;
    box-shadow: inset 3px 0 #3b82f6;
}

.nav-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* === Right Content Area === */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 28px 36px 40px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* === Account settings === */
.settings-page { width: 100%; max-width: 1120px; color: #24364e; }
.settings-page-heading { margin-bottom: 22px; }
.settings-page-heading h2 { margin: 0 0 7px; padding: 0; border: 0; color: #17345b; font-size: 1.55rem; }
.settings-page-heading h2::after { display: none; }
.settings-page-heading p { margin: 0; color: #7a899c; font-size: .88rem; }
.settings-grid { display: grid; grid-template-columns: minmax(280px, .82fr) minmax(420px, 1.18fr); gap: 18px; align-items: stretch; }
.settings-card {
    overflow: hidden;
    border: 1px solid #dfe7f1;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(28, 54, 91, .045);
}
.settings-card-header { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 15px 18px; border-bottom: 1px solid #e8edf4; background: #fbfcfe; }
.settings-card-header h3,.settings-card-danger h3 { margin: 0 0 4px; color: #293d57; font-size: .98rem; }
.settings-card-header p,.settings-card-danger p { margin: 0; color: #8896a8; font-size: .78rem; }
.settings-card-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: 10px; background: #e8f1ff; color: #2769c8;
    font-size: .78rem; font-weight: 800;
}
.settings-card-body { padding: 20px; }
.settings-profile-card .settings-card-body { display: flex; align-items: center; gap: 15px; min-height: 190px; }
.settings-avatar {
    display: flex; align-items: center; justify-content: center;
    width: 58px; height: 58px; flex: 0 0 58px;
    border-radius: 16px; background: linear-gradient(135deg, #347bea, #1d5dce);
    color: #fff; font-size: 1.35rem; font-weight: 850;
    box-shadow: 0 7px 16px rgba(37, 99, 235, .18);
}
.settings-account-copy { min-width: 0; }
.settings-row-label { display: block; margin-bottom: 5px; color: #8a98aa; font-size: .75rem; font-weight: 700; }
.settings-row-value { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: #24364e; font-size: 1.02rem; font-weight: 800; overflow-wrap: anywhere; }
.settings-account-hint { display: block; margin-top: 9px; color: #98a5b5; font-size: .76rem; line-height: 1.55; }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-field label { display: block; margin-bottom: 7px; color: #455970; font-size: .79rem; font-weight: 700; }
.settings-field input {
    width: 100%; height: 42px; padding: 0 12px;
    border: 1px solid #d7e0eb; border-radius: 9px;
    background: #fbfcfe; color: #263a52; font: inherit; outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.settings-field input:focus { border-color: #6d9fe8; background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.settings-field-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; min-height: 40px; }
.settings-save-btn { min-width: 112px; border-radius: 8px; padding: 9px 16px; }
.settings-msg { min-width: 0; font-size: .8rem; }
.settings-card-danger {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    margin-top: 18px; padding: 17px 20px;
    border-color: #f0dada; background: #fffafa;
}
.settings-danger-copy { display: flex; align-items: center; gap: 12px; }
.settings-card-danger .settings-card-icon { background: #fff0f0; color: #bc4141; }
.settings-logout-btn {
    flex: 0 0 auto; min-width: 92px; padding: 9px 15px;
    border: 1px solid #e7bcbc; border-radius: 8px;
    background: #fff; color: #bb3b3b; font: inherit; font-size: .82rem; font-weight: 750; cursor: pointer;
}
.settings-logout-btn:hover { background: #fff1f1; border-color: #d99494; }
.settings-page .admin-badge { display: inline-flex; padding: 3px 7px; border-radius: 999px; background: #eeeafe; color: #6941c6; font-size: .65rem; }

@media (max-width: 900px) {
    .settings-grid { grid-template-columns: 1fr; }
    .settings-profile-card .settings-card-body { min-height: 140px; }
}
@media (max-width: 560px) {
    .settings-form { grid-template-columns: 1fr; }
    .settings-field-actions { grid-column: 1; align-items: flex-start; flex-direction: column; }
    .settings-card-danger { align-items: flex-start; flex-direction: column; }
    .settings-logout-btn { width: 100%; }
}

/* === Company Management === */
.company-management-page {
    width: 100%;
    max-width: 1320px;
    color: #172033;
}

.company-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.company-page-heading h2 {
    margin: 0 0 4px;
    padding: 0;
    border: none;
    color: #12213a;
    font-size: 1.45em;
    line-height: 1.25;
}

.company-page-heading h2::after { display: none; }
.company-page-heading p { margin: 0; color: #718096; font-size: 0.88em; }
.company-total { color: #718096; font-size: 0.82em; white-space: nowrap; }

.company-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.company-search {
    width: min(420px, 48%);
    height: 40px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid #d6dfeb;
    border-radius: 6px;
    color: #718096;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.company-search:focus-within {
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.company-search-icon { font-size: 1.25em; line-height: 1; }
.company-search input {
    width: 100%;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: #1a202c;
    font-size: 0.88em;
}
.company-search input::placeholder { color: #a0aec0; }

.company-add-btn,
.company-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid #1667d9;
    border-radius: 6px;
    background: #1667d9;
    color: #fff;
    font-size: 0.86em;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(22, 103, 217, 0.16);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.company-add-btn:hover,
.company-btn-primary:hover { background: #0f58bf; border-color: #0f58bf; box-shadow: 0 5px 14px rgba(22, 103, 217, 0.22); }
.company-add-btn:disabled,
.company-btn-primary:disabled { opacity: 0.62; cursor: default; box-shadow: none; }

.company-accordion-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.company-accordion {
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.company-accordion:hover { border-color: #c5d3e4; }
.company-accordion.is-expanded {
    border-color: #c7d8ec;
    box-shadow: 0 5px 16px rgba(27, 47, 75, 0.055);
}

.company-accordion-header {
    min-height: 54px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 0 14px 0 10px;
}

.company-toggle {
    min-width: 0;
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: none;
    background: transparent;
    color: #172033;
    text-align: left;
    cursor: pointer;
}

.company-chevron {
    width: 18px;
    color: #53657d;
    font-size: 1.45em;
    line-height: 1;
    transform-origin: center;
    transition: transform 0.15s;
}
.company-accordion.is-expanded .company-chevron { transform: rotate(90deg); }

.company-building-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd8e8;
    border-radius: 5px;
    color: #1b4f8c;
    background: #f7faff;
    font-size: 0.88em;
    flex-shrink: 0;
}

.company-heading-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95em;
    font-weight: 700;
}

.company-heading-meta {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #718096;
    font-size: 0.78em;
    white-space: nowrap;
}

.company-row-action {
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid #ccd8e6;
    border-radius: 5px;
    background: #fff;
    color: #1769d2;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.company-row-action:hover { background: #f4f8fd; border-color: #9fb9d8; }
.company-danger-action { color: #b83232; }
.company-danger-action:hover { background: #fff5f5; border-color: #e4a9a9; }

.company-icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid #d5deea;
    border-radius: 5px;
    background: #fff;
    color: #53657d;
    font-size: 1.2em;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.company-icon-btn:hover { background: #f5f8fc; border-color: #b7c6d8; color: #20344f; }
.company-delete-icon:hover { background: #fff5f5; border-color: #f0b8b8; color: #c53030; }

.company-accordion-body {
    margin: 0 12px 12px;
    padding: 18px 18px 12px;
    border-top: 1px solid #e4eaf2;
}

.company-section-heading {
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}
.company-section-heading h3 {
    margin: 0;
    color: #23344d;
    font-size: 0.88em;
    font-weight: 750;
}
.company-section-heading h3 span,
.company-section-heading > span { color: #8290a3; font-size: 0.82em; font-weight: 500; }

.company-basic-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.75fr 0.85fr 1.45fr 0.9fr;
    border: 1px solid #dce5ef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 16px;
}

.company-basic-field {
    min-width: 0;
    min-height: 64px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 10px 13px;
    border-right: 1px solid #e5ebf2;
}
.company-basic-field:last-child { border-right: none; }
.company-basic-field > span { color: #7a899c; font-size: 0.72em; }
.company-basic-field > strong {
    color: #263952;
    font-size: 0.82em;
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.company-product-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.company-product-row {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(170px, 0.9fr) minmax(260px, 1.8fr) minmax(210px, 1fr) auto;
    align-items: stretch;
    border: 1px solid #dde5ee;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.company-product-name,
.company-product-description,
.company-product-attachment,
.company-product-actions {
    min-width: 0;
    padding: 12px 14px;
    border-right: 1px solid #e7ecf2;
}
.company-product-name { display: flex; align-items: flex-start; gap: 9px; }
.company-product-name strong { color: #23344d; font-size: 0.84em; line-height: 1.5; overflow-wrap: anywhere; }
.company-product-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #2b5f9b;
    border: 1px solid #d5e0ec;
    border-radius: 4px;
    background: #f7faff;
}
.company-product-description > span,
.company-product-attachment > span { display: block; color: #8290a3; font-size: 0.7em; margin-bottom: 4px; }
.company-product-description p {
    margin: 0;
    color: #4d5f75;
    font-size: 0.76em;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.company-product-attachment { display: flex; flex-direction: column; justify-content: center; }
.company-product-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    border-right: none;
}

.company-file-link {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 0;
    border: none;
    background: transparent;
    color: #1769d2;
    font-size: 0.74em;
    cursor: pointer;
    text-align: left;
}
.company-file-link:hover .company-file-name { text-decoration: underline; }
.company-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-file-link > span:last-child { color: #8a98aa; }
.company-no-file { color: #a0aec0; font-size: 0.75em; }

.company-product-empty {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e1e7ef;
    border-radius: 6px;
    color: #93a0b0;
    font-size: 0.8em;
}

.company-add-product {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 9px;
    border: 1px dashed #aec6e3;
    border-radius: 5px;
    background: #fbfdff;
    color: #1769d2;
    font-size: 0.8em;
    font-weight: 650;
    cursor: pointer;
}
.company-add-product:hover { background: #f3f8fe; border-color: #78a5d8; }

.company-empty-state {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 28px;
    border: 1px dashed #cbd8e7;
    border-radius: 6px;
    background: rgba(255,255,255,0.7);
    color: #8492a5;
    font-size: 0.84em;
    text-align: center;
}
.company-empty-state strong { color: #40536c; font-size: 1.05em; }
.company-empty-state.is-error { color: #c53030; border-color: #efc0c0; background: #fffafa; }
.company-empty-icon { font-size: 1.65em; color: #3b6fa8; }

.company-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 18px;
    color: #7a899c;
    font-size: 0.78em;
}
.company-pagination[hidden] { display: none; }
.company-page-controls { display: flex; align-items: center; gap: 9px; }
.company-page-controls strong { min-width: 48px; text-align: center; color: #40536c; font-weight: 600; }
.company-page-controls button {
    width: 32px;
    height: 32px;
    border: 1px solid #d4deea;
    border-radius: 5px;
    background: #fff;
    color: #40536c;
    font-size: 1.2em;
    cursor: pointer;
}
.company-page-controls button:disabled { opacity: 0.4; cursor: default; }

body.company-modal-open { overflow: hidden; }
.company-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(7, 18, 34, 0.48);
    backdrop-filter: blur(2px);
}
.company-modal-backdrop[hidden] { display: none; }

.company-modal {
    width: min(680px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #d6dfeb;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 64px rgba(6, 22, 45, 0.24);
}
.company-product-modal { width: min(620px, calc(100vw - 48px)); }

.company-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid #e4eaf1;
}
.company-modal-header h3 { margin: 0 0 3px; color: #16263e; font-size: 1.08em; }
.company-modal-header p { margin: 0; color: #8492a5; font-size: 0.78em; }

.company-modal-body {
    min-height: 0;
    overflow-y: auto;
    padding: 20px 22px 0;
}
.company-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.company-form-field { min-width: 0; }
.company-form-wide { grid-column: span 1; }
.company-form-full { grid-column: 1 / -1; }
.company-form-field label {
    display: block;
    margin-bottom: 6px;
    color: #34465e;
    font-size: 0.78em;
    font-weight: 650;
}
.company-form-field input:not([type="file"]):not([type="checkbox"]),
.company-form-field textarea {
    width: 100%;
    border: 1px solid #d6dfeb;
    border-radius: 6px;
    background: #fbfcfe;
    color: #1f3048;
    font: inherit;
    font-size: 0.86em;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.company-form-field input:not([type="file"]):not([type="checkbox"]) { height: 40px; padding: 0 11px; }
.company-form-field textarea { padding: 10px 11px; resize: vertical; line-height: 1.55; }
.company-form-field input:focus,
.company-form-field textarea:focus { border-color: #3182ce; background: #fff; box-shadow: 0 0 0 3px rgba(49,130,206,0.1); }
.company-form-field input::placeholder,
.company-form-field textarea::placeholder { color: #a6b0bd; }

.company-file-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #d6dfeb;
    border-radius: 6px;
    background: #fbfcfe;
}
.company-file-field input { min-width: 0; flex: 1; color: #40536c; font-size: 0.8em; }
.company-file-field > span { flex-shrink: 0; color: #8a98aa; font-size: 0.72em; }
.company-current-file { margin-top: 8px; color: #50647d; font-size: 0.76em; overflow-wrap: anywhere; }
.company-current-file[hidden],
.company-remove-file[hidden] { display: none; }
.company-remove-file { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: #9b2c2c; font-size: 0.76em; cursor: pointer; }

.company-form-message { min-height: 22px; padding-top: 7px; color: #276749; font-size: 0.78em; }
.company-form-message.is-error { color: #c53030; }
.company-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin: 0 -22px;
    padding: 14px 22px 18px;
    border-top: 1px solid #e8edf3;
    background: #fafbfd;
}
.company-btn-secondary {
    min-height: 40px;
    padding: 0 17px;
    border: 1px solid #cbd6e3;
    border-radius: 6px;
    background: #fff;
    color: #40536c;
    font-size: 0.84em;
    font-weight: 600;
    cursor: pointer;
}
.company-btn-secondary:hover { background: #f5f8fc; }

.company-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1400;
    max-width: 360px;
    padding: 11px 15px;
    border: 1px solid #a8d5ba;
    border-radius: 6px;
    background: #f0fff4;
    color: #276749;
    box-shadow: 0 10px 28px rgba(17, 52, 37, 0.15);
    font-size: 0.84em;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.18s, transform 0.18s;
}
.company-toast.is-visible { opacity: 1; transform: translateY(0); }
.company-toast.is-error { border-color: #efb5b5; background: #fff5f5; color: #c53030; }

/* === Progress === */
.progress-bar {
    height: 8px;
    background: rgba(226, 232, 240, 0.85);
    border-radius: 999px;
    margin-bottom: 14px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2b6cb0, #63b3ed);
    border-radius: 999px;
    transition: width 0.4s ease;
    width: 14%;
}

/* === Deck Profile Management === */
.deck-profile-page {
    max-width: 1280px;
}

.deck-profile-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.deck-profile-list-panel,
.deck-profile-editor-panel {
    min-width: 0;
}

.deck-upload-card,
.deck-empty-state,
.deck-editor {
    background: #fff;
    border: 1px solid #dbe4ef;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.deck-upload-card {
    padding: 18px;
    margin-bottom: 18px;
}

.deck-upload-card h3,
.deck-profile-list-head h3,
.deck-editor h3 {
    font-size: 1.05em;
    color: #1a365d;
    margin-bottom: 12px;
}

.deck-upload-box {
    margin-bottom: 14px;
}

.deck-full-btn {
    width: 100%;
}

.deck-status {
    min-height: 22px;
    margin-top: 10px;
    color: #4a5568;
    font-size: 0.9em;
}

.deck-profile-list-head {
    margin-bottom: 10px;
}

.deck-profile-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.deck-profile-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
    background: #fff;
    border: 1px solid #dbe4ef;
    border-radius: 8px;
    overflow: hidden;
}

.deck-profile-item.active {
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.12);
}

.deck-profile-main {
    min-width: 0;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 14px;
    cursor: pointer;
}

.deck-profile-main:hover {
    background: #f7fafc;
}

.deck-profile-name,
.deck-profile-meta {
    display: block;
}

.deck-profile-name {
    font-weight: 700;
    color: #1a365d;
    overflow-wrap: anywhere;
}

.deck-profile-meta {
    color: #718096;
    font-size: 0.86em;
    margin-top: 4px;
}

.deck-profile-delete {
    border: 0;
    border-left: 1px solid #edf2f7;
    background: #fff5f5;
    color: #c53030;
    padding: 0 12px;
    cursor: pointer;
    font-size: 0.86em;
}

.deck-profile-delete:hover {
    background: #fed7d7;
}

.deck-empty-state {
    padding: 40px 24px;
    color: #718096;
    text-align: center;
}

.deck-editor {
    padding: 20px;
}

.deck-editor-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.deck-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

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

.deck-slide-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px;
    align-items: end;
}

.deck-slide-range label {
    grid-column: 1 / -1;
}

.deck-section-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}

.deck-section-card {
    border: 1px solid #dbe4ef;
    border-radius: 8px;
    padding: 16px;
    background: #f8fafc;
}

.deck-section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.deck-section-tools {
    display: flex;
    gap: 6px;
}

.deck-section-tools button {
    border: 1px solid #cbd5e0;
    background: #fff;
    color: #4a5568;
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
}

.deck-section-tools button:hover {
    background: #edf2f7;
}

.deck-required-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4a5568;
    font-size: 0.92em;
}

/* === Presentation template workspace === */
.deck-profile-page { max-width: 1440px; margin: 0 auto; }
.deck-page-header { display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:22px;padding:22px 24px;border:1px solid #e0e8f2;border-radius:15px;background:linear-gradient(135deg,#fff 0%,#f6f9ff 100%);box-shadow:0 6px 20px rgba(26,54,93,.05); }
.deck-page-title-wrap { display:flex;align-items:center;gap:16px;min-width:0; }
.deck-page-icon { width:48px;height:48px;display:grid;place-items:center;flex:0 0 48px;border-radius:13px;background:linear-gradient(135deg,#2879ef,#185dcc);color:#fff;font-weight:900;box-shadow:0 8px 18px rgba(31,105,219,.22); }
.deck-page-header h2 { margin:0 0 5px;padding:0;border:0;color:#152844;font-size:1.45rem; }
.deck-page-header h2::after { display:none; }
.deck-page-header p { margin:0;color:#728299;font-size:.88rem;line-height:1.55; }
.deck-refresh-btn { flex:0 0 auto;padding:9px 14px;border:1px solid #cbd8e9;border-radius:8px;background:#fff;color:#526985;font-weight:700;cursor:pointer; }
.deck-refresh-btn:hover { border-color:#2b72df;color:#1e66d2;background:#f5f9ff; }
.deck-profile-layout { grid-template-columns:minmax(310px,360px) minmax(0,1fr);gap:22px; }
.deck-upload-card,.deck-empty-state,.deck-editor { border-color:#dfe7f1;border-radius:14px;box-shadow:0 6px 22px rgba(20,43,78,.055); }
.deck-upload-card { margin-bottom:20px;padding:20px; }
.deck-card-heading { display:flex;align-items:center;gap:11px;margin-bottom:20px; }
.deck-card-heading>span { width:38px;height:38px;display:grid;place-items:center;flex:0 0 38px;border-radius:10px;background:#e9f2ff;color:#1769d4;font-size:.74rem;font-weight:900; }
.deck-card-heading h3 { margin:0 0 3px;color:#172b48;font-size:1rem; }
.deck-card-heading p { margin:0;color:#8492a5;font-size:.76rem;line-height:1.45; }
.deck-upload-card .form-group { margin-bottom:14px; }
.deck-upload-card .form-group label { color:#40536e;font-size:.8rem;font-weight:750; }
.deck-upload-card .form-group input { border-radius:8px;background:#fbfcfe; }
.deck-upload-card .deck-upload-box { min-height:144px;margin-bottom:14px;border:1.5px dashed #b9c9dd;border-radius:11px;background:#f8fbff; }
.deck-upload-card .deck-upload-box:hover { border-color:#2d75df;background:#f1f7ff; }
.deck-upload-card .quick-upload-icon { width:34px;height:34px;display:grid;place-items:center;border-radius:9px;background:#e5efff;color:#1769d4;font-size:1rem; }
.deck-upload-card .deck-full-btn { border-radius:8px;box-shadow:0 5px 14px rgba(37,99,235,.2); }
.deck-status { min-height:0;margin-top:10px;padding:0;color:#47719f;font-size:.8rem;line-height:1.5; }
.deck-status:empty { display:none; }
.deck-profile-list-head { display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin:0 2px 11px; }
.deck-profile-list-head h3 { margin:0 0 3px;color:#172b48;font-size:1rem; }
.deck-profile-list-head p { margin:0;color:#8997a9;font-size:.74rem; }
.deck-template-count { flex:0 0 auto;padding:4px 8px;border-radius:999px;background:#eaf2ff;color:#2468c8;font-size:.7rem;font-weight:800; }
.deck-profile-list { gap:9px; }
.deck-profile-item { border-color:#dfe7f1;border-radius:11px;box-shadow:0 3px 10px rgba(20,43,78,.035);transition:border-color .2s,box-shadow .2s,transform .2s; }
.deck-profile-item:hover { transform:translateY(-1px);border-color:#a9c4e7;box-shadow:0 7px 18px rgba(20,43,78,.07); }
.deck-profile-item.active { border-color:#2b72df;box-shadow:0 0 0 3px rgba(43,114,223,.11); }
.deck-profile-main { display:flex;align-items:center;gap:11px;padding:13px 14px; }
.deck-profile-icon { width:34px;height:34px;display:grid;place-items:center;flex:0 0 34px;border-radius:9px;background:#eef4fc;color:#53769f; }
.deck-profile-item.active .deck-profile-icon { background:#e5efff;color:#1769d4; }
.deck-profile-copy { min-width:0; }
.deck-profile-name { color:#203552;font-size:.88rem; }
.deck-profile-meta { color:#8492a5;font-size:.75rem; }
.deck-profile-delete { padding:0 11px;background:#fff;color:#a66a6a; }
.deck-profile-delete:hover { background:#fff1f1;color:#bd3131; }
.deck-list-empty { padding:30px 18px;border:1px dashed #cfdbe9;border-radius:11px;background:#fbfcfe;text-align:center;color:#8997a9; }
.deck-list-empty span,.deck-list-empty strong,.deck-list-empty p { display:block; }
.deck-list-empty span { margin-bottom:8px;font-size:1.5rem;color:#8ba7ca; }
.deck-list-empty strong { color:#53657d;font-size:.86rem; }
.deck-list-empty p { margin:5px 0 0;font-size:.74rem; }
.deck-empty-state { min-height:420px;display:flex;align-items:center;justify-content:center;flex-direction:column;padding:48px 28px;background:linear-gradient(180deg,#fff,#fafcff); }
.deck-empty-icon { width:64px;height:64px;display:grid;place-items:center;margin-bottom:16px;border-radius:18px;background:#edf4ff;color:#3978cb;font-size:1.8rem; }
.deck-empty-state strong { color:#263d5c;font-size:1.05rem; }
.deck-empty-state p { max-width:430px;margin:8px 0 0;color:#8492a5;line-height:1.65;font-size:.84rem; }
.deck-editor { padding:24px;background:#fff; }
.deck-editor-header { margin:-24px -24px 22px;padding:20px 24px;border-bottom:1px solid #e8edf4;background:#fbfcfe;border-radius:14px 14px 0 0; }
.deck-editor-header h3 { margin:0 0 4px;color:#182d4b;font-size:1.1rem; }
.deck-editor-actions button { min-height:36px;border-radius:8px; }
.deck-grid { gap:14px 16px; }
.deck-editor .form-group label { color:#435670;font-size:.8rem;font-weight:750; }
.deck-editor .form-group input,.deck-editor .form-group textarea { border-color:#d6e0ec;border-radius:8px;background:#fbfcfe; }
.deck-section-list { gap:12px;margin-top:22px; }
.deck-section-card { padding:17px;border-color:#dfe7f1;border-radius:11px;background:#fbfcfe; }
.deck-section-head strong { display:inline-flex;align-items:center;padding:5px 9px;border-radius:7px;background:#e8f1ff;color:#2468c8;font-size:.78rem; }
.deck-section-tools button { border-color:#d4deea;border-radius:7px;color:#60738c;font-size:.75rem; }

@media(max-width:760px){.deck-page-header{align-items:flex-start;flex-direction:column}.deck-refresh-btn{align-self:flex-end}.deck-grid{grid-template-columns:1fr}.deck-slide-range{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)}}
.step-indicators {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 22px;
}
.step-dot {
    font-size: 0.78em;
    color: #718096;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    flex: 1;
    padding: 8px 6px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(203, 213, 224, 0.75);
    border-radius: 999px;
    white-space: nowrap;
}
.step-dot.active {
    color: white;
    background: linear-gradient(135deg, #2b6cb0, #4299e1);
    border-color: transparent;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(49, 130, 206, 0.25);
}
.step-dot.done {
    color: #276749;
    background: #f0fff4;
    border-color: #9ae6b4;
    font-weight: 600;
}

/* === Form steps === */
.form-step {
    display: none;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px 30px 30px;
    box-shadow: 0 8px 24px rgba(26, 54, 93, 0.06);
}
.form-step.active { display: block; }

h2 {
    font-size: 1.45em;
    color: #1a365d;
    margin-bottom: 22px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}
h2::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 64px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, #3182ce, #90cdf4);
}
h3 {
    font-size: 1.05em;
    color: #1a365d;
    margin: 24px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
h3::before {
    content: "";
    width: 4px;
    height: 16px;
    border-radius: 999px;
    background: #3182ce;
}
h4 { font-size: 0.92em; color: #4a5568; margin: 10px 0 6px; }

.form-row { display: flex; gap: 14px; margin-bottom: 14px; }
.form-row.three-col > * { flex: 1; }
.form-row.four-col > * { flex: 1; }
.form-group { flex: 1; display: flex; flex-direction: column; }
.form-group label { font-size: 0.84em; color: #2d3748; margin-bottom: 5px; font-weight: 650; }
.form-group label .required { color: #e53e3e; }

input[type="text"],
input[type="number"],
textarea,
select {
    padding: 10px 12px;
    border: 1px solid #d5dee9;
    border-radius: 10px;
    font-size: 0.93em;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
    width: 100%;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49,130,206,0.12), 0 6px 16px rgba(15, 23, 42, 0.04);
}
input:hover, textarea:hover, select:hover { border-color: #a8bfd8; }
textarea { resize: vertical; min-height: 82px; }
select { cursor: pointer; }

.date-row { display: flex; align-items: center; gap: 6px; }
.date-row input { width: 88px; flex: none; }
.date-row select { width: 84px; flex: none; }
.date-row span { color: #718096; font-weight: 600; font-size: 0.9em; }

.range-row { display: flex; align-items: center; gap: 6px; }
.range-row input { min-width: 0; }
.range-row span { color: #718096; font-weight: 700; }

.hint {
    font-size: 0.85em;
    color: #5f6f84;
    margin-bottom: 12px;
    background: #f7fafc;
    border-left: 4px solid #63b3ed;
    border-radius: 8px;
    padding: 8px 12px;
}

/* === Products / Members / Schedule === */
.product-item, .member-item, .schedule-item {
    background: #f9fbfe;
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.04);
}

.year-data-grid {
    display: grid;
    grid-template-columns: 100px repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 6px;
    align-items: flex-start;
}
.year-data {
    display: grid;
    grid-template-rows: 18px repeat(3, 38px);
    gap: 3px;
    min-width: 0;
}
.year-data input { font-size: 0.83em; }
.year-label {
    display: flex;
    align-items: center;
    min-height: 18px;
    font-size: 0.78em;
    color: #718096;
    font-weight: 600;
}
.field-label-column {
    display: grid;
    grid-template-rows: 18px repeat(3, 38px);
    gap: 3px;
    min-width: 0;
}
.field-label {
    display: flex;
    align-items: center;
    font-size: 0.8em;
    color: #2d3748;
    font-weight: 600;
    white-space: nowrap;
}
.field-row input { padding-left: 10px; }

.member-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* === Budget table === */
.budget-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 16px;
    background: white;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 20px rgba(26, 54, 93, 0.06);
}
.budget-table th, .budget-table td {
    padding: 10px 10px;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
}
.budget-table th:last-child, .budget-table td:last-child { border-right: none; }
.budget-table tr:last-child td { border-bottom: none; }
.budget-table th {
    background: linear-gradient(180deg, #edf6ff 0%, #e4edf8 100%);
    font-size: 0.83em;
    color: #1a365d;
    font-weight: 700;
}
.budget-table td:first-child { text-align: left; }
.budget-table input {
    width: 100px;
    text-align: right;
    border: 1px solid #d5dee9;
    padding: 6px 8px;
    font-size: 0.88em;
    border-radius: 8px;
}
.budget-table .total-row td { font-weight: bold; background: #f7fafc; }
.budget-table .subtotal-row td { font-weight: 600; background: #f7fafc; }
.budget-table .total-cell { font-weight: 500; color: #2b6cb0; }

/* === Buttons === */
.button-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}
.btn-primary, .btn-secondary, .btn-submit, .btn-add {
    padding: 10px 28px;
    border: none;
    border-radius: 999px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 650;
}
.btn-primary {
    background: linear-gradient(135deg, #2b6cb0, #4299e1);
    color: white;
    box-shadow: 0 8px 16px rgba(49, 130, 206, 0.2);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(49, 130, 206, 0.28); }
.btn-secondary {
    background: white;
    color: #4a5568;
    border: 1px solid #cbd5e0;
}
.btn-secondary:hover { background: #f7fafc; }
.btn-submit {
    background: linear-gradient(135deg, #2f855a, #38a169);
    color: white;
    font-size: 1.05em;
    padding: 12px 40px;
    box-shadow: 0 10px 20px rgba(56, 161, 105, 0.22);
}
.btn-submit:hover { opacity: 0.95; transform: translateY(-1px); }
.btn-submit:disabled { background: #a0aec0; cursor: not-allowed; }
.btn-add {
    background: transparent;
    color: #3182ce;
    border: 1.5px dashed #3182ce;
    padding: 6px 18px;
    font-size: 0.88em;
    margin-top: 6px;
}
.btn-add:hover { background: #ebf8ff; }

/* === Result（居中竖排白卡片，成功/失败同款） === */
.result-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 520px;
    margin: 36px auto 16px;
    padding: 40px 36px 34px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 10px 28px rgba(26, 54, 93, 0.07);
}
.result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 1.9em;
    font-weight: 800;
    margin-bottom: 14px;
}
.result-box.success .result-icon {
    color: white;
    background: linear-gradient(135deg, #2f855a, #48bb78);
    box-shadow: 0 6px 16px rgba(56, 161, 105, 0.35);
}
.result-box.error .result-icon {
    color: white;
    background: linear-gradient(135deg, #c53030, #f56565);
    box-shadow: 0 6px 16px rgba(197, 48, 48, 0.3);
}
.result-box h3 { margin: 0 0 6px; font-size: 1.35em; }
.result-box h3::before { display: none; }
.result-box.success h3 { color: #276749; }
.result-box.error h3 { color: #c53030; }
.result-sub,
.result-box p {
    margin: 0 0 4px;
    color: #718096;
    font-size: 0.92em;
    font-weight: 500;
    line-height: 1.6;
}
.result-box p:empty { display: none; }
.result-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    width: 100%;
}
.result-actions .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 220px;
    padding: 12px 36px;
    font-size: 1em;
    text-decoration: none;
}
.result-actions .btn-secondary {
    min-width: 220px;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3182ce;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 22px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { text-align: center; color: #718096; font-size: 0.95em; }

/* === History Tab === */
.history-management-page {
    width: 100%;
    max-width: 1500px;
    color: #172033;
}
.history-page-heading {
    display: flex;
    align-items: center;
    min-height: 42px;
    margin-bottom: 28px;
}
.history-page-heading h2 {
    margin: 0;
    padding: 0;
    border: 0;
    color: #16263e;
    font-size: 1.35em;
    font-weight: 700;
}
.history-page-heading h2::after { display: none; }

.history-control-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 14px;
    border-bottom: 1px solid #dfe6ef;
}
.history-tabs {
    min-width: 0;
    display: flex;
    align-items: flex-end;
    gap: 4px;
}
.history-tabs button {
    position: relative;
    min-height: 48px;
    padding: 0 15px 11px;
    border: 0;
    background: transparent;
    color: #66768a;
    font: inherit;
    font-size: 0.82em;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
}
.history-tabs button::after {
    content: "";
    position: absolute;
    right: 8px;
    bottom: -1px;
    left: 8px;
    height: 3px;
    border-radius: 2px 2px 0 0;
    background: transparent;
}
.history-tabs button:hover { color: #1769d2; }
.history-tabs button.active { color: #1769d2; }
.history-tabs button.active::after { background: #1769d2; }
.history-tabs button span { margin-left: 3px; font-weight: 600; }
.history-tabs button span::before { content: "("; }
.history-tabs button span::after { content: ")"; }

.history-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
}
.history-search-box {
    width: min(310px, 25vw);
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid #d5deea;
    border-radius: 6px;
    background: #fff;
    color: #7b8ca3;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.history-search-box:focus-within {
    border-color: #2779d9;
    box-shadow: 0 0 0 3px rgba(39,121,217,0.1);
}
.history-search-box > span { font-size: 1.2em; line-height: 1; }
.history-search-box input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #263850;
    font: inherit;
    font-size: 0.8em;
}
.history-search-box input::placeholder { color: #9aa8b9; }

.history-filter-wrap { position: relative; }
.history-filter-button,
.history-refresh-button {
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d5deea;
    border-radius: 6px;
    background: #fff;
    color: #40536c;
    font: inherit;
    cursor: pointer;
}
.history-filter-button {
    min-width: 86px;
    gap: 6px;
    padding: 0 12px;
    font-size: 0.8em;
    font-weight: 650;
}
.history-filter-button:hover,
.history-refresh-button:hover { border-color: #9eb4cf; background: #f7faff; }
.history-filter-button.active { border-color: #8eb4df; background: #edf5ff; color: #1769d2; }
.history-filter-icon {
    position: relative;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}
.history-filter-icon::before {
    content: "";
    position: absolute;
    inset: 1px;
    background: currentColor;
    clip-path: polygon(0 0, 100% 0, 62% 48%, 62% 100%, 38% 100%, 38% 48%);
}
.history-filter-count {
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #1769d2;
    color: #fff;
    font-size: 0.72em;
}
.history-filter-count[hidden] { display: none; }
.history-refresh-button { width: 40px; font-size: 1.2em; }
.history-refresh-button:disabled { cursor: default; opacity: 0.55; }
.history-refresh-button.is-loading { animation: history-refresh-spin 0.8s linear infinite; }
@keyframes history-refresh-spin { to { transform: rotate(360deg); } }

.history-filter-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 8px);
    right: 0;
    width: 250px;
    padding: 15px;
    border: 1px solid #d6dfeb;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(13,36,67,0.16);
}
.history-filter-panel[hidden] { display: none; }
.history-filter-panel label { display: block; margin-bottom: 12px; }
.history-filter-panel label > span {
    display: block;
    margin-bottom: 5px;
    color: #50647d;
    font-size: 0.74em;
    font-weight: 650;
}
.history-filter-panel select {
    width: 100%;
    height: 36px;
    padding: 0 9px;
    border: 1px solid #d5deea;
    border-radius: 5px;
    background: #fbfcfe;
    color: #40536c;
    font: inherit;
    font-size: 0.78em;
    outline: 0;
}
.history-filter-panel select:focus { border-color: #2779d9; }
.history-filter-panel > button {
    width: 100%;
    height: 34px;
    border: 1px solid #d5deea;
    border-radius: 5px;
    background: #fff;
    color: #50647d;
    font: inherit;
    font-size: 0.76em;
    cursor: pointer;
}
.history-filter-panel > button:hover { background: #f5f8fc; }

.history-table-shell {
    position: relative;
    border: 1px solid #dbe3ed;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(26,54,93,0.035);
}
.history-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.history-table th {
    height: 48px;
    padding: 0 9px;
    border-bottom: 1px solid #dfe6ef;
    background: #f8fafc;
    color: #52647a;
    font-size: 0.72em;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}
.history-table th:nth-child(1) { width: 4%; text-align: center; }
.history-table th:nth-child(2) { width: 21%; }
.history-table th:nth-child(3) { width: 14%; }
.history-table th:nth-child(4) { width: 9%; }
.history-table th:nth-child(5) { width: 15%; }
.history-table th:nth-child(6) { width: 14%; }
.history-table th:nth-child(7) { width: 9%; }
.history-table th:nth-child(8) { width: 14%; }
.history-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    cursor: pointer;
}
.history-sort-button span { color: #9aa8b9; font-size: 0.95em; }
.history-sort-button.active { color: #263850; }
.history-sort-button.active span { color: #1769d2; }

.history-table td {
    height: 82px;
    padding: 10px 9px;
    border-bottom: 1px solid #e3e9f0;
    color: #354860;
    font-size: 0.76em;
    vertical-align: middle;
}
.history-table tbody tr:last-child td { border-bottom: 0; }
.history-table tbody tr:hover td { background: #fbfdff; }
.history-index-column { color: #718096; text-align: center; }

.history-project-cell { min-width: 0; }
.history-project-cell > strong {
    display: block;
    overflow: hidden;
    color: #1d3048;
    font-size: 1.08em;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-project-cell > div {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-top: 5px;
}
.history-project-cell > div > span:first-child {
    min-width: 0;
    overflow: hidden;
    color: #8a98aa;
    font-size: 0.88em;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-company-name {
    display: block;
    overflow: hidden;
    color: #40536c;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-type-badge {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 7px;
    border-radius: 4px;
    background: #e9f3ff;
    color: #2169bd;
    font-size: 0.88em;
    font-weight: 700;
    white-space: nowrap;
}
.history-updated-cell time,
.history-updated-cell span { display: block; white-space: nowrap; }
.history-updated-cell time { color: #40536c; font-weight: 600; }
.history-updated-cell span { margin-top: 4px; color: #8a98aa; font-size: 0.9em; }

.history-files-cell {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}
.history-file-button,
.history-more-files {
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border-radius: 5px;
    background: #fff;
    font: inherit;
    font-size: 0.88em;
    font-weight: 700;
    cursor: pointer;
}
.history-file-button.pptx { border: 1px solid #b9d1ef; color: #1769d2; }
.history-file-button.pdf { border: 1px solid #efc4c4; color: #cf4d4d; }
.history-file-button:hover { background: #f7faff; }
.history-more-files {
    width: 30px;
    padding: 0;
    border: 1px solid #d5deea;
    color: #52647a;
}
.history-more-files:hover { background: #f4f7fb; }
.history-no-file,
.history-no-action { color: #9aa8b9; font-size: 0.9em; white-space: nowrap; }
.history-version-count { color: #50647d; font-weight: 600; white-space: nowrap; }
.history-version-count.processing { color: #2169bd; }
.history-version-count.failed { color: #c13f3f; }

.history-operation-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
}
.history-edit-button {
    height: 34px;
    min-width: 88px;
    padding: 0 9px;
    border: 1px solid #9fc3ed;
    border-radius: 5px;
    background: #fff;
    color: #1769d2;
    font: inherit;
    font-size: 0.92em;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.history-edit-button:hover { background: #edf5ff; border-color: #77a9e2; }
.history-row-menu { position: relative; flex-shrink: 0; }
.history-row-menu-button {
    width: 28px;
    height: 34px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #52647a;
    font-size: 1.25em;
    cursor: pointer;
}
.history-row-menu-button:hover,
.history-row-menu-button[aria-expanded="true"] { background: #eef3f8; }
.history-row-menu-panel {
    position: absolute;
    z-index: 50;
    top: calc(100% + 4px);
    right: 0;
    width: 116px;
    padding: 5px;
    border: 1px solid #d6dfeb;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(13,36,67,0.16);
}
.history-row-menu-panel[hidden] { display: none; }
.history-row-menu-panel .btn-delete {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #c53030;
    font: inherit;
    font-size: 0.85em;
    text-align: left;
    cursor: pointer;
}
.history-row-menu-panel .btn-delete:hover { background: #fff2f2; }

.history-table-empty {
    min-height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 32px;
    color: #8492a5;
    text-align: center;
}
.history-table-empty[hidden] { display: none; }
.history-table-empty > span { color: #52769f; font-size: 1.8em; }
.history-table-empty strong { color: #40536c; font-size: 0.9em; }
.history-table-empty small { font-size: 0.75em; }
.history-table-empty.is-error { color: #c53030; }

.history-pagination {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 14px;
    border-top: 1px solid #dfe6ef;
    color: #7a899c;
    font-size: 0.72em;
}
.history-pagination[hidden] { display: none; }
.history-pagination-controls,
.history-pagination-controls label,
.history-page-numbers { display: flex; align-items: center; gap: 6px; }
.history-pagination-controls label {
    height: 34px;
    min-width: 138px;
    margin-right: 4px;
    padding: 0 8px;
    border: 1px solid #d5deea;
    border-radius: 5px;
    background: #fff;
    color: #66768a;
    white-space: nowrap;
}
.history-page-size-label > span { white-space: nowrap; }
.history-pagination-controls select {
    border: 0;
    outline: 0;
    background: transparent;
    color: #40536c;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}
.history-pagination-controls button {
    width: 32px;
    height: 32px;
    border: 1px solid #d5deea;
    border-radius: 5px;
    background: #fff;
    color: #50647d;
    font: inherit;
    font-size: 1em;
    cursor: pointer;
}
.history-pagination-controls button:hover:not(:disabled) { border-color: #9eb4cf; background: #f6f9fd; }
.history-pagination-controls button.active { border-color: #1769d2; background: #1769d2; color: #fff; }
.history-pagination-controls button:disabled { opacity: 0.38; cursor: default; }

/* Shared compact heading used by deck profiles and task detail. */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.history-header h2 { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.btn-refresh {
    padding: 6px 16px;
    background: #edf2f7;
    color: #4a5568;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-refresh:hover { background: #e2e8f0; }
.history-empty { color: #a0aec0; text-align: center; padding: 32px; }

/* === Template Management Tab === */
.template-management-page {
    width: 100%;
    max-width: 1500px;
    color: #172033;
}

.template-page-heading {
    display: flex;
    align-items: center;
    min-height: 42px;
    margin-bottom: 22px;
}
.template-page-heading h2 {
    margin: 0;
    color: #16263e;
    font-size: 1.35em;
    font-weight: 700;
}

.template-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}
.template-filter-group,
.template-toolbar-actions,
.template-view-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}

.template-search-box {
    width: min(320px, 30vw);
    height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid #d5deea;
    border-radius: 6px;
    background: #fff;
    color: #7b8ca3;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.template-search-box:focus-within {
    border-color: #2779d9;
    box-shadow: 0 0 0 3px rgba(39,121,217,0.1);
}
.template-search-box > span { font-size: 1.25em; line-height: 1; }
.template-search-box input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #263850;
    font: inherit;
    font-size: 0.84em;
}
.template-search-box input::placeholder { color: #9aa8b9; }

.template-select-wrap { position: relative; display: block; }
.template-control-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}
.template-select-wrap select,
.template-upload-modal select {
    height: 42px;
    min-width: 190px;
    padding: 0 36px 0 12px;
    border: 1px solid #d5deea;
    border-radius: 6px;
    background: #fff;
    color: #40536c;
    font: inherit;
    font-size: 0.82em;
    outline: none;
    cursor: pointer;
}
.template-select-wrap select:focus,
.template-upload-modal select:focus {
    border-color: #2779d9;
    box-shadow: 0 0 0 3px rgba(39,121,217,0.1);
}
.template-sort-wrap select { min-width: 205px; }

.template-upload-button,
.template-icon-button {
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.template-upload-button {
    gap: 7px;
    padding: 0 18px;
    border: 1px solid #1769d2;
    background: #1769d2;
    color: #fff;
    font-size: 0.84em;
    font-weight: 650;
}
.template-upload-button:hover { background: #115ab7; border-color: #115ab7; }
.template-upload-button > span { font-size: 1.15em; }
.template-icon-button {
    width: 42px;
    border: 1px solid #d5deea;
    background: #fff;
    color: #40536c;
    font-size: 1.25em;
}
.template-icon-button:hover { border-color: #9eb4cf; background: #f7faff; }
.template-icon-button:disabled { cursor: default; opacity: 0.55; }
.template-icon-button.is-loading { animation: template-refresh-spin 0.8s linear infinite; }
@keyframes template-refresh-spin { to { transform: rotate(360deg); } }

.template-list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 12px;
}
.template-list-heading h3 {
    margin: 0;
    color: #1b2d45;
    font-size: 1em;
    font-weight: 700;
}
.template-view-switch {
    height: 42px;
    display: flex;
    align-items: stretch;
    border: 1px solid #d5deea;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.template-view-switch button {
    width: 40px;
    border: 0;
    border-right: 1px solid #e1e7ef;
    background: #fff;
    color: #718096;
    font-size: 1.08em;
    cursor: pointer;
}
.template-view-switch button:last-child { border-right: 0; }
.template-view-switch button:hover { background: #f6f9fd; }
.template-view-switch button.active { background: #edf5ff; color: #1769d2; }

.template-list.template-grid-view {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.template-card {
    min-width: 0;
    overflow: hidden;
    background: white;
    border: 1px solid #dbe3ed;
    border-radius: 7px;
    box-shadow: 0 3px 10px rgba(26, 54, 93, 0.035);
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.template-card:hover {
    border-color: #b9c9dc;
    box-shadow: 0 8px 20px rgba(26, 54, 93, 0.085);
    transform: translateY(-1px);
}

.template-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-bottom: 1px solid #e1e7ef;
    background: #f4f7fb;
}
.template-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.template-preview img[hidden],
.template-preview-placeholder[hidden] { display: none; }
.template-preview-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #8ca0b8;
    background: #f4f7fb;
}
.template-preview-placeholder > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 38px;
    border: 1px solid #b9c9dc;
    border-radius: 5px;
    background: #fff;
    color: #4c6d94;
    font-size: 0.78em;
    font-weight: 750;
}
.template-preview-placeholder small { font-size: 0.7em; }
.template-preview.preview-unavailable .template-preview-placeholder { color: #9aa8b9; }

.template-card-body { padding: 13px 14px 12px; }
.template-title-row {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.template-title-row h4 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: #1c2f48;
    font-size: 0.9em;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-download-template {
    min-width: 66px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-shrink: 0;
    padding: 0 9px;
    border: 1px solid #bfd3ec;
    border-radius: 5px;
    background: #fff;
    color: #1769d2;
    font: inherit;
    font-size: 0.73em;
    font-weight: 650;
    cursor: pointer;
}
.btn-download-template:hover { background: #f1f7ff; border-color: #8eb4df; }

.template-card-meta {
    min-height: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 9px;
    color: #8996a7;
    font-size: 0.68em;
}
.template-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    color: #8b98aa;
    font-size: 0.69em;
}
.template-card-footer time { min-width: 0; white-space: nowrap; }
.btn-delete-template {
    padding: 0;
    border: 0;
    background: transparent;
    color: #a46a6a;
    font: inherit;
    font-size: 1em;
    cursor: pointer;
}
.btn-delete-template:hover { color: #c53030; text-decoration: underline; }

.template-list.template-list-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.template-list-view .template-card {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
}
.template-list-view .template-preview {
    height: 140px;
    aspect-ratio: auto;
    border-right: 1px solid #e1e7ef;
    border-bottom: 0;
}
.template-list-view .template-card-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 16px 18px;
}
.template-list-view .template-title-row h4 { font-size: 1em; }
.template-list-view .template-card-meta { margin-top: 12px; }
.template-list-view .template-card-footer { margin-top: 13px; }

.template-empty-state {
    grid-column: 1 / -1;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 0;
    padding: 30px;
    border: 1px dashed #cbd8e7;
    border-radius: 6px;
    color: #8492a5;
    text-align: center;
}
.template-empty-state > span { color: #52769f; font-size: 1.8em; }
.template-empty-state strong { color: #40536c; font-size: 0.9em; }
.template-empty-state small { font-size: 0.75em; }
.template-empty-state.is-error { border-color: #efc0c0; background: #fffafa; color: #c53030; }

.template-upload-modal { width: min(590px, calc(100vw - 48px)); }
.template-upload-modal select { width: 100%; min-width: 0; background: #fbfcfe; font-size: 0.86em; }
.template-file-field { min-height: 54px; }
.template-file-field input { cursor: pointer; }

@media (min-width: 1540px) {
    .template-list.template-grid-view { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
    .template-list.template-grid-view { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .template-toolbar { align-items: flex-start; }
    .template-filter-group { flex-wrap: wrap; }
}

/* === Import Step (Step 0) === */

.step-dot.pre-step {
    background: linear-gradient(135deg, #e8f4fd, #f0f7ff);
    border: 1px dashed #63b3ed;
    color: #2b6cb0;
}
.step-dot.pre-step.active {
    background: linear-gradient(135deg, #2b6cb0, #4299e1);
    color: white;
    border-style: solid;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(49, 130, 206, 0.25);
}
.step-dot.pre-step.done {
    background: #f0fff4;
    border-color: #9ae6b4;
    color: #276749;
    border-style: solid;
}

.import-section { margin-bottom: 20px; }

.drop-zone {
    border: 2px dashed #cbd5e0;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fafcfd;
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: #3182ce;
    background: #ebf8ff;
}
.drop-zone.dragover {
    box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.12);
    transform: scale(1.01);
}
.drop-zone-icon { font-size: 2.5em; margin-bottom: 10px; }
.drop-zone-text { font-size: 1em; color: #2d3748; margin-bottom: 6px; font-weight: 500; }
.drop-zone-text .link-text { color: #3182ce; text-decoration: underline; }
.drop-zone-hint { font-size: 0.82em; color: #a0aec0; }

.import-file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ebf8ff;
    border: 1px solid #90cdf4;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 500;
    color: #2b6cb0;
}
.btn-remove-file {
    background: none; border: none;
    font-size: 1.1em; cursor: pointer;
    color: #e53e3e; padding: 2px 8px;
    border-radius: 50%; transition: background 0.2s;
}
.btn-remove-file:hover { background: #fff5f5; }

.import-divider {
    display: flex; align-items: center; text-align: center;
    margin: 20px 0; color: #a0aec0; font-size: 0.9em;
}
.import-divider::before, .import-divider::after {
    content: ''; flex: 1; border-bottom: 1px solid #e2e8f0;
}
.import-divider span { padding: 0 16px; font-weight: 500; }

.url-input-row { display: flex; gap: 10px; }
.url-input-row input { flex: 1; }

.import-actions { text-align: center; margin: 24px 0 16px; }
.import-actions .btn-primary { min-width: 180px; padding: 12px 36px; font-size: 1em; }

.import-skip { text-align: center; margin-top: 16px; }
.import-skip .btn-link {
    background: none; border: none;
    color: #718096; font-size: 0.9em;
    cursor: pointer; text-decoration: underline;
    transition: color 0.2s;
}
.import-skip .btn-link:hover { color: #2d3748; }

.import-success, .import-error { margin-top: 16px; }

.loading-text {
    text-align: center; color: #718096; margin-top: 12px; font-size: 0.95em;
}

/* === Responsive === */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .sidebar {
        position: relative;
        width: 100%;
        min-width: unset;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
        padding: 0;
    }
    .sidebar-brand { display: none; }
    .sidebar-nav { flex-direction: row; padding: 8px; }
    .nav-item { padding: 10px 14px; white-space: nowrap; font-size: 14px; margin-bottom: 0; }
    .nav-item.active { box-shadow: none; border-bottom: 2px solid #3b82f6; }

    .main-content { margin-left: 0; padding: 16px 12px 28px; }
    .form-row { flex-direction: column; }
    .form-step { padding: 20px 16px 24px; border-radius: 14px; }
    .member-grid { grid-template-columns: 1fr; }
    .step-indicators { font-size: 0.7em; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
    .step-dot { min-width: 100px; }
    .budget-table { display: block; overflow-x: auto; }
    .template-list { grid-template-columns: 1fr; }
}

/* === Form Card (for non-step pages like Quick Gen) === */
.form-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px 30px 30px;
    box-shadow: 0 8px 24px rgba(26, 54, 93, 0.06);
}

/* === Quick Generate Page (3-step) === */
.quick-gen-page {
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== 3-Step Indicator ===== */
.qg3-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    padding: 0;
    gap: 0;
}
.qg3-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    opacity: 0.45;
    transition: opacity 0.3s;
}
.qg3-step.active { opacity: 1; }
.qg3-step.done { opacity: 0.8; }
.qg3-step-num {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9em;
    background: #e2e8f0; color: #94a3b8;
    transition: all 0.3s;
    flex-shrink: 0;
}
.qg3-step.active .qg3-step-num {
    background: #2563eb; color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.qg3-step.done .qg3-step-num {
    background: #16a34a; color: #fff;
}
.qg3-step-text { display: flex; flex-direction: column; line-height: 1.3; }
.qg3-step-label { font-weight: 600; color: #334155; font-size: 0.9em; white-space: nowrap; }
.qg3-step.active .qg3-step-label { color: #0f172a; }
.qg3-connector {
    width: 64px; height: 2px;
    background: #e2e8f0; margin: 0 8px;
    transition: background 0.3s;
    flex-shrink: 0;
}
.qg3-connector.done { background: #16a34a; }
@media (max-width: 600px) {
    .qg3-connector { width: 32px; margin: 0 4px; }
    .qg3-step-label { font-size: 0.78em; }
}

/* ===== Panels ===== */
.qg3-panel { display: none; }
.qg3-panel.active { display: block; }

/* Step 2 keeps the document editor and AI assistant side-by-side. */
#qg3Panel2.active.review-ready {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--ai-panel-w, 340px);
    align-items: stretch;
    gap: 20px;
}
#qg3Panel2.review-ready #sectionReview { grid-column: 1; min-width: 0; }
.ai-edit-panel { display: none; }
#qg3Panel2.review-ready .ai-edit-panel {
    display: flex;
    grid-column: 2;
    flex-direction: column;
    position: fixed;
    top: 112px;
    right: 24px;
    bottom: 24px;
    z-index: 30;
    width: var(--ai-panel-w, 340px);
    height: auto;
    min-height: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid #dfe7f1;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 36, 70, .08);
}
.ai-edit-resizer {
    position: absolute;
    inset: 0 auto 0 -5px;
    width: 10px;
    cursor: col-resize;
}
.ai-edit-head { padding: 18px 20px; border-bottom: 1px solid #edf1f6; }
.ai-edit-title { font-weight: 800; color: #1b2b45; }
.ai-edit-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; background: #fbfcfe; }
.ai-edit-empty { color: #8290a4; line-height: 1.7; font-size: .88rem; }
.ai-edit-input-row { display: flex; gap: 10px; align-items: flex-end; padding: 14px; border-top: 1px solid #edf1f6; background: #fff; }
.ai-edit-input { flex: 1; min-width: 0; resize: none; padding: 10px 12px; border: 1px solid #d7e0ec; border-radius: 9px; font: inherit; }
.ai-edit-send { width: 38px; height: 38px; flex: 0 0 38px; border: 0; border-radius: 50%; background: #1769e8; color: #fff; font-size: 1.15rem; cursor: pointer; }
.ai-msg { max-width: 92%; margin-bottom: 12px; padding: 10px 12px; border-radius: 10px; line-height: 1.55; white-space: pre-wrap; font-size: .9rem; }
.ai-msg.user { margin-left: auto; background: #e7f0ff; color: #24466f; }
.ai-msg.assistant { background: #fff; border: 1px solid #e2e8f0; color: #34445a; }
.ai-msg.error { color: #b42318; border-color: #fecaca; background: #fff7f7; }
.ai-edited-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ai-edited-chip { padding: 3px 7px; border-radius: 10px; background: #e9f8ef; color: #16803b; font-size: .76rem; }
.ai-msg.ppt-revise-activity {
    max-width: 100%; padding: 12px; white-space: normal;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
    border-color: #cfe0f7;
}
.ppt-revise-activity-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.ppt-revise-activity-head > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex: 1; }
.ppt-revise-activity-head strong { color: #1e3a5f; font-size: .86rem; }
.ppt-revise-elapsed { color: #7890ac; font-size: .72rem; font-variant-numeric: tabular-nums; }
.ppt-revise-spinner {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; flex: 0 0 18px;
    border: 2px solid #bfdbfe; border-top-color: #2563eb; border-radius: 50%;
    color: #16803b; font-size: .72rem; font-weight: 900;
    animation: ppt-revise-spin .85s linear infinite;
}
.ppt-revise-steps { display: flex; flex-direction: column; gap: 0; }
.ppt-revise-step { display: grid; grid-template-columns: 16px 1fr; gap: 8px; min-width: 0; }
.ppt-revise-step-dot {
    position: relative; display: block; width: 9px; height: 9px; margin: 5px 0 0 3px;
    border: 2px solid #bfd0e5; border-radius: 50%; background: #fff;
}
.ppt-revise-step:not(:last-child) .ppt-revise-step-dot::after {
    content: ''; position: absolute; left: 2px; top: 9px; width: 1px; height: calc(100% + 34px);
    background: #dbe6f2;
}
.ppt-revise-step-body { min-width: 0; padding: 0 0 10px; }
.ppt-revise-step-body strong { display: block; color: #64748b; font-size: .76rem; }
.ppt-revise-step-body p { margin: 2px 0 0; color: #7b8798; font-size: .75rem; line-height: 1.4; }
.ppt-revise-step.is-active .ppt-revise-step-dot { border-color: #2563eb; background: #2563eb; box-shadow: 0 0 0 3px #dbeafe; }
.ppt-revise-step.is-active .ppt-revise-step-body strong { color: #1d4ed8; }
.ppt-revise-step.is-active .ppt-revise-step-body p { color: #395a82; }
.ppt-revise-step.is-done .ppt-revise-step-dot { border-color: #22a45d; background: #22a45d; }
.ppt-revise-step.is-done .ppt-revise-step-body strong { color: #16803b; }
.ppt-revise-step.is-error .ppt-revise-step-dot { border-color: #dc2626; background: #dc2626; }
.ppt-revise-step.is-error .ppt-revise-step-body strong,
.ppt-revise-step.is-error .ppt-revise-step-body p { color: #b42318; }
.ppt-revise-step-details { margin: 5px 0 0; padding-left: 17px; color: #64748b; font-size: .72rem; line-height: 1.45; }
.ppt-revise-activity.is-complete { border-color: #bbebcc; background: #f7fcf9; }
.ppt-revise-activity.is-complete .ppt-revise-spinner,
.ppt-revise-activity.is-error .ppt-revise-spinner { border: 0; animation: none; }
.ppt-revise-activity.is-error { border-color: #fecaca; background: #fff7f7; }
@keyframes ppt-revise-spin { to { transform: rotate(360deg); } }

/* ===== Step 1: Form Card ===== */
.qg3-form-card {
    background: #fff; border: 1px solid #e8ecf1;
    border-radius: 16px; padding: 36px 32px 32px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.qg3-stage-heading { margin: 0 0 18px; padding-left: 18px; border-left: 5px solid #1688e8; }
.qg3-stage-heading h2 { margin: 0 0 4px; padding: 0; border: 0; color: #14213d; font-size: 1.25rem; }
.qg3-stage-heading h2::after { display: none; }
.qg3-stage-heading p { margin: 0; color: #718096; font-size: .88rem; }
.qg3-input-workspace { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; padding: 20px 20px 0; border-radius: 12px; }
.qg3-input-column { min-width: 0; padding: 4px 18px 20px; border-left: 1px solid #e5eaf0; }
.qg3-input-column:first-child { border-left: 0; }
.qg3-input-footer { grid-column: 1 / -1; display: flex; justify-content: flex-end; padding: 20px 0; border-top: 1px solid #e5eaf0; }
.qg3-input-footer .qg3-submit-btn { width: min(280px, 100%); }
.qg3-input-workspace .qg3-upload-zone { min-height: 165px; justify-content: center; padding: 22px 14px; border-width: 1.5px; }
.qg3-input-workspace textarea { width: 100%; min-height: 110px; resize: vertical; padding: 12px; border: 1.5px solid #e2e8f0; border-radius: 10px; font: inherit; }
.qg3-product-tree { max-height: 220px; overflow: auto; padding: 12px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fbfdff; }
.qg3-check-row { display: block !important; margin: 0 !important; padding: 6px 2px; font-weight: 500 !important; }
.qg3-company-row { font-weight: 700 !important; }
.qg3-check-row + .qg3-check-row { padding-left: 18px; }
.qg3-muted { color: #94a3b8; font-size: .82rem; }
.qg3-prompt-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.qg3-prompt-chips button { padding: 6px 10px; border: 1px solid #cbd9ea; border-radius: 6px; color: #38699f; background: #fff; cursor: pointer; }
.qg3-prompt-chips button:hover { border-color: #2563eb; color: #2563eb; background: #eff6ff; }
.qg3-form-title {
    font-size: 1.4em; font-weight: 800; color: #0f172a; margin: 0 0 6px;
}
.qg3-form-desc {
    font-size: 0.9em; color: #64748b; margin: 0 0 28px;
}
.qg3-form-group { margin-bottom: 20px; }
.qg3-form-group label {
    display: block; font-size: 0.85em; font-weight: 600; color: #334155; margin-bottom: 8px;
}
.qg3-form-group label .required { color: #dc2626; }
.qg3-form-group input[type="text"],
.qg3-form-group select {
    width: 100%; padding: 11px 14px;
    border: 1.5px solid #e2e8f0; border-radius: 10px;
    font-size: 0.93em; color: #0f172a; background: #fafbfc;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.qg3-form-group input:focus,
.qg3-form-group select:focus {
    outline: none; border-color: #2563eb; background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Upload zone */
.qg3-upload-zone {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 32px 20px;
    border: 2px dashed #cbd5e0; border-radius: 14px;
    background: #fafbfc; cursor: pointer;
    transition: all 0.2s;
}
.qg3-upload-zone:hover {
    border-color: #2563eb; background: #f0f6ff;
}
.qg3-upload-zone.dragover {
    border-color: #2563eb; background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
.qg3-upload-icon { font-size: 1.5em; }
.qg3-upload-main { font-size: 0.95em; font-weight: 600; color: #334155; }
.qg3-upload-sub { font-size: 0.82em; color: #94a3b8; }
.qg3-upload-name {
    font-size: 0.82em; color: #2563eb; background: #eff6ff;
    padding: 4px 14px; border-radius: 20px; margin-top: 4px;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Submit button */
.qg3-submit-btn {
    width: 100%; padding: 13px;
    border: none; border-radius: 10px;
    background: #2563eb; color: #fff;
    font-size: 1em; font-weight: 700; cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}
.qg3-submit-btn:hover { background: #1d4ed8; }
.qg3-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== Status card (analysis/generation progress) ===== */
.qg3-status-card {
    background: #fff; border: 1px solid #e8ecf1; border-radius: 14px;
    padding: 32px; text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    margin-bottom: 20px;
}
.qg3-spinner {
    width: 32px; height: 32px;
    border: 3px solid #e2e8f0; border-top-color: #2563eb;
    border-radius: 50%; animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.qg3-status-card h3 { font-size: 1.05em; font-weight: 700; color: #0f172a; margin: 0 0 8px; }
.qg3-status-msg { font-size: 0.88em; color: #64748b; margin: 0; }
/* Generation milestone log: capped at ~10 lines, scrollable if longer */
.qg3-status-card pre.generate-log {
    margin: 10px 0 0; padding: 10px 12px; text-align: left;
    max-height: 210px; overflow-y: auto;
    font-size: 0.78em; line-height: 1.5; color: #475569;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
}

/* Step 3 uses a compact status strip; detailed logs expand only when present. */
.qg3-generate-status-card {
    padding: 17px 20px;
    text-align: left;
    border-radius: 12px;
    margin-bottom: 14px;
}
.qg3-generate-status-main {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 44px;
}
.qg3-generate-status-card .qg3-spinner {
    width: 26px;
    height: 26px;
    border-width: 3px;
    margin: 0;
}
.qg3-generate-status-copy { min-width: 0; }
.qg3-generate-status-card h3 {
    margin: 0 0 3px;
    font-size: 0.98em;
}
.qg3-generate-status-card .qg3-status-msg {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qg3-generate-status-card .qg3-generate-elapsed {
    justify-self: end;
    margin: 0;
    white-space: nowrap;
}
.qg3-generate-status-card pre.generate-log {
    margin: 13px 0 0;
    max-height: 138px;
}
.qg3-generate-status-card pre.generate-log[hidden] { display: none; }

@media (max-width: 680px) {
    .qg3-generate-status-card { padding: 14px 16px; }
    .qg3-generate-status-main {
        grid-template-columns: 28px minmax(0, 1fr);
        gap: 10px;
    }
    .qg3-generate-status-card .qg3-generate-elapsed {
        grid-column: 2;
        justify-self: start;
        margin-top: 5px;
    }
}

/* ===== Review header ===== */
.qg3-review-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 20px; flex-wrap: wrap;
    margin-bottom: 20px;
}
.qg3-review-header h2 { font-size: 1.15em; font-weight: 800; color: #0f172a; margin: 0 0 4px; padding: 0; border: none; }
.qg3-review-header h2::after { display: none; }
.qg3-review-header p { font-size: 0.88em; color: #64748b; margin: 0; }
.qg3-review-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* Chapter navigation in the generated plan editor */
.section-editor-list { min-width: 0; }
.sec-tabs {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    margin: 0 0 18px;
    padding: 7px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: #cbd8e8 transparent;
    border: 1px solid #dfe7f1;
    border-radius: 12px;
    background: #f5f8fc;
}
.sec-tabs::-webkit-scrollbar { height: 5px; }
.sec-tabs::-webkit-scrollbar-thumb { background: #cbd8e8; border-radius: 10px; }
.sec-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    max-width: 220px;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #596a80;
    font: inherit;
    font-size: .84rem;
    font-weight: 650;
    cursor: pointer;
    transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.sec-tab:hover {
    color: #185bc0;
    border-color: #c8daf2;
    background: #fff;
}
.sec-tab.active {
    color: #fff;
    border-color: #2468e5;
    background: linear-gradient(135deg, #3478ee, #1e5fd7);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .22);
}
.sec-tab-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 6px;
    background: #e7eef8;
    color: #49627f;
    font-size: .76rem;
    font-weight: 800;
}
.sec-tab.active .sec-tab-num { background: rgba(255,255,255,.2); color: #fff; }
.sec-tab-title {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Editable chapter card, aligned with the chapter tabs above */
.section-editor-card {
    overflow: hidden;
    border: 1px solid #dfe7f1;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(28, 54, 91, .06);
}
.sec-header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 11px 16px;
    border-bottom: 1px solid #e7edf5;
    background: linear-gradient(180deg, #fbfdff, #f5f8fc);
}
.sec-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    background: #e8f0fc;
    color: #365f91;
    font-size: .84rem;
    font-weight: 800;
    white-space: nowrap;
}
.sec-title-input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    outline: none;
    background: transparent;
    color: #24364e;
    font: inherit;
    font-size: 1rem;
    font-weight: 750;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.sec-title-input:hover { border-color: #d3deec; background: #fff; }
.sec-title-input:focus {
    border-color: #6da0ed;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.sec-editor { min-height: 420px; background: #fff; }
.sec-editor .toastui-editor-defaultUI {
    border: 0;
    border-radius: 0;
}
.sec-editor .toastui-editor-toolbar {
    height: auto;
    padding: 8px 12px;
    border-bottom: 1px solid #e7edf5;
    background: #fff;
}
.sec-editor .toastui-editor-main { background: #fff; }
.sec-editor .toastui-editor-contents { padding: 22px 26px 36px; color: #34445a; }
.sec-textarea {
    display: block;
    width: 100%;
    min-height: 420px;
    padding: 22px 26px;
    resize: vertical;
    border: 0;
    outline: 0;
    color: #34445a;
    font: inherit;
    line-height: 1.7;
}

@media (max-width: 640px) {
    .sec-header { align-items: flex-start; flex-direction: column; gap: 7px; }
    .sec-title-input { width: 100%; }
    .sec-editor .toastui-editor-contents, .sec-textarea { padding: 18px; }
}

/* === Task detail page === */
.task-detail-page { width: 100%; max-width: 1280px; margin: 0 auto; color: #22324a; }
.task-detail-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}
.task-detail-page-header h2 { margin: 0; padding: 0 0 10px; border: 0; font-size: 1.65rem; color: #19365e; }
.task-detail-page-header h2::after { width: 64px; height: 4px; border-radius: 5px; background: linear-gradient(90deg, #2779db, #83d4f1); }
.task-detail-back { border-radius: 9px; padding: 9px 15px; background: #fff; border: 1px solid #d5dfeb; color: #53667d; }
.task-detail-body { width: 100%; }
.td-summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    padding: 20px 22px;
    border: 1px solid #dfe7f1;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(28, 54, 91, .05);
}
.td-summary-icon {
    display: flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; flex: 0 0 46px;
    border-radius: 12px; background: linear-gradient(135deg, #367bea, #1c5dce);
    color: #fff; font-weight: 800;
}
.td-summary-main { flex: 1; min-width: 0; }
.td-summary-label { margin-bottom: 3px; color: #8a98aa; font-size: .76rem; font-weight: 700; letter-spacing: .08em; }
.td-summary-company { display: block; overflow: hidden; color: #233852; font-size: 1.12rem; text-overflow: ellipsis; white-space: nowrap; }
.td-summary-created { margin-top: 5px; color: #77879b; font-size: .84rem; }
.td-summary-usage { margin-top: 5px; color: #5a6b81; font-size: .84rem; }
.td-summary-status { flex: 0 0 auto; }
.td-summary-status .status-badge { display: inline-flex; align-items: center; padding: 6px 11px; border-radius: 999px; font-size: .8rem; font-weight: 750; }
.td-summary-status .status-processing { background: #fff4db; color: #9a6500; }
.td-summary-status .status-completed { background: #e7f8ee; color: #19703a; }
.td-summary-status .status-failed { background: #fff0f0; color: #b42318; }
.td-source-files-card {
    margin-bottom: 18px;
    overflow: hidden;
    border: 1px solid #dce6f2;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(28, 54, 91, .04);
}
.td-source-files-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 16px;
    border-bottom: 1px solid #e7edf5;
    background: #f7faff;
}
.td-source-files-head > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.td-source-files-head strong { color: #29445f; font-size: .9rem; }
.td-source-files-head span { color: #7d8da1; font-size: .75rem; }
.td-source-files-count { flex: none; }
.td-source-files-list { padding: 8px 12px; }
.td-source-file-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; }
.td-source-file-row + .td-source-file-row { border-top: 1px solid #edf1f6; }
.td-source-file-icon {
    display: grid; place-items: center; width: 30px; height: 30px; flex: none;
    border-radius: 8px; background: #e9f2ff; color: #2d68b2; font-size: .72rem; font-weight: 800;
}
.td-source-file-main { min-width: 0; flex: 1; }
.td-source-file-name { overflow: hidden; color: #30445c; font-size: .86rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.td-source-file-meta { margin-top: 3px; color: #8a99aa; font-size: .72rem; }
.td-source-file-download { flex: none; }
.td-stepper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
    align-items: center;
    margin: 0 0 16px;
    padding: 8px;
    border: 1px solid #dfe7f1;
    border-radius: 14px;
    background: #f5f8fc;
}
.td-stepper .qg-step {
    display: flex; align-items: center; gap: 12px;
    width: 100%; min-height: 66px; padding: 12px 16px;
    border: 1px solid transparent; border-radius: 10px;
    background: transparent; color: #607188; text-align: left; cursor: pointer;
}
.td-stepper .qg-step:not(:disabled):hover { background: #fff; border-color: #ccdaeb; }
.td-stepper .qg-viewing { background: #fff; border-color: #bfd2eb; box-shadow: 0 3px 10px rgba(27, 69, 120, .08); }
.td-stepper .qg-step-num {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%;
    background: #e4ebf4; color: #687a91; font-weight: 800;
}
.td-stepper .qg-done .qg-step-num { background: #dcf6e6; color: #1a7a3e; }
.td-stepper .qg-active .qg-step-num { background: #dceafe; color: #1f62c9; }
.td-stepper .qg-failed .qg-step-num { background: #fee2e2; color: #b42318; }
.td-stepper .qg-step-text { display: flex; flex-direction: column; gap: 3px; }
.td-stepper .qg-step-label { color: #2c405a; font-size: .95rem; font-weight: 800; }
.td-stepper .qg-step-state { color: #7b8a9d; font-size: .79rem; }
.td-stepper .qg-step-connector { height: 2px; background: #ccd8e7; }
.td-stage-panel { overflow: hidden; border: 1px solid #dfe7f1; border-radius: 14px; background: #fff; box-shadow: 0 5px 16px rgba(28, 54, 91, .04); }
.td-stage-time { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 12px 18px; border-bottom: 1px solid #e8edf4; background: #f9fbfd; color: #748499; font-size: .8rem; }
.td-stage-time span + span { position: relative; }
.td-stage-time span + span::before { content: ''; position: absolute; left: -13px; top: 4px; bottom: 4px; width: 1px; background: #d5deea; }
.td-running { color: #a76a00; font-weight: 700; }
.td-muted { color: #9ba7b7; }
.td-stage-content { padding: 18px; }
.td-primary-action { margin: 0 0 16px; border-radius: 9px; padding: 10px 18px; }
.td-section-list { display: grid; gap: 9px; }
.td-section-item { overflow: hidden; border: 1px solid #e0e7f0; border-radius: 9px; background: #fbfcfe; }
.td-section-item summary { padding: 12px 15px; cursor: pointer; color: #354a65; font-size: .9rem; font-weight: 750; }
.td-section-item[open] summary { color: #1f60bd; background: #f0f6ff; }
.td-section-content { padding: 14px 18px 20px; border-top: 1px solid #e5ebf3; background: #fff; }
.td-pptx-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 0 12px;
    padding: 11px 13px;
    border: 1px solid #dce6f2;
    border-radius: 10px;
    background: #f7faff;
}
.td-pptx-summary { flex: 1; color: #66778d; font-size: .82rem; }
.td-pptx-upload-wrap { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px 10px; }
.td-pptx-upload {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #2d6fd2;
    border-radius: 8px;
    background: #fff;
    color: #245eaf;
    font-size: .82rem;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, color .16s ease;
}
.td-pptx-upload:hover { border-color: #1c58b5; background: #edf5ff; color: #194e9e; }
.td-pptx-upload input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.td-pptx-upload.is-disabled, .td-pptx-upload.is-uploading { opacity: .55; cursor: not-allowed; pointer-events: none; }
.td-pptx-upload-hint { color: #94a1b2; font-size: .72rem; }
.td-pptx-upload-message { color: #397354; font-size: .76rem; font-weight: 650; }
.td-pptx-upload-message:empty { display: none; }
.td-pptx-upload-message.is-error { color: #b42318; }
.td-pptx-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 7px;
    padding: 11px 14px;
    border: 1px solid #e0e7f0;
    border-radius: 9px;
    background: #fbfcfe;
}
.td-pptx-icon, .td-pptx-download { flex: none; }
.td-pptx-main { flex: 1; min-width: 0; }
.td-pptx-name { overflow: hidden; color: #2d4058; font-size: .9rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.td-pptx-meta { margin-top: 4px; color: #97a4b4; font-size: .76rem; }
.td-pptx-actions { display: flex; align-items: center; flex: none; gap: 8px; }
.td-pptx-revise {
    padding: 7px 11px;
    border: 1px solid #c7d8ef;
    border-radius: 7px;
    background: #eef5ff;
    color: #245eaf;
    font: inherit;
    font-size: .78rem;
    font-weight: 750;
    cursor: pointer;
}
.td-pptx-revise:hover:not(:disabled) { border-color: #77a4df; background: #e1efff; color: #174f9c; }
.td-pptx-revise:disabled { border-color: #e0e5ec; background: #f4f5f7; color: #a1a9b4; cursor: not-allowed; }
.td-pptx-latest, .td-pptx-source {
    display: inline-flex;
    margin-left: 7px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 750;
    line-height: 1.45;
    vertical-align: middle;
}
.td-pptx-latest { background: #dcf6e6; color: #19703a; }
.td-pptx-source.is-generated { background: #e9f1fc; color: #2d5f9e; }
.td-pptx-source.is-uploaded { background: #fff0d9; color: #995b00; }

@media (max-width: 700px) {
    .task-detail-page-header { align-items: flex-start; flex-direction: column; }
    .td-summary-card { align-items: flex-start; flex-wrap: wrap; }
    .td-summary-status { width: 100%; padding-left: 62px; }
    .td-stepper { grid-template-columns: 1fr; gap: 6px; }
    .td-stepper .qg-step-connector { width: 2px; height: 18px; margin-left: 31px; }
    .td-stage-time { flex-direction: column; gap: 5px; }
    .td-stage-time span + span::before { display: none; }
    .td-pptx-toolbar { align-items: flex-start; flex-direction: column; }
    .td-pptx-upload-wrap { justify-content: flex-start; }
    .td-pptx-row { align-items: flex-start; flex-wrap: wrap; }
    .td-pptx-main { width: calc(100% - 34px); }
    .td-pptx-actions { width: 100%; margin-left: 34px; }
}
.qg3-btn-primary {
    padding: 10px 22px; border: none; border-radius: 10px;
    background: #2563eb; color: #fff; font-size: 0.9em; font-weight: 700;
    cursor: pointer; transition: all 0.2s; text-decoration: none;
    display: inline-flex; align-items: center;
}
.qg3-btn-primary:hover { background: #1d4ed8; }
.qg3-btn-outline {
    padding: 10px 22px; border: 1.5px solid #d5dee9; border-radius: 10px;
    background: #fff; color: #475569; font-size: 0.9em; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.qg3-btn-outline:hover { background: #f8fafc; border-color: #94a3b8; }

/* ===== Step 3: Result + Preview ===== */
.qg3-result-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    align-items: start;
    gap: 20px;
}
.qg3-result {
    min-width: 0;
    background: #fff; border: 1px solid #e8ecf1; border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.qg3-result-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 20px; flex-wrap: wrap;
    padding: 24px 28px;
    border-bottom: 1px solid #f1f5f9;
}
.qg3-result-header h2 { font-size: 1.15em; font-weight: 800; color: #16a34a; margin: 0 0 4px; padding: 0; border: none; }
.qg3-result-header h2::after { display: none; }
.qg3-result-header p { font-size: 0.88em; color: #64748b; margin: 0; }
.qg3-result-actions { display: flex; gap: 10px; flex-shrink: 0; }
.qg3-version-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.qg3-version-row label { color: #64748b; font-size: .78rem; font-weight: 700; }
.qg3-version-row select,
.ppt-revise-scope-row select {
    max-width: 260px; padding: 7px 30px 7px 10px;
    border: 1px solid #d7e0ec; border-radius: 8px; background: #fff;
    color: #334155; font: inherit; font-size: .8rem;
}
.qg3-version-editable { color: #16803b; font-size: .76rem; font-weight: 700; }
.qg3-version-editable.unavailable { color: #b45309; }

.ppt-revise-panel {
    display: flex; flex-direction: column;
    position: sticky; top: 112px;
    height: calc(100vh - 136px); min-height: 520px; overflow: hidden;
    background: #fff; border: 1px solid #dfe7f1; border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 36, 70, .08);
}
.ppt-revise-panel .ai-edit-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ppt-revise-page-context { color: #64748b; font-size: .76rem; white-space: nowrap; }
.ppt-revise-scope-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 14px; border-bottom: 1px solid #edf1f6; background: #fff;
}
.ppt-revise-scope-row label { color: #64748b; font-size: .78rem; font-weight: 700; }
.ppt-revise-scope-row select { max-width: 210px; }
.ppt-revise-scope-hint {
    padding: 7px 14px;
    border-bottom: 1px solid #dbeafe;
    background: #eff6ff;
    color: #315f82;
    font-size: .76rem;
    line-height: 1.45;
}
.ppt-revise-panel .ai-edit-messages { padding: 14px; }
.ppt-revise-status {
    padding: 8px 14px; border-top: 1px solid #dbeafe; background: #eff6ff;
    color: #1d4ed8; font-size: .78rem; line-height: 1.45;
}
.ppt-revise-panel.is-busy .ai-edit-send { cursor: wait; opacity: .55; }
.ppt-revise-panel.is-disabled .ai-edit-input,
.ppt-revise-panel.is-disabled .ai-edit-send,
.ppt-revise-panel.is-disabled select { cursor: not-allowed; opacity: .55; }

/* PPT Preview area */
.qg3-preview-box {
    padding: 28px;
    min-height: 400px;
    display: flex; align-items: center; justify-content: center;
    background: #fafbfc;
}
.qg3-preview-placeholder {
    text-align: center; color: #94a3b8;
}
.qg3-preview-icon { font-size: 3em; display: block; margin-bottom: 12px; }
.qg3-preview-placeholder p { font-size: 1em; margin: 0 0 6px; }
.qg3-preview-hint { font-size: 0.85em !important; color: #cbd5e0; }

/* PPTX page viewer */
.qg3-preview-box.has-viewer { display: block; align-items: initial; justify-content: initial; }
.qg3-preview-viewer { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.qg3-preview-main { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qg3-preview-main img {
    max-width: 100%; max-height: 56vh; object-fit: contain;
    border: 1px solid #e2e8f0; border-radius: 8px; background: #fff;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .08);
}
.qg3-preview-nav { display: flex; align-items: center; gap: 12px; font-size: .9em; color: #64748b; }
.qg3-preview-thumbs {
    display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px;
}
.qg3-thumb {
    height: 64px; width: auto; border: 2px solid transparent; border-radius: 4px;
    cursor: pointer; opacity: .75; transition: opacity .15s, border-color .15s;
    flex-shrink: 0;
}
.qg3-thumb:hover { opacity: 1; }
.qg3-thumb.active { border-color: #2563eb; opacity: 1; }

/* Live preview during generation */
.qg3-live-preview {
    margin-top: 20px; padding: 20px; border: 1px solid #e2e8f0; border-radius: 12px;
    background: #fff; display: flex; flex-direction: column; gap: 14px;
}
.qg3-live-title { font-size: 1em; color: #334155; margin: 0; }
.qg3-live-preview .qg3-preview-main img { max-height: 40vh; }

/* ===== Error ===== */
.qg3-error {
    max-width: 500px; margin: 40px auto;
    background: #fff; border: 1px solid #fecaca; border-radius: 16px;
    padding: 40px 32px; text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.qg3-error-icon {
    display: flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; margin: 0 auto 16px;
    background: #fef2f2; color: #dc2626;
    border-radius: 50%; font-size: 1.5em; font-weight: 800;
}
.qg3-error h3 { font-size: 1.15em; font-weight: 800; color: #0f172a; margin: 0 0 8px; }
.qg3-error p { font-size: 0.9em; color: #64748b; margin: 0; }

/* Step 1 — streamlined input flow */
.qg3-input-workspace {
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}
.qg3-source-rule {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    padding: 12px 15px;
    border: 1px solid #d7e4f4;
    border-radius: 8px;
    background: #f5f9ff;
    color: #607691;
    font-size: .8rem;
    line-height: 1.5;
}
.qg3-source-rule strong {
    flex: none;
    color: #275d9e;
    font-size: .82rem;
}
.qg3-source-rule.uses-attachments {
    border-color: #b9ddca;
    background: #f1faf5;
}
.qg3-source-rule.uses-attachments strong {
    color: #287348;
}
.qg3-company-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 18px;
    margin-bottom: 34px;
}
.qg3-company-field {
    display: block;
    min-width: 0;
    margin: 0;
}
.qg3-company-field > span:first-child {
    display: block;
    margin-bottom: 8px;
    color: #172842;
    font-size: .82rem;
    font-weight: 800;
    pointer-events: none; /* 標題不可點擊,避免誤觸發下拉 */
}
.qg3-company-select-shell {
    position: relative;
    display: block;
}
.qg3-company-picker-icon {
    position: absolute;
    top: 17px;
    left: 20px;
    z-index: 1;
    color: #274c7f;
    font-size: 1.25rem;
    pointer-events: none;
}
.qg3-company-picker select {
    width: 100%;
    height: 58px;
    padding: 0 52px 0 58px;
    appearance: none;
    border: 1px solid #d8e2ef;
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%231f3b64' stroke-width='2'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 20px center;
    color: #51647e;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.qg3-company-field:not(:first-child) select {
    padding-left: 18px;
}
.qg3-company-picker select:disabled {
    background-color: #f2f5f9;
    color: #94a0b0;
    cursor: not-allowed;
}
.qg3-company-picker select:focus,
.qg3-template-item select:focus,
.qg3-prompt-wrap textarea:focus {
    outline: none;
    border-color: #2b70ea;
    box-shadow: 0 0 0 3px rgba(43, 112, 234, .1);
}
.qg3-template-picker {
    display: block;
    margin-bottom: 18px;
    background: #f8fbff;
}
.qg3-template-picker select {
    width: 100%;
    margin-top: 8px;
}
.qg3-template-picker label {
    margin: 0;
}
.qg3-template-picker label span,
.qg3-template-picker label small {
    display: block;
}
.qg3-template-picker label span {
    color: #172842;
    font-size: .95rem;
    font-weight: 800;
}
.qg3-template-picker label small {
    margin-top: 5px;
    color: #71849d;
    font-size: .78rem;
    font-weight: 500;
    line-height: 1.5;
}
.qg3-template-picker select {
    width: 100%;
    height: 46px;
    padding: 0 42px 0 14px;
    appearance: none;
    border: 1px solid #cad8e9;
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%231f3b64' stroke-width='2'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center;
    color: #263750;
    font: inherit;
    font-weight: 600;
}
.qg3-template-picker select:focus {
    outline: none;
    border-color: #2b70ea;
    box-shadow: 0 0 0 3px rgba(43, 112, 234, .1);
}
@media (max-width: 760px) {
    .qg3-source-rule {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
    .qg3-company-picker {
        grid-template-columns: 1fr;
    }
    .qg3-template-picker {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
.qg3-prompt-block > label {
    display: block;
    margin-bottom: 16px;
    color: #172842;
    font-size: 1rem;
    font-weight: 800;
}
.qg3-prompt-wrap { position: relative; }
.qg3-input-workspace .qg3-prompt-wrap textarea {
    width: 100%;
    min-height: 88px;
    padding: 18px 18px 38px;
    resize: vertical;
    border: 1px solid #d8e2ef;
    border-radius: 8px;
    background: #fff;
    color: #263750;
    font: inherit;
    line-height: 1.65;
}
.qg3-prompt-wrap textarea::placeholder { color: #9aa8ba; }
.qg3-prompt-count {
    position: absolute;
    right: 18px;
    bottom: 16px;
    color: #8a9aaf;
    font-size: .84rem;
}
.qg3-prompt-count b { font-weight: 500; }
.qg3-main-upload-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 28px 0 34px;
}
.qg3-main-upload {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.qg3-main-upload strong {
    flex-basis: 100%;
}
.qg3-main-upload .deck-file-cards {
    flex-basis: 100%;
}

/* === 快速生成：資料上傳卡片模式 === */
#quickGenFile {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden; opacity: 0; pointer-events: none;
}
.qg3-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
    flex-basis: 100%;
    margin-top: 4px;
}
.qg3-upload-grid.dragover {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
    border-radius: 12px;
}
.qg3-add-file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 8px 12px;
    border: 1.5px dashed #b9cdeb;
    border-radius: 9px;
    background: #f8fbff;
    color: #2563c9;
    cursor: pointer;
    transition: border-color .18s, background .18s;
}
.qg3-add-file-card:hover {
    border-color: #2563eb;
    background: #eff6ff;
}
.qg3-add-file-plus {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}
.qg3-add-file-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.qg3-add-file-copy strong {
    font-size: .78rem;
    font-weight: 750;
    color: #2b6cb0;
}
.qg3-add-file-copy small {
    font-size: .68rem;
    color: #91a0b3;
}
    color: #172842;
    font-size: 1rem;
}
.qg3-upload-zone.qg3-upload-button {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    width: auto;
    min-height: 0;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid #cfd9e7;
    border-radius: 8px;
    background: #fff;
    color: #33465f;
    font-size: .9rem;
    font-weight: 700;
}
.qg3-upload-zone.qg3-upload-button:hover,
.qg3-upload-zone.qg3-upload-button.dragover { border-color: #2b70ea; background: #f3f7ff; }
.qg3-main-upload .qg3-upload-name {
    max-width: 360px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: none;
    color: #718096;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qg3-main-upload-row .qg3-submit-btn {
    flex: 0 0 280px;
    width: 280px;
    padding: 13px 20px;
    border-radius: 6px;
}
.qg3-main-upload-row .qg3-submit-btn span { margin-left: 12px; }
@media (max-width: 980px) {
    #qg3Panel2.active.review-ready { grid-template-columns: 1fr; }
    #qg3Panel2.review-ready .ai-edit-panel { grid-column: 1; position: static; width: auto; height: 520px; }
    .qg3-result-workspace { grid-template-columns: 1fr; }
    .ppt-revise-panel { position: static; height: 560px; }
    .deck-profile-layout {
        grid-template-columns: 1fr;
    }
    .deck-editor-header {
        flex-direction: column;
    }
    .deck-editor-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .qg3-main-upload-row { align-items: stretch; flex-direction: column; }
    .qg3-main-upload-row .qg3-submit-btn { flex-basis: auto; width: 100%; }
    .deck-grid {
        grid-template-columns: 1fr;
    }
    .deck-section-head {
        align-items: flex-start;
        flex-direction: column;
    }
    .deck-section-tools {
        flex-wrap: wrap;
    }
}

/* === Deck profile workspace aligned with Quick Generate === */
.deck-profile-page {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    color: #172842;
}

.deck-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 0 0 18px;
    padding: 0 0 0 18px;
    border: 0;
    border-left: 5px solid #1688e8;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.deck-page-title-wrap {
    display: block;
    min-width: 0;
}

.deck-page-header h2 {
    margin: 0 0 4px;
    padding: 0;
    border: 0;
    color: #14213d;
    font-size: 1.25rem;
    letter-spacing: 0;
}

.deck-page-header h2::after {
    display: none;
}

.deck-page-header p {
    margin: 0;
    color: #718096;
    font-size: .88rem;
    line-height: 1.5;
}

.deck-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid #cfd9e7;
    border-radius: 8px;
    background: #fff;
    color: #40536e;
    font: inherit;
    font-size: .86rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
}

.deck-refresh-btn:hover {
    border-color: #2b70ea;
    background: #f3f7ff;
    color: #1769e8;
}

.deck-profile-layout {
    display: grid;
    grid-template-columns: 370px minmax(0, 1fr);
    gap: 0;
    min-height: 680px;
    overflow: hidden;
    align-items: stretch;
    border: 1px solid #e8ecf1;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .04);
}

.deck-profile-list-panel {
    min-width: 0;
    padding: 26px 24px;
    border-right: 1px solid #e5eaf0;
    background: #fff;
}

.deck-profile-editor-panel {
    min-width: 0;
    min-height: 680px;
    background: #fff;
}

.deck-upload-card {
    margin: 0 0 24px;
    padding: 0 0 24px;
    border: 0;
    border-bottom: 1px solid #e5eaf0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.deck-card-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.deck-card-heading > span {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    flex: 0 0 38px;
    border-radius: 9px;
    background: #eaf2ff;
    color: #1769e8;
    font-size: .72rem;
    font-weight: 900;
}

.deck-card-heading h3,
.deck-profile-list-head h3,
.deck-editor h3 {
    margin: 0;
    color: #172842;
}

.deck-card-heading h3 {
    margin-bottom: 3px;
    font-size: 1rem;
}

.deck-card-heading p {
    margin: 0;
    color: #8493a7;
    font-size: .76rem;
    line-height: 1.45;
}

.deck-upload-card .form-group {
    margin-bottom: 16px;
}

.deck-upload-card .form-group label,
.deck-editor .form-group label {
    margin-bottom: 8px;
    color: #334155;
    font-size: .82rem;
    font-weight: 700;
}

.deck-upload-card .form-group input,
.deck-editor .form-group input,
.deck-editor .form-group textarea {
    border: 1px solid #d8e2ef;
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
}

.deck-upload-card .form-group input {
    height: 44px;
}

.deck-upload-card .form-group input:focus,
.deck-editor .form-group input:focus,
.deck-editor .form-group textarea:focus {
    border-color: #2b70ea;
    box-shadow: 0 0 0 3px rgba(43, 112, 234, .1);
}

.deck-upload-box {
    position: relative;
    display: flex;
    min-height: 150px;
    margin-bottom: 14px;
    padding: 24px 18px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    overflow: hidden;
    border: 1.5px dashed #c7d4e4;
    border-radius: 10px;
    background: #fbfdff;
    cursor: pointer;
    text-align: center;
    transition: border-color .2s, background .2s, box-shadow .2s;
}

.deck-upload-box:hover,
.deck-upload-box.dragover {
    border-color: #2b70ea;
    background: #f3f7ff;
    box-shadow: 0 0 0 3px rgba(43, 112, 234, .07);
}

.deck-upload-box .quick-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.deck-upload-box .quick-upload-icon {
    display: grid;
    width: 38px;
    height: 38px;
    margin-bottom: 2px;
    place-items: center;
    border-radius: 9px;
    background: #eaf2ff;
    color: #1769e8;
    font-size: 1.15rem;
    font-weight: 800;
}

.deck-upload-box .quick-upload-main {
    color: #334155;
    font-size: .9rem;
    font-weight: 700;
}

.deck-upload-box .quick-upload-sub {
    color: #94a3b8;
    font-size: .76rem;
}

.deck-upload-box .quick-upload-filename {
    display: block;
    max-width: 100%;
    margin-top: 3px;
    overflow: hidden;
    color: #1769e8;
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deck-file-cards {
    display: grid;
    max-height: 250px;
    margin: -2px 0 14px;
    padding-right: 3px;
    gap: 8px;
    overflow-y: auto;
}

.deck-file-cards[hidden] {
    display: none;
}

.deck-file-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 30px;
    min-height: 58px;
    padding: 8px 9px;
    align-items: center;
    gap: 10px;
    border: 1px solid #dce6f2;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(34, 67, 112, .04);
    transition: border-color .18s, box-shadow .18s, transform .18s;
}

.deck-file-card:hover {
    border-color: #b9cdeb;
    box-shadow: 0 4px 12px rgba(34, 67, 112, .08);
    transform: translateY(-1px);
}

.deck-file-type {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: #edf4ff;
    color: #2563c9;
    font-size: .64rem;
    font-weight: 900;
    letter-spacing: .02em;
}

.deck-file-info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.deck-file-info strong {
    overflow: hidden;
    color: #30445f;
    font-size: .78rem;
    font-weight: 750;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deck-file-info small {
    color: #91a0b3;
    font-size: .68rem;
}

.deck-file-remove {
    display: grid;
    width: 28px;
    height: 28px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #91a0b3;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: color .18s, background .18s;
}

.deck-file-remove:hover,
.deck-file-remove:focus-visible {
    outline: 0;
    background: #fff0f0;
    color: #c43f3f;
}

.deck-full-btn {
    width: 100%;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font: inherit;
    font-size: .9rem;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .22);
    cursor: pointer;
    transition: background .2s, box-shadow .2s;
}

.deck-full-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 5px 14px rgba(37, 99, 235, .25);
}

.deck-full-btn:disabled {
    opacity: .6;
    cursor: wait;
}

.deck-status {
    min-height: 0;
    margin: 0;
    color: #456b98;
    font-size: .78rem;
    line-height: 1.5;
}

.deck-status:not(:empty) {
    margin-top: 12px;
    padding: 9px 11px;
    border-left: 3px solid #3b82f6;
    border-radius: 5px;
    background: #f3f7ff;
}

.deck-status:empty {
    display: none;
}

.deck-status[hidden] {
    display: none;
}

.deck-status {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid #dbe7f8;
    border-left: 1px solid #dbe7f8;
    border-radius: 10px;
    background: linear-gradient(145deg, #f8fbff, #f2f7ff);
}

.deck-ai-progress-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.deck-ai-progress-head > div {
    min-width: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex: 1;
    gap: 10px;
}

.deck-ai-progress-head strong {
    color: #183a66;
    font-size: .85rem;
}

.deck-ai-progress-head span {
    color: #7690af;
    font-size: .72rem;
}

.deck-ai-pulse {
    width: 9px;
    height: 9px;
    flex: none;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 0 0 0 rgba(37, 99, 235, .35);
    animation: deck-ai-pulse 1.5s infinite;
}

.deck-status.is-complete .deck-ai-pulse {
    background: #16a34a;
    animation: none;
}

.deck-status.is-error .deck-ai-pulse {
    background: #dc2626;
    animation: none;
}

.deck-status > p {
    margin: 10px 0 12px;
    color: #294d78;
    font-size: .8rem;
    font-weight: 650;
}

.deck-ai-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.deck-ai-steps li {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 7px 5px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .7);
    color: #8a9caf;
    font-size: .65rem;
}

.deck-ai-steps li > span {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    flex: none;
    border-radius: 50%;
    background: #e7edf6;
    color: #71839a;
    font-size: .62rem;
    font-weight: 800;
}

.deck-ai-steps li.is-active {
    background: #e9f2ff;
    color: #1d5fbf;
    font-weight: 700;
}

.deck-ai-steps li.is-active > span {
    background: #2563eb;
    color: #fff;
}

.deck-ai-steps li.is-done {
    color: #25804c;
}

.deck-ai-steps li.is-done > span {
    background: #dcf7e7;
    color: #168143;
}

.deck-ai-steps li.is-done > span::before {
    content: "✓";
}

.deck-ai-steps li.is-done > span {
    font-size: 0;
}

.deck-ai-steps li.is-done > span::before {
    font-size: .7rem;
}

.deck-ai-steps li.is-failed {
    background: #fff0f0;
    color: #b42323;
}

.deck-ai-log {
    max-height: 104px;
    overflow-y: auto;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #dde8f6;
}

.deck-ai-log > div {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 7px;
    padding: 3px 0;
    color: #66809f;
    font-size: .68rem;
    line-height: 1.45;
}

.deck-ai-log time {
    color: #9aacc0;
    font-variant-numeric: tabular-nums;
}

@keyframes deck-ai-pulse {
    70% { box-shadow: 0 0 0 7px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

@media (max-width: 620px) {
    .deck-ai-steps {
        grid-template-columns: 1fr 1fr;
    }
}

.deck-profile-list-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
}

.deck-profile-list-head h3 {
    margin-bottom: 4px;
    font-size: .98rem;
}

.deck-profile-list-head p {
    margin: 0;
    color: #8997a9;
    font-size: .74rem;
}

.deck-template-count {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eaf2ff;
    color: #2468c8;
    font-size: .7rem;
    font-weight: 800;
}

.deck-profile-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.deck-profile-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid #dfe7f1;
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
    transition: border-color .2s, background .2s;
}

.deck-profile-item:hover {
    transform: none;
    border-color: #a9c4e7;
    box-shadow: none;
}

.deck-profile-item.active {
    border-color: #2b70ea;
    background: #f7faff;
    box-shadow: inset 3px 0 #2b70ea;
}

.deck-profile-main {
    display: flex;
    min-width: 0;
    padding: 12px;
    align-items: center;
    gap: 11px;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.deck-profile-main:hover {
    background: #f8fbff;
}

.deck-profile-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    flex: 0 0 34px;
    border-radius: 8px;
    background: #eef4fc;
    color: #53769f;
}

.deck-profile-item.active .deck-profile-icon {
    background: #e5efff;
    color: #1769d4;
}

.deck-profile-copy {
    min-width: 0;
}

.deck-profile-name,
.deck-profile-meta {
    display: block;
}

.deck-profile-name {
    overflow: hidden;
    color: #203552;
    font-size: .84rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deck-profile-meta {
    margin-top: 3px;
    color: #8492a5;
    font-size: .72rem;
}

.deck-profile-delete {
    padding: 0 11px;
    border: 0;
    border-left: 1px solid #edf1f5;
    background: transparent;
    color: #a65b5b;
    font-size: .75rem;
    cursor: pointer;
}

.deck-profile-delete:hover {
    background: #fff1f1;
    color: #bd3131;
}

.deck-list-empty {
    padding: 28px 16px;
    border: 1px dashed #cfdbe9;
    border-radius: 8px;
    background: #fbfdff;
    color: #8997a9;
    text-align: center;
}

.deck-list-empty span,
.deck-list-empty strong,
.deck-list-empty p {
    display: block;
}

.deck-list-empty span {
    margin-bottom: 7px;
    color: #8ba7ca;
    font-size: 1.4rem;
}

.deck-list-empty strong {
    color: #53657d;
    font-size: .84rem;
}

.deck-list-empty p {
    margin: 4px 0 0;
    font-size: .72rem;
}

.deck-empty-state {
    display: flex;
    min-height: 680px;
    padding: 48px 32px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    color: #718096;
    text-align: center;
}

.deck-empty-icon {
    display: grid;
    width: 58px;
    height: 58px;
    margin-bottom: 16px;
    place-items: center;
    border-radius: 14px;
    background: #edf4ff;
    color: #3978cb;
    font-size: 1.5rem;
}

.deck-empty-state strong {
    color: #263d5c;
    font-size: 1rem;
}

.deck-empty-state p {
    max-width: 430px;
    margin: 8px 0 0;
    color: #8492a5;
    font-size: .82rem;
    line-height: 1.65;
}

.deck-editor {
    padding: 0 28px 30px;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
}

.deck-editor-header {
    display: flex;
    margin: 0 -28px 24px;
    padding: 22px 28px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid #e5eaf0;
    border-radius: 0;
    background: #fff;
}

.deck-editor-header h3 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.deck-editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.deck-editor-actions button {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 7px;
    box-shadow: none;
    font-size: .8rem;
}

.deck-editor .btn-primary,
.deck-editor .btn-submit {
    background: #2563eb;
    color: #fff;
}

.deck-editor .btn-secondary {
    border: 1px solid #cfd9e7;
    background: #fff;
    color: #40536e;
}

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

.deck-slide-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    gap: 8px;
}

.deck-slide-range label {
    grid-column: 1 / -1;
}

.deck-section-list {
    display: flex;
    margin-top: 24px;
    flex-direction: column;
    gap: 12px;
}

.deck-section-card {
    padding: 17px;
    border: 1px solid #dfe7f1;
    border-radius: 8px;
    background: #fbfcfe;
}

.deck-section-head {
    display: flex;
    margin-bottom: 13px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.deck-section-head strong {
    display: inline-flex;
    padding: 5px 9px;
    align-items: center;
    border-radius: 6px;
    background: #e8f1ff;
    color: #2468c8;
    font-size: .76rem;
}

.deck-section-tools {
    display: flex;
    gap: 6px;
}

.deck-section-tools button {
    padding: 5px 8px;
    border: 1px solid #d4deea;
    border-radius: 6px;
    background: #fff;
    color: #60738c;
    font-size: .72rem;
    cursor: pointer;
}

.deck-required-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4a5568;
    font-size: .82rem;
}

@media (max-width: 1100px) {
    .deck-profile-layout {
        grid-template-columns: 330px minmax(0, 1fr);
    }
}

@media (max-width: 980px) {
    .deck-profile-layout {
        grid-template-columns: 1fr;
    }

    .deck-profile-list-panel {
        border-right: 0;
        border-bottom: 1px solid #e5eaf0;
    }

    .deck-profile-editor-panel,
    .deck-empty-state {
        min-height: 520px;
    }

    .deck-editor-header {
        flex-direction: column;
    }

    .deck-editor-actions {
        justify-content: flex-start;
    }
}

/* 生成階段與即時計時 */
.qg3-substeps{display:flex;align-items:center;justify-content:center;gap:8px;margin-bottom:18px;flex-wrap:wrap}
.qg3-substep{display:grid;grid-template-columns:22px auto;grid-template-rows:auto auto;align-items:center;column-gap:8px;padding:8px 13px;border:1.5px solid #e2e8f0;border-radius:14px;background:#fff;color:#94a3b8;font-size:0.88em;font-weight:600}
.qg3-substep-num{width:22px;height:22px;display:grid;place-items:center;border-radius:50%;background:#e2e8f0;color:#64748b;font-size:0.8em}
.qg3-substep-num{grid-row:1 / 3}
.qg3-substep.active{border-color:#2563eb;color:#1d4ed8;background:#eff6ff}
.qg3-substep.active .qg3-substep-num{background:#2563eb;color:#fff}
.qg3-substep.done{border-color:#22c55e;color:#15803d;background:#f0fdf4}
.qg3-substep.done .qg3-substep-num{background:#22c55e;color:#fff}
.qg3-substep.skipped{border-color:#d8e0ea;color:#7c8a9c;background:#f8fafc}
.qg3-substep.skipped .qg3-substep-num{background:#e8edf3;color:#7c8a9c}
.qg3-substep.unobserved{border-color:#e5b94e;color:#8a5b00;background:#fffbeb}
.qg3-substep.unobserved .qg3-substep-num{background:#fef0bd;color:#8a5b00}
.qg3-substep.failed{border-color:#ef4444;color:#b91c1c;background:#fef2f2}
.qg3-substep.failed .qg3-substep-num{background:#ef4444;color:#fff}
.qg3-substep-label{white-space:nowrap}
.qg3-substep-state{grid-column:2;font-size:0.72em;line-height:1.25;color:#64748b;white-space:nowrap;font-variant-numeric:tabular-nums}
.qg3-substep-arrow{color:#cbd5e1;font-weight:700}
.qg3-generate-elapsed{display:inline-flex;margin:12px 0 0;padding:5px 12px;border-radius:999px;background:#eff6ff;color:#1d4ed8;font-size:.8rem;font-weight:750;font-variant-numeric:tabular-nums}

/* Quick generation intake: only unresolved Q1/Q2 appear before analysis. */
.qg3-intake-questions[hidden], .qg3-secondary-panel[hidden] { display:none !important; }
.qg3-intake-questions { max-width:980px; margin:0 auto; padding:28px; border:1px solid #dbe6f5; border-radius:18px; background:#fff; box-shadow:0 14px 35px rgba(30,64,175,.08); }
.qg3-intake-head { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; padding-bottom:20px; border-bottom:1px solid #e8eef7; }
.qg3-intake-head h2 { margin:4px 0 6px; color:#17233d; font-size:1.45rem; }
.qg3-intake-head p { margin:0; color:#667085; }
.qg3-intake-kicker, .qg3-secondary-kicker { color:#2563eb; font-size:.75rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.qg3-intake-count { flex:0 0 auto; padding:6px 11px; border-radius:999px; background:#eff6ff; color:#1d4ed8; font-size:.8rem; font-weight:750; }
.qg3-intake-list { display:grid; gap:16px; margin-top:20px; }
.qg3-question-card { padding:20px; border:1px solid #dfe7f2; border-radius:14px; background:#f9fbfe; }
.qg3-question-title { display:flex; align-items:flex-start; gap:12px; margin-bottom:16px; color:#1f2a44; line-height:1.55; }
.qg3-question-title > span { flex:0 0 auto; display:grid; place-items:center; min-width:34px; height:28px; border-radius:8px; background:#1d4ed8; color:#fff; font-size:.78rem; font-weight:800; }
.qg3-answer-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.qg3-answer-choice { display:flex; align-items:center; gap:9px; min-height:44px; padding:10px 12px; border:1px solid #d9e2ef; border-radius:10px; background:#fff; cursor:pointer; }
.qg3-answer-choice:has(input:checked) { border-color:#3b82f6; background:#eff6ff; color:#1d4ed8; }
.qg3-answer-choice input { accent-color:#2563eb; }
.qg3-answer-label { display:block; margin:16px 0 7px; color:#475467; font-size:.84rem; font-weight:700; }
.qg3-answer-text, .qg3-answer-select { width:100%; margin-top:10px; padding:11px 12px; border:1px solid #d7e0ed; border-radius:10px; background:#fff; color:#1f2937; font:inherit; box-sizing:border-box; }
.qg3-answer-text:focus, .qg3-answer-select:focus, .qg3-secondary-text:focus { outline:2px solid rgba(37,99,235,.18); border-color:#3b82f6; }
.qg3-question-help { margin:0 0 8px; color:#667085; font-size:.84rem; }
.qg3-intake-error { margin-top:16px; padding:10px 12px; border-radius:9px; background:#fef2f2; color:#b42318; font-size:.88rem; }
.qg3-intake-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:22px; }

/* Non-blocking S1-S7 completeness panel shown after the plan is generated. */
.qg3-secondary-panel { margin:0 0 18px; border:1px solid #d9e5f5; border-radius:14px; background:#f8fbff; overflow:hidden; }
.qg3-secondary-summary { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:16px 18px; }
.qg3-secondary-summary > div { display:grid; gap:3px; }
.qg3-secondary-summary strong { color:#1f2a44; }
.qg3-secondary-summary small { color:#667085; }
.qg3-secondary-backdrop { position:fixed; inset:0; z-index:70; visibility:hidden; opacity:0; background:rgba(15,23,42,.36); backdrop-filter:blur(1px); pointer-events:none; transition:opacity .25s ease,visibility 0s linear .25s; }
.qg3-secondary-backdrop.is-open { visibility:visible; opacity:1; pointer-events:auto; transition-delay:0s; }
.qg3-secondary-drawer { position:fixed; inset:0 0 0 auto; z-index:71; display:flex; flex-direction:column; width:min(560px,100vw); height:100dvh; visibility:hidden; transform:translateX(100%); background:#f8fbff; border-left:1px solid #d9e5f5; box-shadow:-18px 0 48px rgba(15,36,70,.18); transition:transform .28s cubic-bezier(.22,1,.36,1),visibility 0s linear .28s; }
.qg3-secondary-drawer.is-open { visibility:visible; transform:translateX(0); transition-delay:0s; }
.qg3-secondary-drawer-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; flex:0 0 auto; padding:24px 24px 20px; background:#fff; border-bottom:1px solid #e2e8f0; }
.qg3-secondary-drawer-head h3 { margin:4px 0 5px; color:#17233d; font-size:1.28rem; }
.qg3-secondary-drawer-head p { margin:0; color:#667085; font-size:.86rem; line-height:1.55; }
.qg3-secondary-drawer-close { flex:0 0 38px; display:grid; place-items:center; width:38px; height:38px; padding:0; border:1px solid #d8e1ed; border-radius:10px; background:#fff; color:#52637a; font-size:1.55rem; line-height:1; cursor:pointer; }
.qg3-secondary-drawer-close:hover { border-color:#b9c8dc; background:#f1f5f9; color:#17233d; }
.qg3-secondary-drawer-close:focus-visible { outline:3px solid rgba(37,99,235,.22); border-color:#3b82f6; }
.qg3-secondary-cards { display:grid; gap:12px; flex:1 1 auto; min-height:0; padding:20px 24px 28px; overflow-y:auto; overscroll-behavior:contain; }
.qg3-secondary-card { padding:16px; border:1px solid #dfe7f2; border-radius:12px; background:#fff; }
.qg3-secondary-card-head { display:flex; align-items:flex-start; gap:11px; }
.qg3-secondary-card-head > span { display:grid; place-items:center; width:32px; height:28px; border-radius:8px; background:#eaf2ff; color:#1d4ed8; font-size:.78rem; font-weight:800; }
.qg3-secondary-card-head strong { color:#25324a; }
.qg3-secondary-card-head p { margin:3px 0 0; color:#667085; font-size:.85rem; }
.qg3-secondary-text { width:100%; min-height:78px; margin-top:12px; padding:10px 12px; resize:vertical; border:1px solid #d7e0ed; border-radius:10px; font:inherit; box-sizing:border-box; }
.qg3-secondary-upload { display:inline-flex; align-items:center; margin-top:10px; color:#2563eb; font-size:.84rem; font-weight:700; cursor:pointer; }
.qg3-secondary-upload input { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.qg3-secondary-upload:has(input:disabled) { opacity:.55; cursor:not-allowed; }
.qg3-secondary-card-actions { display:flex; align-items:center; justify-content:flex-end; gap:9px; margin-top:12px; }
.qg3-secondary-status { margin-right:auto; color:#39705a; font-size:.82rem; }
.qg3-secondary-status.is-error { color:#b42318; }
body.qg3-secondary-drawer-open { overflow:hidden; }
body.qg3-secondary-drawer-open .main-content { overflow:hidden; }
.td-intake-resume { display:flex; align-items:center; justify-content:space-between; gap:20px; margin:16px 0; padding:18px; border:1px solid #bfdbfe; border-radius:13px; background:#eff6ff; }
.td-intake-resume > div { display:grid; gap:4px; }
.td-intake-resume strong { color:#1e3a8a; }
.td-intake-resume span { color:#52637a; font-size:.86rem; }
.status-badge.status-pending { background:#fff7e6; color:#9a5b00; }

@media (max-width: 760px) {
    .qg3-intake-questions { padding:18px; }
    .qg3-intake-head, .qg3-secondary-summary, .td-intake-resume { align-items:stretch; flex-direction:column; }
    .qg3-answer-grid { grid-template-columns:1fr; }
    .qg3-intake-actions, .qg3-secondary-card-actions { align-items:stretch; flex-direction:column; }
    .qg3-secondary-status { margin:0; }
    .qg3-secondary-drawer-head { padding:20px 18px 16px; }
    .qg3-secondary-cards { padding:16px 18px 24px; }
}
@media (prefers-reduced-motion: reduce) {
    .qg3-secondary-backdrop, .qg3-secondary-drawer { transition-duration:0s; }
}
.qg3-timing-summary{display:flex;flex-wrap:wrap;gap:7px;margin-top:12px;max-width:760px}
.qg3-timing-item,.qg3-timing-total{display:inline-flex;align-items:center;min-height:26px;padding:4px 9px;border-radius:7px;background:#f1f5f9;color:#475569;font-size:.72rem;font-weight:650;font-variant-numeric:tabular-nums}
.qg3-timing-item.is-skipped{color:#8995a5;background:#f8fafc;border:1px dashed #d8e0ea}
.qg3-timing-item.is-unobserved{color:#8a5b00;background:#fffbeb;border:1px dashed #e5b94e}
.qg3-timing-total{background:#eaf7ee;color:#15723a;font-weight:800}
.qg3-error-timing{justify-content:center;margin:16px auto 0}
.qg3-error-timing .qg3-timing-total{background:#fee2e2;color:#b42318}

@media (max-width:760px){
    .qg3-substeps{align-items:stretch;justify-content:stretch;gap:7px}
    .qg3-substep{flex:1 1 calc(50% - 8px)}
    .qg3-substep-arrow{display:none}
}

/* 簡報內容模板:自訂下拉,外觀與公司/產品一致,彈層固定在下 */
.qg3-deck-field {
    display: block;
    min-width: 0;
    margin-bottom: 18px;
}
.qg3-custom-select { position: relative; }
.qg3-custom-select-trigger {
    width: 100%;
    height: 58px;
    padding: 0 52px 0 18px;
    border: 1px solid #d8e2ef;
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%231f3b64' stroke-width='2'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 20px center;
    color: #51647e;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
}
.qg3-custom-select-trigger:focus {
    outline: none;
    border-color: #2b70ea;
    box-shadow: 0 0 0 3px rgba(43, 112, 234, .1);
}
.qg3-custom-select-trigger span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qg3-custom-select-trigger:disabled {
    background-color: #f2f5f9;
    color: #94a0b0;
    cursor: not-allowed;
}
.qg3-company-select-shell .qg3-custom-select-trigger {
    padding-left: 58px;
}
.qg3-custom-select-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 60;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid #d8e2ef;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    max-height: 280px;
    overflow-y: auto;
}
.qg3-custom-select-list li {
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    color: #263750;
    font-size: .92rem;
}
.qg3-custom-select-list li:hover { background: #eff6ff; color: #1d4ed8; }
.qg3-custom-select-list li.active { background: #eff6ff; color: #1d4ed8; font-weight: 700; }

/* === 工作空間切換器 === */
.workspace-switcher { position: relative; margin-bottom: 10px; }
.workspace-switcher-trigger {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 12px; border: 1px solid rgba(255,255,255,0.14);
    border-radius: 10px; background: rgba(255,255,255,0.06); color: #e2e8f0;
    cursor: pointer; font-size: 14px; text-align: left; position: relative;
}
.workspace-switcher-trigger:hover { background: rgba(255,255,255,0.1); }
.workspace-switcher-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.workspace-switcher-caret { color: #94a3b8; font-size: 12px; }
.workspace-badge {
    position: absolute; right: 26px; top: -8px; font-size: 10px; padding: 1px 7px;
    border-radius: 999px; font-weight: 600;
}
.workspace-badge.is-enterprise { background: #2b6cb0; color: #fff; }
.workspace-badge.is-personal { background: #4a5568; color: #cbd5e0; }
.workspace-switcher-menu {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
    background: #ffffff; border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.35);
    padding: 6px; max-height: 340px; overflow-y: auto;
}
.workspace-switcher-section { display: flex; flex-direction: column; gap: 2px; }
.workspace-switcher-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
    border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left;
}
.workspace-switcher-item:hover { background: #f1f5f9; }
.workspace-switcher-item.is-active { background: #ebf4ff; }
.workspace-switcher-item-icon { font-size: 15px; color: #64748b; }
.workspace-switcher-item-copy { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.workspace-switcher-item-name { font-size: 13px; color: #1a202c; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-switcher-item-role { font-size: 11px; color: #718096; }
.workspace-switcher-item-check { color: #2b6cb0; font-weight: 700; }
.workspace-switcher-divider {
    margin: 6px 10px; padding-top: 6px; border-top: 1px solid #e2e8f0;
    font-size: 11px; color: #94a3b8;
}
.workspace-switcher-create {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px;
    border: 1px dashed #cbd5e0; background: transparent; border-radius: 8px;
    color: #2b6cb0; font-size: 13px; font-weight: 600; cursor: pointer;
}
.workspace-switcher-create:hover { background: #f0f7ff; }
.workspace-switcher-hint {
    margin: 4px 8px 0; padding: 8px 10px; font-size: 12px; color: #64748b;
    background: #f8fafc; border-radius: 8px; text-align: center;
}

/* === 企業管理頁 === */
.enterprise-page { padding: 8px 4px 40px; max-width: 980px; }
.enterprise-page-heading {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 22px;
}
.enterprise-page-heading h2 { margin: 0 0 4px; font-size: 22px; }
.enterprise-page-heading p { margin: 0; color: #718096; font-size: 13px; }
.enterprise-empty { text-align: center; padding: 48px 24px; color: #718096; }
.enterprise-empty p { margin-bottom: 18px; }
.enterprise-section {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
    padding: 20px 22px; margin-bottom: 18px;
}
.enterprise-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.enterprise-section-header h3 { margin: 0; font-size: 16px; }
.enterprise-profile-fields { display: flex; flex-direction: column; gap: 8px; }
.enterprise-profile-row { display: flex; gap: 16px; font-size: 14px; }
.enterprise-profile-label { width: 96px; color: #718096; flex-shrink: 0; }
.enterprise-profile-value { color: #1a202c; font-weight: 500; }
.enterprise-edit-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.enterprise-members, .enterprise-invitations { display: flex; flex-direction: column; gap: 8px; }
.enterprise-member-row, .enterprise-invite-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    background: #f8fafc; border-radius: 10px;
}
.enterprise-member-avatar {
    width: 34px; height: 34px; border-radius: 50%; background: #2b6cb0; color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.enterprise-member-copy { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.enterprise-member-name { font-size: 14px; font-weight: 600; color: #1a202c; }
.enterprise-member-name small { color: #718096; font-weight: 400; }
.enterprise-member-role { font-size: 12px; color: #718096; }
.enterprise-member-role.is-admin { color: #2b6cb0; font-weight: 600; }
.enterprise-member-actions { display: flex; gap: 8px; flex-shrink: 0; }
.enterprise-invite-form { display: grid; grid-template-columns: 1fr 180px; gap: 12px; margin-bottom: 14px; }
.enterprise-danger { color: #718096; font-size: 13px; }
.enterprise-danger p { margin-top: 0; }
.enterprise-delete-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-logout-btn {
    background: #c53030; color: #fff; border: 0; border-radius: 8px;
    padding: 9px 18px; font-weight: 600; cursor: pointer;
}
.settings-logout-btn:hover { background: #9b2c2c; }

/* === 認證表單補充 === */
.auth-form-row { display: flex; justify-content: flex-end; margin-top: -6px; margin-bottom: 4px; }
.auth-forgot-link { font-size: 13px; color: #2b6cb0; text-decoration: none; }
.auth-forgot-link:hover { text-decoration: underline; }

/* === 套餐權益與 TapPay 付款 === */
.billing-entitlement-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    margin-bottom: 18px; padding: 13px 16px; border: 1px solid #bfdbfe;
    border-radius: 12px; background: #eff6ff; color: #1e3a8a;
}
.billing-entitlement-banner[hidden] { display: none; }
.billing-entitlement-banner > div { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.billing-entitlement-banner strong { font-size: 14px; }
.billing-entitlement-banner span { font-size: 13px; color: #475569; }
.billing-entitlement-banner button {
    flex: none; border: 0; border-radius: 8px; padding: 8px 12px;
    background: #2563eb; color: #fff; font-weight: 700; cursor: pointer;
}
.billing-entitlement-banner.is-blocked { border-color: #fed7aa; background: #fff7ed; color: #9a3412; }
.billing-entitlement-banner.is-blocked button { background: #ea580c; }
.billing-settings-body { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.billing-settings-body > div { display: flex; flex-direction: column; gap: 5px; }
.billing-settings-body strong { color: #0f172a; font-size: 18px; }
.billing-settings-body p { margin: 0; color: #475569; font-size: 13px; }
.billing-settings-body small { color: #94a3b8; }
.billing-plan-status-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.billing-membership-status {
    padding: 3px 8px; border-radius: 999px; background: #e2e8f0;
    color: #475569; font-size: 11px; font-weight: 700;
}
.billing-membership-status[data-status="active"],
.billing-membership-status[data-status="trialing"] { background: #dcfce7; color: #166534; }
.billing-membership-status[data-status="past_due"],
.billing-membership-status[data-status="expired"] { background: #ffedd5; color: #9a3412; }
.billing-membership-status[data-status="canceled"] { background: #fee2e2; color: #991b1b; }
.billing-settings-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.billing-cancel-renew { border: 1px solid #cbd5e1; border-radius: 8px; padding: 9px 12px; background: #fff; color: #475569; font-weight: 700; cursor: pointer; }

body.billing-checkout-open { overflow: hidden; }
.billing-modal-backdrop {
    position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center;
    padding: 24px; background: rgba(10, 20, 38, .64); backdrop-filter: blur(6px);
}
.billing-modal-backdrop[hidden] { display: none; }
.billing-plan-picker-modal {
    width: min(900px, calc(100vw - 48px)); max-height: calc(100vh - 48px);
    display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid #dbe4ef; border-radius: 20px; background: #fff;
    box-shadow: 0 28px 90px rgba(8, 20, 38, .32);
}
.billing-plan-picker-cards {
    min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px; overflow-y: auto; padding: 22px 24px; background: #f6f8fb;
}
.billing-picker-card {
    min-width: 0; display: flex; flex-direction: column; padding: 20px;
    border: 1px solid #dbe4ef; border-radius: 14px; background: #fff;
    box-shadow: 0 8px 22px rgba(26, 44, 72, .06);
}
.billing-picker-card.is-recommended { border-color: #8ab4ec; box-shadow: 0 8px 24px rgba(37, 99, 235, .1); }
.billing-picker-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.billing-picker-card-head h3 { margin: 5px 0 0; color: #172a45; font-size: 19px; line-height: 1.25; }
.billing-picker-interval { color: #6d7f96; font-size: 11px; font-weight: 700; }
.billing-picker-badge { padding: 4px 8px; border-radius: 999px; background: #e9f2ff; color: #1c5ec2; font-size: 10px; font-weight: 800; }
.billing-picker-description { min-height: 40px; margin: 12px 0 16px; color: #687b92; font-size: 12px; line-height: 1.6; }
.billing-picker-price { display: flex; align-items: baseline; gap: 4px; }
.billing-picker-price strong { color: #123a78; font-size: 27px; line-height: 1; letter-spacing: -.03em; }
.billing-picker-price span { color: #8391a3; font-size: 11px; }
.billing-picker-price-note { margin: 8px 0 0; color: #58708e; font-size: 10px; line-height: 1.45; }
.billing-picker-features {
    display: flex; flex-direction: column; gap: 8px; flex: 1; list-style: none;
    margin: 17px 0 18px; padding: 16px 0 0; border-top: 1px solid #e7edf4;
}
.billing-picker-features li { position: relative; padding-left: 18px; color: #40546d; font-size: 11px; line-height: 1.45; }
.billing-picker-features li::before { content: "✓"; position: absolute; left: 0; top: 0; color: #247060; font-weight: 800; }
.billing-picker-select { width: 100%; min-height: 42px; border-radius: 8px; }
.billing-plan-picker-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    flex: none; padding: 13px 24px 16px; border-top: 1px solid #e3eaf2; background: #fff;
}
.billing-plan-picker-footer p { margin: 0; color: #73849a; font-size: 11px; }
.billing-modal {
    width: min(920px, calc(100vw - 48px)); max-height: calc(100vh - 48px);
    display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid #dbe4ef; border-radius: 20px; background: #fff;
    box-shadow: 0 28px 90px rgba(8, 20, 38, .32);
}
.billing-modal-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
    flex: none; padding: 22px 26px 19px; border-bottom: 1px solid #e7edf4;
}
.billing-modal-heading { min-width: 0; }
.billing-modal-header h2 { margin: 4px 0 3px; color: #102039; font-size: 24px; line-height: 1.25; }
.billing-modal-header p { margin: 0; color: #6b7c93; font-size: 13px; line-height: 1.5; }
.billing-modal-kicker { color: #2767d8; font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.billing-modal-close {
    width: 36px; height: 36px; flex: none; border: 1px solid transparent; border-radius: 10px;
    background: #f4f7fb; color: #60738c; font-size: 24px; line-height: 1; cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.billing-modal-close:hover { border-color: #d6e0ec; background: #eaf0f7; color: #263b57; }
.billing-modal-close:focus-visible { outline: 3px solid rgba(49, 130, 206, .2); outline-offset: 2px; }
.billing-modal-body {
    min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 310px; overflow: hidden;
}
.billing-payment-form { min-width: 0; overflow-y: auto; padding: 24px 26px 22px; }
.billing-form-section + .billing-form-section {
    margin-top: 22px; padding-top: 22px; border-top: 1px solid #e8edf3;
}
.billing-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.billing-section-heading h3 { margin: 0; color: #20334d; font-size: 15px; line-height: 1.3; }
.billing-section-heading p { margin: 0; color: #8795a8; font-size: 11px; text-align: right; }
.billing-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.billing-phone-group { grid-column: 1 / -1; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 13px; }
.billing-field { min-width: 0; display: flex; flex-direction: column; gap: 7px; color: #344861; font-size: 12px; font-weight: 700; }
.billing-form-grid input {
    width: 100%; height: 44px; box-sizing: border-box; border: 1px solid #cad6e4; border-radius: 9px;
    padding: 0 12px; outline: none; color: #17253a; background: #fbfcfe; font: inherit; font-size: 14px; font-weight: 500;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.billing-form-grid input::placeholder { color: #a0acbb; font-weight: 400; }
.billing-form-grid input:hover, .billing-tappay-field:hover { border-color: #aebed0; }
.billing-form-grid input:focus { border-color: #3182ce; background: #fff; box-shadow: 0 0 0 3px rgba(49, 130, 206, .12); }
.billing-card-fields { display: flex; flex-direction: column; gap: 13px; }
.billing-card-fields-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.billing-tappay-field {
    height: 44px; box-sizing: border-box; padding: 11px 12px; border: 1px solid #cad6e4;
    border-radius: 9px; background: #fbfcfe; transition: border-color .15s, box-shadow .15s, background .15s;
}
.billing-tappay-field:focus-within { border-color: #3182ce; background: #fff; box-shadow: 0 0 0 3px rgba(49, 130, 206, .12); }
.billing-security-note { margin: 11px 0 0; color: #78889d; font-size: 11px; line-height: 1.55; }
.billing-renew-consent {
    display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 0; padding: 12px 13px;
    border: 1px solid #dbe5f1; border-radius: 10px; background: #f7faff;
    color: #3f536d; font-size: 11px; line-height: 1.55; cursor: pointer;
}
.billing-renew-consent input { width: 16px; height: 16px; flex: none; margin: 1px 0 0; accent-color: #2563eb; }
.billing-renew-unavailable { margin: 18px 0 0; padding: 10px 12px; border-radius: 9px; background: #f7f9fc; color: #66778c; font-size: 11px; }
.billing-checkout-message { min-height: 18px; margin: 10px 0 0; color: #b42318; font-size: 12px; line-height: 1.45; }
.billing-order-panel {
    min-width: 0; padding: 24px 22px; border-left: 1px solid #e4eaf2; background: #f7f9fc;
}
.billing-order-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.billing-order-heading > span { color: #20334d; font-size: 14px; font-weight: 800; }
.billing-order-heading small { color: #8a98aa; font-size: 10px; }
.billing-selected-plan {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px; border: 1px solid #d7e1ed; border-radius: 10px; background: #fff;
}
.billing-selected-plan > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.billing-selected-plan strong { color: #263d5a; font-size: 13px; }
.billing-selected-plan span { color: #8090a4; font-size: 10px; }
.billing-selected-plan button {
    flex: none; padding: 4px 0; border: 0; background: transparent;
    color: #1d63c6; font-size: 10px; font-weight: 750; cursor: pointer;
}
.billing-selected-plan button:hover { color: #124b9c; text-decoration: underline; }
.billing-quote {
    display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px;
    margin: 16px 0; padding: 17px 0; border-top: 1px solid #dce5ef; border-bottom: 1px solid #dce5ef;
}
.billing-quote-copy { display: flex; flex-direction: column; gap: 3px; }
.billing-quote-copy span { color: #566981; font-size: 12px; }
.billing-quote-copy small { color: #8a98aa; font-size: 10px; }
.billing-quote strong { color: #174fb8; font-size: 25px; line-height: 1; letter-spacing: -.025em; white-space: nowrap; }
.billing-quote-credit { grid-column: 1 / -1; color: #55708f; font-size: 10px; line-height: 1.45; }
.billing-order-assurance { display: flex; flex-direction: column; gap: 4px; padding: 12px 13px; border-radius: 10px; background: #fff; }
.billing-order-assurance strong { color: #2d4260; font-size: 11px; }
.billing-order-assurance span { color: #7c8b9e; font-size: 10px; line-height: 1.5; }
.billing-modal-actions {
    display: flex; justify-content: flex-end; gap: 10px; flex: none;
    padding: 14px 24px 17px; border-top: 1px solid #e3eaf2; background: #fff;
}
.billing-modal-actions .company-btn-secondary, .billing-modal-actions .company-btn-primary { min-height: 42px; border-radius: 8px; }
.billing-modal-actions .company-btn-primary { min-width: 154px; }

@media (max-width: 820px) {
    .billing-plan-picker-modal { width: min(700px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border-radius: 17px; }
    .billing-plan-picker-cards { padding: 18px; }
    .billing-modal { width: min(660px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border-radius: 17px; }
    .billing-modal-backdrop { padding: 16px; }
    .billing-modal-body { display: flex; flex-direction: column; overflow-y: auto; }
    .billing-order-panel { order: -1; padding: 17px 22px; border-left: 0; border-bottom: 1px solid #e4eaf2; }
    .billing-order-heading { margin-bottom: 12px; }
    .billing-order-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .72fr); gap: 12px 18px; align-items: end; }
    .billing-order-heading { grid-column: 1 / -1; }
    .billing-quote { margin: 0; padding: 0; border: 0; }
    .billing-order-assurance { display: none; }
    .billing-payment-form { overflow: visible; padding: 20px 22px; }
}

@media (max-width: 560px) {
    .billing-entitlement-banner, .billing-settings-body { align-items: flex-start; flex-direction: column; }
    .billing-modal-backdrop { padding: 0; }
    .billing-plan-picker-modal { width: 100%; max-height: 100dvh; border: 0; border-radius: 0; }
    .billing-plan-picker-cards { grid-template-columns: 1fr; padding: 16px; }
    .billing-picker-card { padding: 18px; }
    .billing-picker-description { min-height: 0; }
    .billing-plan-picker-footer { padding: 12px 16px 15px; }
    .billing-plan-picker-footer p { display: none; }
    .billing-plan-picker-footer .company-btn-secondary { width: 100%; }
    .billing-modal { width: 100%; max-height: 100dvh; border: 0; border-radius: 0; }
    .billing-modal-header { padding: 17px 18px 15px; }
    .billing-modal-header h2 { font-size: 21px; }
    .billing-modal-header p { max-width: 280px; }
    .billing-order-panel { display: block; padding: 16px 18px; }
    .billing-order-heading { margin-bottom: 12px; }
    .billing-quote { margin: 13px 0 0; padding: 13px 0 0; border-top: 1px solid #dce5ef; border-bottom: 0; }
    .billing-payment-form { padding: 18px; }
    .billing-form-grid { grid-template-columns: 1fr; }
    .billing-phone-group { grid-column: auto; grid-template-columns: 92px minmax(0, 1fr); }
    .billing-card-fields-row { grid-template-columns: 1fr 1fr; }
    .billing-section-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
    .billing-section-heading p { text-align: left; }
    .billing-modal-actions { padding: 12px 16px 15px; }
    .billing-modal-actions .company-btn-secondary { flex: 0 0 auto; }
    .billing-modal-actions .company-btn-primary { flex: 1; min-width: 0; }
}
