/* =============================================
   UNIFIED MODAL STYLES — Auditara
   Применяется ко всем модалкам: ds-modal, dok-modal, honViewModal
   ============================================= */

/* ── Overlay ── */
.ds-modal-overlay,
.dok-modal-overlay {
  position: fixed; inset: 0;
  background: var(--shadow-overlay);
  backdrop-filter: blur(6px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.ds-modal-overlay.open,
.dok-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
/* dok-modal-overlay показывается через display:flex, а не классом */
.dok-modal-overlay[style*="flex"] {
  opacity: 1;
  pointer-events: all;
}

/* ── Modal box ── */
.ds-modal,
.dok-modal-box {
  background: var(--card);
  border-radius: 20px;
  border: 1.5px solid var(--border-2);
  border-top: 3px solid var(--brand);
  box-shadow: 0 24px 60px rgba(99,102,241,.15), 0 4px 16px rgba(0,0,0,.10);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  max-height: 90vh;
  transform: translateY(12px);
  transition: transform .2s;
}
.ds-modal-overlay.open .ds-modal,
.dok-modal-overlay[style*="flex"] .dok-modal-box {
  transform: translateY(0);
}

/* ── Header ── */
.ds-modal-head,
.uni-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1.5px solid var(--border-2);
  background: linear-gradient(135deg, rgba(99,102,241,.07) 0%, rgba(139,92,246,.04) 100%);
  flex-shrink: 0;
}
.ds-modal-head h3,
.uni-modal-head h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--fg-2);
  margin: 0;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

/* ── Close button ── */
.ds-modal-close,
.uni-modal-close {
  background: var(--surface-2);
  border: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.ds-modal-close:hover,
.uni-modal-close:hover {
  background: rgba(99,102,241,.12);
  color: var(--brand);
}

/* ── Body ── */
.ds-modal-body,
.uni-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

/* ── Chat messages area ── */
.dok-chat-messages {
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  margin-bottom: 12px;
}

/* ── Chat message ── */
.dok-chat-msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}
.dok-chat-msg.staff { align-items: flex-end; }
.dok-chat-msg.client { align-items: flex-start; }

/* ── Chat bubble ── */
.dok-chat-bubble {
  max-width: 82%;
  padding: 9px 14px;
  border-radius: 14px;
  font-size: .88rem;
  line-height: 1.45;
  word-break: break-word;
}
.dok-chat-msg.staff .dok-chat-bubble {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}
.dok-chat-msg.client .dok-chat-bubble {
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--border-2);
  border-radius: 14px 14px 14px 4px;
}

/* ── Chat meta ── */
.dok-chat-meta {
  font-size: .74rem;
  color: var(--muted);
  margin-top: 4px;
  padding: 0 4px;
}

/* ── Chat input area ── */
.dok-chat-input {
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dok-chat-input:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.dok-chat-textarea {
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  width: 100%;
  color: var(--fg-2);
  font-size: .88rem;
  font-family: inherit;
  min-height: 52px;
}
.dok-chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-2);
}

/* ── Chat send button ── */
.dok-chat-send-btn {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 20px;
  font-weight: 700;
  font-size: .84rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(99,102,241,.35);
  transition: opacity .15s;
}
.dok-chat-send-btn:hover { opacity: .88; }

/* ── Chat waiting status ── */
.dok-chat-waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  font-weight: 600;
  font-size: .88rem;
  margin-top: 4px;
}

/* ── System message in chat ── */
.dok-chat-system {
  text-align: center;
  color: var(--muted);
  font-size: .78rem;
  padding: 6px 12px;
  background: var(--surface-2);
  border-radius: 20px;
  margin: 6px auto;
  max-width: 80%;
}

/* ── Details/summary (счёт) ── */
.uni-modal-body details {
  background: var(--surface);
  border: 1.5px solid rgba(99,102,241,.2);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.uni-modal-body details summary {
  background: rgba(99,102,241,.06);
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: .9rem;
  border-bottom: 1px solid rgba(99,102,241,.12);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.uni-modal-body details[open] summary {
  border-bottom: 1.5px solid rgba(99,102,241,.15);
}

/* ── Chat layout wrappers ── */
.dok-chat-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.dok-chat-footer {
  flex-shrink: 0;
  padding-top: 8px;
}

/* ── ds-form-actions в модалках ── */
.ds-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.ds-btn-cancel {
  flex: 1;
  background: var(--surface-2);
  border: 1.5px solid var(--border-2);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s;
}
.ds-btn-cancel:hover { background: var(--border-2); }
.ds-btn-submit {
  flex: 2;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: .88rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
  transition: opacity .15s;
}
.ds-btn-submit:hover { opacity: .88; }

/* ── Adv detail: history ── */
.adv-history-list { padding: 0 4px; }
.adv-history-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-2);
}
.adv-history-date { flex: 1; font-size: .8rem; color: var(--muted); }
.adv-history-info { flex: 2; font-size: .82rem; }
.adv-history-from { color: var(--muted); }
.adv-history-comment { color: var(--muted); margin-top: 2px; }

