/*
 * @vantage/ui tasarim belirteçleri. Kaynak gercek: bu dosya; kontrast testi (tests/tokens.test.ts) ciftleri okur.
 * Tema: <html data-theme="light|dark">; yoksa isletim sistemi tercihi (prefers-color-scheme).
 * Yazi tipi: sistem yigini (ag istegi yok, cevrimdisi calisir). Sayilar tabular-nums.
 */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --vt-bg: #f6f4ef;
  --vt-surface: #ffffff;
  --vt-surface-sunken: #ece9e1;
  --vt-text: #1a1d21;
  --vt-text-muted: #4f565d;
  --vt-border: #858b91;
  --vt-border-subtle: #d3cfc4;
  --vt-accent: #0b5a62;
  --vt-accent-hover: #084a51;
  --vt-on-accent: #ffffff;
  --vt-focus: #0b5a62;
  --vt-danger: #a1252b;
  --vt-on-danger: #ffffff;
  --vt-success-bg: #dff3e6;
  --vt-success-text: #12552b;
  --vt-warning-bg: #fdecc8;
  --vt-warning-text: #6b4000;
  --vt-danger-bg: #fbe0e1;
  --vt-danger-text: #8c1d22;
  --vt-info-bg: #dce9fa;
  --vt-info-text: #174580;
  --vt-neutral-bg: #e6e3da;
  --vt-neutral-text: #2b3036;
  --vt-chart-1: #0b5a62;
  --vt-chart-2: #a1252b;
  --vt-chart-3: #6b4000;
  --vt-chart-4: #174580;
  --vt-chart-5: #5b3a8c;
  --vt-chart-6: #3f6b12;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --vt-bg: #121518;
  --vt-surface: #1b1f23;
  --vt-surface-sunken: #0d0f11;
  --vt-text: #eceff2;
  --vt-text-muted: #aab1b8;
  --vt-border: #7a8189;
  --vt-border-subtle: #343a40;
  --vt-accent: #62c5cd;
  --vt-accent-hover: #86d6dc;
  --vt-on-accent: #08171a;
  --vt-focus: #8bd9df;
  --vt-danger: #ff8d92;
  --vt-on-danger: #2a0809;
  --vt-success-bg: #12301e;
  --vt-success-text: #86dca3;
  --vt-warning-bg: #3a2a08;
  --vt-warning-text: #f3bf63;
  --vt-danger-bg: #3d1517;
  --vt-danger-text: #ffa2a6;
  --vt-info-bg: #14283f;
  --vt-info-text: #9cc4f7;
  --vt-neutral-bg: #2a2f35;
  --vt-neutral-text: #dde1e5;
  --vt-chart-1: #62c5cd;
  --vt-chart-2: #ff8d92;
  --vt-chart-3: #f3bf63;
  --vt-chart-4: #9cc4f7;
  --vt-chart-5: #c4a6f2;
  --vt-chart-6: #a8d86f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --vt-bg: #121518;
    --vt-surface: #1b1f23;
    --vt-surface-sunken: #0d0f11;
    --vt-text: #eceff2;
    --vt-text-muted: #aab1b8;
    --vt-border: #7a8189;
    --vt-border-subtle: #343a40;
    --vt-accent: #62c5cd;
    --vt-accent-hover: #86d6dc;
    --vt-on-accent: #08171a;
    --vt-focus: #8bd9df;
    --vt-danger: #ff8d92;
    --vt-on-danger: #2a0809;
    --vt-success-bg: #12301e;
    --vt-success-text: #86dca3;
    --vt-warning-bg: #3a2a08;
    --vt-warning-text: #f3bf63;
    --vt-danger-bg: #3d1517;
    --vt-danger-text: #ffa2a6;
    --vt-info-bg: #14283f;
    --vt-info-text: #9cc4f7;
    --vt-neutral-bg: #2a2f35;
    --vt-neutral-text: #dde1e5;
    --vt-chart-1: #62c5cd;
    --vt-chart-2: #ff8d92;
    --vt-chart-3: #f3bf63;
    --vt-chart-4: #9cc4f7;
    --vt-chart-5: #c4a6f2;
    --vt-chart-6: #a8d86f;
  }
}

