/* ============================================================
   نظام إدارة الأفكار والابتكار · المحاسبون الدوليون (HLB SA)
   Application styles — built on HLB brand tokens (tokens.css).
   RTL-first; LTR handled via [dir] + logical properties.
   ============================================================ */

/* ---------------------------------------------------------- *
   Utilities & layout primitives
 * ---------------------------------------------------------- */
.app-root { min-height: 100vh; }
.row { display: flex; align-items: center; gap: var(--space-4); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.gap-2 { gap: var(--space-3); } .gap-3 { gap: var(--space-5); } .gap-4 { gap: var(--space-7); }
.muted { color: var(--text-muted); }
.strong { color: var(--text-strong); }
.center { text-align: center; }
.hidden { display: none !important; }
.eyebrow { font-size: var(--text-2xs); font-weight: 700; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--color-brand); }
.figure { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------- *
   Buttons (HLB: amber primary CTA, teal secondary)
 * ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3);
  font-family: var(--font-sans); font-weight: 700; font-size: var(--text-sm);
  padding: 10px 18px; border-radius: var(--radius-md); border: 1.5px solid transparent;
  cursor: pointer; white-space: nowrap; transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast), transform var(--duration-fast);
  line-height: 1;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn .ic { width: 18px; height: 18px; flex: none; }
.btn--primary { background: var(--color-cta); color: var(--color-cta-on); }
.btn--primary:hover { background: var(--color-cta-hover); }
.btn--primary:active { background: var(--color-cta-pressed); }
.btn--brand { background: var(--color-brand); color: var(--color-brand-on); }
.btn--brand:hover { background: var(--color-brand-hover); }
.btn--brand:active { background: var(--color-brand-pressed); }
.btn--secondary { background: var(--white); color: var(--color-brand); border-color: var(--hlb-teal-200); }
.btn--secondary:hover { border-color: var(--color-brand); background: var(--color-brand-tint); }
.btn--ghost { background: transparent; color: var(--text-body); }
.btn--ghost:hover { background: var(--surface-sunken); }
.btn--subtle { background: var(--surface-sunken); color: var(--text-body); }
.btn--subtle:hover { background: var(--line-200); }
.btn--danger { background: var(--status-danger); color: #fff; }
.btn--danger:hover { filter: brightness(0.94); }
.btn--sm { padding: 7px 12px; font-size: var(--text-xs); }
.btn--lg { padding: 14px 24px; font-size: var(--text-base); }
.btn--block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn--icon { padding: 9px; width: 38px; height: 38px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--radius-md); border: 1px solid transparent; background: transparent; color: var(--ink-600); cursor: pointer; position: relative; transition: background var(--duration-fast), color var(--duration-fast); }
.icon-btn:hover { background: var(--surface-sunken); color: var(--ink-900); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.icon-btn .ic { width: 20px; height: 20px; }

.ic { display: inline-block; vertical-align: middle; stroke: currentColor; }

/* ---------------------------------------------------------- *
   Badges, tags, pills
 * ---------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-2xs); font-weight: 700; padding: 3px 9px; border-radius: var(--radius-pill); line-height: 1.4; white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--success { background: var(--status-success-bg); color: #1d7a43; }
.badge--warning { background: var(--status-warning-bg); color: #9a6800; }
.badge--danger  { background: var(--status-danger-bg);  color: #ad3030; }
.badge--info    { background: var(--status-info-bg);    color: #155a90; }
.badge--brand   { background: var(--color-brand-tint);  color: var(--hlb-teal-600); }
.badge--neutral { background: var(--line-100); color: var(--ink-600); }
.badge--amber   { background: var(--hlb-amber-050); color: var(--hlb-amber-700); }
.badge--purple  { background: #F1E9F7; color: var(--accent-purple); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; padding: 5px 11px; border-radius: var(--radius-pill); background: var(--white); border: 1px solid var(--line-200); color: var(--ink-700); cursor: pointer; transition: all var(--duration-fast); }
.chip:hover { border-color: var(--hlb-teal-300); color: var(--color-brand); }
.chip.is-active { background: var(--color-brand); border-color: var(--color-brand); color: #fff; }
.chip .swatch { width: 9px; height: 9px; border-radius: 3px; }

.pri { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 700; }
.pri::before { content: ""; width: 8px; height: 8px; border-radius: 2px; }
.pri--critical { color: #ad3030; } .pri--critical::before { background: var(--status-danger); }
.pri--high { color: #b06a00; } .pri--high::before { background: var(--hlb-amber-600); }
.pri--medium { color: #155a90; } .pri--medium::before { background: var(--accent-blue); }
.pri--low { color: var(--ink-500); } .pri--low::before { background: var(--ink-400); }

/* ---------------------------------------------------------- *
   Cards & panels
 * ---------------------------------------------------------- */
.card { background: var(--surface-card); border: 1px solid var(--line-200); border-radius: var(--radius-lg); }
.card--pad { padding: var(--space-7); }
.card--interactive { cursor: pointer; transition: border-color var(--duration-base), box-shadow var(--duration-base), transform var(--duration-base); }
.card--interactive:hover { border-color: var(--hlb-teal-200); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); }
.panel-head h3 { font-size: var(--text-h4); }
.panel-title { font-size: var(--text-h4); font-weight: 700; color: var(--ink-900); }
.divider { height: 1px; background: var(--line-200); border: 0; margin: var(--space-6) 0; }

