/* ====== Light Theme — Global ====== */
:root{
  --bg:#f7f9fc;           /* page background */
  --card:#ffffff;         /* cards */
  --soft:#f2f5f9;         /* subtle alt */
  --muted:#6b7280;        /* secondary text */
  --text:#1f2937;         /* primary text */
  --primary:#2ea8ff;      /* accents */
  --primary-2:#0ea5e9;
  --ok:#16a34a;
  --no:#dc2626;
  --border:#dce3ec;
  --chip:#f3f4f6;
  --chip-2:#e5e7eb;
  --warning:#f59e0b;
  --radius:14px;
  --shadow: 0 10px 24px rgba(17, 24, 39, .05);
  --shadow-soft: 0 6px 16px rgba(17, 24, 39, .06);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Noto Kufi Arabic", Tahoma, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color:var(--text);
  background:
    radial-gradient(900px 600px at 110% -10%, rgba(46,168,255,.08), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(14,165,233,.06), transparent 60%),
    var(--bg);
}

/* ====== Layout ====== */
.page{padding:20px 14px; max-width:1200px; margin-inline:auto}
@media(min-width:900px){ .page{padding:28px 18px;} }

.topbar{
  display:flex; gap:12px; align-items:center; justify-content:space-between;
  margin-bottom:18px;
}
.topbar h1{margin:0; font-size:1.6rem; letter-spacing:.2px}
.user{display:flex; gap:12px; align-items:center; color:var(--muted)}
.user a{color:var(--primary); text-decoration:none}
.user a:hover{opacity:.85}

.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:18px;
  margin-bottom:16px;
}