:root {
  --vt-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --vt-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --vt-text-xs: 0.8125rem;
  --vt-text-sm: 0.9375rem;
  --vt-text-md: 1rem;
  --vt-text-lg: 1.25rem;
  --vt-text-xl: 1.75rem;
  --vt-space-1: 0.25rem;
  --vt-space-2: 0.5rem;
  --vt-space-3: 0.75rem;
  --vt-space-4: 1rem;
  --vt-space-6: 1.5rem;
  --vt-space-8: 2rem;
  --vt-radius: 0.5rem;
  --vt-radius-sm: 0.3125rem;
  --vt-control-height: 2.75rem;
  --vt-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 4px 14px rgb(0 0 0 / 0.1);
  --vt-motion: 140ms;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --vt-motion: 0ms;
  }
}

/* Bilesen stilleri; yalniz tokens.css degiskenlerini kullanir (tema degisince elle renk yok). */
.vt-root { background: var(--vt-bg); color: var(--vt-text); font-family: var(--vt-font); font-size: var(--vt-text-md); line-height: 1.5; }
.vt-num { font-variant-numeric: tabular-nums; }
.vt-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

:where(.vt-root) :focus-visible,
.vt-btn:focus-visible, .vt-input:focus-visible, .vt-bell__button:focus-visible, .vt-chip:focus-visible,
.vt-table__sort:focus-visible, .vt-details summary:focus-visible { outline: 3px solid var(--vt-focus); outline-offset: 2px; }

.vt-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--vt-space-2); min-height: var(--vt-control-height); min-width: var(--vt-control-height); padding: 0 var(--vt-space-4); border: 1px solid transparent; border-radius: var(--vt-radius); font: inherit; font-weight: 600; cursor: pointer; transition: background-color var(--vt-motion), border-color var(--vt-motion); }
.vt-btn--primary { background: var(--vt-accent); color: var(--vt-on-accent); }
.vt-btn--primary:hover:not(:disabled) { background: var(--vt-accent-hover); }
.vt-btn--secondary { background: var(--vt-surface); color: var(--vt-text); border-color: var(--vt-border); }
.vt-btn--secondary:hover:not(:disabled) { background: var(--vt-surface-sunken); }
.vt-btn--danger { background: var(--vt-danger); color: var(--vt-on-danger); }
.vt-btn--ghost { background: transparent; color: var(--vt-accent); }
.vt-btn--ghost:hover:not(:disabled) { background: var(--vt-surface-sunken); }
.vt-btn:disabled, .vt-btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.vt-btn__spinner { width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: vt-spin 800ms linear infinite; }
@media (prefers-reduced-motion: reduce) { .vt-btn__spinner { animation-duration: 3s; } }
@keyframes vt-spin { to { transform: rotate(360deg); } }

.vt-field { display: grid; gap: var(--vt-space-1); }
.vt-field__label { font-weight: 600; font-size: var(--vt-text-sm); }
.vt-field__hint { color: var(--vt-text-muted); font-size: var(--vt-text-xs); }
.vt-field__error { color: var(--vt-danger-text); font-size: var(--vt-text-xs); font-weight: 600; }
.vt-input { min-height: var(--vt-control-height); padding: 0 var(--vt-space-3); border: 1px solid var(--vt-border); border-radius: var(--vt-radius); background: var(--vt-surface); color: var(--vt-text); font: inherit; width: 100%; box-sizing: border-box; }
.vt-input[aria-invalid="true"] { border-color: var(--vt-danger); border-width: 2px; }
.vt-input:disabled { opacity: 0.6; cursor: not-allowed; }

.vt-badge { display: inline-flex; align-items: center; gap: var(--vt-space-1); padding: 0.125rem var(--vt-space-2); border-radius: 999px; font-size: var(--vt-text-xs); font-weight: 700; }
.vt-badge--neutral { background: var(--vt-neutral-bg); color: var(--vt-neutral-text); }
.vt-badge--success { background: var(--vt-success-bg); color: var(--vt-success-text); }
.vt-badge--warning { background: var(--vt-warning-bg); color: var(--vt-warning-text); }
.vt-badge--danger { background: var(--vt-danger-bg); color: var(--vt-danger-text); }
.vt-badge--info { background: var(--vt-info-bg); color: var(--vt-info-text); }

