/* ==========================================================================
   Ayklo demo — çekirdek modüller: Multi Channel Dashboard (.dmx-dashboard),
   Konuşma Başlat (.dmx-chat), Soru Kütüphanesi (.dmx-library).
   Yalnız style.css tokenları. Min. yazı: gövde 14 · tablo 14 · küçük etiket 12.
   ========================================================================== */

/* ==========================================================================
   Multi Channel Dashboard
   ========================================================================== */
.dmx-dashboard__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 12px; }
.dmx-dashboard__head .dm-h { margin: 0; }
.dmx-dashboard__period { margin: 0; font-size: 12px; line-height: 16px; color: var(--text-muted); }
.dmx-dashboard__prop { margin-top: 10px; }
.dmx-dashboard__kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1023.98px) { .dmx-dashboard__kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dmx-dashboard .dm-kpi__label { display: inline-flex; align-items: center; gap: 5px; }
.dmx-dashboard__vs { font-weight: 500; color: var(--text-muted); }

.dmx-dashboard__alert { margin-top: 20px; }
.dmx-dashboard__alert .pl-logo { vertical-align: -2px; }
.dmx-dashboard__alert-icon {
  flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--chip-yellow-text); color: var(--mock-surface); font-size: 12px; font-weight: 700; line-height: 1;
}
.dmx-dashboard__alert-link { white-space: nowrap; }

.dmx-dashboard__chips { margin-bottom: 12px; }
.dmx-dashboard__chips .dm-chip { min-height: 34px; }

.dmx-dashboard__chart-card { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--mock-surface); padding: 14px 12px 10px; }
.dmx-dashboard__legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0 4px 8px; font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.dmx-dashboard__key { display: inline-flex; align-items: center; gap: 6px; }
.dmx-dashboard__axis-note { color: var(--text-muted); font-size: 12px; }
.dmx-dashboard__swatch { display: inline-block; flex: none; width: 14px; height: 3px; border-radius: 2px; }
.dmx-dashboard__swatch--spend { background: var(--black-300); }
.dmx-dashboard__swatch--rev { background: var(--accent); }