/* ---------------------------------------------------------- *
   Authentication / Login
 * ---------------------------------------------------------- */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; background: var(--white); }
.auth__brand {
  position: relative; overflow: hidden; color: #fff; padding: var(--space-11) var(--space-10);
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(0,93,119,0.0) 40%, rgba(0,34,44,0.55) 100%),
    linear-gradient(155deg, var(--hlb-teal-600) 0%, var(--hlb-teal-700) 48%, var(--hlb-teal-900) 100%);
}
.auth__brand::after { content: ""; position: absolute; inset-block-start: -120px; inset-inline-end: -120px; width: 360px; height: 360px; border-radius: 50%; border: 44px solid rgba(245,168,0,0.10); }
.auth__brand-logo { height: 64px; width: auto; position: relative; z-index: 2; }
.auth__brand-body { position: relative; z-index: 2; max-width: 460px; }
.auth__brand-body h1 { color: #fff; font-size: 38px; line-height: 1.2; letter-spacing: -0.01em; margin-bottom: var(--space-5); }
.auth__brand-body p { color: rgba(255,255,255,0.85); font-size: var(--text-lg); line-height: 1.7; }
.auth__stats { display: flex; gap: var(--space-9); position: relative; z-index: 2; }
.auth__stat .v { font-family: var(--font-mono); font-size: 30px; font-weight: 600; color: var(--hlb-amber-400); line-height: 1; }
.auth__stat .l { font-size: var(--text-xs); color: rgba(255,255,255,0.7); margin-top: 6px; }
.auth__form-wrap { display: flex; align-items: center; justify-content: center; padding: var(--space-9); }
.auth__form { width: 100%; max-width: 400px; }
.auth__form .auth__mlogo { display: none; }
.auth__form h2 { font-size: var(--text-h2); margin-bottom: 6px; }
.auth__form .sub { color: var(--text-muted); margin-bottom: var(--space-8); }
.auth__demos { margin-top: var(--space-7); }
.auth__demos-label { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: var(--space-4); display: flex; align-items: center; gap: var(--space-3); }
.auth__demos-label::before, .auth__demos-label::after { content: ""; height: 1px; background: var(--line-200); flex: 1; }
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.role-card { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line-200); border-radius: var(--radius-md); background: var(--white); cursor: pointer; text-align: start; transition: all var(--duration-fast); }
.role-card:hover { border-color: var(--hlb-teal-300); background: var(--color-brand-tint); }
.role-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.role-card .avatar { flex: none; }
.role-card .rc-name { font-weight: 700; font-size: var(--text-sm); color: var(--ink-900); }
.role-card .rc-role { font-size: var(--text-2xs); color: var(--text-muted); }

