/* ══════════════════════════════════════════════════════════════════
   НОВИЙ ДИЗАЙН КАРТКИ КЛІЄНТА — 3 колонки (2026)
   ══════════════════════════════════════════════════════════════════
   Ліва (240px) — компактна інфо про клієнта
   Центральна (flex) — широкий чат без скролу
   Права (280px) — швидкі дії (нагадування, коментарі)
   ══════════════════════════════════════════════════════════════════ */

.dr-grid {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  gap: 16px;
  margin-top: 16px;
  min-height: calc(100vh - 300px);
}

/* ────────────────────────────────────────────────────────────────
   ЛІВА КОЛОНКА — інформація
   ──────────────────────────────────────────────────────────────── */
.dr-col-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dr-info-card {
  background: var(--ios-card, #fff);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.dr-info-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted2, #64748b);
  margin-bottom: 12px;
}

.dr-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 13px;
}

.dr-info-row:last-child {
  margin-bottom: 0;
}

.dr-info-label {
  color: var(--muted2, #64748b);
  font-weight: 500;
  min-width: 70px;
}

.dr-info-value {
  color: var(--ios-txt, #1c1c1e);
  font-weight: 600;
  text-align: right;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dr-compact-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--ios-bg, #f8fafc);
  color: var(--ios-txt, #1c1c1e);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dr-compact-select:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
}

/* ────────────────────────────────────────────────────────────────
   ЦЕНТРАЛЬНА КОЛОНКА — чат
   ──────────────────────────────────────────────────────────────── */
.dr-col-center {
  display: flex;
  flex-direction: column;
  background: var(--ios-card, #fff);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.dr-chat-header {
  font-size: 16px;
  font-weight: 700;
  color: var(--ios-txt, #1c1c1e);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.dr-chat-box {
  flex: 1;
  overflow-y: auto;
  background: var(--ios-bg, #f8fafc);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  min-height: 400px;
  max-height: calc(100vh - 450px);
}

/* Повідомлення в чаті */
.dr-chat-box .msg {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

.dr-chat-box .msg.in {
  align-items: flex-start;
}

.dr-chat-box .msg.out {
  align-items: flex-end;
}

.dr-chat-box .msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.dr-chat-box .msg.in .msg-bubble {
  background: #fff;
  color: #1c1c1e;
  border: 1px solid var(--border, #e5e7eb);
}

.dr-chat-box .msg.out .msg-bubble {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
}

.dr-chat-box .msg-time {
  font-size: 11px;
  color: var(--muted2, #64748b);
  margin-top: 4px;
  padding: 0 4px;
}

/* ────────────────────────────────────────────────────────────────
   ПРАВА КОЛОНКА — швидкі дії
   ──────────────────────────────────────────────────────────────── */
.dr-col-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dr-action-card {
  background: var(--ios-card, #fff);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.dr-action-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ios-txt, #1c1c1e);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dr-badge {
  background: var(--muted, #e5e7eb);
  color: var(--ios-txt, #1c1c1e);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
}

/* Швидке нагадування */
.dr-rem-quick {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.dr-rem-quick .dr-rem-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--ios-bg, #f8fafc);
}

.dr-rem-quick .dr-rem-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
}

.dr-rem-add {
  width: 36px;
  height: 36px;
  border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dr-rem-add:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.dr-rem-list {
  margin-top: 8px;
}

.dr-rem-item-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.dr-rem-item-compact:last-child {
  border-bottom: none;
}

.dr-rem-chk {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.dr-rem-txt {
  flex: 1;
  color: var(--ios-txt, #1c1c1e);
  line-height: 1.4;
}

.dr-rem-txt.done {
  text-decoration: line-through;
  opacity: 0.5;
}

/* Швидкий коментар */
.dr-com-quick {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.dr-com-quick .dr-com-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--ios-bg, #f8fafc);
}

.dr-com-quick .dr-com-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
}

.dr-com-add {
  width: 36px;
  height: 36px;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dr-com-add:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.dr-com-list {
  margin-top: 8px;
}

.dr-com-item-compact {
  padding: 8px 0;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.dr-com-item-compact:last-child {
  border-bottom: none;
}

.dr-com-txt-compact {
  font-size: 13px;
  color: var(--ios-txt, #1c1c1e);
  line-height: 1.4;
  margin-bottom: 4px;
}

.dr-com-meta-compact {
  font-size: 11px;
  color: var(--muted2, #64748b);
}

/* Журнал активності */
.dr-log-list {
  margin-top: 8px;
}

.dr-log-item-compact {
  padding: 6px 0;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.dr-log-item-compact:last-child {
  border-bottom: none;
}

.dr-log-txt-compact {
  font-size: 12px;
  color: var(--ios-txt, #1c1c1e);
  line-height: 1.4;
  margin-bottom: 3px;
}

.dr-log-meta-compact {
  font-size: 10px;
  color: var(--muted2, #64748b);
}

/* Посилання "Ще..." */
.dr-more {
  font-size: 12px;
  color: #3b82f6;
  font-weight: 600;
  padding: 6px 0;
  cursor: pointer;
  text-align: center;
  transition: color 0.2s ease;
}

.dr-more:hover {
  color: #2563eb;
  text-decoration: underline;
}

/* Кнопка "Детальніше" */
.dr-notes-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

.dr-notes-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* ────────────────────────────────────────────────────────────────
   ВКЛАДКА НОТАТКИ (повна інформація)
   ──────────────────────────────────────────────────────────────── */
.dr-tab-notes {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--ios-bg, #f8fafc);
  z-index: 100;
  overflow-y: auto;
}

.dr-tab-notes.on {
  display: block;
}

.dr-notes-header {
  position: sticky;
  top: 0;
  background: var(--ios-card, #fff);
  padding: 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.dr-back-btn {
  padding: 8px 16px;
  background: var(--ios-bg, #f8fafc);
  color: var(--ios-txt, #1c1c1e);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dr-back-btn:hover {
  background: #fff;
  border-color: #3b82f6;
  color: #3b82f6;
}

.dr-notes-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ios-txt, #1c1c1e);
}

.dr-notes-body {
  padding: 20px;
  max-width: 900px;
  margin: 0 auto;
}

/* ────────────────────────────────────────────────────────────────
   АДАПТИВНІСТЬ (для маленьких екранів)
   ──────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .dr-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dr-col-left,
  .dr-col-right {
    display: none;
  }

  .dr-chat-box {
    min-height: 500px;
  }
}
