.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
}
.modal.hidden { display: none; }
.modal img {
  max-width: 92vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.dialog-card {
  width: min(860px, 96vw);
  border-radius: 18px;
  padding: 22px;
  background: #3f3f3f;
  color: #f5f5f5;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.dialog-title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
}
.dialog-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.6fr;
  gap: 16px;
}
.dialog-grid .full {
  grid-column: 1 / -1;
}
.dialog-card label {
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
}
.dialog-card input {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.14);
  border-radius: 10px;
  font-size: 18px;
  padding: 14px 16px;
}
.dialog-card input::placeholder {
  color: rgba(255,255,255,0.42);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.dialog-actions button {
  min-width: 120px;
}
.dialog-actions .secondary {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.14);
  box-shadow: none;
}
.address-correction-card {
  width: min(880px, 94vw);
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #172033;
  color: #f8fafc;
}
.address-correction-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.address-correction-body label {
  color: rgba(226, 232, 240, 0.86);
}
.address-correction-card.preview-ready .address-correction-input {
  display: none;
}
.address-correction-body textarea {
  width: 100%;
  min-height: 150px;
  max-height: 220px;
  resize: vertical;
  background: #f8fafc;
  color: #111827;
  border-color: rgba(148, 163, 184, 0.42);
  -webkit-text-fill-color: #111827;
}
.address-correction-result {
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: #111827;
  max-height: 340px;
  overflow-y: auto;
  padding: 14px 16px;
}
.address-correction-result .validation-row {
  color: #1f2937;
  padding: 8px 0;
  margin: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}
.address-correction-result .validation-row:last-child {
  border-bottom: 0;
}
.address-correction-result .validation-row strong {
  color: #0f172a;
  display: block;
  margin-bottom: 3px;
}
.address-correction-result .validation-row span {
  color: #334155;
}
.address-correction-result .validation-row.bad {
  background: #fef2f2;
  color: #7f1d1d;
  margin: -2px -4px 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border-bottom: 0;
}
.address-correction-result .validation-row.bad strong {
  color: #7f1d1d;
  margin-bottom: 0;
}
#addressCorrectionResult.address-correction-result {
  background: #ffffff;
  color: #111827;
  border-color: rgba(15, 23, 42, 0.16);
}
#addressCorrectionResult.address-correction-result .validation-row {
  color: #1f2937;
  background: transparent;
}
#addressCorrectionResult.address-correction-result .validation-row strong {
  color: #0f172a;
}
#addressCorrectionResult.address-correction-result .validation-row span {
  color: #334155;
}
.address-correction-note-highlight {
  color: #fef08a;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  font-weight: 800;
}
.dialog-status {
  min-height: 20px;
  margin-top: 12px;
  font-size: 13px;
  color: rgba(255,255,255,0.88);
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.34);
  border: 1px solid rgba(255,255,255,0.12);
}
.dialog-status.ok {
  color: #ecfdf5;
  background: rgba(6, 95, 70, 0.72);
  border-color: rgba(110, 231, 183, 0.34);
}
.dialog-status.bad {
  color: #fff7ed;
  background: rgba(154, 52, 18, 0.8);
  border-color: rgba(251, 146, 60, 0.38);
}
.tool-settings-card {
  width: min(640px, 94vw);
  height: min(82vh, 680px);
  border-radius: 28px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}
.tool-settings-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.tool-settings-copy {
  min-width: 0;
}
.tool-settings-copy .dialog-title {
  margin-bottom: 6px;
}
.tool-settings-subtitle {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255,255,255,0.74);
}
.tool-settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tool-settings-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.tool-settings-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 4px;
  background: inherit;
}
.tool-settings-tab {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(15, 23, 42, 0.28);
  color: rgba(255,255,255,0.82);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.tool-settings-tab:hover {
  background: rgba(255,255,255,0.12);
}
.tool-settings-tab.active {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.32), rgba(16, 185, 129, 0.26));
  border-color: rgba(110, 231, 183, 0.3);
  color: #f0fdf4;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.tool-settings-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.tool-settings-panel.active {
  display: flex;
}
.tool-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  cursor: pointer;
}
.tool-setting-copy-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tool-setting-copy-block strong {
  font-size: 14px;
  color: #fff;
}
.tool-setting-desc {
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255,255,255,0.72);
}
.tool-setting-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.26);
  border: 1px solid rgba(255,255,255,0.1);
}
.tool-setting-fields.hidden {
  display: none;
}
.tool-setting-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tool-setting-field label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.84);
}
.tool-setting-field input,
.tool-setting-field textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.72);
  color: #f8fafc;
  border: 1px solid rgba(125, 211, 252, 0.2);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.18);
}
.tool-setting-field textarea {
  min-height: 92px;
  resize: vertical;
}
.tool-setting-field input::placeholder,
.tool-setting-field textarea::placeholder {
  color: rgba(226, 232, 240, 0.56);
}
.tool-setting-field input:focus,
.tool-setting-field textarea:focus {
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.16);
}
.tool-settings-note {
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255,255,255,0.66);
}
.tool-settings-empty {
  padding: 18px 16px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.32);
  border: 1px dashed rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  line-height: 1.5;
}
