*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

body{
    font-family:Arial, sans-serif;
    background:#f3f6fb;
    color:#111827;
}

.container{
    width:95%;
    max-width:1200px;
    margin:auto;
    padding:30px 20px;
}

.header{
    text-align:center;
    margin-bottom:25px;
}

.header h1{
    font-size:34px;
    color:#0f172a;
}

.nav{
    display:flex;
    justify-content:center;
    gap:14px;
    margin-bottom:35px;
    flex-wrap:wrap;
}

.nav a{
    background:#ffffff;
    color:#1f2937;
    padding:10px 16px;
    border-radius:10px;
    text-decoration:none;
    border:1px solid #e5e7eb;
}

.nav a:hover{
    background:#eef2ff;
}

.hero-card{
    background:#ffffff;
    border:1px solid #e5e7eb;
    border-radius:22px;
    padding:45px;
    box-shadow:0 20px 50px rgba(15,23,42,.08);
    text-align:center;
}

.hero-badge{
    display:inline-block;
    background:#eef2ff;
    color:#1d4ed8;
    padding:8px 14px;
    border-radius:999px;
    font-weight:bold;
    margin-bottom:18px;
    font-size:14px;
}

.hero-card h2{
    font-size:38px;
    margin-bottom:18px;
    color:#0f172a;
}

.hero-card p{
    max-width:760px;
    margin:0 auto 28px;
    line-height:1.7;
    color:#4b5563;
    font-size:17px;
}

.upload-box{
    max-width:620px;
    margin:30px auto 0;
    background:#f9fafb;
    border:1px dashed #cbd5e1;
    border-radius:18px;
    padding:25px;
}

.upload-box label{
    display:block;
    font-weight:bold;
    margin-bottom:12px;
}

input[type=file]{
    width:100%;
    background:white;
    border:1px solid #d1d5db;
    border-radius:10px;
    padding:14px;
    margin-bottom:18px;
}

button{
    background:#2563eb;
    color:white;
    border:none;
    padding:13px 24px;
    border-radius:10px;
    cursor:pointer;
    font-weight:bold;
}

button:hover{
    background:#1d4ed8;
}

.notice{
    margin:25px auto 0;
    max-width:760px;
    background:#fff7ed;
    border:1px solid #fed7aa;
    color:#9a3412;
    padding:14px 18px;
    border-radius:12px;
    font-size:14px;
}

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

.feature-card{
    background:white;
    border:1px solid #e5e7eb;
    border-radius:18px;
    padding:25px;
    box-shadow:0 10px 25px rgba(15,23,42,.05);
}

.feature-card .icon{
    font-size:32px;
    margin-bottom:12px;
}

.feature-card h3{
    margin-bottom:10px;
    color:#0f172a;
}

.feature-card p{
    color:#4b5563;
    line-height:1.6;
}

.card{
    background:white;
    border:1px solid #e5e7eb;
    border-radius:18px;
    padding:30px;
    box-shadow:0 10px 30px rgba(15,23,42,.06);
    margin-bottom:25px;
}

.section{
    background:#fafafa;
    border:1px solid #e5e7eb;
    padding:20px;
    border-radius:12px;
    margin-bottom:25px;
}

pre{
    white-space:pre-wrap;
    word-wrap:break-word;
    background:#f9fafb;
    padding:15px;
    border-radius:8px;
    line-height:1.6;
}

summary{
    cursor:pointer;
    font-weight:bold;
    font-size:18px;
}

.history-table{
    width:100%;
    border-collapse:collapse;
}

.history-table th,
.history-table td{
    border:1px solid #ddd;
    padding:12px;
}

.history-table th{
    background:#f3f4f6;
}

.topbar{
    background:white;
    border-bottom:1px solid #e5e7eb;
    padding:18px 30px;

    display:flex;
    justify-content:space-between;
    align-items:center;
}

.brand{
    text-decoration:none;
    font-size:24px;
    font-weight:bold;
    color:#111827;
}

.auth-links{
    display:flex;
    align-items:center;
    gap:12px;
}

.auth-links a{
    text-decoration:none;
}

.register-btn{
    background:#2563eb;
    color:white !important;
    padding:10px 16px;
    border-radius:8px;
}

.auth-card{
    max-width:500px;
    margin:40px auto;
    background:white;
    padding:30px;
    border-radius:18px;
    border:1px solid #e5e7eb;
}

.auth-card form{
    display:flex;
    flex-direction:column;
    gap:15px;
}

