/* ── Dialog Overlay ── */
#dialog-overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  z-index: 1500;
}
#dialog-overlay.hidden { display: none; }

/* ── Dialog Base ── */
.dialog {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-dialog);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: var(--shadow-popup);
  z-index: 1600;
  min-width: 340px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
}
.dialog.hidden { display: none; }

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  background: #F5F5F5;
  border-radius: 6px 6px 0 0;
}
.dialog-close {
  width: 22px; height: 22px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.dialog-close:hover { background: #E0E0E0; color: var(--text-primary); }

.dialog-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }

.dialog-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.dtab {
  padding: 6px 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
}
.dtab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.dialog-body label { font-size: 12.5px; color: var(--text-primary); display: flex; flex-direction: column; gap: 4px; }
.dialog-body input[type="text"],
.dialog-body input[type="url"],
.dialog-body input[type="number"],
.dialog-body select {
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 8px;
  font-size: 12.5px;
  outline: none;
  transition: border-color var(--tr);
}
.dialog-body input:focus, .dialog-body select:focus { border-color: var(--border-focus); }

.dialog-options { display: flex; flex-direction: column; gap: 6px; }
.dialog-options label { flex-direction: row; align-items: center; gap: 6px; cursor: pointer; }

.dialog-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.dialog-actions button {
  padding: 5px 14px;
  border-radius: 3px;
  font-size: 12.5px;
  background: var(--accent);
  color: #fff;
  transition: background var(--tr);
}
.dialog-actions button:hover { background: var(--accent-hover); }
.dialog-actions button:first-child { background: #E0E0E0; color: var(--text-primary); }
.dialog-actions button:first-child:hover { background: #D0D0D0; }

#find-status { font-size: 11px; color: var(--text-muted); margin-left: auto; }

.dialog-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.dialog-section { display: flex; flex-direction: column; gap: 8px; }
.dialog-section strong { font-size: 12.5px; color: var(--text-secondary); }

/* Table grid picker */
#table-grid-picker { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#table-grid {
  display: grid;
  grid-template-columns: repeat(10, 20px);
  grid-template-rows: repeat(8, 20px);
  gap: 2px;
}
.tg-cell {
  width: 20px; height: 20px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
  transition: background var(--tr), border-color var(--tr);
}
.tg-cell.hover { background: var(--accent-light); border-color: var(--accent); }
#table-grid-label { font-size: 12px; color: var(--text-secondary); }

/* Drop zone */
#drop-zone {
  border: 2px dashed var(--border);
  border-radius: 6px;
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12.5px;
  transition: border-color var(--tr), background var(--tr);
}
#drop-zone.dragover { border-color: var(--accent); background: var(--accent-light); }
#drop-zone input[type="file"] { display: none; }
#drop-zone button {
  padding: 5px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  font-size: 12.5px;
}