/* ── Detail section title ── */
.ds-detail-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 16px 0 8px;
}

/* ── Detail muted / overdue ── */
.ds-detail-muted { color: var(--muted); font-size: .85rem; }
.ds-detail-overdue { color: #ef4444 !important; }

/* ── File action btn ── */
.ds-file-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--brand);
  padding: 2px 6px;
  font-size: .8rem;
  text-decoration: none;
  flex-shrink: 0;
}
.ds-file-action-btn:hover { color: var(--brand-2); }

/* ── No files placeholder ── */
.ds-no-files { color: var(--muted); font-size: .85rem; margin: 0; }

/* ── Chat message number ── */
.dok-msg-num { font-size: .68rem; color: var(--border-2); margin-right: 4px; }

/* ── File size ── */
.ds-file-size { opacity: .5; font-size: .72rem; flex-shrink: 0; }

/* ── ds-detail-muted / overdue ── */
.ds-detail-muted { color: var(--muted); font-size: .85rem; }
.ds-detail-overdue { color: #ef4444 !important; }

/* ── adv history list ── */
.adv-history-item { display:flex; align-items:flex-start; gap:10px; padding:6px 0; border-bottom:1px solid var(--border-2); }
.adv-history-date { flex:1; font-size:.8rem; color:var(--muted); }
.adv-history-change { flex:2; font-size:.82rem; }
.adv-history-from { color:#94a3b8; }
.adv-history-comment { color:var(--muted); margin-top:2px; font-size:.8rem; }

/* ── chat file row (unified: staff + advisor) ── */
.dok-chat-file-row { display:flex; align-items:center; gap:6px; padding:3px 0; }
.dok-chat-file-row .dok-cf-icon { flex-shrink:0; font-size:.8rem; opacity:.7; }
.dok-chat-file-row .dok-cf-name { flex:1; font-size:.78rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dok-chat-file-row .dok-cf-size { opacity:.5; font-size:.72rem; flex-shrink:0; }
.dok-chat-file-row .dok-cf-btn { flex-shrink:0; background:none; border:none; cursor:pointer; color:inherit; padding:2px; font-size:.85rem; }
.dok-chat-file-row .dok-cf-btn-dl { color:#6366f1; }
.dok-chat-file-sep { height:1px; background:currentColor; opacity:.15; margin:6px 0; }
.dok-msg-num { font-size:.68rem; color:#cbd5e1; margin-right:4px; }

/* ── compact modal header (unified: staff + advisor) ── */
.dok-modal-meta { display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; font-size:.75rem; color:var(--muted); margin-top:4px; }
.dok-modal-meta-item { display:flex; align-items:center; gap:4px; }
.dok-modal-meta-item .bi { font-size:.8rem; opacity:.7; }
.dok-modal-meta-overdue { color:#ef4444 !important; }

/* h3 title row: title text + badge inline */
.ds-modal-h3-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; width:100%; }
.ds-modal-h3-row .ds-badge { flex-shrink:0; }





/* ── Modal footer ── */
.ds-modal-footer,
.uni-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1.5px solid var(--border-2);
  flex-shrink: 0;
  background: var(--card);
}

/* ── Wide modal variant ── */
.ds-modal--wide { max-width: 680px; }

/* ── Form grid inside modal body ── */
.ds-form-grid {
  display: grid;
  gap: 14px;
  padding: 4px 0 8px;
}

/* ── Inputs full width ── */
.ds-input { width: 100%; box-sizing: border-box; }

/* ── Textarea ── */
.ds-input--textarea { resize: vertical; }

/* ── Totals box ── */
.ds-totals-box {
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: .9rem;
}
.ds-totals-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--muted-3);
}
.ds-totals-row--total {
  padding: 8px 0 0;
  margin-top: 6px;
  border-top: 1.5px solid var(--border-2);
  font-weight: 800;
  font-size: 1rem;
  color: var(--fg-2);
}

/* ── Confirm Modal ─────────────────────────────────────────────────────────── */
.hon-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--shadow-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.hon-confirm-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.hon-confirm-box {
  background: var(--card);
  border: 1.5px solid var(--border-2);
  border-top: 3px solid var(--c-danger, #ef4444);
  border-radius: 16px;
  padding: 28px 28px 22px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  transform: translateY(12px) scale(.97);
  transition: transform .18s ease, opacity .18s ease;
}
.hon-confirm-overlay.open .hon-confirm-box {
  transform: translateY(0) scale(1);
}
.hon-confirm-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(239,68,68,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--c-danger, #ef4444);
  margin-bottom: 14px;
}
.hon-confirm-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg-2);
  margin-bottom: 8px;
}
.hon-confirm-text {
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.5;
}
.hon-confirm-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Unified modal buttons ── */
.ds-modal-footer .ds-btn-primary,
.ds-modal-footer .ds-btn-secondary,
.ds-modal-footer .ds-btn-success {
  flex-shrink: 0;
  white-space: nowrap;
}
.ds-btn-primary {
  padding: 8px 18px; border-radius: 999px; border: 2px solid #4f46e5;
  background: #4f46e5; color: #fff; font-weight: 600; font-size: .85rem;
  cursor: pointer; transition: background .15s, transform .15s;
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.ds-btn-primary:hover { background: #4338ca; border-color: #4338ca; transform: translateY(-1px); }
.ds-btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.ds-btn-secondary {
  padding: 8px 16px; border-radius: 999px; border: 2px solid var(--border-2);
  background: transparent; color: var(--muted-3); font-weight: 600; font-size: .85rem;
  cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.ds-btn-secondary:hover { border-color: #94a3b8; color: var(--fg-2); }
.ds-btn-success {
  padding: 8px 18px; border-radius: 999px; border: 2px solid #16a34a;
  background: #16a34a; color: #fff; font-weight: 600; font-size: .85rem;
  cursor: pointer; transition: background .15s, transform .15s;
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.ds-btn-success:hover { background: #15803d; border-color: #15803d; transform: translateY(-1px); }
.ds-btn-success:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Compact modal footer buttons ── */
#honClientModalFooter .ds-btn-primary,
#honClientModalFooter .ds-btn-secondary,
#honClientModalFooter .ds-btn-success {
  padding: 6px 14px;
  font-size: .82rem;
  border-width: 1.5px;
}
@media (max-width: 600px) {
  #honClientModalFooter {
    flex-wrap: wrap;
    justify-content: stretch;
  }
  #honClientModalFooter .ds-btn-primary,
  #honClientModalFooter .ds-btn-secondary,
  #honClientModalFooter .ds-btn-success {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
  }
}

/* ── ds-modal base ── */
.ds-modal {
  width: 100%;
  box-sizing: border-box;
}

/* ── Unified modal button style: sharp corners ── */
.ds-modal-footer .ds-btn-primary,
.ds-modal-footer .ds-btn-secondary,
.ds-modal-footer .ds-btn-success,
.ds-modal-footer .ds-btn-danger,
#honClientModalFooter .ds-btn-primary,
#honClientModalFooter .ds-btn-secondary,
#honClientModalFooter .ds-btn-success,
#honClientModalFooter .ds-btn-danger,
#honViewFooter .ds-btn-primary,
#honViewFooter .ds-btn-secondary,
#honViewFooter .ds-btn-danger {
  border-radius: 8px !important;
  padding: 8px 18px;
  font-size: .85rem;
  border-width: 2px;
}

.ds-btn-danger {
  padding: 8px 18px; border-radius: 8px; border: 2px solid #dc2626;
  background: transparent; color: #dc2626; font-weight: 600; font-size: .85rem;
  cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.ds-btn-danger:hover { background: #dc2626; color: #fff; transform: translateY(-1px); }
.ds-btn-danger:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Compact buttons for honClientModalFooter ── */
#honClientModalFooter .ds-btn-primary,
#honClientModalFooter .ds-btn-secondary,
#honClientModalFooter .ds-btn-success,
#honClientModalFooter .ds-btn-danger {
  border-radius: 8px !important;
  padding: 6px 12px !important;
  font-size: .78rem !important;
  border-width: 1.5px !important;
  flex: 1;
}
