/* Yeniden kullanılabilir bileşenler */

/* Düğmeler */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.25rem; padding: .4rem .9rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--card); color: var(--foreground); font-weight: 550; font-size: .9rem; text-decoration: none; line-height: 1.2;
  box-shadow: var(--shadow-card); transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast); white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--accent); border-color: color-mix(in oklch, var(--primary) 35%, var(--border)); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: linear-gradient(135deg, var(--primary), color-mix(in oklch, var(--primary) 70%, var(--accent-2))); color: var(--primary-foreground); border-color: transparent; }
.btn--primary:hover:not(:disabled) { background: linear-gradient(135deg, color-mix(in oklch, var(--primary) 88%, white), var(--primary)); color: var(--primary-foreground); }
.btn--danger { color: var(--destructive); }
.btn--danger:hover:not(:disabled) { background: color-mix(in oklch, var(--destructive) 10%, var(--card)); border-color: var(--destructive); }
.btn--ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn--sm { min-height: 1.9rem; padding: .2rem .6rem; font-size: .82rem; }
.btn--lg { min-height: 2.75rem; padding: .6rem 1.3rem; font-size: 1rem; }
.btn svg { flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: .75rem; border: 1px solid var(--border);
  background: var(--card); color: var(--foreground); box-shadow: var(--shadow-card); }
.icon-btn:hover { background: var(--accent); }
.chip-btn { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: .2rem .7rem; font-size: .82rem; font-weight: 500; }
.chip-btn:hover { background: var(--accent); border-color: var(--primary); }

/* Form alanları */
input[type="text"], input[type="number"], input[type="search"], input[type="password"], input[type="file"], select, textarea {
  width: 100%; min-height: 2.25rem; padding: .4rem .65rem; border-radius: calc(var(--radius) * .8); border: 1px solid var(--input); background: var(--card); color: var(--foreground); }
textarea { min-height: 5rem; resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ring); outline-offset: 0; border-color: var(--ring); }
input::placeholder, textarea::placeholder { color: color-mix(in oklch, var(--muted-foreground) 70%, transparent); }
.field { display: grid; gap: .3rem; align-content: start; min-width: 0; }
.field > span, .field__label { font-size: .82rem; font-weight: 600; color: var(--foreground); }
.field small, .help { font-size: .78rem; color: var(--muted-foreground); line-height: 1.4; }
.field .req { color: var(--destructive); margin-left: .15rem; }
.check { display: flex; align-items: flex-start; gap: .5rem; font-size: .88rem; }
.check input { margin-top: .22rem; width: 1rem; height: 1rem; accent-color: var(--primary); flex: none; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.field--wide { grid-column: 1 / -1; }
.form-error { color: var(--destructive); font-size: .88rem; margin: .5rem 0 0; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.segmented button { border: 0; background: transparent; padding: .3rem .8rem; font-size: .84rem; font-weight: 550; border-right: 1px solid var(--border); }
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); }

/* Kartlar, rozetler, bildirimler */
.card { background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.4); box-shadow: var(--shadow-card); padding: 1.1rem 1.25rem; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .08rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--muted); color: var(--muted-foreground); white-space: nowrap; }
.badge--int, .badge--float { background: color-mix(in oklch, var(--c1) 16%, var(--card)); color: var(--accent-foreground); }
.badge--text { background: color-mix(in oklch, var(--c3) 16%, var(--card)); }
.badge--datetime { background: color-mix(in oklch, var(--c4) 22%, var(--card)); }
.badge--bool { background: color-mix(in oklch, var(--c6) 16%, var(--card)); }
.badge--error { background: color-mix(in oklch, var(--destructive) 15%, var(--card)); color: var(--destructive); }
.badge--warn { background: var(--warning); color: var(--warning-foreground); }
.badge--ok { background: color-mix(in oklch, var(--success) 15%, var(--card)); color: var(--success); }
.notice { padding: .65rem .9rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); font-size: .88rem; }
.notice--warn { background: var(--warning); color: var(--warning-foreground); border-color: color-mix(in oklch, var(--warning-foreground) 25%, transparent); }
.notice--error { background: color-mix(in oklch, var(--destructive) 10%, var(--card)); border-color: color-mix(in oklch, var(--destructive) 40%, var(--border)); color: var(--foreground); }
.notice--ok { background: color-mix(in oklch, var(--success) 10%, var(--card)); border-color: color-mix(in oklch, var(--success) 35%, var(--border)); }
.notice ul { margin: .3rem 0 0; padding-left: 1.1rem; }

