@import url("https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap");
*{box-sizing:border-box}
[hidden]{display:none!important}
:root{
  --background:#f7f9fc;
  --foreground:#111827;
  --card:#fff;
  --muted:#f1f5f9;
  --muted-foreground:#667085;
  --border:#d9e1ea;
  --primary:#0b4578;
  --primary-soft:#e8f1f8;
  --sidebar-bg:#001b33;
  --sidebar-fg:#eaf2fb;
  --sidebar-muted:#9fb2c7;
  --gold:#e8a734;
  --gold-soft:#fff7e6;
  --danger:#d92d20;
  --success:#067647;
  --radius:12px;
}
html{direction:rtl;scroll-behavior:smooth}
body{
  margin:0;
  background:var(--background);
  color:var(--foreground);
  font-family:"Tajawal","IBM Plex Sans Arabic",Tahoma,Arial,sans-serif;
  font-size:15px;
  line-height:1.7;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit}
button,input,select,textarea{font:inherit}
input,select,textarea{
  width:100%;
  border:1px solid #cfd8e3;
  border-radius:10px;
  background:#fff;
  color:var(--foreground);
  padding:11px 12px;
  outline:0;
  transition:border-color .18s,box-shadow .18s,background .18s;
}
input:focus,select:focus,textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(11,69,120,.12);
}
input[type=checkbox]{width:auto}
button:active,.btn:active{transform:scale(.97)}
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-track{background:var(--muted)}
::-webkit-scrollbar-thumb{background:#98a8ba;border-radius:999px}
::-webkit-scrollbar-thumb:hover{background:#667085}

.sidebar{
  position:fixed;
  inset:0 0 0 auto;
  width:290px;
  background:var(--sidebar-bg);
  color:var(--sidebar-fg);
  display:flex;
  flex-direction:column;
  border-left:1px solid rgba(255,255,255,.12);
  z-index:20;
}
.brand{
  min-height:100px;
  display:flex;
  align-items:center;
  gap:14px;
  padding:16px;
  border-bottom:1px solid rgba(255,255,255,.14);
}
.brand img{
  width:84px;
  height:84px;
  display:block;
  border-radius:18px;
  background:#fff;
  padding:5px;
  object-fit:contain;
  box-shadow:0 8px 22px rgba(0,0,0,.18);
  flex:0 0 auto;
}
.brand strong{display:block;font-size:18px;line-height:1.35;font-weight:800;letter-spacing:0}
.brand span,.userbox span{display:block;color:var(--sidebar-muted);font-size:12px;margin-top:4px}
.sidebar nav{padding:18px 10px;display:flex;flex-direction:column;gap:7px;overflow:auto}
.sidebar nav a{
  color:#d9e6f2;
  text-decoration:none;
  min-height:46px;
  display:flex;
  align-items:center;
  gap:12px;
  justify-content:flex-start;
  padding:12px 16px;
  border-radius:14px;
  font-weight:800;
  transition:background .18s,color .18s,transform .18s;
}
.sidebar nav a:hover,.sidebar nav a.active{background:var(--gold);color:#fff}
.nav-icon{
  width:22px!important;
  height:22px!important;
  max-width:22px!important;
  max-height:22px!important;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  line-height:1;
  overflow:hidden;
}
.nav-icon svg{
  width:20px!important;
  height:20px!important;
  max-width:20px!important;
  max-height:20px!important;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
  display:block;
  overflow:visible;
}
.nav-icon > svg{
  inline-size:20px!important;
  block-size:20px!important;
}
.nav-icon svg *{
  fill:none;
  stroke:currentColor;
  stroke-width:2!important;
  stroke-linecap:round;
  stroke-linejoin:round;
  vector-effect:non-scaling-stroke;
}
.userbox{
  margin-top:auto;
  padding:16px;
  border-top:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.035);
}
.userbox strong{
  display:block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:14px;
  line-height:1.5;
}
.userbox span{
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.logout{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  width:100%;
  margin-top:14px;
  min-height:44px;
  background:var(--gold);
  color:#001b33;
  text-decoration:none;
  padding:10px 12px;
  border:1px solid rgba(232,167,52,.55);
  border-radius:12px;
  font-weight:800;
  transition:background .18s,color .18s,border-color .18s;
}
.logout:hover{
  background:#f2bd55;
  color:#001b33;
  border-color:var(--gold);
}

.main{margin-right:290px;min-height:100vh}
.topbar{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:18px;
  min-height:132px;
  background:rgba(255,255,255,.96);
  border-bottom:1px solid var(--border);
  padding:18px 28px;
  box-shadow:0 1px 8px rgba(16,24,40,.06);
}
.topbar img{
  width:76px;
  height:76px;
  display:block;
  border-radius:50%;
  object-fit:contain;
  background:#fff;
  padding:4px;
  box-shadow:0 3px 12px rgba(16,24,40,.12);
}
.topbar p,.topbar span{margin:0;color:var(--muted-foreground);font-weight:600}
.topbar h1{margin:2px 0;font-size:30px;line-height:1.25;font-weight:900;letter-spacing:0}
.container{padding:24px;max-width:none;margin-inline:0}
.page-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px;
}
.page-head h1{margin:0;font-size:24px;line-height:1.3}
.page-head p{margin:4px 0 0;color:var(--muted-foreground);font-size:14px}
.section-title-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  min-height:116px;
}
.section-title-row p{max-width:850px}

.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:16px}
.split{display:grid;grid-template-columns:1fr 160px;gap:12px}
.card,.doc-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:10px;
  padding:20px;
  box-shadow:0 1px 3px rgba(16,24,40,.05);
}
.doc-card{
  transition:box-shadow .2s,transform .2s,border-color .2s;
}
.doc-card:hover{
  border-color:rgba(11,69,120,.28);
}
.card h2,.card h3,.doc-card h2,.doc-card h3{margin-top:0}
.stat{font-size:32px;font-weight:900;margin-top:8px}
.muted{color:var(--muted-foreground)}
.pre{white-space:pre-wrap;line-height:1.9}
.actions{display:flex;gap:10px;flex-wrap:wrap}
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:40px;
  border:0;
  border-radius:12px;
  background:var(--gold);
  color:#fff;
  text-decoration:none;
  padding:10px 16px;
  font-weight:900;
  cursor:pointer;
  white-space:nowrap;
  transition:opacity .18s,background .18s,transform .18s,box-shadow .18s;
}
.btn:hover{opacity:.92;box-shadow:0 5px 14px rgba(232,167,52,.22)}
.btn.secondary{
  background:#fff;
  color:#102a43;
  border:1px solid var(--border);
  box-shadow:none;
}
.btn.secondary:hover{background:var(--muted)}
.btn.danger{background:var(--danger)}

