/* === Admin — Compose & QR & Send Modal === */

/* Compose layout */
.compose-wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 var(--page-padding) 60px;
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: 32px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
}
.panel + .panel { margin-top: 20px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.panel-head h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 24px;
  margin: 0;
}
.panel-head .mono { margin: 0; }

/* Recipient mode buttons */
.recipient-modes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.rmode {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s;
}
.rmode:hover { border-color: var(--line-strong); }
.rmode.active { border-color: var(--text); background: var(--text); color: var(--bg); }
.rmode.active .mono { color: var(--dim); }
.rmode .top {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  margin-bottom: 4px;
}
.rmode .lbl { font-size: 12px; }

/* Recipients list */
.recipients-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg);
}
.recipients-list .rrow {
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.recipients-list .rrow:last-child { border-bottom: 0; }
.recipients-list .rrow .ravg {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sakura-soft), var(--sakura));
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}
.recipients-list .rrow .rmail {
  color: var(--muted);
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
}
.recipients-list .empty-list {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Form fields */
.field-block { margin-bottom: 18px; }
.field-block label.lbl {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.field-block input.txt,
.field-block textarea.txt,
.field-block select.txt {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  resize: vertical;
}
.field-block textarea.txt {
  min-height: 220px;
  line-height: 1.55;
  font-family: var(--font-sans);
}
.field-block input.txt:focus,
.field-block textarea.txt:focus,
.field-block select.txt:focus {
  border-color: var(--sakura);
}
.vars { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.var-chip {
  border: 1px dashed var(--line-strong);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}
.var-chip:hover { background: var(--sakura-pale); border-color: var(--sakura); color: #8a3357; }

/* Preview card */
.preview-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 20px;
}
.preview-toolbar {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.preview-toolbar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sakura);
  box-shadow: 0 0 0 4px rgba(214,103,143,0.15);
}
.preview-toolbar .sw { display: inline-flex; margin-left: auto; gap: 4px; }
.preview-toolbar .sw button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  letter-spacing: 0.06em;
}
.preview-toolbar .sw button.active {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}
.preview-mail {
  padding: 28px 28px 32px;
  font-family: var(--font-sans);
  color: var(--text);
}
.preview-mail .pm-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.preview-mail .pm-meta .row { display: flex; gap: 8px; margin-bottom: 4px; }
.preview-mail .pm-meta .row strong { color: var(--text); font-weight: 600; min-width: 60px; display: inline-block; }
.preview-mail .pm-subject {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 18px;
}
.preview-mail .pm-body { font-size: 14px; line-height: 1.65; white-space: pre-wrap; color: #2a2a2a; }
.preview-mail .pm-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.preview-mail .pm-footer .mark { width: 14px; height: 14px; position: relative; display: inline-block; }
.preview-mail .pm-footer .mark::before,
.preview-mail .pm-footer .mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sakura);
  border-radius: 60% 40% 60% 40% / 50%;
}
.preview-mail .pm-footer .mark::after { transform: rotate(45deg); opacity: 0.6; background: var(--sakura-soft); }
.preview-mail .pm-cycle {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.preview-mail .pm-cycle button {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
}
.preview-mail .pm-cycle button:hover { border-color: var(--line-strong); }

/* Compose footer / actions */
.compose-actions {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.compose-actions .info { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.compose-actions .info strong { color: var(--text); font-weight: 600; }
.compose-actions .right { margin-left: auto; display: flex; gap: 10px; }

/* QR picker */
.qr-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.qr-opt {
  flex: 1;
  min-width: 110px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
}
.qr-opt:hover { border-color: var(--line-strong); }
.qr-opt.active { border-color: var(--text); background: var(--text); color: var(--bg); }
.qr-opt.active .mono { color: var(--dim); }
.qr-opt .amt { font-family: var(--font-serif); font-size: 22px; font-weight: 500; line-height: 1; margin-bottom: 4px; }
.qr-opt .amt .cur { font-size: 13px; opacity: 0.65; margin-left: 4px; }
.qr-opt .lbl { font-size: 11px; }
.qr-opt .lbl[contenteditable] { outline: none; border-radius: 2px; cursor: text; }
.qr-opt .lbl[contenteditable]:focus { background: rgba(128,128,128,0.15); }
.qr-remove {
  display: block;
  margin-top: 8px;
  align-self: flex-end;
  font-size: 15px;
  line-height: 1;
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.1s;
}
.qr-opt:hover .qr-remove { opacity: 0.8; }

/* Custom amount add card */
.qr-add-card {
  flex: 1;
  min-width: 110px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg);
}
.qr-add-amt {
  border: none;
  background: transparent;
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--text);
  outline: none;
  width: 100%;
}
.qr-add-amt::placeholder { color: var(--muted); }
.qr-add-desc {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  color: var(--text);
  outline: none;
  width: 100%;
}
.qr-add-desc::placeholder { color: var(--muted); }
.qr-add-btn {
  align-self: flex-end;
  margin-top: 6px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-add-btn:hover { opacity: 0.75; }

.qr-help { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.qr-help code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

/* QR preview u emailu */
.pm-qr-list { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.pm-qr-list:empty { margin-top: 0; }
.pm-qr {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: center;
}
.pm-qr canvas, .pm-qr .qr-canvas-wrap {
  width: 120px;
  height: 120px;
  background: white;
  border-radius: var(--radius-sm);
  padding: 6px;
  box-shadow: 0 1px 0 var(--line) inset;
}
.pm-qr canvas { padding: 0; }
.pm-qr .qr-canvas-wrap { display: flex; align-items: center; justify-content: center; }
.pm-qr .qr-details { font-size: 12px; line-height: 1.55; color: var(--text); }
.pm-qr .qr-details .ttl {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 6px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  justify-content: space-between;
}
.pm-qr .qr-details .ttl .big-amt {
  font-family: var(--font-serif);
  color: var(--sakura);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.pm-qr .qr-details dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; }
.pm-qr .qr-details dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  align-self: center;
}
.pm-qr .qr-details dd { margin: 0; font-variant-numeric: tabular-nums; }
.pm-qr .qr-details dd.amount { font-weight: 600; }

/* Send-status modal */
.send-modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  padding: 0;
  box-shadow: var(--shadow-overlay);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.send-modal-head { padding: 24px 28px 18px; border-bottom: 1px solid var(--line); }
.send-modal-head .mono { margin-bottom: 4px; }
.send-modal-head h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 28px;
  margin: 4px 0;
  line-height: 1.1;
}
.send-modal-head h2 em { font-style: italic; color: var(--sakura); }
.send-modal-head .sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.send-modal-head .sub .chip {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text);
}
.send-modal-head .sub .chip.ok { background: var(--green-soft); color: #2f5e3c; border-color: transparent; }
.send-modal-head .sub .chip.err { background: #fbe8ea; color: #a3343d; border-color: transparent; }

.send-progress { height: 6px; background: var(--surface-2); position: relative; overflow: hidden; }
.send-progress .bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--sakura), #a04566);
  width: 0%;
  transition: width 0.25s;
}

.send-list { overflow-y: auto; flex: 1; padding: 6px 0; min-height: 200px; }
.send-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.send-row:last-child { border-bottom: 0; }
.send-row .av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sakura-soft), var(--sakura));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.send-row .who { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.send-row .who .nm { font-weight: 500; color: var(--text); }
.send-row .who .em {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.send-row .errnote { font-size: 11px; color: #a3343d; margin-top: 2px; }
.send-row .stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.send-row .stat.pending { background: var(--surface-2); color: var(--muted); }
.send-row .stat.sending { background: var(--sakura-pale); color: #8a3357; }
.send-row .stat.sent { background: var(--green-soft); color: #2f5e3c; }
.send-row .stat.failed { background: #fbe8ea; color: #a3343d; }
.send-row .stat .ico { width: 12px; height: 12px; flex-shrink: 0; }
.send-row .stat .ico.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.send-modal-foot {
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.send-modal-foot .info {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.send-modal-foot .right { margin-left: auto; display: flex; gap: 8px; }

@media (max-width: 1000px) {
  .compose-wrap { grid-template-columns: 1fr; }
  .preview-card { position: static; }
  .recipient-modes { grid-template-columns: 1fr 1fr; }
}