.auth-card input{
    padding:14px;
    border:1px solid #d1d5db;
    border-radius:8px;
}

.success-message{
    background:#dcfce7;
    color:#166534;
    padding:12px;
    border-radius:8px;
    margin-bottom:20px;
}

.error-message{
    background:#fee2e2;
    color:#991b1b;
    padding:12px;
    border-radius:8px;
    margin-bottom:20px;
}

.link-button{
    background:none;
    border:none;
    cursor:pointer;
    color:#dc2626;
    font-weight:bold;
}

.user-dropdown{
    position:relative;
    padding-bottom:12px;
}

.user-menu-button{
    background:#f8fafc;
    color:#0f172a;
    border:1px solid #e5e7eb;
    padding:10px 16px;
    border-radius:999px;
    cursor:pointer;
    font-weight:bold;
    box-shadow:0 8px 20px rgba(15,23,42,.08);
}

.user-dropdown-menu{
    display:none;
    position:absolute;
    right:0;
    top:42px;
    min-width:180px;
    background:white;
    border:1px solid #e5e7eb;
    border-radius:14px;
    box-shadow:0 18px 40px rgba(15,23,42,.15);
    overflow:hidden;
    z-index:999;
}

.user-dropdown:hover .user-dropdown-menu{
    display:block;
}

.user-dropdown-menu a,
.user-dropdown-menu button{
    display:block;
    width:100%;
    padding:13px 16px;
    background:white;
    color:#111827;
    border:none;
    text-align:left;
    text-decoration:none;
    cursor:pointer;
    font-size:14px;
}

.user-dropdown-menu a:hover,
.user-dropdown-menu button:hover{
    background:#f3f4f6;
}

.analysis-section{
    background:white;
    border:1px solid #e5e7eb;
    border-radius:22px;
    padding:28px;
    margin-bottom:20px;
    box-shadow:0 15px 40px rgba(15,23,42,.08);
}

.analysis-section-header{
    display:flex;
    align-items:center;
    gap:12px;
    margin-bottom:18px;
    border-bottom:1px solid #eef2f7;
    padding-bottom:15px;
}

.analysis-section-header span{
    font-size:28px;
}

.analysis-section-header h3{
    margin:0;
    color:#0f172a;
    font-size:22px;
}

.analysis-section-content{
    color:#374151;
    line-height:1.8;
    font-size:15px;
}

.report-shell{
    max-width:1100px;
    margin:0 auto;
}

