/* =========================================================
   Ledar — Policies & Procedures Manual
   مبني وفق LEDAR_DESIGN_SYSTEM.md
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');


/* ============ شريط الأخبار المتحرك (Ticker) ============ */
.news-ticker {
  display: flex;
  align-items: stretch;
  background: #745C4D;
  color: #FFF4F0;
  overflow: hidden;
  font-size: 14.5px;
}
.tk-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 0 18px;
  font-weight: 700;
  background: #483A31;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tk-live {
  width: 8px; height: 8px; border-radius: 999px;
  background: #F7DDD0;
  animation: tkPulse 1.6s ease-in-out infinite;
}
.tk-viewport { position: relative; flex: 1; overflow: hidden; }
.tk-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 11px 0;
  will-change: transform;
  animation: tkScroll 45s linear infinite;
}
/* RTL: النص يتحرك من اليسار إلى اليمين */
.tk-track { animation-name: tkScrollRTL; }
.tk-viewport:hover .tk-track { animation-play-state: paused; }

.tk-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  color: #FFF4F0;
  text-decoration: none;
}
a.tk-item:hover .tk-text { text-decoration: underline; }
.tk-item--important .tk-text { color: #F7DDD0; font-weight: 700; }
.tk-dot { width: 7px; height: 7px; border-radius: 999px; background: #F7DDD0; flex-shrink: 0; }
.tk-sep { padding: 0 16px; color: rgba(255, 244, 240, 0.45); }

@keyframes tkScrollRTL {
  from { transform: translate3d(-50%, 0, 0); }
  to   { transform: translate3d(0, 0, 0); }
}
@keyframes tkPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.35); }
}
@media (prefers-reduced-motion: reduce) {
  .tk-track { animation: none; }
  .tk-viewport { overflow-x: auto; }
}

/* ============ Navbar: الشعار + روابط الأقسام ============ */
.navbar__brand { display: flex; align-items: center; gap: 10px; }
.navbar__brand img { height: 46px; width: auto; }
.navbar__links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-end: auto;
  margin-inline-start: 20px;
  flex-wrap: wrap;
  min-width: 0;
}
.navbar__link {
  position: relative;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.navbar__link:hover { background: rgba(116, 92, 77, 0.08); color: var(--primary-deep); }
.navbar__link.is-active {
  color: var(--primary-deep);
  font-weight: 800;
  background: var(--highlight);
}
.navbar__actions { display: flex; align-items: center; gap: 10px; }

/* ============ شريط التنبيهات (يُتحكم به من لوحة التحكم فقط) ============ */
.alerts-wrap { position: relative; }

/* ============ الرئيسية: البحث الكبير ============ */
.home-hero { position: relative; padding: var(--sp-3xl) 0 var(--sp-xl); text-align: center; }
.home-hero::before {
  content: "";
  position: absolute;
  top: -55%; inset-inline-start: 50%;
  width: 900px; max-width: 100%; height: 480px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(247, 221, 208, 0.65) 0%, rgba(247, 221, 208, 0) 68%);
  pointer-events: none;
  z-index: 0;
}
.home-hero > .container { position: relative; z-index: 1; }
.home-hero__title {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 800;
  color: var(--primary-deep);
  margin: 0 0 var(--sp-md-sm);
}
.home-hero__sub {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 var(--sp-xl);
}
.home-search { position: relative; max-width: 680px; margin: 0 auto; text-align: right; }
.home-search .search__input { padding: 20px 56px; font-size: 17px; border-radius: var(--r-lg); }
.home-search .search__icon { width: 22px; height: 22px; }
.home-search__suggestions {
  position: absolute;
  top: calc(100% + 8px);
  right: 0; left: 0;
  background: #fff;
  border: 1px solid var(--border-visible);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 40px rgba(72, 58, 49, 0.16);
  overflow: hidden;
  z-index: 50;
  text-align: right;
}
.hs-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md-sm);
  padding: 12px 18px;
  text-decoration: none;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--t-fast);
}
.hs-item:last-child { border-bottom: none; }
.hs-item:hover { background: var(--n-50); }
.hs-item__kind {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--r-full);
  background: var(--highlight);
  color: var(--primary-deep);
}
.hs-item__title { font-weight: 700; color: var(--primary-deep); font-size: 14.5px; }
.hs-item__sub { font-size: 12.5px; color: var(--text-muted); margin-inline-start: auto; white-space: nowrap; }
.hs-empty { padding: 16px 18px; color: var(--text-muted); font-size: 14px; }