.dmx-dashboard__chart { position: relative; width: 100%; min-height: 260px; border-radius: var(--radius-md); }
.dmx-dashboard__chart:focus { outline: none; }
.dmx-dashboard__chart:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.dmx-dashboard__svg { display: block; max-width: 100%; overflow: visible; }
.dmx-dashboard__grid { stroke: var(--mock-line); stroke-width: 1; }
.dmx-dashboard__grid.is-base { stroke: var(--border-subtle); }
.dmx-dashboard__tick { fill: var(--text-muted); font-family: var(--font-sans); font-size: 12px; font-variant-numeric: tabular-nums; }
.dmx-dashboard__tick--spend { fill: var(--text-secondary); }
.dmx-dashboard__tick--rev { fill: var(--blue-600); }
.dmx-dashboard__line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.dmx-dashboard__line--spend { stroke: var(--black-300); }
.dmx-dashboard__line--rev { stroke: var(--accent); }
.dmx-dashboard__overlay { fill: transparent; pointer-events: all; cursor: crosshair; }
.dmx-dashboard__cursor { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.dmx-dashboard__dot { stroke: var(--mock-surface); stroke-width: 2; }
.dmx-dashboard__dot--spend { fill: var(--black-300); }
.dmx-dashboard__dot--rev { fill: var(--accent); }
.dmx-dashboard__tip {
  position: absolute; z-index: 3; pointer-events: none;
  display: flex; flex-direction: column; gap: 3px; min-width: 170px;
  padding: 8px 10px; border-radius: var(--radius-md); background: var(--black-200); color: var(--white-100);
  font-size: 12px; line-height: 16px; box-shadow: var(--shadow-5); font-variant-numeric: tabular-nums;
}
.dmx-dashboard__tip-date { font-weight: 700; font-size: 13px; }
.dmx-dashboard__tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.dmx-dashboard__tip-row b { margin-left: auto; padding-left: 10px; font-weight: 600; }
.dmx-dashboard__tip .dmx-dashboard__swatch--spend { background: var(--white-600); }
.dmx-dashboard__tip .dmx-dashboard__swatch--rev { background: var(--blue-300); }
.dmx-dashboard__chart-help { margin: 6px 4px 0; }

/* Kanal tablosu */
.dmx-dashboard__table .dmx-dashboard__row > th { padding: 0; }
.dmx-dashboard__toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px;
  padding: 10px 14px; border: 0; background: none; cursor: pointer; text-align: left;
}
.dmx-dashboard__toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; border-radius: var(--radius-sm); }
.dmx-dashboard__toggle .pl-chip { color: var(--text-primary); }
.dmx-dashboard__caret {
  flex: none; width: 8px; height: 8px; margin: 0 2px 0 1px;
  border-right: 1.5px solid var(--text-tertiary); border-bottom: 1.5px solid var(--text-tertiary);
  transform: rotate(-45deg); transition: transform var(--dur-fast) var(--ease-in-out);
}
.dmx-dashboard__row.is-open .dmx-dashboard__caret { transform: rotate(45deg); }
html.is-still .dmx-dashboard__caret { transition: none; }
.dmx-dashboard__row.is-open > * { background: var(--mock-sunken); }
.dmx-dashboard__detail > td { padding: 4px 14px 16px; background: var(--mock-sunken); white-space: normal; }
.dmx-dashboard__sub-title { display: flex; align-items: center; gap: 6px; margin: 4px 0 8px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--text-secondary); }
.dmx-dashboard__sub-wrap { background: var(--mock-surface); }
.dmx-dashboard__other { font-size: 14px; color: var(--text-tertiary); }
.dmx-dashboard__total > * { font-weight: 600; color: var(--text-primary); background: var(--mock-sunken); border-top: 1px solid var(--border-subtle); }

@media (max-width: 767.98px) {
  .dmx-dashboard__chart-card { padding: 12px 6px 8px; }
  .dmx-dashboard__alert { align-items: flex-start; }
  .dmx-dashboard__alert-link { white-space: normal; text-align: left; }
}

/* ==========================================================================
   Konuşma Başlat
   ========================================================================== */
.dmx-chat { position: relative; display: flex; flex-direction: column; gap: 0; max-width: 860px; margin: 0 auto; }

.dmx-chat__welcome { display: flex; flex-direction: column; align-items: center; padding: 40px 0 24px; text-align: center; }
.dmx-chat__mark { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; border-radius: 12px; background: var(--black-200); color: var(--white-100); }
.dmx-chat__hello { margin: 0 0 6px; font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
.dmx-chat__hint { margin-bottom: 22px; }

.dmx-chat__cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; text-align: left; }
.dmx-chat__card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  min-height: 116px; padding: 14px 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  background: var(--mock-surface); box-shadow: var(--shadow-2); cursor: pointer; text-align: left;
  transition: border-color var(--dur-fast) var(--ease-in-out), background-color var(--dur-fast) var(--ease-in-out);
}
.dmx-chat__card:hover { border-color: var(--border-strong); background: var(--mock-sunken); }
.dmx-chat__card:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.dmx-chat__card[aria-disabled="true"] { opacity: .55; cursor: progress; }
.dmx-chat__card-q { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-primary); }
.dmx-chat__card { justify-content: flex-start; gap: 10px; }
.dmx-chat__card-level {
  align-self: flex-start; padding: 1px 8px; border: 1px solid; border-radius: 999px;
  font-size: 12px; line-height: 18px; font-weight: 600;
}
.dmx-chat__card-level--micro { background: var(--chip-blue-bg); border-color: var(--chip-blue-border); color: var(--chip-blue-text); }
.dmx-chat__card-level--macro { background: var(--chip-green-bg); border-color: var(--chip-green-border); color: var(--chip-green-text); }
.dmx-chat__card-src {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: auto;
  padding-top: 10px; border-top: 1px solid var(--border-subtle);
}
.dmx-chat__card-src .pl-chip { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.dmx-chat__card-src-label { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-tertiary, var(--text-secondary)); }
.dmx-chat__cards--small .dmx-chat__card { min-height: 0; gap: 10px; padding: 10px 12px; box-shadow: none; }

