/* ==========================================================================
   ComplianceHand — design system
   Palette, typography and component styles carried over from the prototype
   (ComplianceHand - V2). Values are unchanged; only the organisation is new.
   ========================================================================== */

/* --- 1. Tokens ----------------------------------------------------------- */

:root {
  --p: #400078;          /* primary  */
  --s: #3C3AAC;          /* secondary */
  --t: #D6D5F0;          /* tint / badges */
  --a: #7EDEA4;          /* accent */
  --bg: #f8f7fc;
  --card: #fff;
  --txt: #1a1a2e;
  --done: #22c55e;
  --prog: #f59e0b;
  --not: #ef4444;
  --border: #e5e3f0;
  --muted: #888;
  --radius: 9px;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .04);
  --shadow-md: 0 4px 20px rgba(64, 0, 120, .3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* --- 2. Login ------------------------------------------------------------ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a0030 0%, var(--p) 40%, var(--s) 100%);
  padding: 20px;
}
.login-box {
  background: var(--card);
  border-radius: 20px;
  padding: 44px 36px;
  width: 420px;
  max-width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.login-logo {
  width: 65px; height: 65px;
  background: linear-gradient(135deg, var(--p), var(--s));
  border-radius: 16px;
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo svg { width: 34px; height: 34px; color: #fff; }
.login-title { text-align: center; font-size: 22px; font-weight: 700; color: var(--p); margin-bottom: 4px; }
.login-sub { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 28px; }
.login-field { margin-bottom: 16px; position: relative; }
.login-label { display: block; font-size: 11px; font-weight: 600; color: #555; margin-bottom: 5px; }
.login-input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 2px solid var(--border);
  border-radius: 9px;
  font-family: inherit; font-size: 13px;
  outline: none; background: var(--bg);
}
.login-input:focus { border-color: var(--s); background: #fff; }
.login-icon { position: absolute; left: 12px; bottom: 12px; width: 16px; height: 16px; color: #aaa; }
.show-pass { position: absolute; left: 38px; bottom: 12px; cursor: pointer; width: 16px; height: 16px; color: #bbb; background: none; border: 0; padding: 0; }
.remember-row { display: flex; align-items: center; gap: 7px; margin: 10px 0 4px; }
.remember-row input { width: 15px; height: 15px; accent-color: var(--p); cursor: pointer; }
.remember-row label { font-size: 11px; color: #666; cursor: pointer; }
.login-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--p), var(--s));
  color: #fff; border: none; border-radius: 9px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; margin-top: 6px;
}
.login-btn:hover { box-shadow: 0 6px 20px rgba(64, 0, 120, .3); }
.login-error {
  background: #fef2f2; color: #dc2626;
  padding: 9px; border-radius: 7px; font-size: 11px;
  margin-top: 12px; text-align: center; border: 1px solid #fecaca;
}
.login-footer { text-align: center; margin-top: 20px; font-size: 10px; color: #aaa; }

/* --- 3. Header and navigation -------------------------------------------- */

.header {
  background: linear-gradient(135deg, var(--p) 0%, var(--s) 100%);
  color: #fff; padding: 14px 24px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-md);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
}
.header h1 { font-size: 16px; font-weight: 700; }
.header p { font-size: 10px; opacity: .8; }
.btn-group { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.user-info {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; background: rgba(255, 255, 255, .1);
  border-radius: 6px; font-size: 10px;
}
.user-info svg { width: 13px; height: 13px; }
.hbtn {
  padding: 5px 12px; background: rgba(255, 255, 255, .15);
  color: #fff; border: 1.5px solid rgba(255, 255, 255, .3);
  border-radius: 6px; font-family: inherit; font-size: 10px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.hbtn:hover { background: rgba(255, 255, 255, .3); }
.hbtn.danger { background: rgba(239, 68, 68, .2); color: #fca5a5; border-color: rgba(239, 68, 68, .3); }
.hbtn.admin { background: rgba(126, 222, 164, .2); color: #a7f3d0; border-color: rgba(126, 222, 164, .3); }

.mainnav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex; gap: 2px; flex-wrap: wrap;
  position: sticky; top: 58px; z-index: 90;
}
.mainnav a {
  padding: 10px 14px; font-size: 11px; font-weight: 600;
  color: #666; border-bottom: 3px solid transparent; white-space: nowrap;
}
.mainnav a:hover { color: var(--p); background: var(--bg); }
.mainnav a.act { color: var(--p); border-bottom-color: var(--p); }

/* --- 4. Regulations chip bar --------------------------------------------- */

.regs-bar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 10px 24px; display: flex; gap: 6px;
  flex-wrap: wrap; align-items: center;
}
.regs-bar .reg-label { font-size: 10px; font-weight: 700; color: var(--p); margin-left: 6px; white-space: nowrap; }
.reg-chip {
  padding: 4px 10px; border-radius: 14px; font-size: 9px; font-weight: 500;
  background: var(--t); color: var(--p); border: 1px solid transparent; white-space: nowrap;
}
.reg-chip:hover { border-color: var(--p); }
/* Logical property: the gap must sit between the count and the label, which
   under RTL means the inline-end side. */
.reg-chip .rc { font-weight: 700; margin-inline-end: 5px; }

/* --- 5. Stat tiles and progress ------------------------------------------ */

.stats { display: flex; gap: 8px; padding: 12px 24px; flex-wrap: wrap; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 12px 14px;
  flex: 1; min-width: 100px; box-shadow: var(--shadow-sm);
  border-right: 4px solid var(--p); text-align: center;
}
.stat .num { font-size: 22px; font-weight: 700; color: var(--p); }
.stat .lbl { font-size: 9px; color: #666; margin-top: 2px; }
.stat.done { border-color: var(--done); } .stat.done .num { color: var(--done); }
.stat.prog { border-color: var(--prog); } .stat.prog .num { color: var(--prog); }
.stat.notd { border-color: var(--not); } .stat.notd .num { color: var(--not); }
a.stat:hover { box-shadow: 0 3px 12px rgba(64, 0, 120, .12); }

.pb { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin: 4px 24px 0; }
.pf { height: 100%; border-radius: 2px; transition: .5s; background: linear-gradient(90deg, var(--a), var(--done)); }
.pi { padding: 4px 24px; font-size: 10px; color: var(--muted); text-align: center; }

/* --- 6. Filters ---------------------------------------------------------- */

.controls { padding: 8px 24px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search {
  flex: 1; min-width: 160px; padding: 8px 12px;
  border: 2px solid var(--border); border-radius: 7px;
  font-family: inherit; font-size: 12px; outline: none;
}
.search:focus { border-color: var(--s); }
select, .ctl-input {
  padding: 8px 12px; border: 2px solid var(--border); border-radius: 7px;
  font-family: inherit; font-size: 11px; background: var(--card);
  outline: none; cursor: pointer; max-width: 240px;
}
.cats { padding: 0 24px 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.cat-btn {
  padding: 4px 10px; border-radius: 14px; border: 1.5px solid var(--border);
  background: var(--card); font-family: inherit; font-size: 10px;
  cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px;
}
.cat-btn:hover { border-color: var(--s); background: var(--t); }
.cat-btn.act { background: var(--p); color: #fff; border-color: var(--p); }
.cnt { background: rgba(0, 0, 0, .08); padding: 1px 4px; border-radius: 6px; margin-right: 2px; font-size: 8px; }
.cat-btn.act .cnt { background: rgba(255, 255, 255, .2); }

/* --- 7. Requirement list ------------------------------------------------- */

.list { padding: 0 24px 24px; }
.item {
  background: var(--card); border-radius: var(--radius); margin-bottom: 5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03); border: 1px solid var(--border);
}
.item:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
.item-h { padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.item-n {
  background: var(--t); color: var(--p); width: 30px; height: 30px;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.item-i { flex: 1; min-width: 0; }
.item-r { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-a { font-size: 9px; color: var(--muted); margin-top: 1px; }
.item-open { flex-shrink: 0; }
.item-open svg { width: 15px; height: 15px; opacity: .35; }
.item-open:hover svg { opacity: 1; color: var(--p); }

.badge { padding: 3px 8px; border-radius: 4px; font-size: 9px; font-weight: 600; flex-shrink: 0; display: inline-block; }
.badge.s1 { background: #dcfce7; color: #166534; }
.badge.s2 { background: #fef3c7; color: #92400e; }
.badge.s3 { background: #fce7f3; color: #9d174d; }
.badge.s4 { background: #fef3c7; color: #92400e; }
.badge.s5 { background: #fef2f2; color: #dc2626; }

.dep-badge {
  padding: 2px 6px; border-radius: 4px; font-size: 8px; font-weight: 600;
  background: var(--t); color: var(--p); white-space: nowrap;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0;
}
.risk-badge { padding: 2px 6px; border-radius: 4px; font-size: 8px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.risk-badge.rh { background: #fef2f2; color: #dc2626; }
.risk-badge.rm { background: #fef3c7; color: #92400e; }
.risk-badge.rl { background: #ecfdf5; color: #065f46; }

.att-count { background: var(--s); color: #fff; padding: 0 5px; border-radius: 8px; font-size: 8px; font-weight: 700; min-width: 16px; text-align: center; display: inline-block; }
.empty { text-align: center; padding: 40px; color: #999; font-size: 12px; }

/* --- 8. Requirement detail ----------------------------------------------- */

.page { padding: 16px 24px 32px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; }
.panel-title {
  font-size: 12px; font-weight: 700; color: var(--p);
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--t);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.panel-title svg { width: 15px; height: 15px; }
.crumbs { font-size: 10px; color: var(--muted); padding: 12px 24px 0; }
.crumbs a:hover { color: var(--p); text-decoration: underline; }

.fg { display: grid; grid-template-columns: 220px 1fr; gap: 10px; }
.full { grid-column: 1 / -1; }
.dt { font-size: 10px; font-weight: 600; margin-bottom: 3px; display: flex; align-items: center; gap: 4px; }
.dt::before { content: ''; width: 3px; height: 10px; border-radius: 2px; }
.dt.c1 { color: var(--p); } .dt.c1::before { background: var(--p); }
.dt.c2 { color: var(--s); } .dt.c2::before { background: var(--s); }
.dt.c3 { color: #0d9488; } .dt.c3::before { background: #0d9488; }
.dt.c4 { color: #7c3aed; } .dt.c4::before { background: #7c3aed; }
.ea {
  width: 100%; padding: 8px 10px; border: 2px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 11px;
  line-height: 1.7; color: #444; background: var(--bg);
  resize: vertical; outline: none; direction: rtl;
}
.ea:focus { border-color: var(--s); background: #fff; }
.ea.art { min-height: 38px; font-weight: 600; color: var(--p); font-size: 12px; resize: none; }
.ea.mech { min-height: 60px; }
.ea.reg { min-height: 90px; background: #f0fdf4; border-color: #bbf7d0; }
.ea.reg:focus { border-color: #22c55e; background: #fff; }
.ea.det { min-height: 60px; }
.ea[readonly] { opacity: .55; cursor: not-allowed; background: #f1f1f1; }
.field-locked { font-size: 8px; color: #b45309; background: #fef3c7; padding: 1px 5px; border-radius: 3px; font-weight: 600; }

.sr { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sr select { font-size: 10px; padding: 5px 10px; }
.sr label { font-size: 10px; color: var(--muted); }

.meta-row { display: flex; flex-wrap: wrap; gap: 14px; font-size: 9px; color: var(--muted); margin-top: 8px; }
.meta-row b { color: #555; font-weight: 600; }

/* --- 9. Evidence --------------------------------------------------------- */

.ev-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ev-item { background: var(--bg); border: 1.5px solid var(--border); border-radius: 7px; padding: 10px 12px; }
.ev-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 8px; }
.ev-num { background: var(--prog); color: #fff; width: 20px; height: 20px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; }
.ev-date input { padding: 3px 7px; border: 1.5px solid var(--border); border-radius: 4px; font-family: inherit; font-size: 9px; outline: none; direction: ltr; width: 130px; }
.ev-del { width: 22px; height: 22px; background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; border-radius: 4px; cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.ev-text {
  width: 100%; padding: 6px 9px; border: 1.5px solid var(--border);
  border-radius: 5px; font-family: inherit; font-size: 10px;
  line-height: 1.6; color: #444; background: #fff;
  resize: vertical; outline: none; min-height: 34px; direction: rtl;
}
.ev-add {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 12px; background: var(--card); border: 2px dashed var(--border);
  border-radius: 7px; cursor: pointer; font-family: inherit;
  font-size: 10px; color: var(--s); font-weight: 600; width: 100%;
}
.ev-add:hover { border-color: var(--s); background: var(--t); }
.ev-add svg { width: 14px; height: 14px; }
.ev-attach-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.ev-attach-btn {
  padding: 4px 10px; background: var(--t); color: var(--p);
  border: 1.5px dashed var(--s); border-radius: 5px;
  font-family: inherit; font-size: 9px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 3px;
}
.ev-attach-btn:hover { background: var(--s); color: #fff; }
.ev-file {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; background: #eff6ff; color: #1d4ed8;
  border: 1px solid #bfdbfe; border-radius: 4px; font-size: 8px; max-width: 200px;
}
.ev-file span.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-file .fsize { color: #64748b; flex-shrink: 0; }
.ev-file-x { color: #dc2626; font-weight: 700; font-size: 10px; cursor: pointer; background: none; border: 0; padding: 0 2px; }

/* --- 10. Action plans ---------------------------------------------------- */

.ap-item { background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; }
.ap-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ap-title { font-size: 11px; font-weight: 600; flex: 1; min-width: 140px; }
.ap-badge { padding: 2px 8px; border-radius: 10px; font-size: 8px; font-weight: 700; }
.ap-badge.ap-new { background: #e0e7ff; color: #3730a3; }
.ap-badge.ap-progress { background: #fef3c7; color: #92400e; }
.ap-badge.ap-done { background: #dcfce7; color: #166534; }
.ap-badge.ap-cancelled { background: #f1f5f9; color: #475569; }
.ap-badge.ap-overdue { background: #fef2f2; color: #dc2626; }
.ap-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 9px; color: var(--muted); margin-top: 6px; }
.ap-progress-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 7px; }
.ap-progress-fill { height: 100%; background: linear-gradient(90deg, var(--a), var(--done)); }
.prio { padding: 1px 6px; border-radius: 4px; font-size: 8px; font-weight: 600; }
.prio.high { background: #fef2f2; color: #dc2626; }
.prio.medium { background: #fef3c7; color: #92400e; }
.prio.low { background: #ecfdf5; color: #065f46; }

/* --- 11. Audit trail ----------------------------------------------------- */

.log-list { display: flex; flex-direction: column; }
.log-entry { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f3f2f8; font-size: 9px; }
.log-entry:last-child { border: none; }
.log-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--s); margin-top: 5px; flex-shrink: 0; }
.log-dot.add { background: var(--done); }
.log-dot.edit { background: var(--prog); }
.log-dot.del { background: var(--not); }
.log-user { font-weight: 600; color: var(--p); white-space: nowrap; }
.log-time { color: #999; direction: ltr; white-space: nowrap; margin-right: auto; }
.log-msg { color: #555; flex: 1; }
.log-count { background: #e0e7ff; color: #3730a3; padding: 0 6px; border-radius: 8px; font-size: 8px; font-weight: 700; }
.log-diff { font-size: 8px; color: #64748b; background: #f8fafc; border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px; margin-top: 3px; white-space: pre-wrap; word-break: break-word; }

/* --- 12. Tables (admin) -------------------------------------------------- */

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--t); color: var(--p); font-size: 9px; font-weight: 600; padding: 8px; text-align: right; white-space: nowrap; }
.data-table td { padding: 8px; font-size: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: #fafaff; }
.table-wrap { overflow-x: auto; }
.perm-check { width: 14px; height: 14px; accent-color: var(--p); cursor: pointer; }
.role-badge { padding: 2px 8px; border-radius: 8px; font-size: 8px; font-weight: 600; }
.role-badge.admin { background: #dcfce7; color: #166534; }
.role-badge.user { background: #dbeafe; color: #1e40af; }
.role-badge.viewer { background: #fef3c7; color: #92400e; }
.pill-off { background: #f1f5f9; color: #64748b; padding: 2px 8px; border-radius: 8px; font-size: 8px; font-weight: 600; }
.pill-on { background: #dcfce7; color: #166534; padding: 2px 8px; border-radius: 8px; font-size: 8px; font-weight: 600; }

.dept-list { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.dept-tag { display: flex; align-items: center; gap: 5px; padding: 5px 10px; background: var(--t); color: var(--p); border-radius: 6px; font-size: 10px; font-weight: 600; }
.dept-tag .dept-x { cursor: pointer; color: #dc2626; font-size: 13px; font-weight: 700; background: none; border: 0; padding: 0; }

/* --- 13. Forms and buttons ----------------------------------------------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 10px; font-weight: 600; color: #555; }
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%; padding: 8px 10px; border: 2px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 11px;
  outline: none; direction: rtl; background: #fff;
}
.form-field textarea { min-height: 70px; resize: vertical; line-height: 1.7; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--s); }
.form-field .err { font-size: 9px; color: #dc2626; }
.form-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.btn {
  padding: 8px 18px; border: none; border-radius: 6px;
  font-family: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: linear-gradient(135deg, var(--p), var(--s)); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(64, 0, 120, .3); }
.btn-solid { background: var(--p); color: #fff; }
.btn-ghost { background: #f3f2f8; color: #555; border: 1px solid var(--border); }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 4px 10px; font-size: 9px; }
.btn svg { width: 14px; height: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- 14. Flash messages, toast, pagination ------------------------------- */

.flash { margin: 12px 24px 0; padding: 10px 14px; border-radius: 8px; font-size: 11px; font-weight: 500; }
.flash.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash.err { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.flash ul { margin: 4px 16px 0; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--p); color: #fff; padding: 8px 20px; border-radius: 7px;
  font-size: 11px; z-index: 400; opacity: 0; transition: .3s; pointer-events: none;
}
.toast.on { opacity: 1; }

.pager { display: flex; gap: 4px; justify-content: center; padding: 14px 0; flex-wrap: wrap; align-items: center; }
.pager a, .pager span {
  padding: 5px 10px; border-radius: 6px; font-size: 10px;
  border: 1px solid var(--border); background: var(--card); color: #555;
}
.pager .cur { background: var(--p); color: #fff; border-color: var(--p); font-weight: 700; }
.pager .disabled { opacity: .4; }
.result-count { font-size: 10px; color: var(--muted); padding: 0 24px 6px; }

/* --- 15. Dashboard charts ------------------------------------------------ */

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 10px; }
.bar-row:hover .bar-label { color: var(--p); }
.bar-label { width: 150px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #555; }
/* Both track and fill are spans inside an <a>, so they need an explicit
   block display — an inline box ignores width and height. */
.bar-track { display: block; flex: 1; height: 14px; background: var(--bg); border-radius: 7px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--s), var(--p)); border-radius: 7px; min-width: 2px; }
.bar-value { width: 34px; text-align: left; font-weight: 700; color: var(--p); flex-shrink: 0; }

/* --- 16. Responsive ------------------------------------------------------ */

@media (max-width: 900px) {
  .fg { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .header { padding: 10px 12px; }
  .mainnav { padding: 0 8px; top: 92px; }
  .stats { padding: 8px 12px; }
  .controls, .cats, .list, .page, .regs-bar { padding-left: 12px; padding-right: 12px; }
  .flash, .result-count { margin-left: 12px; margin-right: 12px; padding-left: 0; padding-right: 0; }
  .pb, .pi { margin-left: 12px; margin-right: 12px; padding-left: 0; padding-right: 0; }
  .dep-badge { max-width: 80px; font-size: 7px; }
  .risk-badge { font-size: 7px; }
  .bar-label { width: 100px; }
  select, .ctl-input { max-width: 100%; flex: 1 1 140px; }
}

@media print {
  .header, .mainnav, .controls, .cats, .form-actions, .btn { display: none !important; }
  body { background: #fff; }
  .panel { break-inside: avoid; border-color: #ccc; }
}