/* ============ عناوين الأقسام في الرئيسية ============ */
.home-section { padding: var(--sp-xl) 0; }
.home-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
}
.home-section__title { font-size: 21px; font-weight: 800; color: var(--primary-deep); margin: 0; }
.home-section__more { font-size: 13.5px; font-weight: 600; color: var(--primary); text-decoration: none; }
.home-section__more:hover { text-decoration: underline; }

/* ============ الوصول السريع ============ */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: var(--sp-md);
}
.quick-card {
  --accent: var(--primary);
  --accent-bg: rgba(116, 92, 77, 0.10);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: var(--sp-xl) var(--sp-md) var(--sp-lg);
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: 0 6px 18px rgba(72, 58, 49, 0.06);
  text-decoration: none;
  overflow: hidden;
  transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-fast);
}
.quick-card::before {
  content: "";
  position: absolute; inset-inline: 0; top: 0; height: 4px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--t-med) var(--ease);
}
.quick-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 34px rgba(72, 58, 49, 0.14);
  border-color: var(--border-visible);
}
.quick-card:hover::before { transform: scaleX(1); }
.quick-card:hover .quick-card__icon { transform: scale(1.08) rotate(-4deg); }
.quick-card:hover .quick-card__name { color: var(--accent); }

.quick-card__icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: var(--r-lg);
  background: var(--accent-bg);
  color: var(--accent);
  transition: transform var(--t-med) var(--ease);
}
.quick-card__icon svg { width: 27px; height: 27px; }
.quick-card__name { font-size: 14px; font-weight: 700; color: var(--primary-deep); text-align: center; line-height: 1.4; transition: color var(--t-fast); }

/* تلوين متناوب من نفس باليت الموقع لإبراز البطاقات بصرياً */
.quick-card:nth-child(5n+2) { --accent: #3F6FB0; --accent-bg: rgba(63, 111, 176, 0.12); }
.quick-card:nth-child(5n+3) { --accent: #3E8E5A; --accent-bg: rgba(62, 142, 90, 0.12); }
.quick-card:nth-child(5n+4) { --accent: #B4534A; --accent-bg: rgba(180, 83, 74, 0.12); }
.quick-card:nth-child(5n+5) { --accent: var(--primary-deep); --accent-bg: rgba(72, 58, 49, 0.10); }

/* ============ الأخبار + الإجازة القادمة ============ */
.home-grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--sp-lg); align-items: start; }
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-md-sm); }
.news-card {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--sp-md);
  box-shadow: 0 6px 18px rgba(72, 58, 49, 0.06);
  text-decoration: none;
  display: flex; flex-direction: column; gap: 8px;
}
.news-card__img {
  width: 100%; height: 100px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--highlight) 0%, var(--n-100) 100%);
  display: grid; place-items: center;
  color: var(--primary);
}
.news-card__img svg { width: 28px; height: 28px; }
.news-card__cat { font-size: 11.5px; font-weight: 700; color: var(--primary); }
.news-card__title { font-size: 14.5px; font-weight: 700; color: var(--primary-deep); line-height: 1.5; }
.news-card__date { font-size: 12px; color: var(--text-muted); margin-top: auto; }

.holiday-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #FFF4F0;
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  text-align: center;
}
.holiday-card__label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; opacity: 0.75; text-transform: uppercase; }
.holiday-card__name { font-size: 19px; font-weight: 800; margin: var(--sp-sm) 0; }
.holiday-card__days { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.holiday-card__date { font-size: 13px; opacity: 0.8; margin-top: 4px; }

@media (max-width: 820px) {
  .home-grid-2 { grid-template-columns: 1fr; }
  .navbar__links { display: none; }
}

/* ============ نافذة آخر خبر المنبثقة ============ */
.news-popup {
  position: fixed;
  inset-block-end: 24px;
  inset-inline-end: 24px;
  max-width: 340px;
  width: calc(100% - 48px);
  background: #fff;
  border: 1px solid var(--border-visible);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 50px rgba(42, 32, 30, 0.22);
  padding: 20px 20px 18px;
  z-index: 400;
  animation: newsPopupIn 420ms var(--ease) both;
}
@keyframes newsPopupIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.news-popup__close {
  position: absolute; top: 12px; inset-inline-end: 12px;
  width: 26px; height: 26px; display: grid; place-items: center;
  border: none; border-radius: var(--r-full);
  background: rgba(116, 92, 77, 0.08); color: var(--text-secondary);
  cursor: pointer;
}
.news-popup__close svg { width: 13px; height: 13px; }
.news-popup__close:hover { background: rgba(116, 92, 77, 0.16); }
.news-popup__badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 4px 10px; border-radius: var(--r-full);
  background: var(--highlight); color: var(--primary-deep); margin-bottom: 10px;
}
.news-popup__title { font-size: 15.5px; font-weight: 800; color: var(--primary-deep); line-height: 1.5; margin: 0 0 6px; padding-inline-end: 18px; }
.news-popup__excerpt { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin: 0 0 12px; }
.news-popup__link { font-size: 13.5px; font-weight: 700; color: var(--primary); text-decoration: none; }
.news-popup__link:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .news-popup { inset-inline: 16px; max-width: none; width: auto; }
}