/* ---------------------------------------------------------- *
   App shell: sidebar + topbar + main
 * ---------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--hlb-teal-700) 0%, var(--hlb-teal-800) 100%);
  color: rgba(255,255,255,0.78); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
}
.sidebar__brand { padding: var(--space-6) var(--space-6) var(--space-5); display: flex; align-items: center; gap: var(--space-3); border-bottom: 1px solid rgba(255,255,255,0.10); }
.sidebar__brand img { height: 42px; width: auto; }
.nav { padding: var(--space-5) var(--space-4); display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav__section { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.42); padding: var(--space-5) var(--space-3) var(--space-3); }
.nav__item { display: flex; align-items: center; gap: var(--space-4); padding: 10px var(--space-4); border-radius: var(--radius-md); color: rgba(255,255,255,0.80); font-weight: 600; font-size: var(--text-sm); cursor: pointer; position: relative; transition: background var(--duration-fast), color var(--duration-fast); }
.nav__item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav__item.is-active { background: rgba(255,255,255,0.12); color: #fff; }
.nav__item.is-active::before { content: ""; position: absolute; inset-inline-start: -4px; inset-block: 8px; width: 4px; border-radius: 4px; background: var(--hlb-amber-500); }
.nav__item .ic { width: 19px; height: 19px; flex: none; opacity: 0.92; }
.nav__item .nav__count { margin-inline-start: auto; background: rgba(255,255,255,0.16); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: var(--radius-pill); font-family: var(--font-mono); }
.sidebar__foot { padding: var(--space-5); border-top: 1px solid rgba(255,255,255,0.10); }
.sidebar__user { display: flex; align-items: center; gap: var(--space-4); }
.sidebar__user .su-name { color: #fff; font-weight: 700; font-size: var(--text-sm); }
.sidebar__user .su-role { color: rgba(255,255,255,0.6); font-size: var(--text-2xs); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--topbar-h); background: rgba(255,255,255,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-200); display: flex; align-items: center; gap: var(--space-5); padding: 0 var(--space-7); position: sticky; top: 0; z-index: 30; }
.topbar__search { display: flex; align-items: center; gap: var(--space-3); background: var(--surface-100); border: 1px solid transparent; border-radius: var(--radius-md); padding: 9px var(--space-4); flex: 1; max-width: 440px; color: var(--ink-500); }
.topbar__search:focus-within { border-color: var(--hlb-teal-300); background: #fff; box-shadow: var(--focus-ring); }
.topbar__search input { border: 0; background: transparent; outline: none; font-family: inherit; font-size: var(--text-sm); width: 100%; color: var(--ink-900); }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: var(--space-2); }
.hamburger { display: none; }
.lang-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--radius-md); border: 1px solid var(--line-200); background: #fff; cursor: pointer; font-weight: 700; font-size: var(--text-xs); color: var(--ink-700); }
.lang-toggle:hover { border-color: var(--hlb-teal-300); color: var(--color-brand); }

.notif-dot { position: absolute; inset-block-start: 6px; inset-inline-end: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--status-danger); border: 2px solid #fff; }

.usermenu { display: flex; align-items: center; gap: var(--space-3); padding: 4px 6px 4px 4px; border-radius: var(--radius-pill); cursor: pointer; }
.usermenu:hover { background: var(--surface-sunken); }
.usermenu .um-meta { line-height: 1.2; }
.usermenu .um-name { font-weight: 700; font-size: var(--text-xs); color: var(--ink-900); }
.usermenu .um-role { font-size: 10.5px; color: var(--text-muted); }

.page { padding: var(--space-8) var(--space-9); max-width: 1320px; width: 100%; margin: 0 auto; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap; margin-bottom: var(--space-8); }
.page__title { font-size: var(--text-h1); }
.page__sub { color: var(--text-muted); margin-top: 6px; font-size: var(--text-base); }
.breadcrumb { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-xs); color: var(--text-muted); margin-bottom: var(--space-4); }
.breadcrumb .ic { width: 14px; height: 14px; }

/* ---------------------------------------------------------- *
   Avatars
 * ---------------------------------------------------------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; color: #fff; font-size: var(--text-xs); flex: none; line-height: 1; font-family: var(--font-sans); }
.avatar--sm { width: 30px; height: 30px; font-size: 11px; }
.avatar--md { width: 38px; height: 38px; }
.avatar--lg { width: 46px; height: 46px; font-size: var(--text-base); }

/* ---------------------------------------------------------- *
   KPI cards
 * ---------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }
.kpi { background: var(--surface-card); border: 1px solid var(--line-200); border-radius: var(--radius-lg); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.kpi__top { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi__icon { width: 42px; height: 42px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.kpi__icon .ic { width: 22px; height: 22px; }
.kpi__label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; }
.kpi__value { font-family: var(--font-mono); font-size: 30px; font-weight: 600; color: var(--ink-900); line-height: 1; letter-spacing: -0.01em; }
.kpi__delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: 700; }
.kpi__delta .ic { width: 14px; height: 14px; }
.kpi__delta.up { color: var(--status-success); }
.kpi__delta.down { color: var(--status-danger); }
.kpi__delta.flat { color: var(--text-muted); }

/* ---------------------------------------------------------- *
   Grid scaffolding for dashboard
 * ---------------------------------------------------------- */
