
/* -------- Modal (reusable) -------- */
.modal { display:none; position:fixed; inset:0; z-index:999; }
.modal[aria-hidden="false"]{ display:block; }

.modal__backdrop{
position:absolute; inset:0;
background: rgba(0,0,0,.35);
}

.modal__dialog{
position:relative;
width: min(720px, calc(100% - 24px));
margin: 10vh auto 0;
background:#fff;
border:1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow);
padding: 12px;
max-height: calc(100vh - 20vh);
display: flex;
flex-direction: column;
}

.modal__header{
display:flex; align-items:center; justify-content:space-between;
gap: 10px;
padding-bottom: 8px;
border-bottom: 1px solid #eee;
}

.modal__title{ margin:0; font-size: 1.1rem; }
.modal__x{
border:1px solid #d7d7d7;
background:#fff;
border-radius: 10px;
padding: 6px 10px;
cursor:pointer;
}

.modal__body{ 
padding: 12px 2px; 
color:#111; 
overflow-y: auto;
max-height: 60vh; /* safe default */
padding-right: 4px; /* avoids scrollbar overlap */
}
.modal__footer{
display:flex; justify-content:flex-end; gap:10px;
padding-top: 8px;
border-top: 1px solid #eee;
}

.modal__btn{
padding: 10px 14px;
border-radius: 10px;
border: 1px solid #cfcfcf;
background: #f7f7f7;
cursor:pointer;
}
.modal__btn:hover{ background:#f0f0f0; }

.modal__btn--primary{
background:var(--ui-accent); 
color:#fff; 
border-color:var(--ui-accent);
}
.modal__btn--primary:hover{ background:#222; }

.modal__btn--ghost{
background:#fff;
}
.modal__btn--ghost:hover{ background:#f5f5f5; }

/* --- Profile diff (modal) --- */
.diff-summary {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
}

.diff-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.diff-kpi {
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 6px 10px;
  background: #fff;
  font-size: 13px;
}

.diff-kpi b { font-weight: 650; }

.diff-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d7d7d7;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.diff-details {
  margin-top: 10px;
  border-top: 1px solid #eee;
  padding-top: 10px;
}

.diff-section {
  margin: 10px 0 12px;
}

.diff-section-title {
  font-weight: 650;
  margin: 0 0 6px;
  font-size: 14px;
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #eee;
  border-radius: 10px;
  overflow: hidden;
}

.diff-table th,
.diff-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
  font-size: 13px;
}

.diff-table th {
  background: #fafafa;
  color: #111;
  text-align: left;
  font-weight: 650;
}

.diff-table tr:last-child td { border-bottom: none; }

.diff-muted {
  color: #666;
  font-size: 13px;
}


/* -------------------------
   Modal size variants
------------------------- */


.modal--sm .modal__dialog {
  width: min(520px, calc(100% - 24px));
}

.modal--md .modal__dialog {
  width: min(720px, calc(100% - 24px));
}

.modal--lg .modal__dialog {
  width: min(960px, calc(100% - 24px));
}

.modal--xl .modal__dialog {
  width: min(1180px, calc(100% - 24px));
}

.modal--full .modal__dialog {
  width: min(1400px, calc(100% - 24px));
  margin-top: 4vh;
  max-height: 92vh;
}

.modal--tall .modal__body {
  max-height: 78vh;
}

.modal--code .modal__dialog {
  width: min(1180px, calc(100% - 24px));
  margin-top: 5vh;
  max-height: 90vh;
}

.modal--code .modal__body {
  max-height: 78vh;
}

/* -------------------------
   Shared modal layout helpers
------------------------- */

.modal-stack {
  display: grid;
  gap: 12px;
}

.modal-panel {
  border: 1px solid #d8d8d8;
  padding: 12px;
  border-radius: 10px;
  background: #fff;
}

.modal-note {
  color: #666;
  font-size: 13px;
}

.modal-form-row {
  display: grid;
  gap: 6px;
}

.modal-form-row label {
  font-weight: 600;
}

.modal-form-row input,
.modal-form-row select,
.modal-form-row textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #cfcfcf;
  background: #fff;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}


.is-hidden {
  display: none !important;
}