.report-header{
    background:linear-gradient(135deg,#0f172a,#1e293b);
    color:white;
    border-radius:24px;
    padding:35px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:20px;
    margin-bottom:22px;
    box-shadow:0 25px 60px rgba(15,23,42,.25);
}

.report-header h2{
    font-size:34px;
    margin:12px 0;
}

.report-header p{
    color:#cbd5e1;
    line-height:1.6;
}

.report-badge{
    display:inline-block;
    background:#2563eb;
    color:white;
    padding:8px 14px;
    border-radius:999px;
    font-size:13px;
    font-weight:bold;
}

.report-warning{
    background:#fff7ed;
    color:#9a3412;
    border:1px solid #fed7aa;
    padding:16px 20px;
    border-radius:16px;
    margin-bottom:22px;
}

.analysis-section{
    background:white;
    border:1px solid #e5e7eb;
    border-radius:22px;
    padding:28px;
    margin-bottom:20px;
    box-shadow:0 15px 40px rgba(15,23,42,.08);
}

.analysis-section-header{
    display:flex;
    align-items:center;
    gap:12px;
    margin-bottom:18px;
    border-bottom:1px solid #eef2f7;
    padding-bottom:15px;
}

.analysis-section-header span{
    font-size:28px;
}

.analysis-section-header h3{
    margin:0;
    color:#0f172a;
    font-size:22px;
}

.analysis-section-content{
    color:#374151;
    line-height:1.8;
    font-size:15px;
}

.risk-score-card{
    border-radius:22px;
    padding:35px;
    margin-bottom:25px;
    color:white;
}

.risk-score-number{
    font-size:60px;
    font-weight:bold;
    margin-bottom:10px;
}

.risk-high{
    background:#dc2626;
}

.risk-medium{
    background:#ea580c;
}

.risk-low{
    background:#16a34a;
}

.risk-score-text{
    font-size:16px;
    line-height:1.8;
}

.report-actions{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
}

.pdf-btn{
    background:#16a34a;
    color:white;
    border:none;
    padding:12px 18px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
}

.pdf-btn:hover{
    background:#15803d;
}

.new-analysis-btn{
    background:#2563eb;
    color:white;
    border:none;
    padding:12px 18px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
}

.new-analysis-btn:hover{
    background:#1d4ed8;
}

.document-type-card{
    background:white;
    border:1px solid #e5e7eb;
    border-radius:20px;
    padding:24px;
    margin-bottom:22px;
    display:flex;
    gap:18px;
    align-items:flex-start;
    box-shadow:0 15px 40px rgba(15,23,42,.08);
}

.document-type-icon{
    font-size:38px;
}

.document-type-card h3{
    margin-bottom:10px;
    color:#0f172a;
}

.document-type-card p{
    color:#374151;
    line-height:1.7;
}

textarea{
    width:100%;
    padding:14px;
    border:1px solid #d1d5db;
    border-radius:10px;
    margin-bottom:15px;
    font-family:Arial, sans-serif;
}

.chat-box{
    margin-top:20px;
    border:1px solid #e5e7eb;
    border-radius:16px;
    overflow:hidden;
}

.chat-question{
    background:#f8fafc;
    padding:16px;
    border-bottom:1px solid #e5e7eb;
}

.chat-answer{
    background:white;
    padding:16px;
    line-height:1.7;
}

.history-header{
    background:linear-gradient(135deg,#0f172a,#1e293b);
    color:white;
    border-radius:24px;
    padding:35px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:20px;
    margin-bottom:25px;
    box-shadow:0 25px 60px rgba(15,23,42,.22);
}

.history-header h2{
    font-size:32px;
    margin:10px 0;
}

.history-header p{
    color:#cbd5e1;
    line-height:1.6;
}

.history-badge{
    display:inline-block;
    background:#2563eb;
    color:white;
    padding:8px 14px;
    border-radius:999px;
    font-size:13px;
    font-weight:bold;
}

.history-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
    gap:20px;
}

.history-card{
    background:white;
    border:1px solid #e5e7eb;
    border-radius:20px;
    padding:22px;
    display:flex;
    gap:16px;
    box-shadow:0 15px 40px rgba(15,23,42,.08);
}

.history-card-icon{
    width:52px;
    height:52px;
    border-radius:16px;
    background:#eef2ff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:26px;
    flex-shrink:0;
}

.history-card-content h3{
    font-size:17px;
    color:#0f172a;
    margin-bottom:8px;
    word-break:break-word;
}

.history-card-content p{
    color:#6b7280;
    font-size:14px;
    margin-bottom:15px;
}

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

.history-actions a{
    text-decoration:none;
    background:#f3f4f6;
    color:#111827;
    padding:9px 13px;
    border-radius:9px;
    font-weight:bold;
    font-size:14px;
}

.history-actions a:hover{
    background:#e0e7ff;
}

.empty-history{
    grid-column:1/-1;
    background:white;
    border:1px solid #e5e7eb;
    border-radius:22px;
    padding:40px;
    text-align:center;
}

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

.empty-history p{
    color:#6b7280;
    margin-bottom:20px;
}

.pagination-area{
    margin-top:25px;
}

.site-logo{
    display:flex;
    align-items:center;
    gap:12px;
    position:relative;
}

.site-logo img{
    width:42px;
    height:42px;
    object-fit:contain;
    filter:drop-shadow(0 8px 18px rgba(37,99,235,.35));
}

.site-logo span{
    font-size:32px;
    font-weight:900;
    letter-spacing:-1px;
    color:#0f172a;
    background:linear-gradient(90deg,#0f172a,#2563eb,#7c3aed);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    text-shadow:0 10px 30px rgba(37,99,235,.18);
}

.site-logo::after{
    content:"AI";
    font-size:11px;
    font-weight:800;
    color:white;
    background:linear-gradient(135deg,#2563eb,#7c3aed);
    padding:4px 7px;
    border-radius:999px;
    margin-left:4px;
    box-shadow:0 8px 20px rgba(37,99,235,.35);
}

#selectedFiles{
    margin-top:15px;
}

.selected-file{
    background:#f8fafc;
    border:1px solid #e5e7eb;
    border-radius:10px;
    padding:10px 14px;
    margin-bottom:8px;
    font-size:14px;
}

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

#loadingOverlay{
    position:fixed;
    inset:0;
    background:rgba(15,23,42,.85);
    display:none;
    align-items:center;
    justify-content:center;
    z-index:9999;
}

.loading-card{
    width:520px;
    max-width:92%;
    background:white;
    border-radius:24px;
    padding:40px;
    text-align:center;
}

.ai-loader{
    width:70px;
    height:70px;
    border-radius:50%;
    border:5px solid #e5e7eb;
    border-top:5px solid #2563eb;
    margin:0 auto 25px;
    animation:spin 1s linear infinite;
}

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

.loading-steps{
    margin-top:25px;
    text-align:left;
}

.loading-steps .step{
    padding:10px 0;
    color:#94a3b8;
    font-weight:600;
}

.loading-steps .active{
    color:#2563eb;
}

.ad-box{
    margin:25px 0;
    padding:12px;
    background:#f8fafc;
    border:1px solid #e5e7eb;
    border-radius:14px;
    text-align:center;
    min-height:90px;
}

.top-ad-space{
    max-width:1200px;
    margin:15px auto 20px auto;
    padding:0 20px;
}

.top-ad-space .ad-box{
    margin:0;
    min-height:120px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:18px;
    box-shadow:0 10px 30px rgba(15,23,42,.06);
}
.login-btn{
    color:#0f172a;
    text-decoration:none;
    font-weight:700;
    padding:10px 14px;
    border-radius:10px;
    transition:.2s;
}

.login-btn:hover{
    background:#f3f4f6;
}

.register-btn{
    background:#2563eb;
    color:white !important;
    padding:10px 16px;
    border-radius:10px;
    text-decoration:none;
    font-weight:700;
}

.topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
}

