/*
 * app.css — import barrel for the Itqanat design system.
 * Order matters: fonts → tokens → shell → components → utilities.
 * ai_dock.css is reintroduced in Phase 0b-ai when apps/ai_core ships its
 * floating dock partial.
 */

@import url("fonts.7047a700b357.css");
@import url("tokens.077d1b4ea877.css");
@import url("topbar.73651204b109.css");
@import url("sidebar.d49a50d9ea9a.css");
@import url("toasts.e592d1ef00c6.css");
@import url("components.cd91cde3a961.css");
@import url("finance.7a89d6e3aac4.css");
@import url("guide.34b6d4bb4bb1.css");
@import url("utilities.1ba98231a5a8.css");
@import url("print.257ffd7b4006.css");
/* Shared operational timeline (RTL labels and chronological axis). */
.ops-gantt__scroll { overflow-x: auto; }
.ops-gantt__chart { min-width: calc(var(--ops-gantt-width) + 16rem); }
.ops-gantt__head, .ops-gantt__row { display: grid; grid-template-columns: 16rem minmax(var(--ops-gantt-width), 1fr); }
.ops-gantt__head { color: var(--bs-secondary-color); font-size: .75rem; font-weight: 600; border-bottom: 1px solid var(--bs-border-color); }
.ops-gantt__head > span, .ops-gantt__label { padding: .65rem .9rem; }
.ops-gantt__row { min-height: 2.65rem; border-bottom: 1px solid var(--bs-border-color-translucent); }
.ops-gantt__row:last-child { border-bottom: 0; }
.ops-gantt__row--objective { background: var(--bs-tertiary-bg); font-weight: 700; }
.ops-gantt__row--task .ops-gantt__label { padding-inline-start: 2rem; font-size: .875rem; }
.ops-gantt__row--activity .ops-gantt__label { padding-inline-start: 1.3rem; }
.ops-gantt__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops-gantt__track { position: relative; min-height: 2.65rem; }
.ops-gantt__month, .ops-gantt__grid { position: absolute; inset-block: 0; border-inline-start: 1px solid var(--bs-border-color-translucent); }
.ops-gantt__month { padding: .65rem .25rem; overflow: hidden; white-space: nowrap; }
.ops-gantt__bar { position: absolute; inset-block-start: .85rem; height: .95rem; min-width: .35rem; border-radius: .3rem; background: var(--bs-primary); }
.ops-gantt__row--objective .ops-gantt__bar { background: var(--bs-secondary-color); }
.ops-gantt__row--period .ops-gantt__bar { background: var(--bs-info); }
.ops-gantt__bar--actual { inset-block-start: 1.8rem; height: .35rem; background: var(--bs-success); }
.ops-gantt__bar--milestone { width: .7rem !important; min-width: .7rem; border-radius: 50%; }
.ops-gantt__missing { position: relative; display: inline-block; padding: .75rem .5rem; color: var(--bs-secondary-color); font-size: .75rem; }
.ops-gantt__key { display: inline-block; width: 1rem; height: .55rem; border-radius: .2rem; background: var(--bs-primary); }
.ops-gantt__key--actual { background: var(--bs-success); }
.ops-gantt__key--period { background: var(--bs-info); }

/* ══════════════════════════════════════════════════════════════════════
   Shared interaction conventions (WP-20).
   Written once here, adopted by the domain pages. Rules and usage:
   Docs/TEMPLATE_DESIGN_STANDARDS.md «Shared interaction conventions».
   ══════════════════════════════════════════════════════════════════════ */

/* Confirm dialog variants. Red (the base .itqanat-confirm look) is for
   deletions; a state change that deletes nothing is primary or neutral. */
.itqanat-confirm--primary { border-inline-start-color: var(--bs-primary); }
.itqanat-confirm--primary .itqanat-confirm__icon { background: var(--bs-primary-bg-subtle); }
.itqanat-confirm--primary .itqanat-confirm__icon i,
.itqanat-confirm--primary .itqanat-confirm__icon svg { color: var(--bs-primary-text-emphasis); }
.itqanat-confirm--neutral { border-inline-start-color: var(--itqanat-ink-400); }
.itqanat-confirm--neutral .itqanat-confirm__icon { background: var(--itqanat-surface-muted); }
.itqanat-confirm--neutral .itqanat-confirm__icon i,
.itqanat-confirm--neutral .itqanat-confirm__icon svg { color: var(--itqanat-ink-700); }

/* Submit guard: a guarded submit button looks busy without shifting layout. */
button[aria-busy="true"], input[type="submit"][aria-busy="true"] { cursor: progress; }

/* Icon gap (UAT-185): an icon that leads a button, badge or menu item gets the
   standard gap, unless the control already lays itself out with flex/gap. An
   icon-only control names itself with aria-label (§22) and is left alone. */
:is(.btn, .badge, .dropdown-item):not(.d-flex, .d-inline-flex, [class*="gap-"], [aria-label],
  .btn-icon, .btn-close) > :is(svg, i[data-lucide]):first-child { margin-inline-end: .4rem; }