/* Sekmeler */
.tabs { display: flex; gap: .15rem; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.tabs button { border: 0; background: transparent; padding: .65rem .9rem; font-weight: 550; font-size: .9rem; color: var(--muted-foreground); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--foreground); }
.tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }

/* Tablolar */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); max-width: 100%; }
.table { width: 100%; font-size: .84rem; }
.table th, .table td { padding: .4rem .7rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; max-width: 24rem; overflow: hidden; text-overflow: ellipsis; }
.table th { position: sticky; top: 0; background: var(--surface); font-weight: 650; z-index: 1; }
.table tbody tr:hover td { background: color-mix(in oklch, var(--primary) 5%, var(--card)); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.null { color: var(--muted-foreground); font-style: italic; opacity: .7; }
.table .rownum { color: var(--muted-foreground); text-align: right; font-variant-numeric: tabular-nums; background: var(--surface); position: sticky; left: 0; }

/* Diyalog / yer paylaşımı */
.overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 1rem; background: color-mix(in oklch, var(--foreground) 40%, transparent); backdrop-filter: blur(3px); }
.dialog { width: min(100%, 46rem); max-height: calc(100dvh - 2rem); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.6); box-shadow: var(--shadow-pop); }
.dialog--wide { width: min(100%, 64rem); }
.dialog--narrow { width: min(100%, 30rem); }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.dialog__head h2 { margin: 0; font-size: 1.15rem; }
.dialog__body { padding: 1.1rem 1.25rem; overflow: auto; display: grid; gap: 1rem; }
.dialog__foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.25rem; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* Toast */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 80; display: grid; gap: .5rem; width: min(24rem, calc(100vw - 2rem)); }
.toast { padding: .7rem .9rem; border-radius: var(--radius); background: var(--foreground); color: var(--background); box-shadow: var(--shadow-pop); font-size: .88rem; animation: toast-in var(--dur-base) var(--ease-out); }
.toast--error { background: var(--destructive); color: white; }
.toast--ok { background: var(--success); color: white; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Yükleniyor */
.loading { padding: 2rem; text-align: center; color: var(--muted-foreground); }
.spinner { display: inline-block; width: 1.1rem; height: 1.1rem; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -.2em; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--muted), var(--surface), var(--muted)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); min-height: 1rem; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted-foreground); display: grid; gap: .6rem; justify-items: center; }
.meter { height: .5rem; background: var(--muted); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent-2)); border-radius: 999px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; font-size: .88rem; }
.kv dt { color: var(--muted-foreground); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* Grafikler */
.chart { position: relative; width: 100%; }
.chart__svg { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.chart__legend { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin: .6rem 0 0; padding: 0; font-size: .8rem; color: var(--muted-foreground); }
.chart__legend li { display: inline-flex; align-items: center; gap: .4rem; }
.chart__legend i, .chart__tip i { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; flex: none; }
.chart__legend--list { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); }
.chart__legend b { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--foreground); }
.chart__note { margin: .4rem 0 0; }
.chart__tip { position: absolute; z-index: 5; pointer-events: none; min-width: 9rem; max-width: 18rem; padding: .5rem .65rem; border-radius: .6rem; background: var(--foreground); color: var(--background); font-size: .78rem; box-shadow: var(--shadow-pop); }
.chart__tip strong { display: block; margin-bottom: .25rem; }
.chart__tip-row { display: flex; align-items: center; gap: .4rem; }
.chart__tip-row span { opacity: .8; }
.chart__tip-row b { margin-left: auto; padding-left: .8rem; font-variant-numeric: tabular-nums; }

