/* =====================================================================
   ERPSYS Design System — shared by every application
   RTL-first (logical properties), Tajawal typeface, light theme
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  --brand-900: #062F37;
  --brand-800: #083E48;
  --brand-700: #0B5563;
  --brand-600: #0F6B7A;
  --brand-100: #DCEEF0;
  --brand-50:  #EEF7F8;
  --accent:    #B8912F;
  --accent-100:#F5ECD5;
  --ink:       #14232B;
  --ink-2:     #33454E;
  --muted:     #62737B;
  --bg:        #F6F4EF;
  --surface:   #FFFFFF;
  --surface-2: #FBFAF7;
  --border:    #E5E1D8;
  --border-2:  #D6D1C4;
  --success:   #1E7A4C; --success-bg: #E3F3EA;
  --warning:   #9A6B00; --warning-bg: #FBF1D6;
  --danger:    #B42318; --danger-bg:  #FDE8E6;
  --info:      #175CD3; --info-bg:    #E6EEFB;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20,35,43,.06);
  --shadow:    0 1px 3px rgba(20,35,43,.06), 0 8px 24px rgba(20,35,43,.06);
  --font: 'Tajawal', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --sidebar-w: 264px;
  --ring: 0 0 0 3px rgba(15,107,122,.28);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.65;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-600); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; font-weight: 800; color: var(--ink); }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + .9vw, 1.75rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.icon { width: 1.2em; height: 1.2em; flex-shrink: 0; vertical-align: middle; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .86em; direction: ltr; unicode-bidi: embed; }
.nowrap { white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 1rem; top: -60px; background: var(--brand-800); color: #fff; padding: .5rem 1rem; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 42px; padding: .55rem 1.1rem; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: .95rem; line-height: 1.2; cursor: pointer;
  text-decoration: none !important; transition: background .15s, border-color .15s, color .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-700); color: #fff; }
.btn-primary:hover { background: var(--brand-800); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #9E7B22; color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--brand-600); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #F1B8B2; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-light { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-light:hover { background: rgba(255,255,255,.22); color: #fff; }
.btn-sm { min-height: 34px; padding: .35rem .75rem; font-size: .86rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { min-height: 38px; width: 38px; padding: 0; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 1rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.form-grid .span-all { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label, .label { font-weight: 700; font-size: .9rem; color: var(--ink-2); }
.field .hint { font-size: .82rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: 10px; padding: .6rem .8rem; min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 120px; resize: vertical; }
.textarea.tall { min-height: 260px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-600); box-shadow: var(--ring); }
.input[dir="ltr"], .textarea[dir="ltr"] { text-align: left; }
.field-error { color: var(--danger); font-size: .84rem; font-weight: 500; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-700); }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.hp-field { position: absolute !important; inset-inline-start: -9999px; }

/* ---------- Alerts / badges ---------- */
.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid transparent; font-weight: 500; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #BFE3CE; }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border-color: #F6C7C2; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #F0DDA5; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: #C4D6F6; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--brand-50); color: var(--brand-700); white-space: nowrap; }
.badge-active, .badge-published, .badge-open, .badge-shortlisted, .badge-read { background: var(--success-bg); color: var(--success); }
.badge-locked, .badge-rejected, .badge-closed { background: var(--danger-bg); color: var(--danger); }
.badge-disabled, .badge-draft, .badge-archived { background: #EDEBE6; color: var(--muted); }
.badge-new { background: var(--info-bg); color: var(--info); }
.badge-reviewed, .badge-soon { background: var(--warning-bg); color: var(--warning); }
.chip { display: inline-flex; padding: .2rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--accent-100); color: #7A5E17; }

/* ---------- Cards / tables ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 1.25rem 1.4rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.4rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; font-size: 1.05rem; }
.card-footer { padding: .85rem 1.4rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: .75rem 1rem; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--surface-2); text-transform: none; white-space: nowrap; }
.table tbody tr:hover { background: var(--brand-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: .35rem; justify-content: flex-end; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty .icon { width: 42px; height: 42px; color: var(--border-2); margin: 0 auto .5rem; display: block; }
.stack { display: grid; gap: 1.25rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid-2 { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.dl { display: grid; grid-template-columns: minmax(120px, 35%) 1fr; gap: .55rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.pagination { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 .6rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-weight: 700; font-size: .88rem; text-decoration: none; }
.pagination .current { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.filters .input, .filters .select { min-height: 40px; width: auto; min-width: 170px; }

/* =====================================================================
   Public website
   ===================================================================== */
.container { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(246,244,239,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; align-items: center; gap: 1.25rem; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); font-weight: 800; font-size: 1.05rem; text-decoration: none !important; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(145deg, var(--brand-600), var(--brand-900)); color: #fff; box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); }
.brand-mark .icon { width: 22px; height: 22px; }
.brand small { display: block; font-weight: 500; font-size: .74rem; color: var(--muted); line-height: 1.1; }
.site-nav { display: flex; gap: .2rem; margin-inline-start: auto; }
.site-nav a { padding: .5rem .8rem; border-radius: 9px; color: var(--ink-2); font-weight: 700; font-size: .95rem; text-decoration: none; }
.site-nav a:hover { background: var(--surface); color: var(--brand-700); }
.site-nav a.active { color: var(--brand-700); background: var(--brand-50); }
.header-actions { display: flex; gap: .5rem; align-items: center; }
.lang-toggle { font-weight: 800; min-width: 44px; }
.nav-toggle { display: none; }

.hero { position: relative; overflow: hidden; background: radial-gradient(1200px 500px at 85% -10%, #137F90 0%, transparent 60%), linear-gradient(160deg, var(--brand-800) 0%, var(--brand-900) 100%); color: #fff; }
.hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), transparent 85%); pointer-events: none; }
.hero .container { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; padding-block: clamp(3rem, 7vw, 6rem); }
.hero h1 { color: #fff; font-size: clamp(2rem, 1.3rem + 2.6vw, 3.25rem); letter-spacing: -.01em; }
.hero p.lead { font-size: 1.12rem; color: rgba(255,255,255,.82); max-width: 58ch; }
.hero .eyebrow { display: inline-flex; gap: .45rem; align-items: center; padding: .3rem .8rem; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); font-size: .85rem; font-weight: 700; color: #F3DFA6; margin-bottom: 1.1rem; }
.hero-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.6rem; }
.hero-panel { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); border-radius: 20px; padding: 1.25rem; backdrop-filter: blur(6px); }
.hero-panel .door { display: grid; gap: .8rem; }
.scan-row { display: flex; align-items: center; gap: .8rem; padding: .8rem .9rem; border-radius: 12px; background: rgba(6,47,55,.55); border: 1px solid rgba(255,255,255,.1); }
.scan-row .icon { width: 26px; height: 26px; color: #F3DFA6; }
.scan-row strong { display: block; font-size: .95rem; }
.scan-row span { font-size: .82rem; color: rgba(255,255,255,.7); }
.scan-row .ok { margin-inline-start: auto; color: #7EE2A8; font-weight: 800; font-size: .85rem; }

.section { padding-block: clamp(3rem, 6vw, 5rem); }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }
.section-head { max-width: 680px; margin-bottom: 2.2rem; }
.section-head .kicker { color: var(--accent); font-weight: 800; font-size: .9rem; margin-bottom: .35rem; display: block; }
.section-head p { color: var(--muted); font-size: 1.05rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: -2.4rem; position: relative; z-index: 2; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.9rem; font-weight: 800; color: var(--brand-700); line-height: 1.1; direction: ltr; unicode-bidi: isolate; text-align: start; }
.stat span { color: var(--muted); font-size: .9rem; font-weight: 500; }

.service-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.service { padding: 1.4rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: border-color .2s, box-shadow .2s, transform .2s; }
.service:hover { border-color: var(--brand-600); box-shadow: var(--shadow); transform: translateY(-2px); }
.service .ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); margin-bottom: 1rem; }
.service .ico .icon { width: 24px; height: 24px; }
.service h3 { margin-bottom: .35rem; }
.service p { color: var(--muted); margin: 0; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
.checklist { list-style: none; padding: 0; margin: 1.2rem 0 0; display: grid; gap: .7rem; }
.checklist li { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
.checklist .icon { color: var(--success); margin-top: .2rem; }

.cta { background: linear-gradient(135deg, var(--brand-700), var(--brand-900)); color: #fff; border-radius: 22px; padding: clamp(1.8rem, 4vw, 3rem); display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.cta h2 { color: #fff; margin-bottom: .3rem; }
.cta p { color: rgba(255,255,255,.8); margin: 0; }

.page-hero { background: linear-gradient(160deg, var(--brand-800), var(--brand-900)); color: #fff; padding-block: clamp(2.2rem, 5vw, 3.6rem); }
.page-hero h1 { color: #fff; margin: 0; }
.page-hero p { color: rgba(255,255,255,.78); margin: .5rem 0 0; max-width: 70ch; }
.breadcrumb { font-size: .86rem; color: rgba(255,255,255,.65); margin-bottom: .5rem; }
.breadcrumb a { color: rgba(255,255,255,.85); }

.prose { max-width: 75ch; font-size: 1.04rem; }
.prose h2 { margin-top: 1.8rem; font-size: 1.35rem; }
.prose ul { padding-inline-start: 1.3rem; }
.prose li { margin-bottom: .35rem; }

.job-list { display: grid; gap: .9rem; }
.job { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.15rem 1.35rem; }
.job h3 { margin: 0 0 .25rem; }
.job-meta { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.job-meta span { display: inline-flex; gap: .35rem; align-items: center; }

.contact-info { display: grid; gap: 1rem; }
.contact-info .item { display: flex; gap: .85rem; align-items: flex-start; }
.contact-info .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; flex-shrink: 0; }

.site-footer { background: var(--brand-900); color: rgba(255,255,255,.72); padding-block: 3rem 1.5rem; margin-top: 0; }
.site-footer a { color: rgba(255,255,255,.85); }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
.site-footer h4 { color: #fff; font-size: 1rem; margin-bottom: .8rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.site-footer .brand { color: #fff; }
.site-footer .brand small { color: rgba(255,255,255,.6); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 2rem; padding-top: 1.2rem; font-size: .86rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* =====================================================================
   Auth pages
   ===================================================================== */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); }
.auth-aside { background: radial-gradient(900px 400px at 20% 0%, #137F90 0%, transparent 60%), linear-gradient(160deg, var(--brand-800), var(--brand-900)); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside h2 { color: #fff; font-size: 2rem; max-width: 18ch; }
.auth-aside p { color: rgba(255,255,255,.78); max-width: 46ch; }
.auth-aside .brand { color: #fff; }
.auth-aside .brand small { color: rgba(255,255,255,.6); }
.auth-main { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 2rem; box-shadow: var(--shadow); margin: 2rem auto; }
.auth-card h1 { font-size: 1.55rem; margin-bottom: .25rem; }
.auth-card .sub { color: var(--muted); margin-bottom: 1.5rem; }
.auth-card .field + .field { margin-top: 1rem; }
.password-wrap { position: relative; }
.password-wrap .input { padding-inline-end: 2.8rem; }
.password-wrap button { position: absolute; inset-inline-end: .35rem; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: .4rem; border-radius: 8px; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .85rem; margin: 1.3rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* =====================================================================
   Application shell (internal apps)
   ===================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--brand-900); color: rgba(255,255,255,.75); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 1rem .8rem; }
.sidebar .brand { color: #fff; padding: .4rem .5rem 1.2rem; }
.sidebar .brand small { color: rgba(255,255,255,.55); }
.nav-group { margin-top: 1rem; }
.nav-group-title { font-size: .74rem; font-weight: 800; color: rgba(255,255,255,.42); padding: 0 .75rem; margin-bottom: .35rem; letter-spacing: .02em; }
.nav-link { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 10px; color: rgba(255,255,255,.8); font-weight: 500; text-decoration: none !important; font-size: .94rem; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .nav-link.active { box-shadow: inset -3px 0 0 var(--accent); }
.nav-link .badge { margin-inline-start: auto; background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); font-size: .7rem; }
.nav-link.disabled { opacity: .5; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(6,47,55,.45); z-index: 55; display: none; }
.sidebar-backdrop.open { display: block; }
.sidebar-foot { margin-top: auto; padding: 1rem .5rem 0; font-size: .78rem; color: rgba(255,255,255,.4); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(246,244,239,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .75rem; padding: .7rem 1.5rem; min-height: 64px; }
.topbar .title { font-weight: 800; font-size: 1.05rem; }
.topbar .spacer { flex: 1; }
.user-menu { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: .55rem; background: var(--surface); border: 1px solid var(--border); padding: .3rem .7rem .3rem .3rem; border-radius: 999px; cursor: pointer; font: inherit; color: var(--ink); }
[dir="rtl"] .user-btn { padding: .3rem .3rem .3rem .7rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(145deg, var(--accent), #8C6D1F); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .9rem; flex-shrink: 0; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.3rem; }
.dropdown { position: absolute; inset-inline-end: 0; top: calc(100% + .4rem); min-width: 250px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: .4rem; display: none; z-index: 50; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: flex; width: 100%; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 8px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; text-align: start; text-decoration: none; }
.dropdown a:hover, .dropdown button:hover { background: var(--brand-50); }
.dropdown .head { padding: .6rem .7rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.notif-btn { position: relative; }
.notif-count { position: absolute; top: -3px; inset-inline-end: -3px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 800; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.notif-item { display: block !important; font-size: .88rem; line-height: 1.45; }
.notif-item.unread { background: var(--brand-50); }
.notif-item time { display: block; color: var(--muted); font-size: .76rem; }

.content { padding: 1.6rem 1.5rem 3rem; width: 100%; max-width: 1320px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head h1 { font-size: 1.55rem; margin: 0; }
.page-head p { margin: .2rem 0 0; color: var(--muted); }

.welcome { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1.4rem; background: linear-gradient(135deg, var(--brand-700), var(--brand-900)); color: #fff; border-radius: 18px; border: 0; }
.welcome h1 { color: #fff; margin: 0; font-size: 1.45rem; }
.welcome p { margin: .2rem 0 0; color: rgba(255,255,255,.78); }
.welcome .chip { background: rgba(255,255,255,.14); color: #F3DFA6; }

.app-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.app-tile { display: flex; flex-direction: column; gap: .5rem; padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--ink); text-decoration: none !important; transition: border-color .2s, box-shadow .2s, transform .2s; position: relative; min-height: 170px; }
a.app-tile:hover { border-color: var(--brand-600); box-shadow: var(--shadow); transform: translateY(-2px); color: var(--ink); }
.app-tile .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); }
.app-tile .ico .icon { width: 24px; height: 24px; }
.app-tile h3 { margin: .3rem 0 0; font-size: 1.02rem; }
.app-tile p { margin: 0; color: var(--muted); font-size: .88rem; }
.app-tile .badge { position: absolute; top: 1rem; inset-inline-end: 1rem; }
.app-tile.soon { background: var(--surface-2); }
.app-tile.soon .ico { background: #EDEBE6; color: var(--muted); }

.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi { padding: 1.1rem 1.2rem; }
.kpi .label { color: var(--muted); font-size: .86rem; font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.kpi .value { font-size: 1.8rem; font-weight: 800; line-height: 1.2; margin-top: .25rem; }

.matrix th.rot { min-width: 110px; text-align: center; }
.matrix td.c { text-align: center; }
.matrix .module-row td { background: var(--surface-2); font-weight: 800; color: var(--brand-700); font-size: .82rem; }
.matrix input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand-700); }

.role-list { display: flex; flex-wrap: wrap; gap: .5rem .9rem; }

/* ---------- Error pages ---------- */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem; text-align: center; }
.error-page .code { font-size: 5rem; font-weight: 800; color: var(--brand-700); line-height: 1; direction: ltr; }
.error-page p { color: var(--muted); max-width: 46ch; margin-inline: auto; }

/* ---------- Offline banner ---------- */
.offline-banner { position: fixed; bottom: 1rem; inset-inline: 1rem; margin-inline: auto; max-width: 420px; background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 12px; text-align: center; z-index: 90; font-weight: 500; box-shadow: var(--shadow); }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 980px) {
  .hero .container, .split, .grid-2 { grid-template-columns: 1fr !important; }
  .hero-panel { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .site-footer .cols { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .nav-toggle { display: inline-flex; margin-inline-start: auto; }
  .site-nav { position: absolute; top: 72px; inset-inline: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); padding: .6rem 1.25rem 1rem; display: none; box-shadow: var(--shadow); }
  .site-nav.open { display: flex; }
  .site-header .header-actions .btn-label { display: none; }

  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(var(--sidebar-w), 86vw); z-index: 60; transform: translateX(-105%); transition: transform .22s ease; }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  .sidebar.open { transform: none !important; }
  .topbar { padding: .6rem 1rem; }
  .content { padding: 1.2rem 1rem 2.5rem; }
}
@media (min-width: 981px) { .app-menu-btn { display: none; } }
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat b { font-size: 1.45rem; }
  .dl { grid-template-columns: 1fr; gap: .1rem; }
  .dl dd { margin-bottom: .6rem; }
  .topbar .title { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print { .sidebar, .topbar, .site-header, .site-footer { display: none !important; } .app { display: block; } }
