/* MacroSnip: styles that exist only in this tool. Shared look: ../../shared/css/style.css */

/* Page shell ---------------------------------------------------------------
   Desktop: a fixed one-screen cockpit. Below 1024px the columns stack and
   the page scrolls normally (the original locked overflow on every screen
   size, which made the app unusable on phones and small laptops). */

html, body { min-height: 100%; }

.app-shell { min-height: 100vh; min-height: 100dvh; }

/* The one-screen cockpit only when the window is tall enough to hold the left
   column; on a shorter window the whole page scrolls instead of cutting a box off. */
@media (min-width: 1024px) and (min-height: 780px) {
  html, body { height: 100%; overflow: hidden; }

  .app-shell { height: 100vh; height: 100dvh; }
}

/* Imported files: one card per email / document, above the text box ------ */

.well-stack { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }

.well-stack > textarea { flex: 1 0 auto; height: auto; }

.well-stack.has-docs > textarea { min-height: 70px; }

.doc-list { display: flex; flex-direction: column; gap: 10px; }

.doc-list[hidden] { display: none; }

.doc-card {
  --accent: #6366f1;
  --accent-soft: #eef2ff;
  position: relative;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 12px 10px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 6px 16px -8px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  animation: doc-card-in 0.28s ease-out;
}

.doc-card--email { --accent: #e11d48; --accent-soft: #fff1f2; }

.doc-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #a855f7));
}

.doc-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

.doc-card__badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 40%, transparent);
}

.doc-card__kind {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.doc-card__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.doc-card__remove {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #94a3b8;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.doc-card__remove:hover,
.doc-card__remove:focus-visible { background: var(--accent-soft); color: var(--accent); }

.doc-card__body {
  margin: 0;
  color: #1e293b;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-card__body.is-open { display: block; }

.doc-card__more {
  margin-top: 4px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
}

.doc-card__more:hover { text-decoration: underline; }

@keyframes doc-card-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .doc-card { animation: none; }
}

.crystal-well-3d.is-drop-target {
  border-color: #6366f1;
  border-style: dashed;
  background: #eef2ff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* Number inputs without spinners in the task list ------------------------- */

.item-hours::-webkit-outer-spin-button,
.item-hours::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.item-hours { -moz-appearance: textfield; appearance: textfield; }

/* =========================================================================
   MACROSNIP
   ========================================================================= */

/* Import --------------------------------------------------------------- */

.import-well { max-height: 210px; }

.import-well.has-docs { max-height: 260px; }

.doc-card__formats {
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: #64748b;
}

.fmt-pill {
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-weight: 600;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10px;
}

/* Library -------------------------------------------------------------- */

.lib-group {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 6px 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4338ca;
  background: linear-gradient(180deg, rgba(248, 250, 253, 0.98) 70%, rgba(248, 250, 253, 0));
}

.lib-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 11px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.lib-row:hover { background: rgba(238, 242, 255, 0.6); }

.lib-row.is-active {
  background: #ffffff;
  border-color: #c7d2fe;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 14px -8px rgba(79, 70, 229, 0.35);
}

.lib-check {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  flex: none;
  accent-color: #4f46e5;
  cursor: pointer;
}

.lib-open { flex: 1; min-width: 0; text-align: left; display: flex; flex-direction: column; gap: 1px; }

.lib-title {
  font-size: 10.5pt;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lib-row.is-active .lib-title { color: #3730a3; }

.lib-meta { display: flex; align-items: center; gap: 5px; font-size: 8.5pt; color: #64748b; }

.lib-sep { color: #cbd5e1; }

.lib-dot { width: 7px; height: 7px; border-radius: 999px; flex: none; }

.lib-dot--ok { background: #10b981; box-shadow: 0 0 0 2px #d1fae5; }

.lib-dot--warn { background: #f59e0b; box-shadow: 0 0 0 2px #fef3c7; }

.lib-dot--error { background: #e11d48; box-shadow: 0 0 0 2px #ffe4e6; }

.bulk-bar {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  font-size: 9pt;
}

.bulk-bar[hidden] { display: none; }

.bulk-btn {
  padding: 2px 7px;
  border-radius: 7px;
  font-weight: 700;
  color: #3730a3;
  font-size: 8.5pt;
  transition: background 0.15s;
}

.bulk-btn:hover { background: #ffffff; }

/* Editor --------------------------------------------------------------- */

.ph-bar { display: flex; flex-wrap: wrap; gap: 3px 4px; }

.ph-chip {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 8pt;
  font-weight: 600;
  color: #3730a3;
  background: linear-gradient(180deg, #ffffff 0%, #eef2ff 100%);
  border: 1px solid #c7d2fe;
  box-shadow: 0 1px 2px rgba(49, 46, 129, 0.08);
  transition: transform 0.12s, box-shadow 0.12s;
}

.ph-chip:hover { transform: translateY(-1px); box-shadow: 0 3px 6px rgba(49, 46, 129, 0.15); }

.ph-chip:active { transform: translateY(0.5px); }

.issue-list { display: flex; flex-direction: column; gap: 4px; max-height: 128px; overflow-y: auto; }

.issue {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border-radius: 9px;
  font-size: 9pt;
  line-height: 1.35;
  border: 1px solid;
}

.issue__icon {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
}

.issue__text { flex: 1; min-width: 0; }

.issue--ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }

.issue--ok .issue__icon { background: #10b981; }

.issue--warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

.issue--warn .issue__icon { background: #f59e0b; }

.issue--error { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }

.issue--error .issue__icon { background: #e11d48; }

.issue--info { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }

.issue--info .issue__icon { background: #6366f1; }

.issue__fix {
  flex: none;
  padding: 1px 8px;
  border-radius: 7px;
  background: #ffffff;
  border: 1px solid currentColor;
  font-weight: 700;
  font-size: 8.5pt;
}

.issue__select {
  flex: none;
  max-width: 150px;
  padding: 1px 4px;
  border-radius: 7px;
  background: #ffffff;
  border: 1px solid #fcd34d;
  font-size: 8.5pt;
  font-weight: 600;
  color: #78350f;
}

/* Channel output -------------------------------------------------------- */

.ch-tabs { display: flex; flex-wrap: wrap; gap: 4px; }

.ch-tab {
  padding: 3px 9px;
  border-radius: 9px;
  font-size: 9pt;
  font-weight: 600;
  color: #475569;
  background: linear-gradient(180deg, #ffffff 0%, #eef2f9 100%);
  border: 1px solid rgba(185, 198, 222, 0.7);
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}

.ch-tab:hover { color: #1e1b4b; }

.ch-tab.is-active {
  color: #ffffff;
  background: linear-gradient(180deg, #535c8b 0%, #3a4267 100%);
  border-color: #6672a8;
  box-shadow: 0 3px 8px rgba(45, 52, 85, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.output-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
  font-size: 9.5pt;
  line-height: 1.55;
  color: #1e293b;
}