/* Form oluşturucu parçaları */
.op-form { align-items: start; }
.picker { border: 1px solid var(--input); border-radius: calc(var(--radius) * .8); background: var(--card); overflow: hidden; }
.picker__bar { display: flex; gap: .25rem; padding: .35rem; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; align-items: center; }
.picker__search { flex: 1 1 8rem; min-height: 1.9rem !important; }
.picker__list { max-height: 11rem; overflow: auto; padding: .25rem; display: grid; gap: .1rem; }
.picker__item { display: flex; align-items: center; gap: .5rem; padding: .25rem .45rem; border-radius: .4rem; font-size: .86rem; cursor: pointer; }
.picker__item:hover { background: var(--accent); }
.picker__item.is-on { background: color-mix(in oklch, var(--primary) 9%, var(--card)); }
.picker__item input { accent-color: var(--primary); }
.picker__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker__n { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; border-radius: 999px; background: var(--primary); color: var(--primary-foreground); font-size: .72rem; }
.picker .help { padding: .25rem .6rem .4rem; display: block; }
.editor { display: grid; gap: .5rem; justify-items: start; width: 100%; }
.rows { display: grid; gap: .4rem; width: 100%; }
.row { display: grid; gap: .4rem; align-items: center; }
.row--cond { grid-template-columns: minmax(8rem, 1.2fr) minmax(8rem, 1fr) minmax(6rem, 1fr) minmax(6rem, 1fr) auto; }
.row--cond input[hidden] { display: none; }
.row--sort { grid-template-columns: minmax(8rem, 2fr) minmax(7rem, 1fr) auto; }
.row--agg { grid-template-columns: minmax(8rem, 1fr) minmax(8rem, 1.2fr) minmax(7rem, 1fr) auto; }
.row--pair { grid-template-columns: minmax(6rem, 1fr) auto minmax(8rem, 2fr); }
.pairs { max-height: 18rem; overflow: auto; padding-right: .25rem; }
.pairs__old { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.multi { display: flex; flex-wrap: wrap; gap: .35rem 1rem; }
@media (max-width: 640px) { .row--cond, .row--agg { grid-template-columns: 1fr 1fr; } .row--cond .icon-btn, .row--agg .icon-btn { justify-self: end; } }

/* ---- Yükleme durumları ve geri bildirim ---- */
.top-progress { position: fixed; left: 0; top: 0; right: 0; height: 3px; z-index: 100; transform: scaleX(0); transform-origin: 0 50%; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, var(--primary), var(--accent-2)); box-shadow: 0 0 10px color-mix(in oklch, var(--primary) 60%, transparent); transition: transform .22s ease-out, opacity .25s; }
.top-progress.is-active { opacity: 1; }
.sk-line { display: block; height: .8rem; border-radius: 6px; }
.sk-sm { height: .6rem; } .sk-lg { height: 1.4rem; }
.sk-table td, .sk-table th { padding-block: .65rem; }
.sk-chart { display: flex; align-items: flex-end; padding: 1.2rem; }
.sk-chart__bars { display: flex; align-items: flex-end; gap: .6rem; width: 100%; height: 100%; }
.sk-chart__bars span { flex: 1; border-radius: 6px 6px 0 0; }
.sk-ring { width: 8.2rem; height: 8.2rem; border-radius: 50%; flex: none; }
.spinner--lg { width: 1.8rem; height: 1.8rem; border-width: 3px; flex: none; }
.running { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.25rem; }
.running__time { color: var(--muted-foreground); font-variant-numeric: tabular-nums; font-size: .86rem; }
.running__hint { margin: .2rem 0 0; }
.toast { display: flex; gap: .75rem; align-items: center; }
.toast__text { flex: 1; }
.toast__action { border: 0; background: rgb(255 255 255 / .16); color: inherit; font-weight: 700; padding: .25rem .7rem; border-radius: .5rem; }
.toast__action:hover { background: rgb(255 255 255 / .28); }
.toast__close { border: 0; background: transparent; color: inherit; opacity: .6; padding: .15rem; display: inline-flex; }
.toast__close:hover { opacity: 1; }
.empty__art { display: inline-grid; place-items: center; width: 3.4rem; height: 3.4rem; border-radius: 1rem; color: var(--primary); background: color-mix(in oklch, var(--primary) 10%, var(--card)); border: 1px solid color-mix(in oklch, var(--primary) 22%, var(--border)); }
.empty--error .empty__art { color: var(--destructive); background: color-mix(in oklch, var(--destructive) 10%, var(--card)); border-color: color-mix(in oklch, var(--destructive) 30%, var(--border)); }
.empty__actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.overlay { animation: fade-in var(--dur-base) ease-out; }
.dialog { animation: pop-in var(--dur-base) var(--ease-out); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.panel.is-entering { animation: panel-in 220ms var(--ease-out); }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } }
.fade-in { animation: fade-in var(--dur-base) ease-out; }
.progress { height: .55rem; background: var(--muted); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent-2)); border-radius: 999px; transition: width .2s linear; }
.progress--indeterminate > span { width: 35%; animation: indeterminate 1.1s ease-in-out infinite; }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.pulse-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--success); display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