.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-12 { grid-template-columns: repeat(12, 1fr); }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }

/* ---------------------------------------------------------- *
   Charts
 * ---------------------------------------------------------- */
.donut-wrap { display: flex; align-items: center; gap: var(--space-7); }
.donut { flex: none; }
.donut__center { font-family: var(--font-mono); }
.legend { display: flex; flex-direction: column; gap: var(--space-3); flex: 1; }
.legend__row { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
.legend__row .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend__row .lg-label { color: var(--ink-700); }
.legend__row .lg-val { margin-inline-start: auto; font-family: var(--font-mono); font-weight: 600; color: var(--ink-900); }

.barchart { display: flex; flex-direction: column; gap: var(--space-5); }
.barrow { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: var(--space-4); }
.barrow .bl { font-size: var(--text-sm); color: var(--ink-700); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bartrack { display: block; height: 12px; background: var(--surface-sunken); border-radius: var(--radius-pill); overflow: hidden; }
.barfill { display: block; height: 100%; min-width: 6px; border-radius: var(--radius-pill); background: var(--color-brand); transition: width var(--duration-slow) var(--ease-out); }
.barrow .bv { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 600; color: var(--ink-900); text-align: end; }

.linechart { width: 100%; height: auto; }
.linechart .grid-line { stroke: var(--line-200); stroke-width: 1; }
.linechart .axis-label { fill: var(--ink-400); font-size: 11px; font-family: var(--font-mono); }

/* score meters */
.meters { display: flex; flex-direction: column; gap: var(--space-5); }
.meter__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.meter__label { font-size: var(--text-sm); color: var(--ink-700); font-weight: 600; }
.meter__val { font-family: var(--font-mono); font-weight: 600; color: var(--ink-900); font-size: var(--text-sm); }
.meter__track { display: block; height: 8px; background: var(--surface-sunken); border-radius: var(--radius-pill); overflow: hidden; }
.meter__fill { display: block; height: 100%; border-radius: var(--radius-pill); }

/* ---------------------------------------------------------- *
   Tables
 * ---------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--line-200); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.data thead th { text-align: start; font-size: var(--text-xs); font-weight: 700; color: var(--ink-500); padding: var(--space-4) var(--space-5); background: var(--surface-100); border-bottom: 1px solid var(--line-200); white-space: nowrap; }
table.data tbody td { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line-100); color: var(--ink-700); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background var(--duration-fast); }
table.data tbody tr:hover { background: var(--color-brand-tint); }
table.data tbody tr.clickable { cursor: pointer; }
.td-title { font-weight: 700; color: var(--ink-900); }
.td-code { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-500); }
.cell-user { display: flex; align-items: center; gap: var(--space-3); }

/* ---------------------------------------------------------- *
   Forms
 * ---------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: var(--text-sm); font-weight: 700; color: var(--ink-800); display: flex; align-items: center; gap: 6px; }
.field label .req { color: var(--status-danger); }
.field .hint { font-size: var(--text-xs); color: var(--text-muted); }
.input, .select, .textarea {
  font-family: var(--font-sans); font-size: var(--text-sm); color: var(--ink-900);
  padding: 11px var(--space-4); border: 1px solid var(--line-200); border-radius: var(--radius-md);
  background: #fff; width: 100%; transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--focus-ring); }
.textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7A82' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; padding-inline-start: var(--space-4); padding-inline-end: 38px; }
html[dir="ltr"] .select { background-position: right 14px center; }
.input-prefix { position: relative; }

.seg { display: inline-flex; background: var(--surface-sunken); border-radius: var(--radius-md); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: var(--radius-sm); font-family: inherit; font-weight: 700; font-size: var(--text-xs); color: var(--ink-600); cursor: pointer; }
.seg button.is-active { background: #fff; color: var(--color-brand); box-shadow: var(--shadow-xs); }

.dropzone { border: 1.5px dashed var(--hlb-teal-200); border-radius: var(--radius-md); background: var(--color-brand-tint); padding: var(--space-7); text-align: center; color: var(--text-muted); cursor: pointer; transition: all var(--duration-fast); }
.dropzone:hover, .dropzone.drag { border-color: var(--color-brand); background: var(--hlb-teal-100); }
.dropzone.drag { box-shadow: var(--focus-ring); }
.dropzone .ic { width: 28px; height: 28px; color: var(--color-brand); }

.filebox { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line-200); border-radius: var(--radius-md); background: #fff; }
.filebox .fi { width: 38px; height: 38px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: var(--surface-sunken); color: var(--ink-600); flex: none; }
.filebox .fmeta { line-height: 1.3; min-width: 0; }
.filebox .fname { font-weight: 700; font-size: var(--text-sm); color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filebox .fsub { font-size: var(--text-xs); color: var(--text-muted); }

/* ---------------------------------------------------------- *
   Filter bar
 * ---------------------------------------------------------- */
.filterbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-6); }
.filterbar .chips { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* ---------------------------------------------------------- *
   Idea cards (list/grid)
 * ---------------------------------------------------------- */
.ideas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--space-5); }
.idea-card { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6); }
.idea-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.idea-card__cat { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-2xs); font-weight: 700; }
.idea-card__cat .swatch { width: 10px; height: 10px; border-radius: 3px; }
.idea-card__title { font-size: var(--text-h4); font-weight: 700; color: var(--ink-900); line-height: 1.35; }
.idea-card__desc { font-size: var(--text-sm); color: var(--ink-600); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.idea-card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line-100); }
.idea-card__metrics { display: flex; align-items: center; gap: var(--space-5); font-size: var(--text-xs); color: var(--text-muted); }
.idea-card__metrics .m { display: inline-flex; align-items: center; gap: 5px; }
.idea-card__metrics .ic { width: 15px; height: 15px; }