.auth-links{
    margin-left:auto;
    display:flex;
    align-items:center;
    gap:12px;
    flex-shrink:0;
    position:relative;
    z-index:20;
}

.login-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    color:#0f172a;
    text-decoration:none;
    font-weight:800;
    padding:10px 14px;
    border-radius:999px;
    background:#f8fafc;
    border:1px solid #e5e7eb;
}

.login-btn:hover{
    background:#eef2ff;
}

.register-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    background:linear-gradient(135deg,#2563eb,#7c3aed);
    color:white !important;
    padding:10px 16px;
    border-radius:999px;
    text-decoration:none;
    font-weight:800;
    box-shadow:0 10px 25px rgba(37,99,235,.25);
}

.register-btn:hover{
    transform:translateY(-1px);
}
.topbar{
    width:100%;
    min-height:82px;
    display:flex !important;
    align-items:center !important;
    justify-content:space-between !important;
    gap:20px;
    overflow:visible !important;
}

.site-logo{
    flex:0 1 auto;
}

.auth-links{
    margin-left:auto !important;
    display:flex !important;
    align-items:center !important;
    justify-content:flex-end !important;
    gap:12px;
    min-width:220px;
    visibility:visible !important;
    opacity:1 !important;
    position:relative;
    z-index:9999;
}

.login-btn,
.register-btn{
    display:inline-flex !important;
    visibility:visible !important;
    opacity:1 !important;
    white-space:nowrap;
}

.auth-inline-actions{
    display:flex;
    justify-content:center;
    gap:12px;
    margin-top:20px;
    flex-wrap:wrap;
}

.auth-inline-actions a{
    text-decoration:none;
}
/* Final auth/header safeguards */
.topbar{
    width:100%;
    min-height:82px;
    display:flex !important;
    align-items:center !important;
    justify-content:space-between !important;
    gap:20px;
    overflow:visible !important;
}
.auth-links{
    margin-left:auto !important;
    display:flex !important;
    align-items:center !important;
    justify-content:flex-end !important;
    gap:12px;
    min-width:220px;
    visibility:visible !important;
    opacity:1 !important;
    position:relative;
    z-index:9999;
}
.login-btn,.register-btn{
    display:inline-flex !important;
    align-items:center;
    justify-content:center;
    visibility:visible !important;
    opacity:1 !important;
    white-space:nowrap;
    text-decoration:none;
    font-weight:800;
    border-radius:999px;
}
.login-btn{
    color:#0f172a;
    padding:10px 14px;
    background:#f8fafc;
    border:1px solid #e5e7eb;
}
.register-btn{
    color:white !important;
    padding:10px 16px;
    background:linear-gradient(135deg,#2563eb,#7c3aed);
    box-shadow:0 10px 25px rgba(37,99,235,.25);
}
.auth-inline-actions{
    display:flex;
    justify-content:center;
    gap:12px;
    margin-top:20px;
    flex-wrap:wrap;
}
.guest-upload-box h3{
    color:#0f172a;
    margin-bottom:15px;
}
.guest-upload-box p{
    margin-bottom:20px;
}