/* ---- Saklama süresi ---- */
.retention-field { display: grid; gap: .5rem; text-align: left; }
.retention-field__label { display: flex; align-items: center; gap: .4rem; font-size: .84rem; color: var(--muted-foreground); }
.retention-field__label strong { color: var(--foreground); }
.retention-seg button { padding: .3rem .7rem; font-size: .8rem; }
.retention-seg button[aria-checked="true"] { background: var(--primary); color: var(--primary-foreground); }
.retention-card { display: grid; gap: .45rem; padding: .7rem .8rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); font-size: .8rem; }
.retention-card__head { display: flex; align-items: center; gap: .4rem; color: var(--muted-foreground); }
.retention-card__head span { flex: 1; }
.retention-card__row { display: flex; justify-content: space-between; align-items: baseline; }
.retention-card__time { font-variant-numeric: tabular-nums; font-size: .95rem; }
.retention-card.is-low { border-color: var(--destructive); background: color-mix(in oklch, var(--destructive) 6%, var(--card)); }
.retention-card.is-low .retention-card__time { color: var(--destructive); }
.retention-card.is-low .meter > span { background: var(--destructive); }
.retention-list { display: grid; gap: .5rem; }
.retention-option { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.retention-option:has(input:checked) { border-color: var(--primary); background: color-mix(in oklch, var(--primary) 7%, var(--card)); }
.retention-option input { margin-top: .25rem; accent-color: var(--primary); }
.retention-option small { display: block; color: var(--muted-foreground); }

/* ---- Menü ---- */
.menu { position: fixed; z-index: 70; min-width: 13rem; max-width: 20rem; padding: .3rem; border-radius: calc(var(--radius) * 1.2); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-pop); animation: pop-in 140ms var(--ease-out); }
.menu__item { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; border: 0; background: transparent; padding: .45rem .6rem; border-radius: .5rem; font-size: .86rem; }
.menu__item:hover:not(:disabled), .menu__item:focus-visible { background: var(--accent); outline: none; }
.menu__item:disabled { opacity: .45; cursor: not-allowed; }
.menu__item.is-danger { color: var(--destructive); }
.menu__label { flex: 1; }
.menu__icon-gap { width: 15px; flex: none; }
.menu__sep { height: 1px; background: var(--border); margin: .25rem .2rem; }
.menu__heading { padding: .35rem .6rem .15rem; font-size: .68rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted-foreground); }

/* ---- "ise" kural satırları ---- */
.cases { gap: .7rem; }
.case-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(7rem, 11rem) auto auto; gap: .5rem; align-items: center; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: var(--radius); background: color-mix(in oklch, var(--surface) 55%, var(--card)); }
.case-row__if, .case-row__then { font-size: .74rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--primary); font-weight: 700; }
.case-row .editor { gap: 0; }
.case-row .row--cond { grid-template-columns: minmax(7rem, 1.2fr) minmax(7rem, 1fr) minmax(5rem, 1fr) minmax(5rem, 1fr) auto; }
.case-row .row--cond .icon-btn { display: none; }
.case-row [aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); }
@media (max-width: 900px) { .case-row { grid-template-columns: 1fr; } }

/* ---- Komut paleti ---- */
.dialog--palette { width: min(100%, 38rem); align-self: start; margin-top: 10vh; }
.dialog--palette .dialog__head { display: none; }
.dialog--palette .dialog__body { padding: 0; gap: 0; }
.palette__input { border: 0 !important; border-bottom: 1px solid var(--border) !important; border-radius: 0 !important; padding: 1rem 1.2rem !important; font-size: 1.05rem; background: transparent; }
.palette__input:focus-visible { outline: none; box-shadow: none; }
.palette__list { max-height: min(24rem, 55vh); overflow: auto; padding: .4rem; }
.palette__group { padding: .5rem .7rem .2rem; font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-foreground); }
.palette__item { display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left; border: 0; background: transparent; padding: .5rem .7rem; border-radius: .55rem; font-size: .9rem; }
.palette__item.is-active { background: color-mix(in oklch, var(--primary) 12%, var(--card)); }
.palette__label { flex: 1; min-width: 0; display: grid; }
.palette__label small { color: var(--muted-foreground); font-size: .74rem; }
.palette__badge { font-size: .68rem; color: var(--muted-foreground); border: 1px solid var(--border); border-radius: 999px; padding: .05rem .5rem; }
.palette__empty { padding: 1.2rem; text-align: center; }
.shortcuts td:first-child { white-space: nowrap; }
.shortcuts kbd { margin-left: 0; }
.chart__title { margin: 0 0 .5rem; font-size: 1.05rem; text-align: center; }
.chart__title { margin: 0 0 .5rem; font-size: 1.05rem; text-align: center; }