/* ============ صفحة الأخبار (القائمة + التفاصيل) ============ */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-lg);
}
.article-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(72, 58, 49, 0.08);
  text-decoration: none;
  transition: transform var(--t-med), box-shadow var(--t-med);
}
.article-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(72, 58, 49, 0.14); }
.article-card__img {
  height: 140px;
  background: linear-gradient(135deg, var(--highlight) 0%, var(--n-100) 100%);
  display: grid; place-items: center;
  color: var(--primary);
}
.article-card__img svg { width: 34px; height: 34px; }
.article-card__body { padding: var(--sp-lg); display: flex; flex-direction: column; gap: 8px; flex: 1; }
.article-card__cat {
  align-self: flex-start;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--highlight);
  color: var(--primary-deep);
}
.article-card__title { font-size: 17px; font-weight: 700; color: var(--primary-deep); line-height: 1.5; margin: 0; }
.article-card__excerpt { font-size: 13.5px; color: var(--text-secondary); line-height: 1.7; flex: 1; }
.article-card__date { font-size: 12px; color: var(--text-muted); margin-top: auto; display: flex; align-items: center; gap: 6px; }
.article-card__date svg { width: 14px; height: 14px; }
.article-card--important { border-color: rgba(116, 92, 77, 0.35); }
.article-card--important .article-card__cat { background: var(--primary); color: #FFF4F0; }

.article-detail { max-width: 760px; margin: 0 auto; }
.article-detail__back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--primary);
  text-decoration: none; margin-bottom: var(--sp-lg);
}
.article-detail__back:hover { text-decoration: underline; }
.article-detail__img {
  height: 220px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--highlight) 0%, var(--n-100) 100%);
  display: grid; place-items: center; color: var(--primary);
  margin-bottom: var(--sp-lg);
}
.article-detail__img svg { width: 52px; height: 52px; }
.article-detail__title { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; color: var(--primary-deep); margin: 0 0 var(--sp-sm); line-height: 1.4; }
.article-detail__meta { display: flex; align-items: center; gap: var(--sp-md); margin-bottom: var(--sp-lg); flex-wrap: wrap; }
.article-detail__body { font-size: 16px; line-height: 1.9; color: var(--text-primary); white-space: pre-line; }

