:root{
    --aihg-primary:#5b5cf6;
    --aihg-secondary:#111827;
    --aihg-accent:#10b981;
    --aihg-surface:rgba(255,255,255,.78);
    --aihg-border:rgba(15,23,42,.08);
    --aihg-text:#0f172a;
    --aihg-muted:#64748b;
}

.aihg-app{
    display:grid;
    grid-template-columns:280px minmax(0,1fr);
    min-height:100vh;
    background:linear-gradient(180deg,#f8fafc 0%,#eef2ff 100%);
    color:var(--aihg-text);
    font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

.aihg-sidebar{
    position:sticky;
    top:0;
    height:100vh;
    padding:24px;
    background:linear-gradient(180deg,#0f172a 0%,#111827 100%);
    color:#fff;
    border-right:1px solid rgba(255,255,255,.08);
}

.aihg-brand{
    display:flex;
    gap:14px;
    align-items:center;
    margin-bottom:24px;
}

.aihg-logo{
    width:48px;
    height:48px;
    border-radius:16px;
    display:grid;
    place-items:center;
    background:linear-gradient(135deg,var(--aihg-primary),var(--aihg-accent));
    font-weight:800;
    box-shadow:0 16px 40px rgba(91,92,246,.28);
}

.aihg-brand strong{display:block;font-size:16px}
.aihg-brand span{display:block;font-size:12px;color:rgba(255,255,255,.7)}

.aihg-progress-steps{display:grid;gap:10px}
.aihg-progress-steps .step{
    padding:12px 14px;
    border-radius:14px;
    background:rgba(255,255,255,.05);
    color:rgba(255,255,255,.8);
    transition:.2s ease;
}
.aihg-progress-steps .step.active{
    background:rgba(255,255,255,.14);
    color:#fff;
    transform:translateX(4px);
}

.aihg-sidebar-card{
    margin-top:24px;
    padding:16px;
    border-radius:18px;
    background:rgba(255,255,255,.06);
    border:1px solid rgba(255,255,255,.08);
}
.aihg-sidebar-card h4 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #fff;
}

section.aihg-cover h1 {
    font-size: 30px;
    color: #fff;
    margin: 10px 0;
}

.aihg-sidebar select{
    width:100%;
    border-radius:12px;
    border:1px solid rgba(255,255,255,.12);
    background:#fff;
    color:#111;
    padding:10px;
}

.aihg-main{
    padding:36px;
}

.aihg-hero{
    display:flex;
    justify-content:space-between;
    gap:24px;
    align-items:stretch;
    margin-bottom:24px;
}
.aihg-kicker{
    display:inline-flex;
    padding:8px 12px;
    border-radius:999px;
    background:rgba(91,92,246,.1);
    color:var(--aihg-primary);
    font-size:12px;
    font-weight:700;
}
.aihg-hero h1{
    margin:14px 0 10px;
    font-size:clamp(28px,4vw,44px);
    line-height:1.05;
}
.aihg-hero p{max-width:740px;color:var(--aihg-muted);font-size:16px}

.aihg-hero-card{
    min-width:280px;
    display:grid;
    gap:12px;
    grid-template-columns:repeat(3,1fr);
    align-content:start;
}
.aihg-mini-stat{
    padding:18px;
    border-radius:20px;
    background:var(--aihg-surface);
    border:1px solid var(--aihg-border);
    box-shadow:0 20px 60px rgba(15,23,42,.08);
}
.aihg-mini-stat strong{display:block;font-size:20px}
.aihg-mini-stat span{font-size:12px;color:var(--aihg-muted)}

.aihg-layout{
    display:grid;
    grid-template-columns:minmax(0,1.5fr) minmax(320px,.9fr);
    gap:24px;
}

.aihg-card{
    background:var(--aihg-surface);
    backdrop-filter:blur(20px);
    border:1px solid var(--aihg-border);
    border-radius:28px;
    box-shadow:0 20px 70px rgba(15,23,42,.08);
}

.aihg-wizard{padding:28px;}
.aihg-preview-panel{padding:24px;position:sticky;top:24px;height:fit-content;}

.aihg-step{border:0;padding:0;margin:0}
.aihg-step h2{margin:0 0 18px;font-size:24px}
.aihg-grid-2{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:18px;
}
.aihg-span-2{grid-column:1 / -1}

.aihg-field label{
    display:block;
    font-size:13px;
    font-weight:700;
    margin-bottom:8px;
    color:#334155;
}
.aihg-field input,
.aihg-field textarea,
.aihg-field select{
    width:stretch;
    border:1px solid #dbe4f0;
    background:#fff;
    border-radius:16px;
    padding:14px 15px;
    font-size:14px;
    transition:.2s ease;
    box-shadow:0 1px 0 rgba(15,23,42,.02);
}
.aihg-field input:focus,
.aihg-field textarea:focus,
.aihg-field select:focus{
    outline:none;
    border-color:var(--aihg-primary);
    box-shadow:0 0 0 4px rgba(91,92,246,.12);
}
.aihg-field textarea{resize:vertical;min-height:92px}

.aihg-actions-bar{
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:center;
    margin-top:24px;
    padding-top:18px;
    border-top:1px solid rgba(15,23,42,.08);
}
.aihg-action-group{display:flex;gap:10px;flex-wrap:wrap}
.aihg-primary-btn{
    background:linear-gradient(135deg,var(--aihg-primary),#7c3aed) !important;
    border:0 !important;
    color:#fff !important;
    border-radius:14px !important;
    box-shadow:0 12px 30px rgba(91,92,246,.25);
    padding: 10px 16px !important;
}
.aihg-secondary-btn{
    border-radius:14px !important;
    border:1px solid #dbe4f0 !important;
    background:#fff !important;
    padding: 10px 16px !important;
}

button#aihg-save-draft {
    border-radius: 14px !important;
    border: 1px solid #dbe4f0 !important;
    background: #fff !important;
    padding: 10px 20px;
}

.aihg-panel-head{
    display:flex;
    justify-content:space-between;
    align-items:end;
    margin-bottom:16px;
}
.aihg-panel-head h3{margin:0;font-size:20px}
.aihg-panel-head span{font-size:12px;color:var(--aihg-muted)}

.aihg-preview-empty,
.aihg-loading,
.aihg-error{
    padding:22px;
    border-radius:18px;
    background:#fff;
    border:1px dashed #dbe4f0;
    color:var(--aihg-muted);
}
.aihg-preview-empty-inner h3{margin:0 0 8px;font-size:22px;color:var(--aihg-text)}

.aihg-progress{margin-top:18px}
.aihg-progress-bar{
    height:12px;
    border-radius:999px;
    background:#e2e8f0;
    overflow:hidden;
    margin-bottom:8px;
}
.aihg-progress-bar span{
    display:block;
    width:100%;
    height:100%;
    border-radius:inherit;
    background:linear-gradient(90deg,var(--aihg-primary),var(--aihg-accent));
    animation:aihg-loading 2.3s ease-in-out infinite;
    transform-origin:left;
}
.aihg-progress-log{
    font-size:13px;
    color:var(--aihg-muted);
}

.aihg-preview{
    background:#fff;
    border:1px solid #e7eef8;
    border-radius:22px;
    padding:24px;
}
.aihg-cover{
    padding:28px;
    border-radius:24px;
    background:linear-gradient(135deg,#0f172a 0%,#312e81 100%);
    color:#fff;
    margin-bottom:24px;
}
.aihg-cover h2{margin:12px 0 10px;font-size:34px;line-height:1.1; color: #fff;}
.aihg-cover p{color:rgba(255,255,255,.8);max-width:680px}
.aihg-cover-meta{
    display:flex;
    gap:14px;
    font-size:12px;
    color:rgba(255,255,255,.75);
    margin-top:18px;
}
.aihg-cover-badge{
    display:inline-flex;
    padding:7px 10px;
    border-radius:999px;
    background:rgba(255,255,255,.12);
    font-size:12px;
}
.aihg-preview-section{margin:20px 0}
.aihg-preview-section h2{font-size:22px;margin-bottom:10px}
.aihg-callout{
    padding:14px 16px;
    border-radius:16px;
    background:rgba(91,92,246,.08);
    border:1px solid rgba(91,92,246,.12);
    margin-bottom:12px;
}
.aihg-subsection{margin:16px 0;padding:16px;border:1px solid #edf2f7;border-radius:18px;background:#fafcff}
.aihg-bullets{margin:12px 0 0 20px}
.aihg-table-wrap{overflow:auto;margin-top:12px}
.aihg-table{
    width:100%;
    border-collapse:collapse;
    font-size:14px;
}
.aihg-table th,.aihg-table td{
    padding:12px 14px;
    border-bottom:1px solid #edf2f7;
    text-align:left;
}
.aihg-table th{background:#f8fafc}
.aihg-faq details{
    border:1px solid #edf2f7;
    background:#fff;
    border-radius:16px;
    padding:12px 14px;
    margin-bottom:10px;
}
.aihg-faq summary{cursor:pointer;font-weight:700}
.aihg-result-actions{display:flex;gap:10px;margin-top:16px}

@keyframes aihg-loading{
    0%{transform:scaleX(.35);opacity:.55}
    50%{transform:scaleX(.8);opacity:1}
    100%{transform:scaleX(.35);opacity:.55}
}

@media (max-width: 1200px){
    .aihg-app{grid-template-columns:1fr}
    .aihg-sidebar{position:relative;height:auto}
    .aihg-layout{grid-template-columns:1fr}
    .aihg-preview-panel{position:relative;top:auto}
    .aihg-hero{flex-direction:column}
}

@media (max-width: 780px){
    .aihg-main{padding:18px}
    .aihg-wizard,.aihg-preview-panel{padding:18px}
    .aihg-grid-2{grid-template-columns:1fr}
    .aihg-span-2{grid-column:auto}
    .aihg-hero-card{grid-template-columns:1fr 1fr 1fr}
    .aihg-actions-bar{flex-direction:column;align-items:stretch}
    .aihg-action-group{justify-content:stretch}
    .aihg-action-group .button{flex:1}
}