.vt-table-wrap { overflow-x: auto; border: 1px solid var(--vt-border-subtle); border-radius: var(--vt-radius); background: var(--vt-surface); }
.vt-table-wrap:focus-visible { outline: 3px solid var(--vt-focus); outline-offset: 2px; }
.vt-table { width: 100%; border-collapse: collapse; font-size: var(--vt-text-sm); }
.vt-table caption { text-align: left; font-weight: 700; padding: var(--vt-space-3) var(--vt-space-4); }
.vt-table th, .vt-table td { padding: var(--vt-space-2) var(--vt-space-4); text-align: left; border-top: 1px solid var(--vt-border-subtle); vertical-align: top; }
.vt-table thead th { background: var(--vt-surface-sunken); font-weight: 700; }
.vt-table td.vt-num, .vt-table th.vt-num { text-align: right; }
.vt-table__sort { all: unset; cursor: pointer; display: inline-flex; gap: var(--vt-space-1); align-items: center; font-weight: 700; }
.vt-table__empty { padding: var(--vt-space-6); text-align: center; color: var(--vt-text-muted); }
.vt-skeleton { display: block; height: 1em; border-radius: var(--vt-radius-sm); background: var(--vt-neutral-bg); }

.vt-dialog { border: 1px solid var(--vt-border-subtle); border-radius: var(--vt-radius); background: var(--vt-surface); color: var(--vt-text); padding: 0; max-width: min(36rem, calc(100vw - 2rem)); width: 100%; box-shadow: var(--vt-shadow); }
.vt-dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.vt-dialog__inner { padding: var(--vt-space-6); display: grid; gap: var(--vt-space-4); }
.vt-dialog__title { margin: 0; font-size: var(--vt-text-lg); }
.vt-dialog__actions { display: flex; justify-content: flex-end; gap: var(--vt-space-2); flex-wrap: wrap; }

.vt-toasts { position: fixed; inset-block-end: var(--vt-space-4); inset-inline-end: var(--vt-space-4); display: grid; gap: var(--vt-space-2); max-width: min(24rem, calc(100vw - 2rem)); z-index: 1000; }
.vt-toast { display: flex; gap: var(--vt-space-3); align-items: flex-start; padding: var(--vt-space-3) var(--vt-space-4); background: var(--vt-surface); color: var(--vt-text); border: 1px solid var(--vt-border); border-inline-start-width: 6px; border-radius: var(--vt-radius); box-shadow: var(--vt-shadow); }
.vt-toast--success { border-inline-start-color: var(--vt-success-text); }
.vt-toast--danger { border-inline-start-color: var(--vt-danger); }
.vt-toast--warning { border-inline-start-color: var(--vt-warning-text); }
.vt-toast--info { border-inline-start-color: var(--vt-info-text); }
.vt-toast__body { flex: 1; overflow-wrap: anywhere; }

.vt-bell { position: relative; display: inline-block; }
.vt-bell__button { position: relative; min-height: var(--vt-control-height); min-width: var(--vt-control-height); background: var(--vt-surface); color: var(--vt-text); border: 1px solid var(--vt-border); border-radius: var(--vt-radius); cursor: pointer; font: inherit; }
.vt-bell__count { position: absolute; inset-block-start: -0.4rem; inset-inline-end: -0.4rem; min-width: 1.25rem; padding: 0 0.3rem; border-radius: 999px; background: var(--vt-danger); color: var(--vt-on-danger); font-size: var(--vt-text-xs); font-weight: 700; line-height: 1.25rem; text-align: center; }
.vt-bell__panel { position: absolute; inset-inline-end: 0; margin-top: var(--vt-space-2); min-width: 18rem; max-width: 24rem; background: var(--vt-surface); border: 1px solid var(--vt-border-subtle); border-radius: var(--vt-radius); box-shadow: var(--vt-shadow); padding: var(--vt-space-2); z-index: 900; }
.vt-bell__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--vt-space-1); }
.vt-bell__item { padding: var(--vt-space-2) var(--vt-space-3); border-radius: var(--vt-radius-sm); }
.vt-bell__item[data-unread="true"] { background: var(--vt-info-bg); color: var(--vt-info-text); font-weight: 600; }