.dmx-chat__thread { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.dmx-chat__thread:empty { display: none; }
.dmx-chat__msg { display: flex; gap: 10px; }
.dmx-chat__msg:focus { outline: none; }
.dmx-chat__msg:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 4px; border-radius: var(--radius-md); }
.dmx-chat__msg--user { justify-content: flex-end; }
.dmx-chat__bubble {
  max-width: min(560px, 85%); margin: 0; padding: 10px 14px; border-radius: 16px 16px 4px 16px;
  background: var(--black-200); color: var(--white-100); font-size: 14px; line-height: 20px; overflow-wrap: anywhere;
}
.dmx-chat__avatar { flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin-top: 2px; border-radius: 8px; background: var(--black-200); color: var(--white-100); }
.dmx-chat__body { flex: 1; min-width: 0; padding: 14px 16px; border: 1px solid var(--border-subtle); border-radius: 4px 16px 16px 16px; background: var(--mock-surface); }
.dmx-chat__thinking { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; line-height: 20px; color: var(--text-tertiary); }
.dmx-chat__fetched { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--mock-line); font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-muted); }
.dmx-chat__fetched .pl-chip { font-size: 12px; }
.dmx-chat__reply { margin: 0 0 12px; font-size: 14px; line-height: 21px; color: var(--text-primary); }
.dmx-chat__reply-cta { margin: 0; }

.dmx-chat__follow { padding-left: 38px; }
.dmx-chat__follow-label { margin: 0 0 8px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-muted); }

.dmx-chat__composer {
  position: sticky; bottom: 0; z-index: 4;
  display: flex; align-items: center; gap: 8px;
  margin-top: 20px; padding: 10px 0 2px;
  background: linear-gradient(to bottom, transparent, var(--mock-surface) 10px);
  /* kaydırma kabının alt dolgusunda içerik görünmesin */
  box-shadow: 0 24px 0 var(--mock-surface);
}
.dmx-chat__input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px;
  border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--mock-surface);
  font: inherit; font-size: 14px; color: var(--text-primary); box-shadow: var(--shadow-2);
}
.dmx-chat__input::placeholder { color: var(--text-muted); }
.dmx-chat__input:focus { outline: none; border-color: var(--focus-ring); }
.dmx-chat__input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.dmx-chat__send { height: 44px; }
.dmx-chat__send[aria-disabled="true"] { opacity: .55; cursor: progress; }

@media (prefers-reduced-motion: no-preference) {
  html:not(.is-still) .dmx-chat__in { animation: dmx-chat-in .32s var(--ease-out) both; }
}
@keyframes dmx-chat-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 1023.98px) {
  .dmx-chat__cards { grid-template-columns: 1fr; }
  .dmx-chat__card { min-height: 0; }
}
@media (max-width: 767.98px) {
  .dmx-chat__welcome { padding: 20px 0 16px; }
  .dmx-chat__hello { font-size: 20px; line-height: 26px; }
  .dmx-chat__msg--bot .dmx-chat__avatar { display: none; }
  .dmx-chat__body { padding: 12px; }
  .dmx-chat__follow { padding-left: 0; }
  .dmx-chat__bubble { max-width: 92%; }
}

/* ==========================================================================
   Soru Kütüphanesi
   ========================================================================== */
.dmx-library { position: relative; }
.dmx-library__subtitle { margin: 0 0 14px; font-size: 14px; line-height: 20px; color: var(--text-muted); }
.dmx-library__filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.dmx-library__chips .dm-chip .pl-logo { width: 14px; height: 14px; }
.dmx-library__chips--sub .dm-chip { min-height: 30px; }
.dmx-library__chips--sub { padding-left: 12px; border-left: 2px solid var(--mock-line); }

