/* ----------------------------------------------------------------------------
   modal.css — Modals: the shared input/confirm dialogs, the file preview modal (with
   its document, table and image bodies), and the help modal and its two
   entry-point buttons.
   Slice 13 of 16 (see css/tokens.css for the full load order).
   ------------------------------------------------------------------------- */
/* ------------------------------------------------------------ modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: color-mix(in srgb, #000 55%, transparent);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

/* file preview — a large modal with a scrollable document body */
.preview-modal {
  width: min(920px, 100%);
  max-height: min(86vh, 900px);
  display: flex;
  flex-direction: column;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-title {
  margin: 0;
  font-size: 17px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.preview-body {
  margin-top: 14px;
  flex: 1;
  min-height: 200px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.preview-img {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

.preview-frame {
  display: block;
  width: 100%;
  height: min(64vh, 720px);
  border: none;
  background: #fff;
}

.preview-pre {
  margin: 0;
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-doc {
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.55;
}

.preview-doc img { max-width: 100%; }
.preview-doc table { border-collapse: collapse; }
.preview-doc td, .preview-doc th { border: 1px solid var(--border); padding: 4px 8px; }

.preview-sheet-name {
  padding: 10px 14px 4px;
  font-weight: 600;
  font-size: 13px;
}

.preview-table {
  border-collapse: collapse;
  font-size: 12.5px;
  margin: 8px 14px 14px;
}

.preview-table th,
.preview-table td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-table th {
  position: sticky;
  top: 0;
  background: var(--surface);
}

.preview-more { padding: 0 14px 12px; }

.modal h2 {
  margin: 0 0 4px;
}

.modal .row.end {
  justify-content: flex-end;
  margin-top: 8px;
}

/* ---- help: subtle header button ---- */
.help-btn {
  height: 28px;
  width: 28px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.help-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.help-btn svg {
  display: block;
}

/* ---- help: conspicuous call-to-action on the empty chat screen ---- */
.help-cta {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 22px auto 0;
  height: auto;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--grad);
  background-size: 160% 160%;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  box-shadow: var(--shadow-soft);
}

.help-cta svg {
  width: 18px;
  height: 18px;
  display: block;
}

.help-cta:hover {
  filter: brightness(1.06);
}

/* ---- help modal ---- */
.help-modal {
  width: min(560px, 100%);
  position: relative;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}

.help-sub {
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.help-bar {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-bar li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.35;
}

.help-bar strong {
  color: var(--text);
  font-weight: 600;
}

.help-bar-ic {
  flex-shrink: 0;
  height: 30px;
  width: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  display: grid;
  place-items: center;
}

.help-bar-ic svg {
  width: 16px;
  height: 16px;
  display: block;
}

.help-close {
  position: absolute;
  top: 14px;
  right: 14px;
  height: 30px;
  width: 30px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.help-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.help-close svg {
  width: 16px;
  height: 16px;
  display: block;
}

.help-steps {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-step {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.help-num {
  height: 24px;
  width: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.help-ic {
  color: var(--accent);
  display: grid;
  place-items: center;
}

.help-ic svg {
  width: 22px;
  height: 22px;
  display: block;
}

.help-tx {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.35;
}

.help-tx strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 1px;
}

.help-tx em {
  font-style: normal;
  color: var(--text);
  font-weight: 500;
}

.help-tip {
  margin: 14px 0 6px;
  font-size: 12.5px;
  color: var(--muted);
}

