/* المهام (tasks) — docs/features/tasks.md
   Plain CSS on purpose (like hr-modules.css) so the pages render without `npm run css:build`.
   Classes are prefixed ht-. Colors come from the HR design system; navy/gold follow the Tweaks vars. */
:root {
  --ht-surface: #f4f6fa;
  --ht-raised: #ffffff;
  --ht-sunken: #eef1f6;
  --ht-border: #e1e5ed;
  --ht-border-strong: #8a93a5;
  --ht-ink: #111a2e;
  --ht-ink-muted: #566077;
  --ht-ink-subtle: #5f687d;
  --ht-navy: var(--hr-primary, #16233f);
  --ht-navy-hover: #22335a;
  --ht-navy-soft: #e9edf6;
  --ht-gold: var(--hr-accent, #c29b3c);
  --ht-gold-soft: #f7f0dd;
  --ht-gold-ink: #6f520f;
  --ht-accent: #2c57cc;
  --ht-accent-soft: #e8eefc;
  --ht-excel: #1a7248;
  --ht-excel-soft: #e5f3eb;
  --ht-pdf: #b3261e;
  --ht-pdf-soft: #fcebe9;
  --ht-warning: #9a5b06;
  --ht-warning-soft: #fdf3e2;
  --ht-radius-sm: 8px;
  --ht-radius-md: 12px;
  --ht-radius-lg: 16px;
  --ht-shadow-card: 0 1px 2px rgba(17,26,46,.06), 0 1px 3px rgba(17,26,46,.04);
  --ht-shadow-float: 0 12px 32px rgba(17,26,46,.18);
  --ht-mono: Consolas, "Courier New", monospace;
}

.ht-page { color: var(--ht-ink); font-size: 14px; line-height: 22px; display: flex; flex-direction: column; gap: 24px; }
.ht-page *, .ht-page *::before, .ht-page *::after { box-sizing: border-box; }
.ht-page a { text-decoration: none; }

/* ---------- العناوين ---------- */
.ht-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.ht-title { margin: 0; font-size: 26px; line-height: 36px; font-weight: 700; color: var(--ht-ink); }
.ht-sub { margin: 4px 0 0; color: var(--ht-ink-muted); }
.ht-crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ht-ink-muted); margin-bottom: 4px; }
.ht-crumbs a { color: var(--ht-ink-muted); }
.ht-crumbs a:hover { color: var(--ht-accent); }
.ht-crumbs b { color: var(--ht-ink); font-weight: 600; }