.dmx-library__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.dmx-library__search { position: relative; flex: 1 1 260px; max-width: 420px; display: block; }
.dmx-library__search-icon { position: absolute; left: 12px; top: 50%; margin-top: -8px; color: var(--text-muted); pointer-events: none; }
.dmx-library__input {
  width: 100%; height: 38px; padding: 0 12px 0 36px;
  border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--mock-surface);
  font: inherit; font-size: 14px; color: var(--text-primary);
}
.dmx-library__input::placeholder { color: var(--text-muted); }
.dmx-library__input:focus { outline: none; border-color: var(--focus-ring); }
.dmx-library__input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.dmx-library__count { margin: 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

.dmx-library__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dmx-library__cell { display: flex; min-width: 0; }
.dmx-library__card {
  display: flex; flex-direction: column; gap: 10px; width: 100%;
  padding: 14px 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  background: var(--mock-surface); text-align: left; cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-in-out), box-shadow var(--dur-fast) var(--ease-in-out);
}
.dmx-library__card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.dmx-library__card:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.dmx-library__card.is-demo { border-color: var(--chip-green-border); }
.dmx-library__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.dmx-library__sub { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-muted); }
.dmx-library__badges { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.dmx-library__text { flex: 1; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-primary); }
.dmx-library__src { display: flex; flex-wrap: wrap; gap: 4px 10px; padding-top: 10px; border-top: 1px solid var(--mock-line); }
.dmx-library__src .pl-chip { font-size: 12px; line-height: 16px; color: var(--text-tertiary); }

.dmx-library__empty { grid-column: 1 / -1; padding: 36px 16px; border: 1px dashed var(--border-default); border-radius: var(--radius-lg); text-align: center; }
.dmx-library__empty-title { margin: 0 0 4px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text-primary); }

.dmx-library__pop {
  position: absolute; z-index: 15; width: min(320px, 100%); pointer-events: none;
  padding: 12px 14px; border-radius: var(--radius-lg); background: var(--black-200); color: var(--white-100);
  font-size: 13px; line-height: 18px; box-shadow: var(--shadow-5);
}
.dmx-library__pop-title { margin: 0 0 8px; font-size: 13px; line-height: 18px; font-weight: 700; }
.dmx-library__pop-list { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.dmx-library__pop-list dt { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--white-600); }
.dmx-library__pop-list dd { margin: 2px 0 0; }
.dmx-library__pop-src { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.dmx-library__pop-steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
p.dmx-library__pop-src { margin: 0 0 8px; }
.dmx-library__pop-checks { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; list-style: none; font-size: 12px; line-height: 17px; }
.dmx-library__pop-checks li { position: relative; padding-left: 20px; }
.dmx-library__pop-checks li::before {
  content: "✓"; position: absolute; left: 0; top: 1px; display: grid; place-items: center; width: 14px; height: 14px;
  border-radius: 50%; background: var(--chip-green-text); color: var(--white-100); font-size: 9px; font-weight: 800; line-height: 1;
}
.dmx-library__pop .pl-chip { font-size: 12px; color: var(--white-100); }
.dmx-library__pop .pl-logo--cross { color: var(--white-100); }
.dmx-library__pop-foot { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--black-400); font-size: 12px; line-height: 16px; color: var(--white-600); }
@media (prefers-reduced-motion: no-preference) {
  html:not(.is-still) .dmx-library__pop:not([hidden]) { animation: dmx-lib-pop .16s var(--ease-out) both; }
}
@keyframes dmx-lib-pop { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 1199.98px) {
  .dmx-library__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
  .dmx-library__grid { grid-template-columns: 1fr; }
  .dmx-library__chips {
    flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 2px 14px 6px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .dmx-library__chips::-webkit-scrollbar { display: none; }
  .dmx-library__chips .dm-chip { flex: none; }
  .dmx-library__chips--sub { margin-left: -14px; border-left: 0; }
  .dmx-library__search { max-width: none; }
}