/* ===== Top Navigation (Light) ===== */
.navbar{
  position:sticky; top:0; z-index:50;
  background:#fff; border-bottom:1px solid var(--border);
  padding:10px 12px; box-shadow:var(--shadow);
}
.navbar .inner{
  max-width:1200px; margin:0 auto;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
}
.brand{
  display:flex; align-items:center; gap:8px; color:var(--text);
  text-decoration:none; font-weight:700;
}
.brand img{
  width:22px; height:22px; border-radius:6px; object-fit:cover;
  border:1px solid var(--border);
}
.nav-links{display:flex; gap:6px; align-items:center;}
.nav-item{
  color:#334155; text-decoration:none; padding:8px 10px;
  border-radius:10px; border:1px solid transparent; transition:.15s ease;
  font-size:.95rem;
}
.nav-item:hover{ color:#0f172a; background:#f3f4f6; border-color:var(--border); }
.nav-item.active{ color:#0f172a; background:#e8f0f7; border-color:#bfdcf1; }
@media(min-width:900px){
  .navbar{padding:12px 16px}
  .brand img{width:28px; height:28px}
  .nav-item{padding:8px 14px}
}

/* ===== Buttons / Inputs ===== */
.btn{
  appearance:none; border:none; cursor:pointer;
  background:linear-gradient(180deg, var(--primary), var(--primary-2));
  color:#fff; padding:10px 14px; border-radius:12px; font-weight:700;
  box-shadow:var(--shadow-soft); text-decoration:none; display:inline-flex; gap:8px; align-items:center;
}
.btn.secondary{
  background:linear-gradient(180deg, #f3f4f6, #e5e7eb);
  color:#111827; border:1px solid var(--border);
}
.btn.ghost{
  background:#fff; border:1px solid var(--border); color:#111827;
}
.btn:disabled{opacity:.6; cursor:not-allowed}

label{display:block; margin:.4rem 0 .25rem; color:var(--muted)}
input[type="text"], input[type="date"], input[type="password"], textarea, select{
  width:100%; background:#fff; border:1px solid var(--border);
  color:var(--text); border-radius:12px; padding:10px 12px; outline:none;
}
input::placeholder, textarea::placeholder{color:#9aa4b2}
textarea{min-height:110px; resize:vertical}
.grid-2{display:grid; grid-template-columns:1fr; gap:12px}
@media(min-width:800px){ .grid-2{grid-template-columns:1fr 1fr} }

/* ===== Filters (light, sticky) ===== */
.filters{
  position:sticky; top:12px; z-index:5;
  background:#fff; border:1px solid var(--border); border-radius:16px; padding:12px;
  display:grid; gap:10px; grid-template-columns:repeat(6,1fr); align-items:end;
  box-shadow:var(--shadow-soft);
}
.filters .span2{grid-column:span 2}
.filters .span3{grid-column:span 3}
.filters .span6{grid-column:span 6}
.filters .actions{display:flex; gap:8px; justify-content:flex-end}
@media(max-width:1000px){
  .filters{grid-template-columns:1fr}
  .filters .span2,.filters .span3,.filters .span6{grid-column:span 1}
}

/* ===== Chips / Badges ===== */
.badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:3px 10px; border-radius:999px; font-size:.82rem;
  background:#eef2f7; border:1px solid var(--border); color:#111827;
}
.badge.ok{background:#eaf7ef; border-color:#c9efd7; color:#15803d}
.badge.no{background:#fdecec; border-color:#f3c4c4; color:#b91c1c}
.badge.warn{background:#fff6e6; border-color:#fde2b9; color:#b45309}

.chips{display:flex; flex-wrap:wrap; gap:6px}

/* ===== Companies List (cards) ===== */
.company-list{
  display:grid; grid-template-columns:1fr; gap:12px;
}
@media(min-width:700px){ .company-list{grid-template-columns: repeat(2,1fr)} }
@media(min-width:1100px){ .company-list{grid-template-columns: repeat(3,1fr)} }

.company-card{
  background:#fff; border:1px solid var(--border); border-radius:16px; padding:14px;
  box-shadow:var(--shadow-soft); display:flex; flex-direction:column; gap:10px;
}
.company-card .title{
  display:flex; justify-content:space-between; gap:10px; align-items:center;
}
.company-card .title a{
  color:var(--text); text-decoration:none; font-weight:700; font-size:1.05rem;
}
.company-card .title a:hover{color:#0f172a}
.company-card .meta{
  display:flex; flex-wrap:wrap; gap:8px; color:var(--muted); font-size:.92rem;
}
.company-card .row{display:flex; align-items:center; gap:8px; color:var(--muted)}
.company-card .row strong{color:var(--text)}
.company-card .footer{display:flex; justify-content:space-between; align-items:center; gap:10px}

/* ===== Dense Table (scrollable on phone) ===== */
.table{width:100%; border-collapse:collapse;overflow-x:auto; background:#fff; border:1px solid var(--border); border-radius:12px}
.table thead{white-space:nowrap; background:#f8fafc}
.table th,.table td{border-bottom:1px solid var(--border); padding:10px; text-align:right}
.table th{color:#334155; font-weight:600}

/* ===== Details Page ===== */
.detail-grid{display:grid; grid-template-columns:1fr; gap:14px}
@media(min-width:1000px){ .detail-grid{grid-template-columns: 1.4fr 1fr} }

.definition{display:grid; grid-template-columns: 180px 1fr; row-gap:10px; column-gap:12px}
@media(max-width:700px){ .definition{grid-template-columns:1fr} .definition dt{opacity:.85}}
.definition dt{color:var(--muted)}
.definition dd{margin:0; color:var(--text)}

/* ===== File gallery (images & PDFs) ===== */
.file-grid{display:grid; gap:10px; grid-template-columns: repeat(2, minmax(0,1fr))}
@media(max-width:900px){ .file-grid{grid-template-columns: 1fr} }
@media(min-width:1100px){ .file-grid{grid-template-columns: repeat(3,1fr)} }

.file-card{
  background:#fff; border:1px solid var(--border);
  border-radius:14px; padding:10px; display:flex; flex-direction:column; gap:8px;
}
.file-card .thumb{
  min-height:150px; border-radius:10px; overflow:hidden; background:#f3f4f6;
  display:flex; align-items:center; justify-content:center; border:1px dashed var(--border);
}
.file-card .thumb img{max-width:100%; max-height:180px; display:block}
.pdf-icon,.zip-icon{
  padding:18px 20px; border-radius:10px; background:#eef2f7; border:1px solid var(--border); color:#0f172a; font-weight:700;
}
.file-card .name{white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.file-card .sub{color:var(--muted); font-size:.85rem; display:flex; gap:8px; flex-wrap:wrap}
.file-card .actions{display:flex; gap:8px}
.preview summary{cursor:pointer; color:#0ea5e9}
.preview iframe{width:100%; height:360px; border:1px solid var(--border); border-radius:10px}

/* ===== Helpers ===== */
.muted{color:var(--muted)}
.spacer{height:6px}

/* ===== Login hero logo (light) ===== */
.login-hero{display:flex; flex-direction:column; align-items:center; gap:10px; margin-bottom:16px}
.login-logo{
  width:180px;   /* was 64px */
  height:120px;  /* was 64px */
  border-radius:14px;
  object-fit:cover;
  border:1px solid var(--border);
  box-shadow: var(--shadow-soft);
  animation: floatPulse 3s ease-in-out infinite;
}

@keyframes floatPulse{
  0%{transform:translateY(0) scale(1); opacity:.98}
  50%{transform:translateY(-4px) scale(1.03); opacity:1}
  100%{transform:translateY(0) scale(1); opacity:.98}
}
@media(prefers-reduced-motion:reduce){ .login-logo{animation:none} }
/* داخل style.css */
.row-canceled {
  background: #fff5f5;
}
.row-canceled a { color: #b30000; }
.canceled-note {
  color: #b30000;
  font-size: .9rem;
  margin-top: 4px;
}
.btn-danger {
  background: #e63946;
  border-color: #e63946;
  color: #fff;
}
.btn-danger:hover { filter: brightness(0.95); }
.nav-links .nav-item {
  color: #cc6600; /* برتقالي غامق */
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.nav-links .nav-item:hover {
  background: #ffe0b3; /* برتقالي فاتح */
  color: #994d00; /* برتقالي أغمق عند المرور */
}

.nav-links .nav-item.active {
  background: #ff9800; /* برتقالي متوسط للنشط */
  color: #fff;
}
/* شبكة الملفات */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  align-items: stretch;
  box-sizing: border-box;
}

/* بطاقة الملف */
.file-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #eee;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

/* صورة/أيقونة */
.file-card .thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 8px;
  overflow: hidden;
}
.file-card .thumb img {
  max-width: 100%;
  max-height: 160px;
  display: block;
  object-fit: contain;
}

/* نصوص الميتا */
.file-card .meta {
  padding: 8px 10px;
}
.file-card .name {
  direction: rtl;           /* أسماء عربية لليمين */
  unicode-bidi: plaintext;  /* يعالج خلط العربية/الإنجليزية والأرقام */
  text-align: start;        /* يحترم الـdir */
  font-weight: 600;
  margin-bottom: 4px;
  overflow-wrap: anywhere;  /* يكسر السلاسل الطويلة */
  word-break: break-word;
}

/* الشريط الفرعي */
.file-card .sub {
  color: #666;
  font-size: .85rem;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.badge { background:#f6f8fa; border-radius: 6px; padding: 2px 6px; }

/* أزرار */
.file-card .actions {
  display: flex;
  gap: 8px;
  padding: 10px;
  margin-top: auto; /* يلزّق الأزرار بأسفل الكرت */
}
.file-card .actions .btn { flex: 1; text-align: center; }

/* معاينة PDF/صورة */
.preview { padding: 0 10px 10px; }
.preview summary { cursor: pointer; margin: 0 0 6px; }
.preview iframe, .preview img {
  width: 100%;
  height: 380px;
  border: none;
  display: block;
}

/* منع خروج الشبكة خارج الصفحة */
.card { overflow: hidden; }

/* تحسين للـRTL العام */
html[dir="rtl"] .file-card .sub { justify-content: flex-start; }

/* للشاشات الكبيرة: شوي فراغ */
@media (min-width: 1200px) {
  .file-grid { gap: 16px; }
  .preview iframe, .preview img { height: 440px; }
}
/* أزرار أصغر كستاندرد */
.btn {
  padding: 6px 10px;
  font-size: .9rem;
  line-height: 1.2;
  border-radius: 6px;
}
.btn-lg { padding: 10px 16px; font-size: 1rem; } 
/* خلية عرض السعر */
.quote-cell {
  display:flex; align-items:center; gap:6px; flex-wrap:wrap;
}

.quote-main { font-weight:600; }
.quote-main .cur { opacity:.85; margin-inline-start:2px; }
.quote-main .eq { opacity:.8; margin-inline-start:6px; }

/* بادج رقم العرض */
.badge-quote {
  background:#ffe8cc; color:#7a3e00;
  border-radius:6px; padding:2px 6px; font-size:.8rem;
}

/* أزرار صغيرة */
.btn.btn-xs {
  padding:2px 6px; font-size:.8rem; line-height:1.1;
  border-radius:5px;
}
.quote-cell { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.quote-link { text-decoration:none; color:inherit; display:inline-flex; gap:6px; align-items:baseline; }
.quote-link:hover .quote-main { text-decoration:underline; }
.quote-main { font-weight:600; }
.eq { opacity:.8; margin-inline-start:6px; }
.badge-quote { background:#ffe8cc; color:#7a3e00; border-radius:6px; padding:2px 6px; font-size:.8rem; }
.btn.btn-xs { padding:2px 6px; font-size:.8rem; line-height:1.1; border-radius:5px; }
.btn-submit {
  background-color: #ff9800; /* برتقالي حلو */
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-submit:hover {
  background-color: #e68900;
}
.sheet-table th, .sheet-table td { border:1px solid #eee; padding:6px 8px; vertical-align:middle; }
.sheet-table input { width:100%; box-sizing:border-box; padding:6px 8px; }
.sheet-table thead th { background:#f6f8fa; }
.sheet-header .hint { color:#666; font-size:.85rem; }
.sheet-table th, .sheet-table td { border:1px solid #eee; padding:6px 8px; vertical-align:middle; }
.sheet-header-table th, .sheet-header-table td { border:1px solid #eee; padding:6px 8px; vertical-align:middle; }
.sheet-table thead th { background:#f6f8fa; }
.sheet-table input, .sheet-header-table input, .sheet-header-table select { width:auto; max-width:100%; box-sizing:border-box; padding:6px 8px; }