.itqanat-page-header__actions .btn > :is(svg, i[data-lucide]):first-child,
.itqanat-task-list__bulk-actions .btn > :is(svg, i[data-lucide]):first-child { margin-inline-end: 0; }
/* Explicit form for any other container. */
.itqanat-icon-gap > :is(svg, i[data-lucide]):first-child { margin-inline-end: .4rem; }

/* Breadcrumb separator (UAT-185): adjacent crumb links never glue together. */
.itqanat-page-header__crumbs > a + a::before,
.itqanat-crumbs > a + a::before {
  content: "/";
  margin-inline: .45rem;
  color: var(--itqanat-ink-400);
}

/* Sidebar toggle (UAT-183): the round toggle straddles the sidebar edge, so
   the content keeps a gutter wider than the part that sticks out. */
@media (min-width: 768px) {
  .itqanat-main > .itqanat-content { padding-inline-start: 1.5rem; }
}

/* User-limit box (UAT-183): a compact notice, not a full panel. */
.itqanat-seat-summary { padding: .65rem 1rem; font-size: .875rem; }
.itqanat-seat-summary h2 { margin-block-end: .35rem; font-size: .95rem; }
.itqanat-seat-summary p { margin-block-end: .15rem; }

/* Chart safety net (UAT-032): Chart.js with maintainAspectRatio:false sizes the
   canvas to its parent; a parent that grows with the canvas never settles.
   Wrap the canvas alone in .itqanat-chart-box; this cap keeps any chart that
   is not wrapped yet from running away. */
canvas[data-chart-id] { display: block; max-inline-size: 100%; max-block-size: 20rem; }
.itqanat-chart-box > canvas[data-chart-id] { max-block-size: none; }

/* Page header actions, secondary «المزيد» menu and the phone layout (UAT-161).
   components/page_header.html passes `more_actions` into the menu; hand-written
   headers use the same .itqanat-page-header__more dropdown. */
.itqanat-page-header__more .dropdown-menu { min-inline-size: 12rem; }
@media (max-width: 767.98px) {
  /* A header with many actions no longer stacks them one per row: two columns,
     the primary action and the «المزيد» menu across the full width. */
  .itqanat-page-header__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }
  .itqanat-page-header__actions .btn { inline-size: auto; min-inline-size: 0; white-space: normal; }
  .itqanat-page-header__actions > .btn-primary,
  .itqanat-page-header__actions > .itqanat-page-header__more,
  .itqanat-page-header__actions > form { grid-column: 1 / -1; }
  .itqanat-page-header__actions > .itqanat-page-header__more .btn { inline-size: 100%; }
}

/* Record table (UAT-160/161): one pattern for a list of records.
     <div class="itqanat-record-table-wrap">
       <table class="table itqanat-record-table">
         <thead><tr><th>…</th><th class="itqanat-record-table__actions">…</th></tr></thead>
         <tbody><tr>
           <td class="itqanat-record-table__title">…</td>
           <td data-label="التاريخ">…</td><td data-label="الحالة">…</td>
           <td class="itqanat-record-table__actions">…buttons…</td>
         </tr></tbody>
   Desktop: a normal table whose actions column stays pinned at the inline end
   while the rest scrolls, so a wide table never pushes its buttons off screen.
   Below 768px: each row becomes a card (title, labelled date/status values,
   full-width actions). */
.itqanat-record-table-wrap { overflow-x: auto; max-inline-size: 100%; }
.itqanat-record-table { inline-size: 100%; margin-block-end: 0; }
.itqanat-record-table > :is(thead, tbody) > tr > :is(th, td) { vertical-align: middle; }
.itqanat-record-table .itqanat-record-table__actions {
  position: sticky;
  inset-inline-end: 0;
  z-index: 1;
  background: var(--bs-body-bg);
  white-space: nowrap;
  box-shadow: inset 1px 0 0 var(--bs-border-color);
}
html[dir="rtl"] .itqanat-record-table .itqanat-record-table__actions { box-shadow: inset -1px 0 0 var(--bs-border-color); }
/* Meetings list (R3-MEETINGS2-18): the desktop table was 76rem wide, wider than the
   page at 1440, so the pinned actions column sat on top of «الحالة». It now fits. */
