/* nh-contracts-form.css — shared CSS for contracts tile-grid + CRUD modal.
   Used by:
     - /itsmops/clients.html (tab "📑 Contratti" — per-tenant)
     - /itsmops/contracts.html (cross-tenant view)
   Sprint CONTRACTS-IN-CLIENT-S1 (2026-05-30). */

/* ─── Tile grid ─────────────────────────────────────────────────────────── */
.nhcf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.nhcf-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3, #64748b);
  font-style: italic;
  background: var(--surface-2, #f8fafc);
  border: 1px dashed var(--border, #e2e8f0);
  border-radius: 10px;
}
.nhcf-tile {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-left: 4px solid var(--text-3, #94a3b8);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.nhcf-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
}
.nhcf-tile[data-status="active"]     { border-left-color: #16a34a; }
.nhcf-tile[data-status="expiring"]   { border-left-color: #f59e0b; }
.nhcf-tile[data-status="expired"]    { border-left-color: #dc2626; }
.nhcf-tile[data-status="draft"]      { border-left-color: #94a3b8; }
.nhcf-tile[data-status="terminated"] { border-left-color: #7c3aed; }
.nhcf-tile[data-status="renewed"]    { border-left-color: #06b6d4; }

.nhcf-tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.nhcf-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.nhcf-badge-status.active     { background: #dcfce7; color: #166534; }
.nhcf-badge-status.expiring   { background: #fef3c7; color: #92400e; }
.nhcf-badge-status.expired    { background: #fee2e2; color: #991b1b; }
.nhcf-badge-status.draft      { background: #e2e8f0; color: #475569; }
.nhcf-badge-status.terminated { background: #ede9fe; color: #5b21b6; }
.nhcf-badge-status.renewed    { background: #cffafe; color: #155e75; }

.nhcf-tile-id {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 10.5px;
  color: var(--text-3, #64748b);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nhcf-tile-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1, #0f172a);
}
.nhcf-tile-value small {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3, #64748b);
  margin-left: 4px;
}
.nhcf-tile-dates {
  font-size: 11.5px;
  color: var(--text-2, #475569);
}
.nhcf-tile-dates em {
  font-style: normal;
  color: var(--text-3, #64748b);
  font-size: 10.5px;
}
.nhcf-tile-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-3, #64748b);
  flex-wrap: wrap;
}
.nhcf-tile-acct {
  font-size: 11px;
  color: var(--text-2, #475569);
  padding-top: 6px;
  border-top: 1px dashed var(--border, #e2e8f0);
}
.nhcf-tile-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  gap: 4px;
}
.nhcf-tile:hover .nhcf-tile-actions { display: flex; }
.nhcf-tile-actions button {
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #fff);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
}
.nhcf-tile-actions button.del {
  color: #dc2626;
  border-color: #fca5a5;
}

/* ─── Modal (z-index above clients.html drawer; NH #13 no click-outside) ── */
.nhcf-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .60);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* var() with fallback to fixed value (NH Z-INDEX-SCALE: modal-base = 10500) */
  z-index: var(--nh-z-modal-base, 10500);
}
.nhcf-modal-bg.open { display: flex; }
.nhcf-modal {
  background: var(--surface, #fff);
  color: var(--text-1, #0f172a);
  border-radius: 12px;
  padding: 0;
  max-width: 760px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: var(--nh-z-modal-overlay, 11000);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.nhcf-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--surface-2, #f8fafc);
}
.nhcf-modal-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}
.nhcf-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-3, #64748b);
  padding: 4px 8px;
  line-height: 1;
}
.nhcf-modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}
.nhcf-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border, #e2e8f0);
  background: var(--surface-2, #f8fafc);
}
.nhcf-btn {
  padding: 7px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 7px;
  background: var(--surface, #fff);
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-1, #0f172a);
}
.nhcf-btn.primary { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.nhcf-btn.danger  { color: #dc2626; border-color: #dc2626; }

/* Form rows reuse host styles where possible */
.nhcf-form-row { margin-bottom: 12px; }
.nhcf-form-row label {
  display: block;
  font-size: 11px;
  color: var(--text-3, #64748b);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}
.nhcf-form-row input,
.nhcf-form-row select,
.nhcf-form-row textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  background: var(--surface, #fff);
  color: var(--text-1, #0f172a);
  box-sizing: border-box;
}

/* Toast utility (NH #2 loud errors) */
.nhcf-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  z-index: 12000;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.nhcf-toast.err { background: #dc2626; }
.nhcf-toast.ok  { background: #16a34a; }
