/* components.css — buttons, cards, tables, modals, toasts */

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text-primary);
  border: 1px solid var(--border);
  transition: background 0.18s ease, color 0.18s ease, transform 0.10s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
  user-select: none;
  position: relative;
}

.btn:hover {
  background: var(--bg-soft);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(0); }

.btn:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent-strong);
  color: var(--accent-ink);
  border-color: transparent;
}
.btn-primary:hover {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 18px rgba(37,40,64,0.08);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}
.btn-danger:hover {
  background: var(--danger);
  box-shadow: 0 6px 18px rgba(185,28,28,0.3);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-soft);
  border-color: var(--border);
}

.btn-icon {
  /* 44px is the minimum comfortable tap target on a phone; a 36px square
     icon button is a miss-and-retry on the theme toggle at 390px. Keep the
     drawn box at 36px so the toolbar rhythm does not change, and let padding
     carry the extra 8px of touchable area. */
  width: 44px; height: 44px;
  padding: 4px;
  /* The topbar is a nowrap flex row: at 390px a fixed 44px width still gets
     shrunk below the tap-target floor, so pin it against flex-shrink. */
  flex: 0 0 auto;
  min-width: 44px; min-height: 44px;
}

.btn-lg {
  padding: 12px 18px;
  font-size: 14px;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 14px;
  border-radius: 8px;
}

.channel-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.channel-account-actions .btn { min-height: 44px; }

.btn-spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn.loading .btn-spinner { display: inline-block; }
.btn.loading .btn-label  { opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Forms ---- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.field-input,
.field-select,
.field-textarea {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  outline: none;
}

.field-textarea {
  resize: vertical;
  min-height: 88px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--accent);
  background: var(--bg-elev);
  box-shadow: 0 0 0 3px rgb(242 120 69 / 15%);
}

/* Was an inline style on the textarea; moved here so the phone rule at the
   bottom of this file can override it (an inline min-height cannot be). */
.knowledge-editor {
  width: 100%;
  min-height: 480px;
}

.field-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 2px;
}

.login-error {
  display: none;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin: 0 0 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 26%, transparent);
}
.login-error.visible { display: block; }

.login-submit {
  width: 100%;
  margin-top: 6px;
}

/* ---- Cards ---- */

.card {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.12s ease;
}

.card-padded { padding: 22px 24px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.card-head h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
}

/* Stat card */
.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.stat-card .stat-icon {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--bg-soft);
  border-radius: 10px;
  color: var(--accent-strong);
}
.stat-card .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  font-weight: 600;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}
.stat-card .stat-foot {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-card.wa .stat-icon { background: color-mix(in srgb, var(--whatsapp) 14%, transparent); color: var(--whatsapp); }
.stat-card.ig .stat-icon { background: color-mix(in srgb, var(--instagram) 14%, transparent); color: var(--instagram); }
.stat-card.accent .stat-icon { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-strong); }

/* ---- Tables ---- */

.table-wrap {
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-secondary);
  background: var(--bg-soft);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.12s ease, transform 0.12s ease;
  cursor: default;
}

.data-table tbody tr:hover {
  background: var(--table-row-hov);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

@media (min-width: 601px) {
  [data-agenda-table-wrap] .row-actions { gap: 2px; }
  [data-agenda-table-wrap] .data-table th,
  [data-agenda-table-wrap] .data-table td {
    padding-right: 4px;
    padding-left: 4px;
  }
}

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-secondary);
}
.empty-state .emoji { font-size: 30px; display: block; margin-bottom: 6px; }

.call-phone-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  white-space: nowrap;
}