/* ---------------------------------------------------------- *
   Kanban / pipeline
 * ---------------------------------------------------------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: var(--space-5); overflow-x: auto; padding-bottom: var(--space-4); }
.kcol { background: var(--surface-100); border: 1px solid var(--line-200); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 200px; }
.kcol__head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-5); border-bottom: 1px solid var(--line-200); }
.kcol__dot { width: 9px; height: 9px; border-radius: 50%; }
.kcol__name { font-weight: 700; font-size: var(--text-sm); color: var(--ink-800); }
.kcol__count { margin-inline-start: auto; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; color: var(--ink-500); background: #fff; border: 1px solid var(--line-200); border-radius: var(--radius-pill); padding: 1px 9px; }
.kcol__body { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
.kcard { background: #fff; border: 1px solid var(--line-200); border-radius: var(--radius-md); padding: var(--space-5); cursor: pointer; display: flex; flex-direction: column; gap: var(--space-3); transition: box-shadow var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast); }
.kcard:hover { box-shadow: var(--shadow-md); border-color: var(--hlb-teal-200); transform: translateY(-2px); }
.kcard__title { font-weight: 700; font-size: var(--text-sm); color: var(--ink-900); line-height: 1.4; }
.kcard__meta { display: flex; align-items: center; justify-content: space-between; }
.kcard__bar { height: 4px; border-radius: 2px; background: var(--surface-sunken); overflow: hidden; }
.kcard__bar > i { display: block; height: 100%; background: var(--color-brand); }

/* ---------------------------------------------------------- *
   Timeline / workflow
 * ---------------------------------------------------------- */
.timeline { display: flex; flex-direction: column; }
.tstep { display: grid; grid-template-columns: 34px 1fr; gap: var(--space-4); }
.tstep__rail { display: flex; flex-direction: column; align-items: center; }
.tstep__node { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--line-200); background: #fff; color: var(--ink-400); flex: none; z-index: 2; }
.tstep__node .ic { width: 15px; height: 15px; }
.tstep__line { width: 2px; flex: 1; background: var(--line-200); margin: 2px 0; min-height: 18px; }
.tstep.done .tstep__node { background: var(--status-success); border-color: var(--status-success); color: #fff; }
.tstep.current .tstep__node { background: var(--hlb-amber-500); border-color: var(--hlb-amber-500); color: var(--ink-900); }
.tstep.rejected .tstep__node { background: var(--status-danger); border-color: var(--status-danger); color: #fff; }
.tstep.done .tstep__line, .tstep.current .tstep__line { background: var(--status-success); }
.tstep__body { padding-bottom: var(--space-6); }
.tstep__title { font-weight: 700; font-size: var(--text-sm); color: var(--ink-900); }
.tstep__meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: 3px; }
.tstep__note { font-size: var(--text-sm); color: var(--ink-600); margin-top: 8px; background: var(--surface-100); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); }