/* ---------- الأزرار ---------- */
.ht-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--ht-radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid transparent; white-space: nowrap; transition: background .15s, border-color .15s; }
.ht-btn-primary { background: var(--ht-navy); color: #fff !important; }
.ht-btn-primary:hover { background: var(--ht-navy-hover); }
.ht-btn-secondary { background: #fff; color: var(--ht-ink) !important; border-color: var(--ht-border); }
.ht-btn-secondary:hover { background: var(--ht-sunken); }
.ht-btn-success { background: var(--ht-excel); color: #fff !important; }
.ht-btn-success:hover { background: #155e3b; }
.ht-btn-warning { background: var(--ht-warning-soft); color: var(--ht-warning) !important; border-color: #f0d9b0; }
.ht-btn-warning:hover { background: #fbe9c9; }
.ht-btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.ht-btn:focus-visible, .ht-input:focus, .ht-chip:focus-visible, .ht-seg-btn:focus-visible, .ht-card:focus-visible { outline: 2px solid var(--ht-accent); outline-offset: 2px; }
.ht-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--ht-radius-sm); border: 1px solid var(--ht-border); background: #fff; color: var(--ht-ink-muted); cursor: pointer; }
.ht-icon-btn:hover { background: var(--ht-sunken); color: var(--ht-ink); }

/* ---------- البحث والحقول ---------- */
.ht-search { display: flex; align-items: center; gap: 8px; min-height: 44px; width: 300px; max-width: 100%; padding: 0 12px; background: #fff; border: 1px solid var(--ht-border-strong); border-radius: var(--ht-radius-sm); color: var(--ht-ink-subtle); }
.ht-search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: 14px; color: var(--ht-ink); }
.ht-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #3d465a; margin-bottom: 6px; }
.ht-req { color: var(--ht-pdf); }
.ht-input { width: 100%; min-height: 44px; border: 1px solid var(--ht-border-strong); border-radius: var(--ht-radius-sm); padding: 0 12px; background: #fff; color: var(--ht-ink); font-size: 14px; }
select.ht-input { padding-left: 8px; }
.ht-hint { font-size: 12.5px; color: var(--ht-ink-subtle); margin: 6px 0 0; }
.ht-error { font-size: 12.5px; color: var(--ht-pdf); margin-top: 4px; display: block; }

/* ---------- شرائح الأقسام ---------- */
.ht-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ht-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--ht-border); border-radius: 999px; background: #fff; color: var(--ht-ink) !important; font-size: 13.5px; font-weight: 600; }
.ht-chip:hover { border-color: var(--ht-border-strong); }
.ht-chip.is-on { background: var(--ht-navy); border-color: var(--ht-navy); color: #fff !important; }
.ht-chip.is-on .ht-count { background: rgba(255,255,255,.18); color: #fff; }
.ht-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.ht-count { font-size: 11.5px; font-weight: 700; background: var(--ht-border); color: var(--ht-ink-muted); border-radius: 999px; padding: 1px 7px; line-height: 18px; }

/* ---------- الملخص ---------- */
.ht-stats { display: flex; flex-wrap: wrap; gap: 16px; }
.ht-stat { flex: 1 1 160px; background: #fff; border: 1px solid var(--ht-border); border-bottom: 3px solid var(--ht-gold); border-radius: var(--ht-radius-lg); padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.ht-stat span { font-size: 12px; font-weight: 600; color: var(--ht-ink-subtle); }
.ht-stat b { font-size: 22px; line-height: 28px; font-weight: 700; }

/* ---------- الفلاتر ---------- */
.ht-filters { background: #fff; border: 1px solid var(--ht-border); border-radius: var(--ht-radius-lg); padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--ht-shadow-card); }
.ht-filters-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.ht-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 170px; min-width: 0; }
.ht-field > span { font-size: 12px; font-weight: 600; color: var(--ht-ink-subtle); }
.ht-field .ht-input { min-height: 42px; }
.ht-seg { display: inline-flex; flex-wrap: wrap; padding: 4px; gap: 4px; background: var(--ht-sunken); border-radius: 10px; }
.ht-seg-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 7px; color: var(--ht-ink-muted) !important; font-size: 13.5px; font-weight: 600; }
.ht-seg-btn:hover { color: var(--ht-ink) !important; }
.ht-seg-btn.is-on { background: #fff; color: var(--ht-ink) !important; box-shadow: 0 1px 2px rgba(17,26,46,.1); }
.ht-seg-btn.is-on .ht-count { background: var(--ht-navy); color: #fff; }

/* ---------- اللوحة ---------- */
.ht-board-wrap { overflow-x: auto; padding-bottom: 4px; }
.ht-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; min-width: 900px; align-items: start; }
.ht-col { background: var(--ht-sunken); border-radius: var(--ht-radius-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ht-col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 6px; }
.ht-col-head h2 { margin: 0; font-size: 14px; line-height: 22px; font-weight: 700; }
.ht-empty-col { margin: 0; padding: 20px 8px; text-align: center; color: var(--ht-ink-subtle); font-size: 13px; }
.st-pending { background: var(--ht-border-strong); }
.st-progress { background: var(--ht-accent); }
.st-done { background: var(--ht-excel); }

.ht-card { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid var(--ht-border); border-radius: var(--ht-radius-md); padding: 14px; color: var(--ht-ink) !important; box-shadow: var(--ht-shadow-card); transition: border-color .15s, box-shadow .15s; }
.ht-card:hover { border-color: var(--ht-border-strong); }
.ht-card.is-late { border-color: #efb7b1; }
.ht-card.is-open { border-color: var(--ht-accent); box-shadow: 0 0 0 3px var(--ht-accent-soft); }
.ht-card.is-done .ht-card-title { color: var(--ht-ink-muted); text-decoration: line-through; }
.ht-card-title { font-size: 14.5px; font-weight: 600; line-height: 22px; }
.ht-card-desc { font-size: 13px; color: var(--ht-ink-muted); line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ht-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--ht-sunken); padding-top: 10px; }
.ht-row { display: flex; align-items: center; gap: 8px; }
.ht-row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.ht-tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--ht-sunken); color: #3d465a; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ht-tag .ht-dot { width: 7px; height: 7px; }
.ht-late { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--ht-pdf-soft); color: var(--ht-pdf); font-size: 12px; font-weight: 700; white-space: nowrap; }
.ht-meta { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ht-ink-muted); white-space: nowrap; }
.ht-meta.is-late { color: var(--ht-pdf); font-weight: 600; }
.ht-meta i { font-size: 12px; }
.ht-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--ht-navy-soft); color: var(--ht-navy); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; border: 2px solid #fff; }
.ht-avatar.is-more { background: var(--ht-navy); color: #fff; }
.ht-avatar.is-gold { background: var(--ht-gold-soft); color: var(--ht-gold-ink); }
.ht-stack { display: inline-flex; }
.ht-stack .ht-avatar + .ht-avatar { margin-inline-start: -8px; }
.ht-page { max-width: 1440px; margin: 0 auto; }
.ht-by { font-size: 12px; color: var(--ht-ink-subtle); }
.ht-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ht-ink); white-space: nowrap; }

/* ---------- الجدول ---------- */
.ht-table-card { background: #fff; border: 1px solid var(--ht-border); border-radius: var(--ht-radius-lg); overflow: hidden; }
.ht-table-scroll { overflow-x: auto; }
.ht-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 1040px; }
.ht-table th { background: var(--ht-navy); color: #fff; font-weight: 600; text-align: right; padding: 12px 14px; border-bottom: 3px solid var(--ht-gold); white-space: nowrap; }
.ht-table td { padding: 12px 14px; border-bottom: 1px solid var(--ht-border); vertical-align: middle; color: var(--ht-ink); }
.ht-table tr:nth-child(even) td { background: #f8f9fc; }
.ht-table tr.is-open td { background: var(--ht-accent-soft); }
.ht-table a.ht-tlink { font-weight: 600; color: var(--ht-ink); }
.ht-table a.ht-tlink:hover { color: var(--ht-accent); text-decoration: underline; }
.ht-table-foot { padding: 12px 16px; border-top: 1px solid var(--ht-border); color: var(--ht-ink-muted); font-size: 13px; }

/* ---------- الحالة الفارغة ---------- */
.ht-empty { text-align: center; padding: 56px 16px; background: #fff; border: 1px dashed var(--ht-border-strong); border-radius: var(--ht-radius-lg); color: var(--ht-ink-muted); }
.ht-empty i { font-size: 40px; color: var(--ht-border-strong); margin-bottom: 12px; }
.ht-empty p { margin: 0 0 16px; }

/* ---------- لوحة التفاصيل ---------- */
.ht-drawer-backdrop { position: fixed; inset: 0; background: rgba(17,26,46,.28); z-index: 40; }
.ht-drawer { position: fixed; top: 16px; inset-inline-end: 16px; bottom: 16px; width: 460px; max-width: calc(100% - 32px); background: #fff; border: 1px solid var(--ht-border); border-radius: var(--ht-radius-lg); box-shadow: var(--ht-shadow-float); display: flex; flex-direction: column; overflow: hidden; z-index: 50; }
.ht-panel { background: #fff; border: 1px solid var(--ht-border); border-radius: var(--ht-radius-lg); box-shadow: var(--ht-shadow-card); display: flex; flex-direction: column; overflow: hidden; max-width: 760px; }
.ht-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--ht-border); }
.ht-panel-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 22px; }
.ht-panel-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--ht-border); }
.ht-panel-foot form { display: contents; }
.ht-panel-foot .ht-btn { flex: 1 1 auto; }
.ht-panel h2 { margin: 0; font-size: 20px; line-height: 30px; font-weight: 700; }
.ht-sec { display: flex; flex-direction: column; gap: 10px; }
.ht-sec-title { margin: 0; font-size: 14px; line-height: 22px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.ht-kv-box { display: flex; flex-direction: column; gap: 10px; background: var(--ht-surface); border-radius: var(--ht-radius-md); padding: 14px 16px; }
.ht-kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.ht-kv > span { color: var(--ht-ink-muted); font-size: 12.5px; }
.ht-kv > b { font-weight: 600; }
.ht-person { display: flex; align-items: center; gap: 10px; }
.ht-person b { display: block; font-weight: 600; font-size: 13.5px; }
.ht-person small { display: block; font-size: 12px; color: var(--ht-ink-subtle); font-family: var(--ht-mono); }
.ht-cc { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 4px; border-radius: 999px; background: var(--ht-gold-soft); color: var(--ht-gold-ink); font-size: 13px; font-weight: 600; }
.ht-cc .ht-avatar { width: 22px; height: 22px; font-size: 11px; border: 0; background: #fff; }
.ht-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--ht-border); border-radius: 10px; color: var(--ht-ink) !important; }
.ht-file:hover { border-color: var(--ht-accent); background: #f5f8ff; }
.ht-file-name { display: block; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-file-size { font-size: 12px; color: var(--ht-ink-subtle); }
.ht-ext { width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; flex: none; font-family: var(--ht-mono); }
.x-pdf { background: var(--ht-pdf-soft); color: var(--ht-pdf); }
.x-xls { background: var(--ht-excel-soft); color: var(--ht-excel); }
.x-doc { background: var(--ht-accent-soft); color: var(--ht-accent); }
.x-img { background: #f1ecfb; color: #6b4bc4; }
.x-zip { background: var(--ht-warning-soft); color: var(--ht-warning); }
.x-file { background: var(--ht-sunken); color: var(--ht-ink-muted); }
.ht-readonly { margin: 0; flex: 1; color: var(--ht-ink-muted); font-size: 13px; align-self: center; }

/* ---------- نموذج الإضافة ---------- */
.ht-form-wrap { max-width: 880px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.ht-form-card { background: #fff; border: 1px solid var(--ht-border); border-radius: var(--ht-radius-lg); padding: 24px; display: flex; flex-direction: column; gap: 18px; box-shadow: var(--ht-shadow-card); }
.ht-step { display: flex; align-items: center; gap: 12px; }
.ht-step-num { width: 30px; height: 30px; border-radius: 50%; background: var(--ht-navy); color: #fff; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ht-step h2 { margin: 0; font-size: 17px; line-height: 26px; font-weight: 700; }
.ht-grid-3 { display: flex; flex-wrap: wrap; gap: 16px; }
.ht-grid-3 > * { flex: 1 1 200px; min-width: 0; }
.ht-option { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--ht-border); border-radius: var(--ht-radius-md); cursor: pointer; }
.ht-option.is-on { border-color: var(--ht-accent); background: #f5f8ff; }
.ht-option input[type=checkbox] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ht-accent); }
.ht-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px; border: 2px dashed var(--ht-border-strong); border-radius: var(--ht-radius-md); background: var(--ht-surface); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.ht-drop:hover, .ht-drop.is-drag { border-color: var(--ht-accent); background: #f5f8ff; }
.ht-drop i { font-size: 30px; color: var(--ht-ink-muted); }
.ht-file-del { width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--ht-ink-subtle); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ht-file-del:hover { background: var(--ht-pdf-soft); color: var(--ht-pdf); }
.ht-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.ht-actions .ht-btn-primary { flex: 1 1 280px; }

/* employee picker (assignees / CC) */
.ht-picker { border: 1px solid var(--ht-border-strong); border-radius: var(--ht-radius-sm); background: #fff; }
.ht-picker-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-bottom: 1px solid var(--ht-border); min-height: 46px; align-items: center; }
.ht-picker-chips:empty::before { content: attr(data-empty); color: var(--ht-ink-subtle); font-size: 13px; }
.ht-pchip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 12px; border-radius: 999px; background: var(--ht-accent-soft); color: #1f3f99; font-size: 13px; font-weight: 600; }
[dir=ltr] .ht-pchip { padding: 0 12px 0 4px; }
.ht-picker.is-cc .ht-pchip { background: var(--ht-gold-soft); color: var(--ht-gold-ink); }
.ht-pchip button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ht-pchip button:hover { background: rgba(17,26,46,.08); }
.ht-picker-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--ht-border); color: var(--ht-ink-subtle); }
.ht-picker-search input { border: 0; outline: 0; flex: 1; min-height: 42px; font-size: 14px; background: transparent; color: var(--ht-ink); }
.ht-picker-list { max-height: 220px; overflow-y: auto; padding: 4px; }
.ht-picker-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.ht-picker-item:hover { background: var(--ht-sunken); }
.ht-picker-item input { width: 18px; height: 18px; accent-color: var(--ht-accent); margin: 0; }
.ht-picker-item small { color: var(--ht-ink-subtle); font-size: 12px; }
.ht-picker-item[hidden] { display: none; }
.ht-picker-empty { padding: 14px; text-align: center; color: var(--ht-ink-subtle); font-size: 13px; }
textarea.ht-input { padding: 10px 12px; min-height: 120px; line-height: 24px; resize: vertical; }
.ht-desc-text { color: #3d465a; line-height: 24px; white-space: pre-line; margin: 0; }

/* النص المنسق من Quill داخل التفاصيل */
.ht-rich { color: #3d465a; line-height: 24px; }
.ht-rich p { margin: 0 0 8px; }
.ht-rich ul { list-style: disc; padding-right: 22px; margin: 0 0 8px; }
.ht-rich ol { list-style: decimal; padding-right: 22px; margin: 0 0 8px; }
.ht-rich a { color: var(--ht-accent); text-decoration: underline; }
.ht-rich strong { font-weight: 700; }
.ht-rich em { font-style: italic; }
.ht-rich u { text-decoration: underline; }

@media (max-width: 640px) {
  .ht-search { width: 100%; }
  .ht-drawer { top: 8px; inset-inline-end: 8px; bottom: 8px; max-width: calc(100% - 16px); }
  .ht-form-card { padding: 18px; }
}