/* ---- Channel chips ---- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-soft);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.chip .chip-emoji { font-size: 14px; }
.chip.chip-wa {
  background: color-mix(in srgb, var(--whatsapp) 12%, transparent);
  color: var(--whatsapp-deep);
  border-color: color-mix(in srgb, var(--whatsapp) 22%, transparent);
}
.chip.chip-ig {
  background: color-mix(in srgb, var(--instagram) 12%, transparent);
  color: var(--instagram);
  border-color: color-mix(in srgb, var(--instagram) 22%, transparent);
}
.chip.chip-web {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--text-secondary);
  border-color: var(--border);
}
[data-theme="dark"] .chip.chip-wa { color: color-mix(in srgb, var(--whatsapp) 80%, black 0%); }
[data-theme="dark"] .chip.chip-ig { color: color-mix(in srgb, var(--instagram) 80%, white 10%); }

.chip-reminder-on {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
}
.chip-reminder-off {
  background: var(--bg-soft);
  color: var(--text-secondary);
}

/* ---- Date picker / navigator ---- */

.date-picker {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.dp-arrow {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.dp-arrow:hover { background: var(--bg-soft); color: var(--text-primary); }
.dp-arrow:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

.dp-current {
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  background: var(--accent-strong);
  color: var(--accent-ink);
  border: 0;
}
.dp-current:hover { background: var(--accent); }
.dp-current:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

.dp-date-display {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ---- Modal ---- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,18,12,0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.visible { display: flex; }

.modal {
  background: var(--bg-elev);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--border);
  animation: modalIn 0.22s cubic-bezier(.2,.8,.2,1);
}

.modal-head {
  padding: 22px 24px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
}

.modal-body { padding: 18px 24px; }
.modal-foot {
  padding: 14px 24px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}

.modal-close {
  /* Same 44px tap-target floor as .btn-icon. This one matters more: it is the
     only way out of the customer detail sheet on a phone. */
  width: 44px; height: 44px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 0.15s ease;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text-primary); }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Login foot elements ---- */

.login-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
  user-select: none;
}
.theme-toggle:hover { background: var(--bg-sunken); transform: translateY(-1px); }
.theme-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.backend-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
}
.status-dot.ok { background: var(--success); box-shadow: 0 0 8px color-mix(in srgb, var(--success) 50%, transparent); }
.status-dot.warn { background: var(--warning); }
.status-dot.off { background: var(--danger); }

/* ---- Toast ---- */

.toast-stack {
  position: fixed;
  bottom: 22px; right: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  max-width: 360px;
}

.toast {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toastIn 0.25s cubic-bezier(.2,.8,.2,1);
  border-left: 3px solid var(--accent);
}
.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast .toast-title { font-weight: 600; margin-bottom: 2px; }
.toast .toast-body { color: var(--text-secondary); font-size: 12px; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Toolbar above tables ---- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar .search {
  flex: 1 1 240px;
  position: relative;
  min-width: 200px;
}
.toolbar .search input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 14px;
  outline: none;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}
.toolbar .search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(242 120 69 / 15%);
}
.toolbar .search .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}
.filter-pill:hover { background: var(--bg-soft); color: var(--text-primary); }
.filter-pill.active {
  background: var(--accent-strong);
  color: var(--accent-ink);
  border-color: transparent;
}

/* time column subtle mono style */
.time-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-primary);
  font-weight: 600;
}

/* Avatar circle for customers */
.avatar-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-strong));
  color: var(--accent-ink);
  letter-spacing: 0.5px;
  flex: 0 0 auto;
}

.customer-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.customer-meta { display: flex; flex-direction: column; gap: 2px; }
.customer-meta .name { font-weight: 600; color: var(--text-primary); }
.customer-meta .sub { font-size: 12px; color: var(--text-secondary); }

/* loader shimmer */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-soft) 0%,
    color-mix(in srgb, var(--bg-soft) 60%, var(--bg-elev)) 50%,
    var(--bg-soft) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.skel-card {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 18px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skel-card .skel-line { height: 14px; width: 100%; }
.skel-card .skel-line.short { width: 50%; }
.skel-card .skel-line.big  { height: 30px; width: 70%; }

/* customers list page specific */
.kv-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  align-items: center;
  font-size: 14px;
}
.kv-grid dt { color: var(--text-secondary); font-size: 12px; }
.kv-grid dd { margin: 0; font-weight: 500; color: var(--text-primary); }