.vt-widget { display: grid; gap: var(--vt-space-3); margin-block: var(--vt-space-4); }
.vt-widget__title { margin: 0; font-size: var(--vt-text-md); font-weight: 700; }
.vt-widget__note { color: var(--vt-text-muted); font-size: var(--vt-text-xs); margin: 0; }
.vt-widget--fallback { padding: var(--vt-space-3) var(--vt-space-4); border: 1px dashed var(--vt-border); border-radius: var(--vt-radius); color: var(--vt-text-muted); }
.vt-kpis { display: grid; gap: var(--vt-space-3); grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); margin: 0; padding: 0; list-style: none; }
.vt-kpi { padding: var(--vt-space-4); background: var(--vt-surface); border: 1px solid var(--vt-border-subtle); border-radius: var(--vt-radius); display: grid; gap: var(--vt-space-1); }
.vt-kpi__label { font-size: var(--vt-text-sm); color: var(--vt-text-muted); margin: 0; }
.vt-kpi__value { font-size: var(--vt-text-xl); font-weight: 750; margin: 0; overflow-wrap: anywhere; }
.vt-kpi__sub { font-size: var(--vt-text-xs); color: var(--vt-text-muted); margin: 0; }
.vt-chips { display: flex; flex-wrap: wrap; gap: var(--vt-space-2); margin: 0; padding: 0; list-style: none; }
.vt-chip { min-height: var(--vt-control-height); padding: 0 var(--vt-space-4); border: 1px solid var(--vt-accent); border-radius: 999px; background: var(--vt-surface); color: var(--vt-accent); font: inherit; font-weight: 600; cursor: pointer; }
.vt-chip:hover { background: var(--vt-surface-sunken); }
.vt-funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--vt-space-2); }
.vt-funnel__step { display: grid; gap: var(--vt-space-1); }
.vt-funnel__bar { height: 0.625rem; border-radius: 999px; background: var(--vt-neutral-bg); overflow: hidden; }
.vt-funnel__fill { display: block; height: 100%; background: var(--vt-chart-1); }
.vt-funnel__fill--bottleneck { background: var(--vt-chart-2); }
.vt-chart { width: 100%; height: auto; background: var(--vt-surface); border: 1px solid var(--vt-border-subtle); border-radius: var(--vt-radius); }
.vt-chart text { fill: var(--vt-text-muted); font-size: 11px; }
.vt-legend { display: flex; flex-wrap: wrap; gap: var(--vt-space-3); list-style: none; margin: 0; padding: 0; font-size: var(--vt-text-xs); }
.vt-legend__swatch { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 2px; margin-inline-end: var(--vt-space-1); }
.vt-details summary { cursor: pointer; font-weight: 600; color: var(--vt-accent); min-height: 1.5rem; }
.vt-dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--vt-space-1) var(--vt-space-3); font-size: var(--vt-text-xs); margin: var(--vt-space-2) 0 0; }
.vt-dl dt { color: var(--vt-text-muted); }
.vt-dl dd { margin: 0; overflow-wrap: anywhere; }

.vt-md { overflow-wrap: anywhere; }
.vt-md :where(pre) { overflow-x: auto; background: var(--vt-surface-sunken); padding: var(--vt-space-3); border-radius: var(--vt-radius-sm); font-family: var(--vt-font-mono); font-size: var(--vt-text-sm); }
.vt-md :where(code) { font-family: var(--vt-font-mono); font-size: 0.92em; }
.vt-md :where(a) { color: var(--vt-accent); text-underline-offset: 0.15em; }
.vt-md :where(blockquote) { margin-inline: 0; padding-inline-start: var(--vt-space-4); border-inline-start: 3px solid var(--vt-border-subtle); color: var(--vt-text-muted); }
.vt-md :where(table) { border-collapse: collapse; }
.vt-md :where(th, td) { border: 1px solid var(--vt-border-subtle); padding: var(--vt-space-1) var(--vt-space-3); }

@media (forced-colors: active) {
  .vt-btn, .vt-chip, .vt-input, .vt-badge, .vt-toast { border: 1px solid CanvasText; }
}
