/* نظام تقارير الدوام الشهرية — واجهة عربية RTL (القسم 10.1)
   التصميم: مستوحى من Metronic demo1 (v7): شريط جانبي داكن #1E1E2D، ترويسة بيضاء 65px، صفحة #EEF0F8، بطاقات بيضاء
   بحواف 0.42rem وظل خفيف، ألوان primary #3699FF / success #1BC5BD / warning #FFA800 / danger #F64E60.
   الخطوط: Cairo للعربية، Open Sans للإنجليزية والأرقام — مستضافة محلياً. */

/* ---- الخطوط ---- */
@font-face { font-family: "Cairo"; font-weight: 400; font-display: swap; src: url("/assets/fonts/cairo-arabic-400.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Cairo"; font-weight: 500; font-display: swap; src: url("/assets/fonts/cairo-arabic-500.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Cairo"; font-weight: 600; font-display: swap; src: url("/assets/fonts/cairo-arabic-600.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Cairo"; font-weight: 700; font-display: swap; src: url("/assets/fonts/cairo-arabic-700.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Cairo"; font-weight: 400; font-display: swap; src: url("/assets/fonts/cairo-latin-400.woff2") format("woff2"); }
@font-face { font-family: "Cairo"; font-weight: 700; font-display: swap; src: url("/assets/fonts/cairo-latin-700.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 400; font-display: swap; src: url("/assets/fonts/open-sans-latin-400.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 500; font-display: swap; src: url("/assets/fonts/open-sans-latin-500.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 600; font-display: swap; src: url("/assets/fonts/open-sans-latin-600.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 700; font-display: swap; src: url("/assets/fonts/open-sans-latin-700.woff2") format("woff2"); }

:root {
  --font: "Open Sans", "Cairo", Tahoma, Arial, sans-serif;
  --primary: #3699FF; --primary-hover: #187DE4; --primary-light: #E1F0FF;
  --success: #1BC5BD; --success-light: #C9F7F5; --info: #8950FC; --info-light: #EEE5FF;
  --warning: #FFA800; --warning-light: #FFF4DE; --danger: #F64E60; --danger-light: #FFE2E5;
  --dark: #181C32; --dark-75: #3F4254; --gray-100: #F3F6F9; --gray-200: #EBEDF3; --gray-300: #E4E6EF;
  --gray-400: #D1D3E0; --gray-500: #B5B5C3; --gray-600: #7E8299; --gray-700: #5E6278; --gray-800: #3F4254;
  --page-bg: #EEF0F8; --surface: #FFFFFF; --text: #3F4254; --muted: #7E8299; --line: #EBEDF3;
  --aside-bg: #1E1E2D; --aside-brand: #1A1A27; --aside-text: #A2A3B7; --aside-icon: #494B74; --aside-active: #1B1B28;
  --st-draft: #7E8299; --st-submitted: #3699FF; --st-returned: #FFA800; --st-approved: #1BC5BD; --st-closed: #0BB7AF; --st-late: #F64E60;
  --sidebar-w: 265px; --header-h: 65px; --radius: .42rem; --radius-lg: .75rem;
  --shadow: 0 0 30px 0 rgba(82, 63, 105, .05); --focus: #3699FF;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 14px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--page-bg); line-height: 1.55; font-weight: 400; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
h1, h2, h3, h4 { color: var(--dark); font-weight: 600; line-height: 1.3; margin-block: 0 .6em; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.skip-link { position: absolute; inset-inline-start: -999px; top: 0; background: var(--warning); padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { inset-inline-start: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---- التخطيط: شريط جانبي داكن على اليمين + ترويسة بيضاء ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--aside-bg); color: var(--aside-text); flex-shrink: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .75rem; height: var(--header-h); padding: 0 1.25rem; background: var(--aside-brand); color: #fff; font-weight: 700; font-size: 1rem; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; inline-size: 34px; block-size: 34px; border-radius: .5rem; background: var(--primary); color: #fff; font-family: "Open Sans", sans-serif; font-weight: 700; font-size: 1.1rem; flex-shrink: 0; }
.brand-mark-lg { inline-size: 64px; block-size: 64px; font-size: 2rem; border-radius: 1rem; }
.sidebar-nav { flex: 1; padding: .75rem 0; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }
.nav-link { display: flex; align-items: center; gap: .85rem; padding: .7rem 1.5rem; color: var(--aside-text); text-decoration: none; font-weight: 500; border-inline-start: 3px solid transparent; transition: background .15s, color .15s; }
.nav-link:hover { background: var(--aside-active); color: #fff; text-decoration: none; }
.nav-link:hover .nav-icon { color: var(--primary); }
.nav-link.is-active { background: var(--aside-active); color: #fff; border-inline-start-color: var(--primary); }
.nav-link.is-active .nav-icon { color: var(--primary); }
.nav-link.is-disabled { opacity: .4; cursor: not-allowed; }
.nav-icon { inline-size: 1.4em; text-align: center; color: var(--aside-icon); font-size: 1.05rem; }
.sidebar-foot { padding: .9rem 1.5rem; font-size: .8rem; color: var(--aside-icon); border-top: 1px solid rgba(255,255,255,.05); }
.main-column { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: var(--header-h); padding: .5rem 1.6rem; background: var(--surface); border-block-end: 1px solid var(--line); box-shadow: 0 10px 30px 0 rgba(82,63,105,.05); flex-wrap: wrap; }
.topbar-title h2 { margin: 0; font-size: 1.2rem; }
.topbar-month { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.month-chip { padding: .3rem .8rem; background: var(--gray-100); border-radius: var(--radius); color: var(--dark-75); font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: .8rem; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: start; font-size: .9rem; }
.avatar { display: inline-flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px; border-radius: var(--radius); background: var(--primary-light); color: var(--primary); font-weight: 700; font-size: 1.1rem; }
.content { padding: 1.6rem; max-width: 1400px; width: 100%; flex: 1; }
.app-footer { display: flex; justify-content: space-between; padding: .8rem 1.6rem; color: var(--muted); font-size: .85rem; background: var(--surface); border-block-start: 1px solid var(--line); }
.inline-form { display: inline; }
.bottombar { display: none; }

/* ---- بطاقات، شبكات، جداول ---- */
.card { background: var(--surface); border: 0; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.6rem; margin-block-end: 1.4rem; }
.card > h2:first-child, .card > h3:first-child { padding-block-end: .7rem; border-block-end: 1px solid var(--line); margin-block-end: 1rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.4rem; margin-block-end: 1.4rem; }
.card-grid .card { margin-block-end: 0; }
.stat { font-size: 2rem; font-weight: 700; color: var(--dark); font-variant-numeric: tabular-nums; line-height: 1.1; margin-block: .3rem .5rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-block-end: 1.2rem; }
.page-head h1, .page-head h2 { margin: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .7rem .75rem; border-block-end: 1px solid var(--line); text-align: start; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; background: transparent; border-block-end: 1px solid var(--gray-300); }
tbody tr:hover td { background: var(--gray-100); }
tr.is-inactive td { color: var(--muted); }
td.num, th.num { text-align: center; }
.actions-cell { white-space: nowrap; }
.json { font-family: Consolas, "Courier New", monospace; font-size: .78rem; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-all; max-width: 320px; margin: 0; color: var(--dark-75); }

/* ---- الأزرار ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.1rem; border: 1px solid transparent; background: var(--gray-100); color: var(--dark-75); border-radius: var(--radius); cursor: pointer; font: inherit; font-weight: 500; text-decoration: none; line-height: 1.3; transition: background .15s, color .15s; }
.btn:hover { background: var(--gray-200); text-decoration: none; color: var(--dark); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-light { background: var(--gray-100); color: var(--dark-75); }
.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---- النماذج (form-control-solid) ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 1.4rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field-full { grid-column: 1 / -1; }
label { font-weight: 500; color: var(--dark-75); }
.req { color: var(--danger); }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], input[type="file"], select, textarea {
  font: inherit; padding: .55rem .9rem; border: 1px solid var(--gray-100); border-radius: var(--radius); background: var(--gray-100); color: var(--dark-75); width: 100%; min-height: 2.7rem; transition: background .15s, border-color .15s;
}
input:focus, select:focus, textarea:focus { background: var(--gray-200); border-color: var(--gray-200); outline: none; box-shadow: 0 0 0 2px var(--primary-light); }
input[dir="ltr"], input[type="date"], input[type="time"], input[type="number"] { direction: ltr; text-align: start; font-family: "Open Sans", sans-serif; }
.field.has-error input, .field.has-error select { border-color: var(--danger); background: var(--danger-light); }
.error-text { color: var(--danger); font-size: .85rem; }
.hint { color: var(--muted); font-size: .85rem; }
.check-row { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; }
.check-row label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; }
input[type="checkbox"] { inline-size: 1.15rem; block-size: 1.15rem; accent-color: var(--primary); }
fieldset { border: 1px dashed var(--gray-300); border-radius: var(--radius); padding: .8rem 1rem; margin: 0; }
legend { font-weight: 600; padding-inline: .4rem; color: var(--dark-75); }
.form-actions { display: flex; gap: .6rem; margin-block-start: 1.2rem; flex-wrap: wrap; }
.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-block-end: 1rem; }
.filter-bar .field { min-width: 150px; }
.filter-bar input, .filter-bar select { min-height: 2.5rem; }

/* ---- التنبيهات والشارات (light variants) ---- */
.alert { padding: .8rem 1.1rem; border-radius: var(--radius); margin-block-end: 1rem; border: 1px dashed transparent; font-weight: 500; }
.alert-success { background: var(--success-light); border-color: var(--success); color: #0b7a76; }
.alert-error { background: var(--danger-light); border-color: var(--danger); color: #c22b3d; }
.alert-info { background: var(--primary-light); border-color: var(--primary); color: #1b6dc7; }
.alert-warn { background: var(--warning-light); border-color: var(--warning); color: #a06a00; }
.alert-secret { background: #FFF8DD; border-color: var(--warning); color: #7a5300; }
.secret { font-family: "Open Sans", monospace; font-size: 1.3rem; letter-spacing: .12em; padding: .2rem .6rem; background: #fff; border: 1px dashed var(--warning); border-radius: 4px; display: inline-block; margin-inline: .5rem; user-select: all; }
.badge { display: inline-block; padding: .2rem .65rem; border-radius: var(--radius); font-size: .8rem; font-weight: 600; color: #fff; background: var(--st-draft); white-space: nowrap; line-height: 1.4; }
.status-none { background: var(--gray-200); color: var(--muted); }
.status-draft { background: var(--gray-200); color: var(--dark-75); }
.status-submitted { background: var(--primary-light); color: var(--primary); }
.status-returned { background: var(--warning-light); color: #b57600; }
.status-manager_approved { background: var(--success-light); color: #0b7a76; }
.status-closed { background: var(--success); color: #fff; }
.status-late { background: var(--danger-light); color: var(--danger); }
.badge-on { background: var(--primary-light); color: var(--primary); }
.badge-off { background: var(--gray-200); color: var(--dark-75); }
.badge-warn { background: var(--warning-light); color: #b57600; }
.leave-pending { background: var(--warning-light); color: #b57600; }
.leave-approved { background: var(--success-light); color: #0b7a76; }
.leave-rejected { background: var(--danger-light); color: var(--danger); }
.leave-cancelled { background: var(--gray-200); color: var(--muted); }

/* ---- التبويبات والترقيم ---- */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-block-end: 1px solid var(--line); margin-block-end: 1.2rem; }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--muted); font-weight: 500; border-block-end: 2px solid transparent; }
.tabs a:hover { color: var(--primary); text-decoration: none; }
.tabs a.is-active { color: var(--primary); border-block-end-color: var(--primary); }
.pagination { display: flex; gap: .8rem; align-items: center; justify-content: center; margin-block-start: 1rem; }
dl.props { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.4rem; margin: 0; }
dl.props dt { color: var(--muted); font-weight: 500; } dl.props dd { margin: 0; color: var(--dark-75); }

/* ---- مربع الحوار ---- */
.dialog { border: 0; border-radius: var(--radius-lg); padding: 1.5rem 1.7rem; max-width: 460px; width: calc(100% - 2rem); font-family: var(--font); box-shadow: 0 0 50px 0 rgba(82,63,105,.15); color: var(--text); }
.dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-block-start: 1.2rem; }
.dialog textarea { width: 100%; font: inherit; padding: .55rem .9rem; border: 1px solid var(--gray-100); border-radius: var(--radius); background: var(--gray-100); }

/* ---- صفحة الدخول ---- */
body.guest { display: flex; min-height: 100vh; background: var(--surface); }
.guest-hero { flex: 1; background: linear-gradient(160deg, #1E1E2D 0%, #2b2b45 60%, #3699FF 160%); color: #fff; display: flex; align-items: center; justify-content: center; padding: 3rem; }
.guest-hero-inner { max-width: 420px; text-align: center; }
.guest-hero h1 { color: #fff; font-size: 1.8rem; margin-block-start: 1rem; }
.guest-hero p { color: rgba(255,255,255,.7); }
.guest-main { width: 100%; max-width: 480px; padding: 2rem; display: flex; align-items: center; }
.guest-card { width: 100%; padding: 1rem; }
.brand-title { font-size: 1.3rem; font-weight: 700; color: var(--dark); margin-block-end: 1.5rem; }
.guest-card h2 { font-size: 1.05rem; color: var(--muted); font-weight: 500; }
.guest-card .field { margin-block-end: 1rem; }
.guest-card .btn-primary { width: 100%; padding: .75rem; font-size: 1rem; }
.error-page { text-align: center; padding: 3rem 1rem; }
.error-page .code { font-size: 3.5rem; font-weight: 700; color: var(--gray-400); font-family: "Open Sans", sans-serif; }

/* ---- التقرير الشهري ---- */
.report-meta { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-block-end: 1rem; }
.tools-bar { align-items: flex-end; }
.entry-grid table.entries { font-size: .92rem; }
.entry-grid th, .entry-grid td { padding: .35rem .4rem; }
.entry-grid input, .entry-grid select { min-height: 2.2rem; padding: .3rem .5rem; font-size: .92rem; }
.entry-grid .col-date { white-space: nowrap; min-width: 6.5rem; color: var(--dark); }
.entry-grid .col-activity select { min-width: 11rem; }
.entry-grid .col-details input { min-width: 12rem; }
.entry-grid .col-site input { min-width: 7rem; }
.entry-grid .col-from input, .entry-grid .col-to input { min-width: 6.2rem; }
.entry-grid .col-hours input, .entry-grid .col-early input { width: 4.8rem; }
.entry-grid .col-notes input { min-width: 9rem; }
.entry-grid tbody tr:hover td { background: transparent; }
.entry-grid tr.row-weekly_off td, .entry-grid tr.row-not_scheduled td, .entry-grid tr.row-absent td, .entry-grid tr.row-holiday td, .entry-grid tr.row-leave td { background: var(--gray-100); color: var(--muted); }
.entry-grid tr.row-holiday td { background: var(--primary-light); }
.entry-grid tr.row-leave td { background: var(--warning-light); }
.entry-grid tr.row-absent td { background: var(--danger-light); }
.entry-grid tr.is-incomplete .col-date::after { content: " ●"; color: var(--warning); }
.entry-grid input.has-error, .entry-grid select.has-error { border-color: var(--danger); background: var(--danger-light); }
.row-errors { font-size: .8rem; max-width: 14rem; }
.row-errors.warn { color: #b57600; }
.split summary { list-style: none; cursor: pointer; }
.split summary::-webkit-details-marker { display: none; }
.split-body { display: flex; flex-direction: column; gap: .3rem; margin-block-start: .4rem; min-width: 10rem; }
.split-body label { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.split-body label span { min-width: 5rem; font-family: "Open Sans", sans-serif; direction: ltr; }
.split-body input { width: 5rem; }
.split-sum { font-family: "Open Sans", sans-serif; }
.split-sum.is-mismatch { color: var(--danger); font-weight: 700; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .5rem 1rem; }
.summary-item { display: flex; justify-content: space-between; gap: .5rem; border-block-end: 1px dashed var(--line); padding: .3rem 0; }
.summary-item strong { color: var(--dark); font-family: "Open Sans", sans-serif; }
.summary-leaves, .summary-projects { margin-block-start: .7rem; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.ach-lines { display: flex; flex-direction: column; gap: .4rem; margin-block-end: .5rem; }
.ach-col ol { padding-inline-start: 1.2rem; margin: 0; }
.rating-box { margin-block-start: .9rem; padding: .6rem .9rem; background: var(--success-light); border-radius: var(--radius); }
.error-list { margin: .3rem 0 0; padding-inline-start: 1.2rem; }
.action-bar { position: sticky; bottom: 0; display: flex; gap: .6rem; flex-wrap: wrap; padding: .8rem 1.2rem; background: var(--surface); border-radius: var(--radius); box-shadow: 0 -5px 30px rgba(82,63,105,.1); z-index: 20; }
.people { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; max-height: 14rem; overflow: auto; }
.split { display: flex; gap: 1rem; flex-wrap: wrap; margin-block-end: .3rem; }
.split .late { color: var(--danger); }
.js-only { display: none; }
.js-only:not([hidden]) { display: inline-flex; }

/* ---- ملف الموظف وصفحة المشروع ---- */
.profile-head { display: flex; align-items: center; gap: 1rem; }
.avatar-lg { inline-size: 64px; block-size: 64px; font-size: 1.6rem; border-radius: var(--radius-lg); }
.avatar-photo { inline-size: 64px; block-size: 64px; border-radius: var(--radius-lg); object-fit: cover; border: 2px solid var(--gray-200); }
.timeline { list-style: none; margin: 0 0 1rem; padding: 0 1.2rem 0 0; border-inline-start: 2px solid var(--gray-300); }
.timeline li { position: relative; padding: .3rem 0 .8rem; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -1.45rem; top: .7rem; inline-size: .7rem; block-size: .7rem; border-radius: 50%; background: var(--primary); }
.timeline-head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.progress { block-size: .6rem; background: var(--gray-200); border-radius: 999px; overflow: hidden; margin-block: .6rem .3rem; }
.progress-bar { display: block; block-size: 100%; background: var(--primary); border-radius: 999px; }
.w-0 { width: 0; } .w-5 { width: 5%; } .w-10 { width: 10%; } .w-15 { width: 15%; } .w-20 { width: 20%; } .w-25 { width: 25%; } .w-30 { width: 30%; } .w-35 { width: 35%; } .w-40 { width: 40%; } .w-45 { width: 45%; } .w-50 { width: 50%; }
.w-55 { width: 55%; } .w-60 { width: 60%; } .w-65 { width: 65%; } .w-70 { width: 70%; } .w-75 { width: 75%; } .w-80 { width: 80%; } .w-85 { width: 85%; } .w-90 { width: 90%; } .w-95 { width: 95%; } .w-100 { width: 100%; }

/* ---- الإجازات والتقويم ---- */
.cancel-approved input { width: 12rem; min-height: 2.2rem; display: inline-block; }
.legend { display: flex; gap: .6rem 1.2rem; align-items: center; flex-wrap: wrap; margin-block-end: .8rem; color: var(--muted); font-size: .9rem; }
.cal-cell { display: inline-block; inline-size: 1.1rem; block-size: 1.1rem; border-radius: 4px; vertical-align: middle; border: 1px solid var(--gray-300); }
table.calendar th.cal-day, table.calendar td.cal-day { padding: .25rem .1rem; min-width: 1.7rem; text-align: center; font-size: .8rem; font-family: "Open Sans", sans-serif; }
.cal-approved { background: var(--success-light); color: #0b7a76; }
.cal-pending { background: var(--warning-light); color: #b57600; }
.cal-holiday { background: var(--primary-light); }
.cal-off { background: var(--gray-200); }
table.bulk input { width: 5rem; min-height: 2.2rem; padding: .25rem .4rem; }

/* ---- الهاتف ---- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 1rem; padding-block-end: 5rem; }
  .topbar { padding: .6rem 1rem; }
  .topbar-title { display: none; }
  .user-meta { display: none; }
  .bottombar { display: flex; position: fixed; inset-inline: 0; bottom: 0; background: var(--aside-bg); z-index: 50; box-shadow: 0 -4px 20px rgba(0,0,0,.2); }
  .bottombar a, .bottombar span { flex: 1; text-align: center; padding: .75rem .3rem; color: var(--aside-text); text-decoration: none; font-size: .82rem; font-weight: 500; }
  .bottombar .is-disabled { opacity: .4; }
  .form-grid { grid-template-columns: 1fr; }
  .guest-hero { display: none; }
  .guest-main { max-width: none; }
  .entry-grid table.entries, .entry-grid thead, .entry-grid tbody, .entry-grid tr, .entry-grid td { display: block; }
  .entry-grid thead { display: none; }
  .entry-grid tr[data-entry-row] { border: 1px solid var(--line); border-radius: var(--radius); margin-block-end: .8rem; padding: .6rem .7rem; background: var(--surface); }
  .entry-grid td { border: 0; padding: .3rem 0; display: grid; grid-template-columns: 7rem 1fr; align-items: center; gap: .4rem; }
  .entry-grid td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; }
  .entry-grid td.col-actions::before { content: ""; }
  .entry-grid td.col-date { grid-template-columns: 1fr; font-size: 1.05rem; }
  .entry-grid td.col-date::before { content: none; }
  .entry-grid input, .entry-grid select { width: 100%; min-width: 0; }
  .entry-grid tr.is-incomplete { border-color: var(--warning); }
  .action-bar { position: fixed; inset-inline: 0; bottom: 3.2rem; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .sidebar, .topbar, .bottombar, .btn, .filter-bar, .pagination, .app-footer { display: none !important; } .content { padding: 0; } .card { box-shadow: none; } }

/* ---- لوحة التحكم: محدد الشهر، مؤشرات KPI، تنبيهات، رسوم SVG ---- */
.month-nav { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.month-nav select { width: auto; min-height: 2.3rem; padding-block: .3rem; }
.month-nav .is-disabled { opacity: .4; pointer-events: none; }
.section-title { display: flex; align-items: center; gap: .6rem; margin: 1.8rem 0 .9rem; font-size: 1.05rem; }
.dash-section:first-of-type .section-title { margin-block-start: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1.2rem; margin-block-end: 1.4rem; }
.kpi { display: flex; flex-direction: column; gap: .15rem; padding: 1.2rem 1.4rem; border-radius: var(--radius); color: #fff; box-shadow: var(--shadow); text-decoration: none; min-height: 122px; }
.kpi:hover { text-decoration: none; color: #fff; filter: brightness(1.04); }
.kpi-primary { background: var(--primary); } .kpi-success { background: var(--success); } .kpi-warning { background: var(--warning); }
.kpi-danger { background: var(--danger); } .kpi-info { background: var(--info); } .kpi-dark { background: var(--dark-75); }
.kpi-light { background: var(--surface); color: var(--dark); } .kpi-light:hover { color: var(--dark); }
.kpi-label { font-size: .9rem; opacity: .92; font-weight: 500; }
.kpi-value { font-size: 2rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-value.kpi-text { font-size: 1.35rem; }
.kpi-sub { font-size: .8rem; opacity: .88; }
.kpi-foot { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-block-start: auto; padding-block-start: .4rem; font-size: .8rem; }
.kpi-delta { display: inline-flex; align-items: center; gap: .2rem; padding: .1rem .55rem; border-radius: 999px; background: rgba(255,255,255,.25); font-weight: 600; }
.kpi-delta.is-good { background: rgba(255,255,255,.92); color: #0b7a76; }
.kpi-delta.is-bad { background: rgba(255,255,255,.92); color: var(--danger); }
.kpi-delta.is-none { background: transparent; opacity: .85; font-weight: 400; padding-inline: 0; }
.kpi-light .kpi-delta { background: var(--gray-100); color: var(--dark-75); }
.kpi-light .kpi-delta.is-good { background: var(--success-light); color: #0b7a76; }
.kpi-light .kpi-delta.is-bad { background: var(--danger-light); color: var(--danger); }
.kpi-prev { opacity: .88; }
.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.alert-list a { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: var(--radius); background: var(--gray-100); color: var(--dark-75); font-weight: 500; }
.alert-list a:hover { text-decoration: none; background: var(--gray-200); color: var(--dark); }
.alert-count { display: inline-flex; min-width: 2rem; justify-content: center; padding: .1rem .5rem; border-radius: 999px; font-weight: 700; }
.tone-danger .alert-count { background: var(--danger-light); color: var(--danger); }
.tone-warning .alert-count { background: var(--warning-light); color: #b57600; }
.tone-primary .alert-count { background: var(--primary-light); color: var(--primary); }
.tone-info .alert-count { background: var(--info-light); color: var(--info); }
.alert-ok { display: flex; align-items: center; gap: .5rem; color: #0b7a76; background: var(--success-light); padding: .6rem .9rem; border-radius: var(--radius); margin: 0; font-weight: 500; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.4rem; margin-block-end: 1.4rem; }
.chart-grid .card { margin-block-end: 0; display: flex; flex-direction: column; }
.chart { width: 100%; height: auto; display: block; font-family: var(--font); }
.chart-ring { max-width: 190px; margin-inline: auto; }
.ring-row { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.ring-row .chart-ring { flex: 0 0 170px; }
.chart-legend { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; flex: 1; min-width: 150px; }
.chart-legend li, .chart-legend li a { display: flex; align-items: center; gap: .5rem; color: var(--dark-75); }
.chart-legend li a { flex: 1; } .chart-legend li a:hover { text-decoration: none; color: var(--primary); }
.legend-value { margin-inline-start: auto; color: var(--dark); }
.dot { inline-size: .7rem; block-size: .7rem; flex-shrink: 0; }
.chart-foot { margin-block-start: auto; padding-block-start: .7rem; font-size: .85rem; color: var(--muted); display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; align-items: center; }
.hbar { width: 100%; height: .6rem; display: block; margin-block: .35rem .2rem; }
.bal-list { display: flex; flex-direction: column; gap: .7rem; }
.bal-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; flex-wrap: wrap; }
.avatar-sm { inline-size: 34px; block-size: 34px; font-size: .95rem; border-radius: var(--radius); object-fit: cover; }
.team-cell { display: flex; align-items: center; gap: .6rem; }
.team-cell .muted { font-size: .8rem; }
.mini-stats { display: flex; gap: .8rem; flex-wrap: wrap; }
.mini-stat { display: flex; flex-direction: column; padding: .6rem .9rem; background: var(--gray-100); border-radius: var(--radius); min-width: 120px; color: var(--dark-75); }
.mini-stat:hover { text-decoration: none; background: var(--gray-200); }
.mini-stat strong { font-size: 1.3rem; color: var(--dark); }
@media (max-width: 768px) { .chart-grid { grid-template-columns: 1fr; } .ring-row { justify-content: center; } .kpi-value { font-size: 1.6rem; } }


/* ---- المرحلة 5: الجرس والتنبيهات، تقويم الشهر ---- */
.bell { position: relative; }
.bell-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px; border: 0; border-radius: var(--radius); background: var(--gray-100); color: var(--dark-75); cursor: pointer; font-size: 1.15rem; }
.bell-btn:hover { background: var(--gray-200); }
.bell-count { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 1.2rem; padding: 0 .3rem; border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.2rem; text-align: center; }
.bell-menu { position: absolute; top: calc(100% + .5rem); inset-inline-end: 0; width: min(360px, 92vw); background: var(--surface); border-radius: var(--radius); box-shadow: 0 0 50px 0 rgba(82,63,105,.15); padding: .8rem 1rem; z-index: 60; }
.bell-head { display: flex; justify-content: space-between; align-items: center; margin-block-end: .5rem; }
.ntf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.ntf-item { border-radius: var(--radius); background: var(--gray-100); }
.ntf-item.is-unread { background: var(--primary-light); }
.ntf-form { margin: 0; }
.ntf-link { display: flex; flex-direction: column; gap: .15rem; width: 100%; text-align: start; padding: .55rem .8rem; border: 0; background: transparent; color: var(--dark-75); font: inherit; cursor: pointer; }
.ntf-link:hover { color: var(--primary); }
.ntf-item.is-unread .ntf-text { font-weight: 600; color: var(--dark); }
.ntf-time { font-size: .78rem; }
.ntf-comment { font-size: .85rem; }
.ntf-list-sm .ntf-link { padding: .4rem .6rem; font-size: .9rem; }
.month-cal-wrap summary { cursor: pointer; font-weight: 600; color: var(--dark); list-style: none; }
.month-cal-wrap summary::-webkit-details-marker { display: none; }
.month-cal-wrap summary::before { content: "▾ "; color: var(--primary); }
.month-cal-wrap:not([open]) summary::before { content: "◂ "; }
.month-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; margin-block: .8rem .6rem; }
.cal-head { text-align: center; font-size: .8rem; color: var(--muted); font-weight: 600; padding-block: .2rem; }
.cal-day { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 3.2rem; border-radius: var(--radius); border: 1px solid transparent; color: var(--dark-75); text-decoration: none; background: var(--gray-100); }
.cal-day:hover { text-decoration: none; border-color: var(--primary); }
.cal-num { font-weight: 700; }
.cal-hours { font-size: .75rem; color: var(--muted); }
.cal-work { background: var(--success-light); }
.cal-field { background: var(--primary-light); }
.cal-incomplete { border-color: var(--warning); background: var(--warning-light); }
.cal-leave { background: var(--warning-light); }
.cal-absent { background: var(--danger-light); }
.cal-holiday { background: var(--info-light); }
.cal-weekly_off { background: var(--gray-200); color: var(--muted); } .cal-not_scheduled { background: var(--gray-100); color: var(--muted); border: 1px dashed var(--gray-300); }
.cal-empty { min-height: 3.2rem; }
.legend i.cal-cell { display: inline-block; }
@media (max-width: 768px) { .cal-day { min-height: 2.6rem; } .cal-hours { display: none; } .bell-menu { inset-inline-end: -3rem; } }

/* المرحلة 7: الفترة الثانية وأدوات السطر وزر الحفظ */
.entry-grid .p2 { display: block; margin-block-start: .25rem; }
.entry-grid .p2[hidden] { display: none; }
.entry-grid .col-actions { white-space: normal; min-width: 9rem; }
.row-tools { display: flex; gap: .2rem; flex-wrap: wrap; margin-block-start: .25rem; }
.row-tools .btn, [data-p2-toggle] { padding-inline: .45rem; }
.grid-actions { justify-content: flex-start; margin-block: .6rem; }
.tools-bar .hint { flex-basis: 100%; }

/* الرسائل الداخلية (D7-05) */
.nav-badge { margin-inline-start: auto; background: var(--danger); color: #fff; border-radius: 999px; padding: 0 .5rem; font-size: .75rem; font-weight: 700; line-height: 1.4rem; }
.msg-list { list-style: none; margin: 0; padding: 0; }
.msg-item { border-block-end: 1px solid var(--line); }
.msg-item.is-unread { border-inline-start: 3px solid var(--primary); }
.msg-item.is-unread .msg-subject { font-weight: 700; }
.msg-link { display: grid; gap: .15rem; padding: .7rem .6rem; color: inherit; text-decoration: none; }
.msg-link:hover { background: var(--gray-100); text-decoration: none; }
.msg-preview, .msg-meta { font-size: .85rem; }
.msg-card.is-mine { border-inline-start: 3px solid var(--primary); }
.msg-head { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: baseline; margin-block-end: .6rem; }
.msg-body { white-space: pre-wrap; line-height: 1.7; }
.pagination { display: flex; gap: .6rem; align-items: center; justify-content: center; margin-block-start: .8rem; }

/* صفحة الإجازات (D7-07): شرائح الحالة، بطاقات قابلة للطي، شريط التقدم بعرض ثابت */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-block: .6rem .9rem; }
.chip { display: inline-block; padding: .25rem .8rem; border-radius: 999px; background: var(--gray-100); color: var(--muted); text-decoration: none; font-size: .88rem; border: 1px solid var(--line); }
.chip:hover { color: var(--primary); text-decoration: none; }
.chip.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { display: inline-flex; align-items: center; gap: .5rem; margin: 0; }
details.card > summary h2::before { content: "▸"; font-size: .9em; color: var(--primary); transition: transform .15s; }
details.card[open] > summary h2::before { transform: rotate(90deg); }
details.card[open] > summary { margin-block-end: 1rem; }
.stat-unit { font-size: .95rem; font-weight: 500; }
.progress-w0 { inline-size: 0; } .progress-w5 { inline-size: 5%; } .progress-w10 { inline-size: 10%; } .progress-w15 { inline-size: 15%; } .progress-w20 { inline-size: 20%; }
.progress-w25 { inline-size: 25%; } .progress-w30 { inline-size: 30%; } .progress-w35 { inline-size: 35%; } .progress-w40 { inline-size: 40%; } .progress-w45 { inline-size: 45%; }
.progress-w50 { inline-size: 50%; } .progress-w55 { inline-size: 55%; } .progress-w60 { inline-size: 60%; } .progress-w65 { inline-size: 65%; } .progress-w70 { inline-size: 70%; }
.progress-w75 { inline-size: 75%; } .progress-w80 { inline-size: 80%; } .progress-w85 { inline-size: 85%; } .progress-w90 { inline-size: 90%; } .progress-w95 { inline-size: 95%; } .progress-w100 { inline-size: 100%; }

/* ملف الموظف (D8-01): المهارات كوسوم */
.tag-list { list-style: none; margin: 0 0 .8rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .7rem; border-radius: 999px; background: var(--gray-100); border: 1px solid var(--line); font-size: .9rem; }
.tag-x { background: none; border: 0; color: var(--danger); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .1rem; }

/* المشاريع (D8-02) */
.w-progress { width: 5rem; }
tr.ms-done td { background: var(--primary-light); }
tr.ms-in_progress td { background: var(--warning-light); }

/* الرواتب (D8-03) */
tr.pay-lines td { background: var(--gray-100); padding-block: .4rem; }
.pay-line-form { margin-block-start: .4rem; }
.pay-lines .badge form { display: inline; }

/* التوقيع الإلكتروني (D10-02) */
.signature-preview { max-height: 80px; max-width: 240px; border: 1px solid var(--gray-200); border-radius: 6px; background: #fff; padding: 4px; }

/* عنوان الشهر في صفحة التقارير والتصدير */
.month-head { margin-block-start: .35rem; }
.month-head-label { display: block; font-size: .85rem; color: var(--gray-600); }
.month-head-name { display: block; font-size: 1.45rem; font-weight: 700; line-height: 1.3; }