/* ---- Tables on phones ----
   A 4-column table at 390px wraps the patient name to five lines. Below 600px
   each row becomes a stacked block instead; the header row is then noise, so
   it is hidden. Nothing is dropped — .hide-sm already removes the columns that
   do not matter on a phone. */
@media (max-width: 600px) {
  .table-wrap { overflow-x: auto; }

  .data-table thead { display: none; }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }

  .data-table td {
    padding: 2px 0;
    border-bottom: 0;
  }

  .data-table td.time-cell {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.4px;
  }

  .data-table td.right {
    text-align: left;
    margin-top: 8px;
  }

  /* stacked rows put every cell on its own line, so the two chip cells that
     .hide-sm removes from the desktop table share one line instead */
  .data-table td.hide-sm {
    display: inline-block;
    width: auto;
    margin-right: 6px;
  }

  /* the agenda's patient cell repeats "service · location", which the service
     cell right below already says */
  [data-agenda-table-wrap] .customer-meta .sub { display: none; }

  /* thead is hidden on phones, so a bare "1" says nothing. */
  td[data-label]::before { content: attr(data-label) ": "; color: var(--text-muted); }

  /* the loading / empty placeholder is a single full-width cell */
  .data-table td .empty-state { padding: 24px 8px; }
}


/* ---- Touch targets ----
   Measured on a 390px viewport: day arrows 32px, filter pills 31px, the row
   "Iptal" button 27px. A finger needs ~44px, and Iptal is destructive — a
   misfire cancels a customer's appointment. */
@media (max-width: 600px) {
  .btn,
  .filter-pill,
  .dp-arrow,
  .dp-current {
    min-height: 44px;
  }

  /* 40px was still under the 44px floor the comment above sets, and the
     settings page's "Kaydet"/"Geri al" pair is exactly where a miss costs the
     salon its knowledge-base edit. */
  .btn-sm {
    min-height: 44px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .dp-arrow { min-width: 44px; }

  /* the customers search box measured 38px */
  .toolbar .search input { min-height: 44px; }
}


/* ---- Forms on phones ----
   Two fields per line is fine on a laptop; at 390px the selects truncate
   ("Studio Yedi — Mod…"). Also: iOS Safari zooms the whole page when a focused
   input is under 16px, and every field here was 14px. */
.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .field-pair { grid-template-columns: 1fr; }

  .field-input,
  .field-select,
  .field-textarea,
  .toolbar .search input,
  input,
  select,
  textarea {
    font-size: 16px;
  }

  /* single-line flex rows push the page sideways at 390px */
  .card-head,
  .row-8,
  .toolbar { flex-wrap: wrap; }

  .modal { max-height: 92vh; overflow-y: auto; }

  /* The knowledge editor asks for 480px of height. On an 844px phone screen
     that plus the card head buried "Kaydet"/"Geri al" below a full screen of
     scrolling — the operator could not see that their edit had a save button.
     min-height, not max-height: min beats max when the two conflict, so a
     max-height here would be ignored. */
  /* min-height:0 first — min beats max in CSS, so leaving the 480px floor in
     place would make the max-height below a no-op. rows="22" still sets the
     element height; max-height clips it and the textarea scrolls itself. */
  .knowledge-editor { min-height: 0; max-height: 40vh; }
}

/* ---- Staff alerts ----
   Escalations (human handoff, unhandled message, channel down) used to exist
   only as a Telegram push; with no bot configured they reached nobody. This is
   their only surface, so unread ones must read as urgent, not decorative. */
/* .chip sets display:inline-flex, which outranks the [hidden] UA rule. */
.chip[hidden] { display: none; }