/* ---------------------------------------------------------- *
   Activity feed / comments
 * ---------------------------------------------------------- */
.feed { display: flex; flex-direction: column; gap: var(--space-5); }
.feed__item { display: flex; gap: var(--space-4); }
.feed__body { font-size: var(--text-sm); color: var(--ink-700); }
.feed__body .who { font-weight: 700; color: var(--ink-900); }
.feed__time { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

.comment { display: flex; gap: var(--space-4); }
.comment__bubble { background: var(--surface-100); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); flex: 1; }
.comment__head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: 5px; }
.comment__name { font-weight: 700; font-size: var(--text-sm); color: var(--ink-900); }
.comment__role { font-size: var(--text-2xs); color: var(--text-muted); }
.comment__time { font-size: var(--text-2xs); color: var(--text-muted); margin-inline-start: auto; }
.comment__text { font-size: var(--text-sm); color: var(--ink-700); line-height: 1.6; }

/* voting & rating */
.vote { display: inline-flex; align-items: center; border: 1px solid var(--line-200); border-radius: var(--radius-pill); overflow: hidden; }
.vote button { border: 0; background: #fff; padding: 8px 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-family: inherit; font-weight: 700; font-size: var(--text-sm); color: var(--ink-600); }
.vote button:hover { background: var(--surface-100); }
.vote button.up:hover { color: var(--status-success); }
.vote button.down:hover { color: var(--status-danger); }
.vote .vcount { font-family: var(--font-mono); }
.vote .sep { width: 1px; align-self: stretch; background: var(--line-200); }

.stars { display: inline-flex; gap: 2px; }
.stars .ic { width: 17px; height: 17px; color: var(--ink-300); }
.stars .ic.on { color: var(--hlb-amber-500); fill: var(--hlb-amber-500); }

/* ---------------------------------------------------------- *
   Tabs
 * ---------------------------------------------------------- */
.tabs { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--line-200); margin-bottom: var(--space-7); overflow-x: auto; }
.tab { padding: 12px var(--space-5); font-weight: 700; font-size: var(--text-sm); color: var(--ink-500); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; transition: color var(--duration-fast); }
.tab:hover { color: var(--ink-800); }
.tab.is-active { color: var(--color-brand); border-bottom-color: var(--color-brand); }

/* ---------------------------------------------------------- *
   Detail layout
 * ---------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: 1fr 360px; gap: var(--space-7); align-items: start; }
.side-stack { display: flex; flex-direction: column; gap: var(--space-5); position: sticky; top: calc(var(--topbar-h) + var(--space-5)); }
.kv { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) 0; border-bottom: 1px solid var(--line-100); font-size: var(--text-sm); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--text-muted); }
.kv .v { font-weight: 700; color: var(--ink-900); }

/* ---------------------------------------------------------- *
   Toast & misc
 * ---------------------------------------------------------- */
