/* ── ITEM CARDS ── */
.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  overflow: hidden;
  transition: box-shadow .15s, border-color .15s, background .2s;
  box-shadow: var(--shadow-sm);
}
.item-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.item-card-head {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 12px;
  align-items: start;
  cursor: pointer;
  user-select: none;
}

.item-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0; margin-top: 2px;
}
.sev-critical .item-num { background: var(--red-light);    color: var(--red);   }
.sev-high     .item-num { background: var(--amber-light);  color: var(--amber); }
.sev-medium   .item-num { background: var(--yellow-light); color: var(--yellow);}
.sev-low      .item-num { background: var(--green-light);  color: var(--green); }

/* Left accent bar */
.sev-critical { border-left: 3px solid var(--red);   }
.sev-high     { border-left: 3px solid var(--amber); }
.sev-medium   { border-left: 3px solid var(--yellow);}
.sev-low      { border-left: 3px solid var(--green); }

.item-title  { font-weight: 600; font-size: 14px; line-height: 1.3; margin-bottom: 3px; }
.item-org    { font-size: 12px; color: var(--text-muted); margin-bottom: 7px; }
.item-note   {
  font-size: 12.5px; color: var(--text-muted);
  border-left: 2px solid var(--border-strong);
  padding-left: 8px; margin-bottom: 8px; line-height: 1.5;
}
.item-actions { display: flex; flex-direction: column; gap: 4px; }
.item-chevron {
  color: var(--text-hint); transition: transform .2s;
  font-size: 18px; line-height: 1; padding-top: 2px;
}
.item-card.open .item-chevron { transform: rotate(180deg); }

/* ── TAGS ── */
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 11px; padding: 2px 8px;
  border-radius: 999px; border: 1px solid;
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 500;
}
.tag-gray  { background: var(--surface-2);    color: var(--text-muted); border-color: var(--border); }
.tag-red   { background: var(--red-light);    color: var(--red);        border-color: var(--red-mid); }
.tag-amber { background: var(--amber-light);  color: var(--amber);      border-color: var(--amber-mid); }
.tag-blue  { background: var(--blue-light);   color: var(--blue);       border-color: #90b8e8; }
.tag-green { background: var(--green-light);  color: var(--green);      border-color: #80c8a0; }

/* ── SEVERITY BADGE ── */
.bsev {
  display: inline-block;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 6px; border-radius: 4px;
  margin-left: 8px; vertical-align: middle;
}
.bsev-critical { background: var(--red-light);    color: var(--red);   }
.bsev-high     { background: var(--amber-light);  color: var(--amber); }
.bsev-medium   { background: var(--yellow-light); color: var(--yellow);}
.bsev-low      { background: var(--green-light);  color: var(--green); }

/* ── ITEM DETAIL PANEL ── */
.item-detail { display: none; border-top: 1px solid var(--border); background: var(--surface-2); }
.item-card.open .item-detail { display: block; }

.detail-tabs {
  display: flex; border-bottom: 1px solid var(--border); padding: 0 16px;
}
.dtab {
  background: none; border: none;
  border-bottom: 2px solid transparent; border-radius: 0;
  padding: 8px 12px; font-size: 12px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  transition: color .15s;
}
.dtab:hover { color: var(--text); background: none; }
.dtab.active { color: var(--blue); border-bottom-color: var(--blue); }

.dpanel { display: none; padding: 16px; }
.dpanel.active { display: block; }

/* ── MODAL ── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200; display: none;
  align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--rl);
  border: 1px solid var(--border);
  width: 540px; max-width: 96vw; max-height: 92vh;
  overflow-y: auto; padding: 24px 26px;
  position: relative;
  box-shadow: var(--shadow-md);
}
.modal h2 { font-size: 16px; font-weight: 700; margin-bottom: 18px; }
.modal-close { position: absolute; top: 14px; right: 14px; }

/* ── COMMUNICATIONS ── */
.comms-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.comm-entry {
  display: grid; grid-template-columns: 28px 1fr auto;
  gap: 10px; align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
}
.comm-icon {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.comm-icon.email    { background: var(--blue-light);  color: var(--blue);  }
.comm-icon.whatsapp { background: #e3f5ea;             color: #1a7a3a;      }
.comm-icon.call     { background: var(--amber-light);  color: var(--amber); }
.comm-icon.meeting  { background: #f0eefa;             color: #6a40c0;      }
.comm-icon.note     { background: var(--surface-2);    color: var(--text-muted); }
[data-theme="dark"] .comm-icon.whatsapp { background: #0d2415; color: #3db870; }
[data-theme="dark"] .comm-icon.meeting  { background: #1a1028; color: #a880f0; }

.comm-body .cd  { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.comm-body .ct  { font-size: 13px; color: var(--text); line-height: 1.4; }
.comm-body .cby { font-size: 11px; color: var(--text-hint); margin-top: 2px; }

.comm-add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px;
}
.form-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin-bottom: 10px;
}
.comm-add-row {
  display: grid; grid-template-columns: 1fr 1fr auto auto;
  gap: 8px; align-items: end;
}

/* ── FILES ── */
.file-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.file-entry {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r); padding: 9px 12px;
}
.file-entry .ficon { font-size: 18px; flex-shrink: 0; }
.file-entry .fname { font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-entry .fmeta { font-size: 11px; color: var(--text-muted); }

.file-drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r); padding: 20px;
  text-align: center; color: var(--text-muted);
  font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s;
  display: block;
}
.file-drop:hover { background: var(--surface); border-color: var(--blue); }
.file-drop input[type=file] { display: none; }
.drop-hint { font-size: 11px; margin-top: 4px; color: var(--text-hint); }

/* ── AUDIT TABLE ── */
.audit-table-wrap { overflow-x: auto; border-radius: var(--rl); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.audit-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.audit-table th {
  background: var(--text); color: var(--bg);
  font-size: 11px; font-weight: 600;
  padding: 9px 12px; text-align: left;
  white-space: nowrap;
}
.audit-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px; vertical-align: top;
}
.audit-table tr:last-child td { border-bottom: none; }
.audit-table tr:hover td { background: var(--surface-2); }
.audit-ts   { color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-user { font-weight: 600; color: var(--blue); }
.audit-action { color: var(--text-muted); font-size: 11px; }
.audit-det  { color: var(--text-muted); font-size: 11px; }
.audit-kv   { display: inline-block; margin-right: 8px; }
.audit-kv b { color: var(--text); font-weight: 600; }

/* login screen uses btn directly */
button.primary { background: var(--blue); color: #fff; border: none; }
button.primary:hover { background: #1a4f8a; }