/* ============ ملفات الهوية: معاينة مصغّرة ============ */
.doc-card__thumb {
  width: 100%;
  height: 96px;
  border-radius: var(--r-md);
  background: var(--n-50);
  display: grid;
  place-items: center;
  margin-bottom: var(--sp-md);
  overflow: hidden;
}
.doc-card__thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ============ صفحة التمهيد (Welcome) ============ */
.welcome-body { margin: 0; }
.welcome {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, #745C4D 0%, #483A31 100%);
  color: #FFF4F0;
  overflow: hidden;
}
.welcome__glow {
  position: absolute;
  top: -30%; inset-inline-end: -15%;
  width: 70%; height: 160%;
  background: radial-gradient(circle, rgba(247, 221, 208, 0.20) 0%, transparent 60%);
  pointer-events: none;
}
.welcome__inner {
  position: relative;
  z-index: 1;
/*  max-width: 760px;*/
    max-width: 100%;
  animation: welcomeIn 700ms cubic-bezier(.4, 0, .2, 1) both;
}
.welcome__logo {
  height: 144px;
  width: auto;
  margin: 0 auto 36px;
  display: block;
}
.welcome__title {
  font-size: clamp(26px, 4.2vw, 46px);
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  color: #FFF4F0;
}
.welcome__sub {
  font-size: clamp(15px, 2vw, 19px);
  font-weight: 400;
  line-height: 1.8;
  color: rgba(255, 244, 240, 0.82);
  margin: 0 0 40px;
}
.welcome__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 17px 40px;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  color: #483A31;
  background: #FFF4F0;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(42, 32, 30, 0.28);
  transition: transform 320ms cubic-bezier(.4, 0, .2, 1), box-shadow 320ms cubic-bezier(.4, 0, .2, 1), background 320ms cubic-bezier(.4, 0, .2, 1);
}
.welcome__btn svg { width: 20px; height: 20px; }
.welcome__btn:hover {
  background: #F7DDD0;
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(42, 32, 30, 0.34);
}
.welcome__footer {
  position: relative;
  z-index: 1;
  margin-top: 48px;
  font-size: 13px;
  color: rgba(255, 244, 240, 0.6);
}
@keyframes welcomeIn {
  from { opacity: 0; transform: translate3d(0, 18px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .welcome__inner { animation: none; }
}


/* ---- fonts ----- */
@font-face {
  font-family: 'ITF Qomra Arabic';
  src: url('https://ledar.com/DASHBOARD/fonts/ITFQomra-Regular.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'ITF Qomra Arabic';
  src:
    local("ITF Qomra Arabic"),
    url("/assets/fonts/itfQomraArabic-Bold.otf") format("opentype") tech(color-COLRv1),
    url("/assets/fonts/itfQomraArabic-Bold.woff2") format("woff2");
  font-weight: 800; font-display: swap;
}
@font-face {
  font-family: 'ITF Qomra Arabic';
  src:
    local("ITF Qomra Arabic"),
    url("/assets/fonts/itfQomraArabic-Regular.otf") format("opentype") tech(color-COLRv1),
    url("/assets/fonts/itfQomraArabic-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}


/* ---------- Design Tokens ---------- */
:root {
  /* Brand */
  --primary:       #745C4D;
  --primary-dark:  #644E44;
  --primary-deep:  #483A31;
  --primary-2a:    #2A201E;

  --bg-light:      #FFF4F0;
  --highlight:     #F7DDD0;
  --blue-light:    #DEF2FB;
  --blue-dark:     #BDE7FA;

  /* Neutral */
  --n-50:  #F5F3F1;
  --n-100: #EDE8E4;
  --n-200: #DDD4CC;
  --n-300: #C8BAB0;
  --n-400: #A89080;

  /* Text */
  --text-primary:   #483A31;
  --text-secondary: #745C4D;
  --text-muted:     rgba(72, 58, 49, 0.65);
  --text-on-dark:   #FFF4F0;

  /* Borders */
  --border-subtle:  rgba(116, 92, 77, 0.08);
  --border-visible: rgba(116, 92, 77, 0.18);
  --border-strong:  rgba(116, 92, 77, 0.32);

  /* Spacing (8px base) */
  --sp-xs: 4px; --sp-sm: 8px; --sp-md-sm: 12px; --sp-md: 16px;
  --sp-lg: 24px; --sp-xl: 32px; --sp-2xl: 42px; --sp-3xl: 48px;

  /* Radius */
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px; --r-pill: 20px; --r-full: 999px;

  /* Animation */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --t-fast: 180ms var(--ease);
  --t-med:  320ms var(--ease);
  --t-slow: 520ms var(--ease);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg-light);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', 'ITF Qomra Arabic', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

button { font-family: inherit; cursor: pointer; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--r-md);
  border: 1.5px solid transparent;
  transition: all var(--t-med);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn--primary {
  background: var(--primary);
  color: var(--text-on-dark);
  box-shadow: 0 6px 18px rgba(116, 92, 77, 0.25);
}
.btn--primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(116, 92, 77, 0.32);
}
.btn--secondary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn--secondary:hover { background: rgba(116, 92, 77, 0.07); }

.btn--sm { padding: 9px 16px; font-size: 14px; }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 244, 240, 0.92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}

/* ---------- Page head ---------- */
.page-head { padding: var(--sp-3xl) 0 var(--sp-xl); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 7px 16px;
  background: rgba(116, 92, 77, 0.08);
  color: var(--primary);
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.badge--filled {
  background: var(--highlight);
  font-weight: 700;
  letter-spacing: 0.14em;
}

.page-head__title {
  font-size: clamp(30px, 4.4vw, 46px);
  font-weight: 800;
  color: var(--primary-deep);
  margin: var(--sp-md) 0 var(--sp-md-sm);
  letter-spacing: -0.01em;
}
.page-head__desc {
  max-width: 640px;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.8;
  margin: 0 0 var(--sp-xl);
}

/* ---------- Search ---------- */
.search {
  position: relative;
  max-width: 560px;
}
.search__icon {
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}
.search__input {
  width: 100%;
  padding: 15px 48px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-primary);
  background: #fff;
  border: 1.5px solid var(--border-visible);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 14px rgba(116, 92, 77, 0.06);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search__input::placeholder { color: var(--text-muted); }
.search__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 4px 18px rgba(116, 92, 77, 0.14);
}
.search__clear {
  position: absolute;
  inset-inline-end: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border: none;
  border-radius: var(--r-full);
  background: rgba(116, 92, 77, 0.10);
  color: var(--primary);
  transition: background var(--t-fast);
}
.search__clear svg { width: 15px; height: 15px; }
.search__clear:hover { background: rgba(116, 92, 77, 0.20); }

/* ---------- Filters ---------- */
.filters { padding-bottom: var(--sp-lg); }
.filter-group {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md-sm) 0;
  flex-wrap: wrap;
}
.filter-group + .filter-group { border-top: 1px solid var(--border-subtle); }
.filter-group__label {
  flex-shrink: 0;
  min-width: 64px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}
.chip {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #fff;
  border: 1.5px solid var(--border-visible);
  border-radius: var(--r-full);
  transition: all var(--t-fast);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-dark);
  box-shadow: 0 4px 12px rgba(116, 92, 77, 0.22);
}

/* ---------- Results bar ---------- */
.results { padding-bottom: var(--sp-3xl); }
.results__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
  padding-top: var(--sp-sm);
}
.results__count {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}
.results__count b { color: var(--primary-deep); font-weight: 800; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-lg);
}