.toast-wrap { position: fixed; inset-block-end: var(--space-7); inset-inline-end: var(--space-7); z-index: 90; display: flex; flex-direction: column; gap: var(--space-3); }
.toast { display: flex; align-items: center; gap: var(--space-4); background: var(--ink-900); color: #fff; padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: var(--text-sm); font-weight: 600; animation: toastin var(--duration-base) var(--ease-out); max-width: 380px; }
.toast .ic { width: 20px; height: 20px; flex: none; }
.toast--success { border-inline-start: 4px solid var(--status-success); }
.toast--info { border-inline-start: 4px solid var(--hlb-amber-500); }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.empty { text-align: center; padding: var(--space-11) var(--space-7); color: var(--text-muted); }
.empty .ic { width: 40px; height: 40px; color: var(--ink-300); margin-bottom: var(--space-4); }

.alert { display: flex; gap: var(--space-4); padding: var(--space-5); border-radius: var(--radius-md); font-size: var(--text-sm); }
.alert .ic { width: 20px; height: 20px; flex: none; }
.alert--info { background: var(--status-info-bg); color: #155a90; }
.alert--warning { background: var(--status-warning-bg); color: #9a6800; }

/* Notifications dropdown / drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(6,46,56,0.45); z-index: 70; opacity: 0; animation: fadein var(--duration-base) forwards; }
@keyframes fadein { to { opacity: 1; } }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: 400px; max-width: 92vw; background: #fff; z-index: 71; box-shadow: var(--shadow-xl); display: flex; flex-direction: column; animation: slidein var(--duration-slow) var(--ease-out); }
@keyframes slidein { from { transform: translateX(100%); } to { transform: translateX(0); } }
html[dir="ltr"] .drawer { animation: slideinL var(--duration-slow) var(--ease-out); }
@keyframes slideinL { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-6); border-bottom: 1px solid var(--line-200); }
.drawer__body { overflow-y: auto; padding: var(--space-4); display: flex; flex-direction: column; gap: 2px; }
.notif { display: flex; gap: var(--space-4); padding: var(--space-4); border-radius: var(--radius-md); cursor: pointer; }
.notif:hover { background: var(--surface-100); }
.notif.unread { background: var(--color-brand-tint); }
.notif__icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex: none; }
.notif__title { font-weight: 700; font-size: var(--text-sm); color: var(--ink-900); }
.notif__text { font-size: var(--text-xs); color: var(--ink-600); }
.notif__time { font-size: 10.5px; color: var(--text-muted); margin-top: 3px; }

/* progress ring (svg) center label */
.ring-wrap { position: relative; display: inline-grid; place-items: center; }
.ring-wrap .ring-label { position: absolute; font-family: var(--font-mono); font-weight: 600; font-size: 20px; color: var(--ink-900); }

/* ---------------------------------------------------------- *
   Modal dialog (admin forms & confirmations)
 * ---------------------------------------------------------- */
.modal-scrim { position: fixed; inset: 0; background: rgba(6,46,56,0.5); z-index: 80; display: grid; place-items: center; padding: 20px; animation: fadein var(--duration-base) forwards; }
.modal { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); width: 100%; max-width: 540px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; animation: modalin var(--duration-slow) var(--ease-out); }
@keyframes modalin { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-6) var(--space-7); border-bottom: 1px solid var(--line-200); }
.modal__head h3 { font-size: var(--text-h4); }
.modal__body { padding: var(--space-7); overflow-y: auto; flex: 1; }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--space-3); padding: var(--space-5) var(--space-7); border-top: 1px solid var(--line-200); background: var(--surface-100); }

/* toggle switch */
.switch { position: relative; width: 44px; height: 25px; border-radius: var(--radius-pill); background: var(--line-200); border: 0; cursor: pointer; flex: none; transition: background var(--duration-fast); }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: inset-inline-start var(--duration-fast); }
.switch.on { background: var(--status-success); }
.switch.on::after { inset-inline-start: 22px; }
.switch:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* attachment version badge */
.ver-badge { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--color-brand); background: var(--color-brand-tint); padding: 1px 6px; border-radius: var(--radius-pill); vertical-align: middle; }

/* password input group (admin user form) */
.pass-group { display: flex; gap: 8px; align-items: center; }
.pass-group .input { flex: 1; min-width: 0; }
.pass-group .btn { flex: none; white-space: nowrap; }

/* permission matrix cell (clickable toggle) */
.perm-cell { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 0; background: transparent; cursor: pointer; transition: background var(--duration-fast); }
.perm-cell:hover { background: var(--surface-sunken); }
.perm-cell:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.perm-cell.locked { cursor: not-allowed; }

/* ---------------------------------------------------------- *
   Responsive
 * ---------------------------------------------------------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .span-7, .span-8, .span-5, .span-4, .span-6 { grid-column: span 12; }
  .detail-grid { grid-template-columns: 1fr; }
  .side-stack { position: static; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; transform: translateX(-100%); transition: transform var(--duration-slow) var(--ease-out); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .shell.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-xl); }
  .hamburger { display: inline-flex; }
  .auth { grid-template-columns: 1fr; }
  .auth__brand { display: none; }
  .auth__form .auth__mlogo { display: block; height: 52px; margin-bottom: var(--space-7); }
  .form-grid { grid-template-columns: 1fr; }
  .page { padding: var(--space-6) var(--space-5); }
  .role-cards { grid-template-columns: 1fr; }
  .topbar__search { display: none; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page__title { font-size: var(--text-h2); }
}