table{width:100%;border-collapse:collapse;background:#fff;border-radius:12px;overflow:hidden}
th,td{border-bottom:1px solid #e3e8ef;padding:12px;text-align:right;vertical-align:top}
th{color:var(--muted-foreground);background:#f8fafc;font-size:13px}
.table-wrap{overflow-x:auto}
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border-radius:8px;
  background:#eef3f7;
  color:#344054;
  padding:5px 10px;
  font-size:12px;
  font-weight:900;
}
.badge.ok{background:#dcfae6;color:var(--success)}
.badge.warn{background:#fef0c7;color:#93370d}
.badge-pdf{background:#fee4e2;color:#b42318}
.badge-image{background:#dcfae6;color:#067647}
.badge-word{background:#dbeafe;color:#1d4ed8}
.badge-default{background:#eef3f7;color:#344054}
.flash{
  margin:18px 28px 0;
  padding:13px 16px;
  border-radius:12px;
  background:#dcfae6;
  color:#067647;
  font-weight:700;
}
.flash.error{background:#fee4e2;color:#b42318}

.auth-main{min-height:100vh;display:grid;place-items:center;background:#eef3fb;padding:20px}
.auth-card{width:min(430px,92vw);background:#fff;border:1px solid #d6e0ea;border-radius:16px;padding:28px;box-shadow:0 12px 40px rgba(16,24,40,.08)}
.auth-card img{width:92px;height:92px;display:block;margin:0 auto 12px;border-radius:20px;object-fit:cover}
.auth-card-wide{width:min(430px,92vw)}
.auth-logos{display:flex;align-items:center;justify-content:center;gap:12px;margin-bottom:10px}
.auth-logos img{width:58px;height:58px;margin:0;border-radius:16px}
.auth-card h1,.auth-card h2{text-align:center;margin:0}
.auth-card h1{font-size:24px;font-weight:900}
.auth-card h2{font-size:18px;margin-top:18px}
.auth-card>p{text-align:center;margin:4px 0 0}
.auth-form{margin-top:16px}
.auth-form.compact{margin-top:10px}
.auth-form label{display:flex;align-items:center;gap:8px}
.auth-form label .nav-icon{width:18px!important;height:18px!important;max-width:18px!important;max-height:18px!important;color:var(--muted-foreground)}
.auth-submit{width:100%}
.auth-links{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px;font-size:14px}
.auth-links a,.auth-single-link{color:var(--primary);font-weight:800;text-decoration:none}
.auth-single-link{display:block;text-align:center;margin-top:12px}
.auth-flash{margin:14px 0 0}
.form{max-width:760px}
.field{margin-bottom:14px}
.field label{display:block;font-weight:800;margin-bottom:7px}
.admin-edit-card{
  border-color:rgba(11,69,120,.28);
  background:#fbfdff;
}
.admin-form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.admin-form-grid .field{margin-bottom:0}
.admin-form-grid .full{grid-column:1/-1}
.danger-zone{
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid var(--border);
  display:flex;
  justify-content:flex-end;
}
.admin-shortcuts{
  margin-bottom:18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.admin-shortcuts h2{margin:0}
.admin-shortcuts p{margin:4px 0 0}

.about-page{
  max-width:1180px;
  margin:0 auto;
}
.about-hero{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:24px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  padding:28px;
  box-shadow:0 1px 3px rgba(16,24,40,.05);
}
.about-logos{
  display:flex;
  align-items:center;
  gap:12px;
}
.about-logos img{
  width:96px;
  height:96px;
  border-radius:18px;
  object-fit:contain;
  background:#fff;
  padding:6px;
  border:1px solid var(--border);
  box-shadow:0 8px 24px rgba(16,24,40,.08);
}
.about-kicker{
  margin:0;
  color:var(--primary);
  font-weight:900;
}
.about-hero h2{
  margin:4px 0 8px;
  font-size:30px;
  line-height:1.25;
  font-weight:900;
}
.about-hero p{
  margin:0;
  color:var(--muted-foreground);
  max-width:760px;
}
.about-services{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  margin-top:18px;
}
.about-service{
  display:flex;
  align-items:flex-start;
  gap:12px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:10px;
  padding:16px;
}
.about-service h3{
  margin:0 0 4px;
  font-size:17px;
}
.about-service p{
  margin:0;
  color:var(--muted-foreground);
}
.about-info{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
  margin-top:18px;
}

.doc-breadcrumb{display:flex;align-items:center;gap:8px;color:var(--muted-foreground);font-size:14px;margin-bottom:14px}
.doc-breadcrumb a{text-decoration:none}
.doc-breadcrumb a:hover{color:var(--foreground)}
.doc-hero{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:20px;
  box-shadow:0 1px 3px rgba(16,24,40,.05);
}
.doc-title-wrap{display:flex;align-items:flex-start;gap:16px}
.doc-icon,.tile-icon{
  width:56px;
  height:56px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  background:var(--primary-soft);
  color:var(--primary);
  font-weight:900;
  font-size:25px;
}
.info-tile .tile-icon{margin-bottom:14px;margin-right:auto}
.tile-icon .nav-icon,.doc-icon .nav-icon{color:var(--primary)!important;margin:0!important}
.tile-icon .nav-icon svg,.doc-icon .nav-icon svg{stroke:currentColor!important}
.doc-icon .nav-icon,.tile-icon .nav-icon,.chat-icon .nav-icon,.message-avatar .nav-icon,.chat-float-button .nav-icon{
  width:24px!important;
  height:24px!important;
  max-width:24px!important;
  max-height:24px!important;
}
.doc-icon .nav-icon svg,.tile-icon .nav-icon svg,.chat-icon .nav-icon svg,.message-avatar .nav-icon svg,.chat-float-button .nav-icon svg{
  width:22px!important;
  height:22px!important;
  max-width:22px!important;
  max-height:22px!important;
}
.doc-hero h2{margin:0;font-size:22px;line-height:1.35;font-weight:900}
.doc-hero p{margin:4px 0 0}
.doc-meta-badges{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.doc-page-grid{display:grid;grid-template-columns:minmax(0,2fr) minmax(280px,1fr);gap:20px;margin-top:20px}
.info-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:16px}
.info-tile{
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:10px;
  padding:16px;
  min-height:176px;
}
.info-tile h3{margin:0 0 12px;font-size:17px}
.info-tile p{margin:0;line-height:1.8}
.info-tile span{display:flex;align-items:center;gap:6px;color:var(--muted-foreground);font-size:12px;font-weight:800;margin-bottom:5px}
.info-tile strong{font-size:14px}
.info-row{display:flex;gap:12px;padding:14px 0;border-bottom:1px solid var(--border)}
.info-row:last-child{border-bottom:0}
.tile-icon{width:34px;height:34px;border-radius:10px;font-size:15px}
.summary-text{font-size:15px;color:#26384d}
.file-list{display:flex;flex-direction:column;gap:10px}
.file-chip{
  display:block;
  text-decoration:none;
  color:#102a43;
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  transition:border-color .18s,background .18s;
}
.file-chip:hover{border-color:rgba(11,69,120,.35);background:#fff}
.file-chip .file-preview{
  min-height:64px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#fff2f0;
  color:#d92d20;
  font-weight:900;
}
.file-chip .file-info{padding:12px}
.file-chip small{display:block;color:var(--muted-foreground);margin-top:3px}
.recent-row{
  display:flex;
  align-items:center;
  gap:14px;
  padding:12px 8px;
  text-decoration:none;
  border-bottom:1px solid var(--border);
  border-radius:12px;
  transition:background .18s;
}
.recent-row:last-child{border-bottom:0}
.recent-row:hover{background:rgba(241,245,249,.75)}
.recent-row strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.recent-row p{margin:2px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.quick-card{text-decoration:none;display:block;color:var(--foreground)}
.quick-card strong{display:block;margin-top:10px}
.quick-card p{margin:4px 0 0}
.services-card{margin-top:0;background:#f8fafc;box-shadow:none;border:1px solid var(--border);border-top:0;border-radius:0 0 10px 10px}
.services-card h3{text-align:right;margin:0 0 12px}
.service-bullets{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px 56px;
}
.service-bullets p{margin:0;position:relative;padding-right:14px}
.service-bullets p::before{
  content:"";
  position:absolute;
  right:0;
  top:.9em;
  width:4px;
  height:4px;
  border-radius:999px;
  background:var(--muted-foreground);
}
.stat-card{
  display:flex;
  align-items:flex-start;
  justify-content:flex-start;
  gap:16px;
  min-height:98px;
  border-radius:10px;
}
.stat-card .stat{margin-top:4px}
.stat-date{font-size:24px;line-height:1.4}
.stat-icon{background:var(--primary-soft);color:var(--primary)}
.stat-icon.gold{background:#fff4dc;color:#d89113}
.stat-icon.danger{background:#fee4e2;color:#d92d20}
.upload-choice{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-height:150px;
  border:1px dashed #9fb2c7;
  border-radius:14px;
  background:#f8fafc;
  padding:18px;
  cursor:pointer;
  transition:background .18s,border-color .18s,box-shadow .18s;
}
.upload-choice:hover{
  background:#fff;
  border-color:var(--primary);
  box-shadow:0 8px 22px rgba(16,24,40,.08);
}
.upload-choice strong{font-size:17px}
.upload-choice span{color:var(--muted-foreground);font-size:14px}
.upload-choice input{margin-top:auto;background:#fff}
.choice-icon{
  width:46px;
  height:46px;
  border-radius:14px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:var(--primary-soft);
  color:var(--primary);
}
.choice-icon.small{width:38px;height:38px;float:right;margin-left:12px}
.choice-icon svg{
  width:24px;
  height:24px;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.scanner-note{margin:16px 0;background:var(--gold-soft);box-shadow:none}
.scanner-note p{margin:6px 0 0}
.upload-progress{
  margin:16px 0;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  padding:14px;
}

.image-missing{visibility:hidden}
.upload-page{
  max-width:1180px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  gap:14px;
}
.upload-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.upload-head h1{margin:0;font-size:24px}
.upload-head p{margin:4px 0 0}
.visibility-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px 14px;
}
.visibility-card p{margin:2px 0 0;font-size:13px}
.segmented{
  display:flex;
  border:1px solid var(--border);
  border-radius:10px;
  overflow:hidden;
  flex:0 0 auto;
}
.segmented button{
  border:0;
  background:#fff;
  color:var(--foreground);
  padding:8px 14px;
  cursor:pointer;
  font-weight:800;
}
.segmented button.active{background:var(--primary);color:#fff}
.upload-workspace{
  display:grid;
  grid-template-columns:minmax(360px,.95fr) minmax(420px,1.05fr);
  gap:16px;
  align-items:start;
}
.upload-workspace:not(:has(.result-aside:not([hidden]))){
  grid-template-columns:minmax(360px,760px);
  justify-content:center;
}
.upload-primary{
  display:flex;
  flex-direction:column;
  gap:14px;
  min-width:0;
}
.drop-zone{
  min-height:260px;
  border:2px dashed var(--border);
  border-radius:18px;
  background:#fff;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:14px;
  padding:24px;
  text-align:center;
  cursor:pointer;
  transition:border-color .18s,background .18s,transform .18s;
}
.drop-zone:hover,.drop-zone.drag-over{
  border-color:rgba(11,69,120,.55);
  background:#f8fafc;
}
.drop-zone.drag-over{transform:scale(1.01)}
.drop-icon{
  width:68px;
  height:68px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--muted);
  color:var(--muted-foreground);
}
.drop-zone.drag-over .drop-icon{background:var(--primary-soft);color:var(--primary)}
.drop-icon .nav-icon,.drop-icon .nav-icon svg{width:38px!important;height:38px!important;max-width:38px!important;max-height:38px!important}
.file-type-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
  margin-top:6px;
}
.file-type-row span{
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:var(--muted);
  color:var(--muted-foreground);
  border-radius:999px;
  padding:6px 12px;
  font-size:12px;
  font-weight:800;
}
.upload-status{padding:18px}
.selected-file{
  display:flex;
  align-items:center;
  gap:12px;
  width:max-content;
  max-width:100%;
  margin:0 auto 14px;
  background:var(--muted);
  border-radius:14px;
  padding:10px 14px;
}
.selected-file p{margin:2px 0 0;font-size:12px}
.status-steps{
  max-width:460px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.status-step{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--muted-foreground);
  font-size:14px;
}
.status-step span{
  width:28px;
  height:28px;
  border-radius:999px;
  background:var(--muted);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}
.status-step.active{color:var(--primary);font-weight:800}
.status-step.active span{background:var(--primary-soft)}
.status-step.active span::after{
  content:"";
  width:12px;
  height:12px;
  border:2px solid currentColor;
  border-left-color:transparent;
  border-radius:999px;
  animation:spin .8s linear infinite;
}
.status-step.done{color:var(--success);font-weight:800}
.status-step.done span{background:#dcfae6}
.status-step.done span::after{content:"✓"}
.status-step.error{color:var(--danger);font-weight:800}
.status-step.error span{background:#fee4e2}
.status-step.error span::after{content:"!"}
#statusText{text-align:center;margin:18px 0 0;font-size:13px}
.result-panel{display:flex;flex-direction:column;gap:14px}
.result-aside{
  position:sticky;
  top:18px;
  max-height:calc(100vh - 36px);
  overflow:auto;
}
.success-banner{
  display:flex;
  align-items:center;
  gap:12px;
  background:#ecfdf3;
  border:1px solid #abefc6;
  border-radius:14px;
  padding:14px 16px;
}
.success-banner>.nav-icon{color:var(--success)}
.success-banner p{margin:2px 0 0;font-size:12px}
.success-banner .badge{margin-right:auto}
.result-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  border-top:1px solid var(--border);
  border-right:1px solid var(--border);
}
.result-grid>div{
  padding:12px;
  border-left:1px solid var(--border);
  border-bottom:1px solid var(--border);
}
.result-grid span{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  font-weight:900;
  color:var(--primary);
  background:var(--primary-soft);
  border-radius:999px;
  padding:3px 8px;
  margin-bottom:8px;
}
.result-grid strong{display:block;font-size:14px}
.classify-modal{
  position:fixed;
  inset:0;
  z-index:1200;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,27,51,.30);
  padding:20px;
}
.classify-modal-card{
  width:min(420px,92vw);
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:0 18px 50px rgba(16,24,40,.20);
  padding:22px;
  text-align:center;
}
.classify-modal-card .spinner{
  width:42px;
  height:42px;
  margin:0 auto 12px;
  border:4px solid var(--primary-soft);
  border-top-color:var(--primary);
  border-radius:999px;
  display:block;
  animation:spin .8s linear infinite;
}
.classify-modal-card strong{display:block;font-size:18px}
.classify-modal-card p{margin:6px 0 0}
@keyframes spin{to{transform:rotate(360deg)}}
.progress-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.progress-bar{
  height:10px;
  border-radius:999px;
  background:var(--muted);
  overflow:hidden;
}
.progress-bar span{
  display:block;
  height:100%;
  width:0;
  background:var(--gold);
  transition:width .2s ease;
}
.batch-page{
  max-width:920px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  gap:18px;
}
.batch-drop-zone{min-height:280px}
.drop-title{margin:0;font-size:17px;font-weight:900}
.batch-controls{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.batch-counts{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:12px;
  color:var(--muted-foreground);
}
.batch-counts strong{color:var(--foreground)}
.batch-counts .ok{color:var(--success)}
.batch-counts .bad,.danger-text{color:var(--danger)!important}
.batch-counts .warn{color:#b54708}
.batch-list{display:flex;flex-direction:column;gap:12px}
.folder-group{display:flex;flex-direction:column;gap:8px}
.folder-header{
  width:100%;
  display:flex;
  align-items:center;
  gap:10px;
  border:0;
  border-radius:12px;
  background:rgba(241,245,249,.85);
  padding:10px 12px;
  color:var(--foreground);
  cursor:pointer;
  font-weight:900;
}
.folder-header span{flex:1;text-align:right}
.folder-header em{font-style:normal;color:var(--muted-foreground);font-size:12px}
.folder-group.collapsed .folder-files{display:none}
.folder-files{display:flex;flex-direction:column;gap:10px}
.file-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:10px;
  padding:14px;
  transition:border-color .18s,box-shadow .18s;
}
.file-card.status-done{border-color:#abefc6}
.file-card.status-error{border-color:#fecdca}
.file-main{display:flex;align-items:flex-start;gap:12px}
.file-thumb{
  width:48px;
  height:48px;
  border:0;
  border-radius:12px;
  background:var(--muted);
  color:var(--primary);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  overflow:hidden;
  cursor:default;
}
.file-thumb.can-preview{cursor:pointer}
.file-thumb img{width:100%;height:100%;object-fit:cover}
.file-thumb .nav-icon{width:24px!important;height:24px!important;max-width:24px!important;max-height:24px!important}
.file-info-main{min-width:0;flex:1}
.file-title-row{display:flex;align-items:center;gap:8px}
.file-title-row strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.file-title-row span{font-size:12px;color:var(--muted-foreground);white-space:nowrap}
.file-info-main p{margin:5px 0 0;font-size:12px}
.file-actions{display:flex;align-items:center;gap:6px;flex:0 0 auto}
.icon-btn{
  width:30px;
  height:30px;
  border:0;
  border-radius:9px;
  background:transparent;
  color:#344054;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  cursor:pointer;
}
.icon-btn:hover{background:var(--muted)}
.icon-btn.danger:hover{background:#fee4e2;color:var(--danger)}
.icon-btn .nav-icon{width:17px!important;height:17px!important;max-width:17px!important;max-height:17px!important}
.status-pill{
  display:inline-flex;
  align-items:center;
  gap:5px;
  border-radius:999px;
  padding:4px 9px;
  font-size:12px;
  font-weight:900;
  white-space:nowrap;
  background:var(--muted);
  color:#475467;
}
.status-pill.uploading{background:#e0f2fe;color:#026aa2}
.status-pill.classifying{background:#fef0c7;color:#b54708}
.status-pill.done{background:#dcfae6;color:var(--success)}
.status-pill.error{background:#fee4e2;color:#b42318}
.mini-progress{
  height:6px;
  background:var(--muted);
  border-radius:999px;
  overflow:hidden;
  margin-top:8px;
}
.mini-progress span{display:block;height:100%;background:var(--primary);transition:width .2s}
.file-error{display:flex;align-items:center;gap:6px;color:var(--danger)!important;font-weight:800}
.file-error .nav-icon{width:16px!important;height:16px!important;max-width:16px!important;max-height:16px!important}
.mini-badges{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.mini-badge{
  display:inline-flex;
  align-items:center;
  gap:4px;
  border-radius:999px;
  padding:3px 8px;
  font-size:12px;
  font-weight:800;
  background:#e8f1f8;
  color:var(--primary);
}
.mini-badge.green{background:#dcfae6;color:var(--success)}
.mini-badge.amber{background:#fff4dc;color:#b54708}
.mini-badge .nav-icon{width:14px!important;height:14px!important;max-width:14px!important;max-height:14px!important}
.file-details{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  border-top:1px solid var(--border);
  margin-top:12px;
  padding-top:12px;
}
.file-details span{
  display:inline-flex;
  color:var(--primary);
  background:var(--primary-soft);
  border-radius:999px;
  padding:2px 8px;
  font-size:12px;
  font-weight:900;
  margin-bottom:5px;
}
.file-details strong{display:block;font-size:13px;line-height:1.7}
.batch-success{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  background:#ecfdf3;
  border-color:#abefc6;
}
.batch-success>div{display:flex;align-items:center;gap:10px}
.batch-success .nav-icon{color:var(--success)}
.batch-success p{margin:2px 0 0}
.spinner{
  display:inline-block;
  width:16px;
  height:16px;
  border:2px solid currentColor;
  border-left-color:transparent;
  border-radius:999px;
  animation:spin .8s linear infinite;
}
.spinner.tiny{width:12px;height:12px;border-width:1.5px}
.preview-dialog{
  width:min(920px,92vw);
  height:min(760px,88vh);
  border:1px solid var(--border);
  border-radius:14px;
  padding:0;
  background:#fff;
  box-shadow:0 24px 70px rgba(16,24,40,.25);
}
.preview-dialog::backdrop{background:rgba(0,0,0,.35)}
.preview-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border-bottom:1px solid var(--border);
}
.preview-head strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.preview-body{height:calc(100% - 66px);background:#f8fafc;display:flex;align-items:flex-start;justify-content:center;overflow:auto;padding:16px}
.preview-body img{max-width:100%;height:auto;border-radius:10px;box-shadow:0 8px 24px rgba(16,24,40,.12)}
.preview-body iframe{width:100%;height:100%;border:1px solid var(--border);border-radius:10px;background:#fff}

.chat-page-intro{max-width:620px;margin-bottom:16px}
.chat-page-intro h1{margin:0 0 6px;font-size:22px}
.chat-float-button{
  position:fixed;
  left:22px;
  bottom:22px;
  z-index:995;
  width:60px;
  height:60px;
  border-radius:999px;
  border:0;
  background:var(--primary);
  color:#fff;
  box-shadow:0 14px 30px rgba(0,27,51,.28);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:24px;
  font-weight:900;
  cursor:pointer;
  text-decoration:none;
}
.chat-overlay{
  position:fixed;
  inset:0;
  z-index:1000;
  background:rgba(0,0,0,.30);
  display:none;
}
.chat-overlay.open{display:block}
.chat-drawer{
  position:fixed;
  left:24px;
  top:118px;
  z-index:1010;
  width:min(720px,calc(100vw - 340px));
  height:min(720px,calc(100vh - 145px));
  min-height:560px;
  border:1px solid var(--border);
  background:var(--background);
  border-radius:16px;
  box-shadow:0 18px 50px rgba(16,24,40,.16);
  overflow:hidden;
  transform:translateX(-120%);
  opacity:0;
  pointer-events:none;
  transition:transform .28s ease,opacity .2s ease;
}
.chat-drawer.open{transform:translateX(0);opacity:1;pointer-events:auto}
.global-chat-frame{
  position:fixed;
  left:24px;
  top:96px;
  z-index:1010;
  width:min(920px,calc(100vw - 48px));
  height:min(760px,calc(100vh - 120px));
  min-height:560px;
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:0 18px 50px rgba(16,24,40,.16);
  overflow:hidden;
  background:#fff;
  direction:rtl;
  transform:translateX(-120%);
  opacity:0;
  pointer-events:none;
  transition:transform .28s ease,opacity .2s ease;
}
.global-chat-frame.open{transform:translateX(0);opacity:1;pointer-events:auto}
.global-chat-frame iframe{width:100%;height:100%;border:0;display:block;background:#fff}
.chat-embed-body{margin:0;background:var(--background);overflow:hidden}
.chat-embed-body .container{padding:0;width:100%;height:100vh}
.chat-drawer.embed{
  position:static;
  width:100%;
  height:100vh;
  min-height:0;
  border:0;
  border-radius:0;
  box-shadow:none;
  transform:none;
  opacity:1;
  pointer-events:auto;
}
.chat-drawer.embed .chat-layout{
  grid-template-columns:190px minmax(0,1fr);
  min-height:0;
}
.chat-shell{display:flex;flex-direction:column;height:100%;min-height:0}
.chat-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid var(--border);
  background:#fff;
  padding:12px 16px;
}
.chat-header-title{display:flex;align-items:center;gap:12px}
.chat-icon{width:42px;height:42px;border-radius:12px;background:var(--primary-soft);color:var(--primary);display:flex;align-items:center;justify-content:center;font-size:21px;font-weight:900}
.chat-close{
  width:38px;
  height:38px;
  border:0;
  border-radius:10px;
  background:transparent;
  color:#344054;
  cursor:pointer;
  font-size:22px;
}
.chat-close:hover{background:var(--muted)}
.chat-header h2{font-size:16px;margin:0;font-weight:900}
.chat-header p{margin:0;color:var(--muted-foreground);font-size:12px}
.chat-layout{display:grid;grid-template-columns:190px minmax(0,1fr);flex:1;min-height:0}
.chat-sessions{
  border-left:1px solid var(--border);
  background:rgba(241,245,249,.65);
  padding:10px;
  overflow:auto;
}
.session-list{display:flex;flex-direction:column;gap:6px;margin-top:10px}
.session-item{
  display:flex;
  align-items:center;
  gap:4px;
  border:1px solid transparent;
  border-radius:10px;
  padding:8px;
  transition:background .18s,border-color .18s;
}
.session-item:hover{background:#fff}
.session-item.active{border-color:rgba(11,69,120,.35);background:var(--primary-soft)}
.session-item a{
  flex:1;
  min-width:0;
  text-decoration:none;
  color:#102a43;
}
.session-item a span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:14px;font-weight:700}
.session-list small{display:block;color:var(--muted-foreground);font-size:11px;margin-top:2px}
.session-item form{margin:0}
.session-item button{
  width:28px;
  height:28px;
  border:0;
  border-radius:8px;
  background:transparent;
  color:var(--muted-foreground);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  opacity:.35;
}
.session-item:hover button{opacity:1}
.session-item button:hover{background:#fee4e2;color:var(--danger)}
.session-item button .nav-icon,.session-item button svg{width:16px!important;height:16px!important;max-width:16px!important;max-height:16px!important}
.chat-admin-note{
  margin:10px 0 0;
  padding:8px 10px;
  border-radius:10px;
  background:var(--gold-soft);
  color:#7a4b00;
  font-size:12px;
  font-weight:800;
}
.chat-admin-owner{
  display:flex;
  align-items:center;
  gap:8px;
  padding:9px 14px;
  border-bottom:1px solid var(--border);
  background:#f8fafc;
  color:var(--primary);
  font-weight:900;
  font-size:13px;
}
.chat-readonly-note{
  border-top:1px solid var(--border);
  padding:12px 14px;
  background:#fff8e6;
  color:#7a4b00;
  font-weight:800;
  font-size:13px;
}
.chat-panel{display:flex;flex-direction:column;min-height:0;background:#fff}
.chat-messages{flex:1;overflow:auto;padding:18px;background:#fbfdff}
.message-row{display:flex;align-items:flex-start;gap:10px;margin-bottom:14px}
.message-row.user{justify-content:flex-end}
.message-row.assistant{justify-content:flex-start}
.message-avatar{
  width:32px;
  height:32px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  font-size:13px;
  font-weight:900;
}
.message-avatar .nav-icon{width:18px!important;height:18px!important;max-width:18px!important;max-height:18px!important}
.message-avatar .nav-icon svg{width:17px!important;height:17px!important;max-width:17px!important;max-height:17px!important}
.message-row.assistant .message-avatar{background:var(--primary-soft);color:var(--primary)}
.message-row.user .message-avatar{background:var(--gold);color:#001b33}
.message{
  max-width:80%;
  border-radius:10px;
  padding:10px 14px;
  background:var(--muted);
  color:var(--foreground);
}
.message p{margin:0;font-size:14px}
.message-row.user .message{background:var(--primary);color:#fff}
.chat-form{display:grid;grid-template-columns:1fr auto;gap:10px;border-top:1px solid var(--border);padding:12px;background:#fff}
.chat-form textarea{resize:none;min-height:70px}
.empty-state{text-align:center;margin-top:90px;color:var(--muted-foreground)}
.empty-state h2{margin:0 0 6px;font-size:24px;color:var(--foreground)}
.empty-icon{
  width:54px;
  height:54px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--primary-soft);
  color:var(--primary);
  margin:0 auto 12px;
  opacity:.75;
}
.empty-icon .nav-icon,.empty-icon svg{width:28px!important;height:28px!important;max-width:28px!important;max-height:28px!important}
.suggested-prompts{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  margin-top:18px;
}
.suggested-prompts button{
  width:min(360px,100%);
  border:1px solid var(--border);
  background:#fff;
  color:#344054;
  border-radius:12px;
  padding:9px 12px;
  cursor:pointer;
  font-weight:800;
  text-align:right;
  transition:background .18s,border-color .18s;
}
.suggested-prompts button:hover{background:var(--primary-soft);border-color:rgba(11,69,120,.35)}

@keyframes fadeInUp{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
.animate-fade-in-up{animation:fadeInUp .28s cubic-bezier(.23,1,.32,1) both}

@media(max-width:1100px){
  .upload-workspace{grid-template-columns:1fr}
  .result-aside{position:static;max-height:none}
  .chat-drawer{left:14px;right:14px;top:90px;width:auto;height:calc(100vh - 120px);min-height:0}
  .global-chat-frame{left:16px;right:16px;width:auto}
  .doc-page-grid{grid-template-columns:1fr}
}
@media(max-width:900px){
  .sidebar{position:static;width:auto}
  .main{margin-right:0}
  .topbar{min-height:100px;justify-content:flex-start}
  .topbar h1{font-size:22px}
  .container{padding:18px}
  .about-hero,.about-info{grid-template-columns:1fr}
  .about-services{grid-template-columns:repeat(2,minmax(0,1fr))}
  .split,.info-grid{grid-template-columns:1fr}
  .doc-hero,.page-head{flex-direction:column}
  .message{max-width:100%}
  .admin-form-grid{grid-template-columns:1fr}
}
@media(max-width:640px){
  .about-services{grid-template-columns:1fr}
  .about-hero{padding:20px}
  .about-logos img{width:78px;height:78px}
  .chat-float-button{left:14px;bottom:14px;width:54px;height:54px}
  .global-chat-frame{
    left:10px;
    right:10px;
    top:72px;
    width:auto;
    height:calc(100vh - 92px);
    min-height:0;
    border-radius:14px;
  }
  .chat-drawer{left:10px;right:10px;top:72px;width:auto;height:calc(100vh - 92px)}
  .chat-layout,.chat-drawer.embed .chat-layout{grid-template-columns:1fr;height:auto}
  .chat-sessions{
    border-left:0;
    border-bottom:1px solid var(--border);
    max-height:180px;
  }
  .chat-header{padding:10px 12px}
  .chat-messages{padding:14px}
}