.chip-danger {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

.alert-row {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.alert-row:last-child { border-bottom: 0; }
.alert-row.is-read { opacity: 0.55; }
.alert-row .alert-dot {
  width: 8px; height: 8px; border-radius: 999px; margin-top: 6px;
  flex: 0 0 8px; background: var(--text-muted);
}
.alert-row.level-danger  .alert-dot { background: var(--danger); }
.alert-row.level-warning .alert-dot { background: var(--warning); }
.alert-row.level-info    .alert-dot { background: var(--success); }
.alert-row .alert-text { white-space: pre-line; word-break: break-word; }
.alert-row .alert-time { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.assistant-closed-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  padding: 16px 24px;
  background: var(--danger);
  color: var(--danger-ink);
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .01em;
}
.assistant-closed-banner[hidden] { display: none; }
.assistant-warning-line { flex-basis: 100%; }
.call-start-cost-warning {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}
.call-start-error { margin: 0; color: var(--danger); font-size: 13px; }

/* ReplyRez component states, shared in both themes. */
.btn{min-height:44px;font-size:14px;border-color:var(--border-strong)}
.btn-primary,.btn-primary:hover{color:var(--accent-ink);border-color:transparent}.btn-primary:hover{background:var(--accent-hover)}
.btn-danger{color:var(--danger-ink)}.btn-danger:hover{background:var(--danger);color:var(--danger-ink);filter:brightness(.95)}
.btn:focus-visible{outline:3px solid var(--focus-color);outline-offset:3px}
input:not([type=checkbox]):not([type=radio]),select{min-height:48px;border-color:var(--border-strong)}
input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid var(--focus-color);outline-offset:3px}
.icon{stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
.btn:disabled{opacity:1;background:var(--bg-soft);color:var(--text-secondary);border-color:var(--border);box-shadow:none;transform:none}
.btn.loading .btn-label{opacity:1}

input[type=checkbox],input[type=radio]{width:44px;height:44px;min-width:44px;min-height:44px;accent-color:var(--accent);flex-shrink:0}

.sidebar-link:focus-visible{outline:3px solid var(--sidebar-text);outline-offset:3px}
.sidebar-link.btn-ghost:hover,.sidebar-link.btn:disabled{background:rgba(255,255,255,0.05);border-color:transparent;color:var(--sidebar-text)}
.assistant-closed-banner .btn:focus-visible{outline-color:var(--danger-ink)}
.inbox-video-play:focus-visible{outline-color:var(--sidebar-text);box-shadow:0 0 0 9px var(--sidebar-bg)}
.dp-arrow:focus-visible,.dp-current:focus-visible,.modal-close:focus-visible{outline:3px solid var(--focus-color);outline-offset:3px}

.card-head,.row-8{flex-wrap:wrap;gap:12px}

/* ---- Sohbetler (inbox) ---- */

.inbox { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 16px; align-items: start; }
.inbox [hidden] { display: none !important; }
.inbox-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.inbox-item {
  width: 100%; text-align: left; display: grid; gap: 2px;
  padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text-primary); cursor: pointer; font: inherit;
}
.inbox-item:hover { background: var(--bg-soft); }
.inbox-item[aria-current="true"] { border-color: var(--accent); background: var(--bg-soft); box-shadow: inset 3px 0 0 var(--accent); }
.inbox-item:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 2px; }
.inbox-item-name { font-weight: 600; overflow-wrap: anywhere; }
.inbox-item-meta { font-size: 12px; color: var(--text-secondary); }
.inbox-tag { justify-self: start; font-size: 11px; padding: 2px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--text-primary); }
.inbox-status { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }
.inbox-messages { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px;
  max-height: 60vh; overflow-y: auto; }