/* ---------- Card ---------- */
.doc-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  box-shadow: 0 8px 24px rgba(72, 58, 49, 0.08);
  position: relative;
  overflow: hidden;
  animation: cardIn var(--t-med) both;
  transition: transform var(--t-med), box-shadow var(--t-med);
}
.doc-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--highlight) 0%, transparent 55%);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}
.doc-card > * { position: relative; z-index: 1; }
.doc-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(72, 58, 49, 0.14);
}

.doc-card__head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-md);
  margin-bottom: var(--sp-md);
}
.doc-card__icon {
  flex-shrink: 0;
  width: 46px; height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: rgba(116, 92, 77, 0.08);
  color: var(--primary);
}
.doc-card__icon svg { width: 24px; height: 24px; }
.doc-card__filetype {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-on-dark);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  align-self: flex-start;
  margin-inline-start: auto;
}
.ft-pdf   { background: #B4534A; }
.ft-doc   { background: #3F6FB0; }
.ft-docx  { background: #3F6FB0; }
.ft-xls   { background: #3E8E5A; }
.ft-xlsx  { background: #3E8E5A; }
.ft-default { background: var(--primary); }

.doc-card__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-deep);
  margin: 0 0 var(--sp-md-sm);
  line-height: 1.5;
}

.doc-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-md);
}
.tag {
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: rgba(116, 92, 77, 0.07);
  color: var(--text-secondary);
}
.tag--type {
  background: var(--highlight);
  color: var(--primary-deep);
  font-weight: 700;
}
.tag--code {
  background: rgba(116, 92, 77, 0.10);
  color: var(--primary-deep);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.doc-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-md-sm) var(--sp-lg);
  margin-top: auto;
  padding-top: var(--sp-md);
  border-top: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-md);
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.meta-item svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--text-secondary); }
.meta-item b { color: var(--primary-deep); font-weight: 700; font-variant-numeric: tabular-nums; }

.doc-card__actions {
  display: flex;
  gap: var(--sp-md-sm);
}
.doc-card__actions .btn { flex: 1; justify-content: center; align-items: center;}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: var(--sp-3xl) var(--sp-lg);
  color: var(--text-muted);
}
.empty svg {
  width: 56px; height: 56px;
  color: var(--n-300);
  margin: 0 auto var(--sp-md);
}
.empty h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-deep);
  margin: 0 0 var(--sp-sm);
}
.empty p { margin: 0 0 var(--sp-lg); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--sp-lg) 0;
  margin-top: var(--sp-xl);
}
.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}
.site-footer__muted { color: var(--n-400); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .container { padding: 0 18px; }
  .page-head { padding: var(--sp-xl) 0 var(--sp-lg); }
  .filter-group { align-items: flex-start; flex-direction: column; gap: var(--sp-sm); }
  .filter-group__label { min-width: 0; }
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}