@media (min-width: 768px) {
  .itqanat-list-table--meetings.itqanat-record-table { min-inline-size: 64rem; }
  .itqanat-list-table--meetings.itqanat-record-table .itqanat-list-table__title { inline-size: 18rem; }
  .itqanat-list-table--meetings.itqanat-record-table .itqanat-list-table__date { inline-size: 180px; }
}
@media (max-width: 767.98px) {
  .itqanat-record-table-wrap { overflow-x: visible; }
  /* A card is as wide as the screen. The desktop rules of `.itqanat-list-table`
     (min-width 980px, fixed layout, column widths, ellipsis) must not leak into it;
     the doubled selector outranks the single-class width rules (R3-BODIES-04). */
  .itqanat-record-table.itqanat-record-table {
    min-inline-size: 0;
    max-inline-size: 100%;
    table-layout: auto;
  }
  .itqanat-record-table.itqanat-record-table,
  .itqanat-record-table.itqanat-record-table > tbody,
  .itqanat-record-table.itqanat-record-table > tbody > tr,
  .itqanat-record-table.itqanat-record-table > tbody > tr > td {
    display: block;
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: 100%;
    box-sizing: border-box;
  }
  .itqanat-record-table > tbody > tr > td { overflow: visible; text-overflow: clip; }
  .itqanat-record-table > tbody > tr > td > * { min-inline-size: 0; max-inline-size: 100%; }
  /* The header row stays in the DOM for assistive technology. */
  .itqanat-record-table > thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .itqanat-record-table > tbody > tr {
    margin-block-end: .75rem;
    padding: .75rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .75rem;
    background: var(--bs-body-bg);
  }
  .itqanat-record-table > tbody > tr > td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .75rem;
    padding: .25rem 0;
    border: 0;
    text-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .itqanat-record-table > tbody > tr > td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--bs-secondary-color);
    font-size: .75rem;
  }
  .itqanat-record-table > tbody > tr > td.itqanat-record-table__title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
  }
  .itqanat-record-table > tbody > tr > td.itqanat-record-table__actions {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-block-start: .5rem;
    padding-block: .5rem 0;
    background: transparent;
    box-shadow: none;
  }
  .itqanat-record-table > tbody > tr > td.itqanat-record-table__actions > :is(.btn, form, a) { flex: 1 1 100%; }
  /* The desktop icon-only row buttons are 28px squares; a card shows icon and label. */
  .itqanat-record-table .itqanat-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    inline-size: 100%;
    visibility: visible;
  }
  .itqanat-record-table .itqanat-row-actions .btn {
    flex: 1 1 auto;
    inline-size: auto;
    block-size: auto;
    min-block-size: 2.25rem;
    padding-inline: .75rem;
    white-space: normal;
  }
  .itqanat-record-table > tbody > tr > td.itqanat-record-table__actions form .btn { inline-size: 100%; }
}

/* Scroll cue (R3-BODIES-09, R3-MEETINGS-12, R3-TASKS-08): a table that cannot be
   a card on a phone (editable rows, many answer columns) still scrolls sideways, so
   a one-line hint sits at the inline start of the scroll box, and scrolls away with
   the table's content (it is not dismissed). The text comes
   from the template's data-scroll-hint (translated there). */
@media (max-width: 767.98px) {
  .itqanat-scroll-cue[data-scroll-hint]::before {
    content: attr(data-scroll-hint);
    display: block;
    position: sticky;
    inset-inline-start: 0;
    inline-size: 100%;
    padding: .375rem .75rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: .75rem;
    border-block-end: 1px solid var(--bs-border-color);
  }
}

/* AI-update review (F-QS-04): the seat table of «تعديل بالذكاء الاصطناعي» and of the
   wizard's update step. Below 768px each seat is a stacked card: a labelled value per
   line, controls at the full card width, and the linked committee seats (end / keep,
   the only-chair acknowledgement) under the row at full width. The labels come from the
   cells' data-label. The wizard keeps a 58rem table inside a scroll box on a desktop
   (body-wizard.css), so the phone rules outrank that. */
.itqanat-linked-seats .alert,
.itqanat-linked-seats .form-check-label { overflow-wrap: anywhere; }
@media (max-width: 767.98px) {
  .itqanat-linked-seats { inline-size: 100%; min-inline-size: 0; }
  .table-responsive.itqanat-update-review-wrap.itqanat-update-review-wrap {
    display: block;
    overflow: visible;
    contain: none;
    inline-size: 100%;
    max-inline-size: 100%;
  }
  #update-members-table.itqanat-update-review-table.itqanat-update-review-table,
  #update-members-table.itqanat-update-review-table.itqanat-update-review-table > tbody,
  #update-members-table.itqanat-update-review-table.itqanat-update-review-table > tbody > tr,
  #update-members-table.itqanat-update-review-table.itqanat-update-review-table > tbody > tr > td {
    display: block;
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: 100%;
    box-sizing: border-box;
  }
  #update-members-table.itqanat-update-review-table.itqanat-update-review-table > thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .itqanat-update-review-table > tbody > tr {
    margin-block-end: .75rem;
    padding: .75rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .75rem;
  }
  .itqanat-update-review-table > tbody > tr > td {
    padding: .375rem 0;
    border: 0;
    text-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .itqanat-update-review-table > tbody > tr > td > * { min-inline-size: 0; max-inline-size: 100%; }
  .itqanat-update-review-table > tbody > tr > td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-block-end: .125rem;
    color: var(--bs-secondary-color);
    font-size: .75rem;
  }
  .itqanat-update-review-table > tbody > tr > td.text-center { text-align: start !important; }
  .itqanat-update-review-table > tbody > tr > td:first-child { font-weight: 600; }
  /* The wizard sizes these controls for a wide table (body-wizard.css); a card is narrower. */
  #update-members-table.itqanat-update-review-table.itqanat-update-review-table.itqanat-update-review-table :is(input, select, textarea):not([type="checkbox"], [type="radio"]) {
    min-inline-size: 0;
    inline-size: 100%;
  }
}
