/* invoice-editor.css — the invoice review/edit dialog and the price list.
 * Own tokens, same palette as invoice-collect.css; the dialog lives on <body>
 * and inherits nothing from the screen under it. Buttons state their own
 * padding because the dashboard's bare `button` rule loads after us.
 */
.crm-ied__back {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 18, 22, .55);
}

.crm-ied {
  --ed-ink: #1d1b1c;
  --ed-muted: #55606c;
  --ed-line: #e2e6dd;
  --ed-card: #ffffff;
  --ed-soft: #f7f9f4;
  --ed-bad: #b42318;
  --ed-go: #d4fb08;
  --ed-goink: #1d1b1c;

  width: min(560px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: var(--ed-card);
  color: var(--ed-ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
  overflow: hidden;
  text-align: start;
}

.crm-ied.is-wide { width: min(760px, 100%); }

:root.dark .crm-ied,
.dark .crm-ied,
[data-theme="dark"] .crm-ied {
  --ed-ink: #e8eaed;
  --ed-muted: #9aa3af;
  --ed-line: #2c3138;
  --ed-card: #1b1e23;
  --ed-soft: #15181c;
  --ed-bad: #fca5a5;
  --ed-go: #d4fb08;
  --ed-goink: #1d1b1c;
}

html.crm-rtl .crm-ied { direction: rtl; }

.crm-ied * { box-sizing: border-box; }

.crm-ied__head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--ed-line); flex-shrink: 0;
}

.crm-ied__title { margin: 0; font-size: 15px; font-weight: 700; flex: 1; }

.crm-ied button { font: inherit; transition-property: color, background-color, border-color, opacity; }

.crm-ied .crm-ied__x {
  border: 0; background: transparent; color: var(--ed-muted);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 8px; border-radius: 8px;
}
.crm-ied .crm-ied__x:hover { background: var(--ed-soft); color: var(--ed-ink); }

.crm-ied__body { padding: 16px 18px; overflow: auto; flex: 1; }

.crm-ied__foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--ed-line);
  background: var(--ed-soft); flex-shrink: 0; flex-wrap: wrap;
}

.crm-ied .crm-ied__go {
  border: 0; border-radius: 8px; padding: 9px 22px;
  font-weight: 700; font-size: 13px; cursor: pointer;
  background: var(--ed-go); color: var(--ed-goink);
}
.crm-ied .crm-ied__go[disabled] { opacity: .5; cursor: default; }

.crm-ied .crm-ied__cancel {
  border: 1px solid var(--ed-line); border-radius: 8px; padding: 8px 18px;
  background: transparent; color: var(--ed-ink); font-size: 13px; cursor: pointer;
}

.crm-ied__note { font-size: 12.5px; color: var(--ed-muted); line-height: 1.7; margin: 0 0 14px; }
.crm-ied__err { font-size: 12.5px; font-weight: 600; color: var(--ed-bad); margin: 0 0 10px; line-height: 1.6; }
.crm-ied__empty { font-size: 12.5px; color: var(--ed-muted); padding: 10px 2px; }

.crm-ied .crm-ied__in {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--ed-line);
  border-radius: 8px;
  background: var(--ed-card);
  color: var(--ed-ink);
  font: inherit;
  font-size: 13px;
  margin: 0;
}
.crm-ied textarea.crm-ied__in { height: auto; min-height: 56px; resize: vertical; }
.crm-ied .crm-ied__in.is-bad { border-color: var(--ed-bad); }
.crm-ied .crm-ied__in:focus { outline: 2px solid color-mix(in srgb, var(--ed-go) 35%, transparent); outline-offset: 0; }

/* the lines */
.crm-ied__lines { display: flex; flex-direction: column; gap: 6px; }

.crm-ied__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 104px 96px 30px;
  gap: 8px;
  align-items: center;
}

.crm-ied__row.is-head {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ed-muted);
  padding: 0 2px 2px;
}

.crm-ied__num { text-align: end; font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.crm-ied__total .crm-ied__num { direction: ltr; }
.crm-ied__amount { font-size: 13px; font-weight: 600; }

.crm-ied .crm-ied__drop {
  width: 30px; height: 30px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--ed-muted); font-size: 18px; line-height: 1; cursor: pointer;
}
.crm-ied .crm-ied__drop:hover { background: var(--ed-soft); color: var(--ed-bad); }

.crm-ied__adders { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }

.crm-ied .crm-ied__add {
  border: 1px dashed var(--ed-line); border-radius: 8px; padding: 7px 14px;
  background: transparent; color: var(--ed-ink); font-size: 13px; font-weight: 600; cursor: pointer;
}
.crm-ied .crm-ied__add:hover { background: var(--ed-soft); }

.crm-ied .crm-ied__pick {
  height: 34px; padding: 4px 10px; min-width: 220px; max-width: 100%;
  border: 1px solid var(--ed-line); border-radius: 8px;
  background: var(--ed-card); color: var(--ed-ink); font: inherit; font-size: 13px;
}

.crm-ied__totals {
  margin: 12px 0 4px auto;
  width: min(300px, 100%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--ed-line);
  padding-top: 8px;
}
html.crm-rtl .crm-ied__totals { margin: 12px auto 4px 0; }

.crm-ied__total { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ed-muted); }
.crm-ied__total.is-strong { color: var(--ed-ink); font-size: 15px; font-weight: 700; }

.crm-ied__meta { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px; margin-top: 14px; }
.crm-ied__field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.crm-ied__label { font-size: 12.5px; font-weight: 600; }
.crm-ied__hint { font-size: 11.5px; color: var(--ed-muted); }

/* the price list */
.crm-ied__plist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }

.crm-ied__prow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 104px 64px 30px;
  gap: 8px;
  align-items: center;
}
.crm-ied__pstatus { grid-column: 1 / -1; font-size: 11.5px; color: var(--ed-muted); min-height: 0; }
.crm-ied__pstatus:empty { display: none; }
.crm-ied .crm-ied__cur { text-align: center; }

@media (max-width: 640px) {
  .crm-ied__back { padding: 0; align-items: flex-end; }
  .crm-ied, .crm-ied.is-wide { width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; }
  .crm-ied__row { grid-template-columns: minmax(0, 1fr) 56px 84px 30px; }
  .crm-ied__row .crm-ied__amount, .crm-ied__row.is-head > :nth-child(4) { display: none; }
  .crm-ied__prow { grid-template-columns: minmax(0, 1fr) 84px 30px; }
  .crm-ied__prow .crm-ied__ptype, .crm-ied__prow .crm-ied__cur { grid-row: 2; }
  .crm-ied__meta { grid-template-columns: minmax(0, 1fr); }
  .crm-ied .crm-ied__pick { min-width: 0; width: 100%; }
}

/* Primary buttons are lime with black words, Facebook blue on hover (owner, 2026-10-04). */
.crm-ied .crm-ied__go:hover:not([disabled]) { background: #1877f2; color: #fff; }

/* The Service/Product choice sits level with the name and price beside it:
   the platform draws those inputs 40px, borderless with a 1px outline
   (owner, 2026-10-04). */
.crm-ied .crm-ied__prow select.crm-ied__in {
  height: 2.5rem; border: 0; background-color: rgba(var(--black-alpha-2));
  outline: 1px solid rgb(var(--border-weak) / 1); outline-offset: 0;
}
/* The platform gives every text input a 16px bottom margin; in this row it
   pushed the choice 8px below its neighbours (owner, 2026-10-04). */
.crm-ied .crm-ied__prow > .crm-ied__in { margin: 0 !important; }