.inbox-msg { display: grid; gap: 4px; max-width: 85%; padding: 8px 12px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-soft); }
.inbox-msg-out { justify-self: end; background: var(--bg-elev); }
.inbox-msg-head { font-size: 11px; color: var(--text-secondary); }
.inbox-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.inbox-msg-risky { border-color: var(--danger); }
.inbox-msg-flag { font-size: 12px; font-weight: 600; color: var(--danger); }
.inbox-blocked { padding: 10px 12px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--text-primary); }
.inbox-reply { display: grid; gap: 8px; }
.inbox-hint { margin: 0; font-size: 12px; color: var(--text-secondary); }
.inbox-tag-media { background: var(--info-soft); color: var(--info); }
.inbox-msg-tick { color: var(--text-secondary); font-size: 13px; font-weight: 700; }
.inbox-msg-tick.is-read { color: var(--accent-strong); }
.inbox-msg-quote { display: grid; gap: 3px; margin: 0; padding: 7px 9px;
  border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg-elev); font-size: 12px; overflow-wrap: anywhere; }
.inbox-msg-quote-label,.inbox-reply-quote-label { color: var(--text-secondary); font-size: 11px; font-weight: 600; }
.inbox-msg-media { display: grid; gap: 6px; min-width: 44px; }
.inbox-media-thumb { display: block; width: max-content; max-width: 100%; min-width: 44px; min-height: 44px;
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev);
  overflow: hidden; cursor: zoom-in; }
.inbox-media-thumb img { display: block; width: auto; max-width: min(220px, 100%); max-height: 220px; object-fit: cover; }
.inbox-video-preview { position: relative; width: max-content; max-width: 100%; min-width: 44px; min-height: 44px;
  overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: #000; }
.inbox-video-preview video { display: block; max-width: min(220px, 100%); max-height: 220px; }
.inbox-video-play { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  width: 48px; height: 48px; border: 1px solid var(--border); border-radius: 50%;
  color: var(--text-primary); background: var(--bg-elev); cursor: pointer; font-size: 18px; }
.inbox-media-error { display: block; max-width: 280px; color: var(--danger); font-size: 13px; font-weight: 600; }
.inbox-media-error.is-large { color: var(--warning); }
.inbox-msg-caption { padding-top: 2px; }
.inbox-document { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev); }
.inbox-document-details { display: grid; min-width: 0; gap: 2px; }
.inbox-document-name { overflow-wrap: anywhere; font-weight: 600; }
.inbox-document-size { color: var(--text-secondary); font-size: 12px; }
.inbox-document a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px;
  min-height: 44px; flex: 0 0 auto; color: var(--accent-strong); font-weight: 600; }
.inbox-msg-media audio,.inbox-recording-preview audio { display: block; width: min(320px, 100%); min-height: 44px; }
.inbox-msg-reply { justify-self: start; padding: 6px 10px; font-size: 12px; }
.inbox-reply-quote { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); background: var(--bg-soft); }
.inbox-reply-quote p { margin: 2px 0 0; overflow-wrap: anywhere; font-size: 13px; }
.inbox-media-compose { display: grid; gap: 8px; }
.inbox-media-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inbox-recording-timer { min-width: 56px; color: var(--danger); font-variant-numeric: tabular-nums; font-weight: 700; }
.inbox-media-chip,.inbox-recording-preview { display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); }
.inbox-media-chip-name { min-width: 0; overflow-wrap: anywhere; }
.inbox-recording-preview { flex-wrap: wrap; }
.inbox-media-modal { max-width: 900px; }
.inbox-media-lightbox { display: flex; align-items: center; justify-content: center; min-height: 120px; }
.inbox-media-lightbox img,.inbox-media-lightbox video { display: block; max-width: 100%; max-height: 70vh; object-fit: contain; }
@media (max-width: 760px) { .inbox { grid-template-columns: 1fr; } .inbox-msg { max-width: 100%; } }
@media (max-width: 760px) {
  .inbox-media-tools > .btn { flex: 1 1 140px; }
  .inbox-document { align-items: flex-start; }
  .inbox-media-chip,.inbox-recording-preview { align-items: flex-start; }
}
