@font-face{
    font-family:'Vazirmatn';
    src:url('../fonts/vazirmatn/Vazirmatn-Regular.ttf') format('truetype');
    font-weight:400;
}
@font-face{
    font-family:'Vazirmatn';
    src:url('../fonts/vazirmatn/Vazirmatn-Medium.ttf') format('truetype');
    font-weight:500;
}
@font-face{
    font-family:'Vazirmatn';
    src:url('../fonts/vazirmatn/Vazirmatn-SemiBold.ttf') format('truetype');
    font-weight:600;
}
@font-face{
    font-family:'Vazirmatn';
    src:url('../fonts/vazirmatn/Vazirmatn-Bold.ttf') format('truetype');
    font-weight:700;
}
:root{
    --bg:#eef3f9;
    --surface:#fff;
    --surface-2:#f7faff;
    --border:#d8e2ee;
    --text:#132033;
    --muted:#5d6f86;
    --primary:#1e88ff;
    --primary-strong:#1165d6;
    --danger:#dc4d57;
    --success:#14a86b;
    --shadow:0 18px 50px rgba(18,32,51,.08);
    --radius:22px;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
body{
    font-family:'Vazirmatn',Tahoma,"Segoe UI",sans-serif;
    background:radial-gradient(circle at top,#f8fbff 0,var(--bg) 60%);
    color:var(--text);
}
a{color:inherit;text-decoration:none}
button,input,textarea,select{font:inherit}
button{cursor:pointer}

.crawler-auth-body{min-height:100vh;display:grid;place-items:center;padding:20px}
.auth-card{
    width:min(480px,100%);
    background:linear-gradient(180deg,#fff 0,#fbfdff 100%);
    border:1px solid var(--border);
    border-radius:30px;
    padding:30px;
    box-shadow:var(--shadow);
}
.auth-card__header h1{margin:0 0 10px;font-size:30px}
.auth-card__header p{margin:0 0 22px;color:var(--muted);line-height:1.9}
.auth-form{display:grid;gap:14px}

.crawler-admin-body{min-height:100vh}
.crawler-shell{display:grid;grid-template-columns:340px minmax(0,1fr);min-height:100vh}
.crawler-sidebar{
    background:linear-gradient(180deg,#0f1726 0,#111f33 100%);
    color:#eff5ff;
    padding:22px 18px;
    display:flex;
    flex-direction:column;
    gap:16px;
    position:sticky;
    top:0;
    height:100vh;
    min-height:100vh;
    overflow:hidden;
    border-left:1px solid rgba(255,255,255,.06);
}
.crawler-brand{
    padding:10px 12px 14px;
    border:1px solid rgba(255,255,255,.08);
    border-radius:20px;
    background:rgba(255,255,255,.03);
}
.crawler-brand strong{display:block;font-size:22px;letter-spacing:.2px}
.crawler-brand span{display:block;margin-top:8px;font-size:13px;line-height:1.9;color:#a9bbd9}
.crawler-nav{
    display:flex;
    flex-direction:column;
    gap:10px;
    flex:1 1 auto;
    min-height:0;
    overflow-y:auto;
    overflow-x:hidden;
    padding-bottom:8px;
}
.crawler-nav-group{
    border:1px solid rgba(255,255,255,.08);
    border-radius:20px;
    background:rgba(255,255,255,.03);
    overflow:visible;
}
.crawler-nav-group[open]{background:rgba(255,255,255,.05)}
.crawler-nav-group summary{
    list-style:none;
    padding:12px 14px;
    font-weight:700;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
}
.crawler-nav-group summary::-webkit-details-marker{display:none}
.crawler-nav-group summary::after{content:'+';opacity:.7}
.crawler-nav-group[open] summary::after{content:'–'}
.crawler-nav-links{display:grid;gap:6px;padding:0 10px 12px}
.crawler-nav__item{
    padding:11px 13px;
    border-radius:14px;
    color:#dce6f5;
    background:rgba(255,255,255,.02);
    transition:.18s ease;
    font-size:13px;
    line-height:1.7;
    white-space:normal;
}
.crawler-nav__item:hover,.crawler-nav__item.is-active{background:#20334f;color:#fff;transform:translateX(-2px)}
.crawler-nav__item small{display:block;color:inherit;opacity:.7;font-size:11px;margin-top:4px;line-height:1.7}
.crawler-logout{margin-top:auto}

.crawler-main{padding:24px}
.crawler-page{display:grid;gap:18px}
.crawler-page__header{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:14px;
    flex-wrap:wrap;
    padding:2px 2px 6px;
}
.crawler-page__header h1{margin:0 0 8px;font-size:30px}
.crawler-page__header p{margin:0;color:var(--muted);line-height:1.9;max-width:760px}
.crawler-page__hero{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    align-items:center;
}
.section-tabs{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    padding:4px 0 2px;
}
.section-tab{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:40px;
    padding:0 14px;
    border:1px solid var(--border);
    border-radius:999px;
    background:#fff;
    color:var(--muted);
    font-size:13px;
    font-weight:600;
}
.section-tab.is-active{
    background:var(--primary);
    color:#fff;
    border-color:var(--primary);
}

.grid{display:grid;gap:18px}
.grid--stats{grid-template-columns:repeat(4,minmax(0,1fr))}
.grid--two{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid--three{grid-template-columns:repeat(3,minmax(0,1fr))}
.stat-card,.panel{
    background:linear-gradient(180deg,#fff 0,#fcfdff 100%);
    border:1px solid var(--border);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
}
.stat-card{padding:22px}
.stat-card span{display:block;color:var(--muted);font-size:13px}
.stat-card strong{display:block;margin-top:12px;font-size:30px}
.stat-card small{display:block;margin-top:8px;color:var(--muted);line-height:1.8}
.panel{padding:22px}
.panel__header{
    display:flex;
    justify-content:space-between;
    gap:10px;
    align-items:flex-start;
    flex-wrap:wrap;
    margin-bottom:16px;
}
.panel__header strong{font-size:18px}
.panel__header span{color:var(--muted);font-size:13px;line-height:1.8;max-width:60ch}
.panel--compact{padding:18px}

.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.jobs-filters{
    display:grid;
    gap:12px;
    padding:14px;
    border:1px solid var(--border);
    border-radius:18px;
    background:linear-gradient(180deg,#fbfdff 0,#f7faff 100%);
}
.jobs-filters__main{
    display:grid;
    grid-template-columns:minmax(260px,2.2fr) repeat(5,minmax(120px,1fr));
    gap:12px;
    align-items:end;
}
.jobs-filters__search{min-width:0}
.jobs-filters__advanced{
    border:1px dashed var(--border);
    border-radius:16px;
    background:#fff;
    padding:10px 12px;
}
.jobs-filters__advanced summary{
    cursor:pointer;
    font-weight:700;
    color:var(--muted);
}
.jobs-filters__advanced-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px;
    margin-top:12px;
}
.jobs-filters__actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    align-items:center;
}
.field{display:grid;gap:8px}
.field span{font-size:13px;color:var(--muted)}
.field input,.field textarea,.field select{
    width:100%;
    padding:12px 14px;
    border:1px solid var(--border);
    border-radius:14px;
    background:#fff;
    color:var(--text);
}
.field textarea{resize:vertical;min-height:92px}
.field--full{grid-column:1/-1}
.field--check{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:12px 14px;
    border:1px solid var(--border);
    border-radius:14px;
    background:var(--surface-2);
}
.field--check input{width:18px;height:18px}
.checks{display:flex;gap:8px;flex-wrap:wrap}
.checks label{
    padding:9px 11px;
    border:1px solid var(--border);
    border-radius:12px;
    background:var(--surface-2);
    font-size:13px;
}

.button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:11px 16px;
    border-radius:14px;
    border:1px solid transparent;
    transition:.18s ease;
    font-weight:700;
}
.button:hover{transform:translateY(-1px)}
.button--primary{background:var(--primary);color:#fff}
.button--primary:hover{background:var(--primary-strong)}
.button--secondary{background:#e9f2ff;color:#0e4ea1;border-color:#caddff}
.button--ghost{background:#fff;border-color:var(--border);color:var(--text)}
.button--danger{background:#fff1f2;border-color:#fecdd3;color:#b4232d}
.button--wide{min-width:120px}
.button--sm{padding:8px 12px;border-radius:12px;font-size:12px;min-height:34px}

.alert{
    padding:14px 16px;
    border-radius:16px;
    border:1px solid;
    line-height:1.8;
}
.alert__detail{
    margin-top:10px;
    padding-top:10px;
    border-top:1px solid rgba(159,18,57,.18);
    color:#7f1d1d;
    direction:ltr;
    text-align:left;
    white-space:pre-wrap;
    font-size:12px;
    font-family:Consolas,Monaco,monospace;
}
.alert--success{background:#ecfdf5;border-color:#bbf7d0;color:#166534}
.alert--danger{background:#fff1f2;border-color:#fecdd3;color:#9f1239}

.table-wrap{overflow:auto;border-radius:18px;border:1px solid var(--border);background:#fff}
.table{width:100%;border-collapse:collapse;font-size:14px;min-width:720px}
.table th,.table td{padding:12px 10px;border-bottom:1px solid var(--border);text-align:right;vertical-align:top}
.table th{color:var(--muted);font-weight:700;font-size:13px;background:#fafcff}
.table tr:hover td{background:#fbfdff}
.jobs-table__icon-cell{
    white-space:nowrap;
    text-align:center;
    width:1%;
}
.icon-button{
    width:32px;
    height:32px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:999px;
    border:1px solid var(--border);
    background:#fff;
    color:var(--muted);
    vertical-align:middle;
    margin-inline:2px;
}
.icon-button:hover{background:#f8fbff;color:var(--text)}
.icon-button--primary{background:#eef6ff;color:var(--primary-strong);border-color:#cfe0ff}
.icon-button--danger{background:#fff1f2;color:#b4232d;border-color:#fecdd3}
.icon-button--disabled{opacity:.55;cursor:default}
.icon-button span{font-size:16px;line-height:1}

.stack-list{display:grid;gap:14px}
.stack-card{
    padding:16px;
    border:1px solid var(--border);
    border-radius:18px;
    background:var(--surface-2);
    display:grid;
    gap:12px;
}
.stack-card--source{
    padding:12px 14px;
    gap:10px;
}
.stack-card__header{
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:flex-start;
    flex-wrap:wrap;
}
.source-statuses{
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}
.source-status-badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:7px 12px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
    border:1px solid var(--border);
    background:#fff;
}
.source-status-badge.is-active{
    color:#166534;
    background:#ecfdf5;
    border-color:#bbf7d0;
}
.source-status-badge.is-inactive{
    color:#9a3412;
    background:#fff7ed;
    border-color:#fed7aa;
}
.source-status-badge.is-error{
    color:#991b1b;
    background:#fef2f2;
    border-color:#fecaca;
}
.stack-card--compact{display:flex;justify-content:space-between;align-items:center}
.stack-card__row{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}
.stack-card__actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.source-error-box{
    display:grid;
    gap:6px;
    margin-top:12px;
    padding:12px 14px;
    border-radius:16px;
    border:1px solid #fecaca;
    background:#fff5f5;
}
.source-error-box strong{
    color:#991b1b;
    font-size:13px;
}
.source-error-box span{
    color:#7f1d1d;
    line-height:1.8;
    font-size:13px;
}
.inline-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.badge{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 10px;border-radius:999px;border:1px solid var(--border);background:#eef6ff;color:#1d4ed8;font-size:12px;font-weight:800;white-space:nowrap}
.badge--success{background:#ecfdf5;border-color:#bbf7d0;color:#047857}
.badge--danger{background:#fff1f2;border-color:#fecdd3;color:#be123c}
.badge--muted{background:#f8fafc;border-color:#e2e8f0;color:#64748b}
.llm-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    padding:16px;
    margin-bottom:16px;
    border:1px solid var(--border);
    border-radius:22px;
    background:linear-gradient(135deg,#f8fbff 0%,#eef6ff 100%);
}
.llm-toolbar__text{display:grid;gap:6px}
.llm-toolbar__text strong{font-size:18px}
.llm-toolbar__text span{color:var(--muted);line-height:1.8}
.llm-model-list{display:grid;gap:12px}
.llm-model-card{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:16px;
    align-items:center;
    padding:16px;
    border:1px solid var(--border);
    border-radius:22px;
    background:#fff;
    box-shadow:0 14px 35px rgba(15,23,42,.05);
}
.llm-model-card__main{display:flex;align-items:flex-start;gap:14px;min-width:0}
.llm-model-card__icon{
    width:48px;
    height:48px;
    border-radius:16px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
    background:linear-gradient(135deg,#2563eb,#22c55e);
    color:#fff;
    font-weight:900;
    box-shadow:0 12px 24px rgba(37,99,235,.22);
}
.llm-model-card__content{display:grid;gap:8px;min-width:0}
.llm-model-card__title{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.llm-model-card__title strong{font-size:17px}
.llm-model-card__meta{display:flex;gap:8px;flex-wrap:wrap;color:var(--muted);font-size:13px;direction:ltr;text-align:left}
.llm-model-card__meta span{
    max-width:520px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    padding:5px 9px;
    border:1px solid #e2e8f0;
    border-radius:999px;
    background:#f8fafc;
}
.llm-model-card__actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.llm-model-card__actions form{margin:0}
.llm-modal{width:min(1040px,calc(100vw - 24px))}
.source-metrics{
    display:flex;
    gap:10px;
    flex-wrap:nowrap;
    overflow-x:auto;
    padding-bottom:2px;
}
.source-metrics span{
    display:inline-flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    padding:7px 10px;
    border-radius:999px;
    background:#fff;
    border:1px solid var(--border);
    font-size:12px;
    min-width:0;
    flex:0 0 160px;
}
.source-metrics em{
    color:var(--muted);
    font-style:normal;
    white-space:nowrap;
}
.source-metrics strong{
    font-weight:700;
    white-space:nowrap;
}
.stack-card__actions--compact{
    gap:8px;
}
.stack-card__actions--compact .button{
    padding:9px 12px;
    min-height:36px;
}
.social-posts-list{
    display:grid;
    gap:10px;
}
.social-post-card{
    display:grid;
    grid-template-columns:72px minmax(0,1fr);
    gap:12px;
    align-items:center;
    padding:12px;
    border:1px solid var(--border);
    border-radius:16px;
    background:#fff;
}
.social-post-card__thumb-wrap{
    display:flex;
    align-items:center;
    justify-content:center;
}
.social-post-card__thumb{
    width:72px;
    height:72px;
    border-radius:16px;
    object-fit:cover;
    display:block;
    background:#f3f6fb;
}
.social-post-card__thumb--placeholder{
    display:flex;
    align-items:center;
    justify-content:center;
    color:var(--primary);
    font-weight:800;
    font-size:24px;
    background:linear-gradient(135deg,#eef4ff,#f7f9fc);
}
.social-post-card__body{
    min-width:0;
    display:grid;
    gap:7px;
}
.social-post-card__meta{
    display:flex;
    align-items:center;
    gap:8px;
    min-width:0;
    flex-wrap:wrap;
}
.social-post-card__meta strong{
    font-size:14px;
}
.social-post-card__meta small{
    color:var(--muted);
    font-size:12px;
}
.social-post-card__text{
    margin:0;
    color:var(--text);
    font-size:13px;
    line-height:1.8;
}
.social-post-card__footer{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    color:var(--muted);
    font-size:12px;
}

.crawler-integration-card{display:grid;gap:16px}
.crawler-credential-status{
    display:flex;
    justify-content:space-between;
    gap:14px;
    align-items:flex-start;
    padding:16px 18px;
    border:1px solid var(--border);
    border-radius:20px;
    background:linear-gradient(135deg,#f8fbff 0,#eef5ff 100%);
}
.crawler-credential-status strong{display:block;margin-bottom:6px}
.crawler-credential-status span,.crawler-credential-status small{color:var(--muted);line-height:1.8}
.crawler-credential-badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:8px 12px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
    border:1px solid var(--border);
    background:#fff;
}
.crawler-credential-badge.is-ready{color:#166534;background:#ecfdf5;border-color:#bbf7d0}
.crawler-credential-badge.is-missing{color:#9f1239;background:#fff1f2;border-color:#fecdd3}
.crawler-secret-toggle{display:grid;gap:12px}
.crawler-secret-toggle summary{list-style:none}
.crawler-secret-toggle summary::-webkit-details-marker{display:none}
.crawler-secret-editor{padding:14px;border:1px dashed var(--border);border-radius:18px;background:var(--surface-2)}
.simple-list{display:grid;gap:10px}
.simple-list__item{padding:14px;border:1px solid var(--border);border-radius:16px;background:var(--surface-2)}
.simple-list__item strong{display:block;margin-bottom:6px}
.simple-list__item span,.simple-list__item small{display:block;color:var(--muted);line-height:1.8}
.kv-list{display:grid;gap:12px}
.kv-list div{display:flex;justify-content:space-between;gap:12px;padding:12px 14px;border:1px solid var(--border);border-radius:14px;background:var(--surface-2)}
.muted{color:var(--muted)}
.text-danger{color:#b91c1c}
.code-block{display:grid;gap:10px}
.code-block code{
    display:block;
    padding:12px 14px;
    border-radius:14px;
    background:#0f1726;
    color:#e7eef9;
    direction:ltr;
    text-align:left;
    overflow:auto;
    white-space:pre-wrap;
}

.modal{
    border:none;
    border-radius:24px;
    padding:0;
    width:min(860px,calc(100vw - 24px));
    box-shadow:0 24px 70px rgba(15,23,42,.25);
}
.modal::backdrop{background:rgba(15,23,42,.55)}
.modal__card{padding:22px;background:#fff}
.modal__header{
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:flex-start;
    margin-bottom:16px;
}
.modal__header strong{font-size:18px}
.modal__header span{display:block;color:var(--muted);font-size:13px;line-height:1.8}
.modal__close{
    border:1px solid var(--border);
    background:#fff;
    border-radius:12px;
    width:40px;
    height:40px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
}
.modal__footer{display:flex;justify-content:flex-end;gap:10px;margin-top:16px;flex-wrap:wrap}
.modal__footer .button{min-width:120px}
.website-selector-preview{
    margin-top:14px;
    display:grid;
    gap:10px;
}
.website-selector-preview__item{
    display:grid;
    grid-template-columns:72px minmax(0,1fr);
    gap:12px;
    padding:12px;
    border:1px solid var(--border);
    border-radius:18px;
    background:#fff;
}
.website-selector-preview__thumb{
    width:72px;
    height:72px;
    border-radius:16px;
    background:var(--surface-2);
    border:1px solid var(--border);
    display:flex;
    align-items:center;
    justify-content:center;
    overflow:hidden;
    color:var(--muted);
    font-weight:700;
}
.website-selector-preview__thumb img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}
.website-selector-preview__body{display:grid;gap:6px;min-width:0}
.website-selector-preview__title{
    color:var(--text);
    font-weight:700;
    text-decoration:none;
    line-height:1.8;
}
.website-selector-preview__meta{
    color:var(--muted);
    font-size:12px;
}
.website-selector-preview__summary{
    margin:0;
    color:var(--muted);
    line-height:1.9;
    display:-webkit-box;
    -webkit-line-clamp:3;
    -webkit-box-orient:vertical;
    overflow:hidden;
}

@media (max-width: 1160px){
    .crawler-shell{grid-template-columns:1fr}
    .crawler-sidebar{position:static;height:auto;min-height:unset;overflow:visible}
    .grid--stats,.grid--two,.grid--three,.form-grid,.stack-card__row{grid-template-columns:1fr 1fr}
    .jobs-filters__main,.jobs-filters__advanced-grid{grid-template-columns:1fr 1fr}
}
@media (max-width: 820px){
    .crawler-main{padding:16px}
    .grid--stats,.grid--two,.grid--three,.form-grid,.stack-card__row{grid-template-columns:1fr}
    .jobs-filters__main,.jobs-filters__advanced-grid{grid-template-columns:1fr}
    .auth-card,.panel,.stat-card{border-radius:20px}
    .crawler-credential-status{flex-direction:column}
    .table{min-width:640px}
    .modal{width:calc(100vw - 16px)}
    .stack-card__header{flex-direction:column}
    .source-metrics{flex-wrap:wrap;overflow:visible}
    .source-metrics span{flex:1 1 100%}
    .llm-toolbar,.llm-model-card,.llm-model-card__main{grid-template-columns:1fr;flex-direction:column;align-items:stretch}
    .llm-model-card__actions{justify-content:flex-start}
    .llm-model-card__meta span{max-width:100%}
    .social-post-card{grid-template-columns:56px minmax(0,1fr);padding:10px}
    .social-post-card__thumb,.social-post-card__thumb--placeholder{width:56px;height:56px;border-radius:14px}
    .social-post-card__footer{flex-direction:column;align-items:flex-start}
    .website-selector-preview__item{grid-template-columns:56px minmax(0,1fr)}
    .website-selector-preview__thumb{width:56px;height:56px;border-radius:14px}
}
