/* ═══════════════════════════════════════════════════════════════
   Leyna Panel — Design System (core.css)
   Tokens · themes (light/dark) · reset · base components
   Every page loads this first; page CSS only adds layout.
   ═══════════════════════════════════════════════════════════════ */

/* ─── Font (self-hosted Inter variable, latin + latin-ext for Turkish) ─── */
@font-face {
    font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
    src: url(../fonts/inter-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
    src: url(../fonts/inter-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ─── Tokens: light ─── */
:root {
    color-scheme: light;

    /* Neutrals */
    --bg:            #f6f6f7;
    --surface:       #ffffff;
    --surface-2:     #fafafa;
    --surface-3:     #f4f4f5;
    --hover:         rgba(24, 24, 27, .045);
    --active:        rgba(24, 24, 27, .08);
    --border:        #e7e7ea;
    --border-strong: #d4d4d8;
    --text:          #18181b;
    --text-2:        #52525b;
    --text-3:        #8b8b94;
    --text-inv:      #ffffff;

    /* Brand (indigo) */
    --brand:         #4f46e5;
    --brand-hover:   #4338ca;
    --brand-soft:    #eef0ff;
    --brand-text:    #4338ca;
    --ring:          rgba(79, 70, 229, .28);

    /* Semantic */
    --success: #16a34a; --success-soft: #ecfdf3; --success-text: #15803d;
    --warning: #d97706; --warning-soft: #fff7e6; --warning-text: #b45309;
    --danger:  #dc2626; --danger-soft:  #fef1f1; --danger-text:  #b91c1c;
    --info:    #0284c7; --info-soft:    #eef8fe; --info-text:    #0369a1;
    --violet:  #7c3aed; --violet-soft:  #f4f0ff; --violet-text:  #6d28d9;
    --pink:    #db2777; --pink-soft:    #fdf0f6; --pink-text:    #be185d;

    /* Elevation */
    --shadow-xs: 0 1px 2px rgba(16, 16, 20, .05);
    --shadow-sm: 0 1px 2px rgba(16, 16, 20, .06), 0 1px 3px rgba(16, 16, 20, .04);
    --shadow-md: 0 4px 12px -2px rgba(16, 16, 20, .08), 0 2px 4px -2px rgba(16, 16, 20, .05);
    --shadow-lg: 0 16px 40px -8px rgba(16, 16, 20, .16), 0 4px 12px -4px rgba(16, 16, 20, .08);
    --shadow-pop: 0 0 0 1px rgba(16, 16, 20, .06), 0 12px 32px -6px rgba(16, 16, 20, .2);

    /* Shape & rhythm (4 px grid) */
    --r-xs: 4px; --r-sm: 6px; --r: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 999px;
    --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;

    /* Type */
    --font: 'Inter', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
    --fs-xs: .75rem; --fs-sm: .8125rem; --fs: .875rem; --fs-md: .9375rem; --fs-lg: 1.0625rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem;

    /* Motion */
    --ease: cubic-bezier(.2, .8, .2, 1);
    --t-fast: 120ms; --t: 180ms; --t-slow: 320ms;

    /* Layers */
    --z-sticky: 10; --z-sidebar: 40; --z-overlay: 60; --z-drawer: 70; --z-modal: 80; --z-palette: 90; --z-toast: 100;

    /* Layout */
    --sidebar-w: 248px; --sidebar-w-collapsed: 64px; --topbar-h: 56px;
}

/* ─── Tokens: dark ─── */
[data-theme="dark"] {
    color-scheme: dark;
    --bg:            #0b0b0d;
    --surface:       #131316;
    --surface-2:     #17171b;
    --surface-3:     #1d1d22;
    --hover:         rgba(255, 255, 255, .05);
    --active:        rgba(255, 255, 255, .09);
    --border:        #26262c;
    --border-strong: #34343c;
    --text:          #f4f4f5;
    --text-2:        #a7a7b0;
    --text-3:        #6e6e78;

    --brand:         #6d67f5;
    --brand-hover:   #8580ff;
    --brand-soft:    rgba(109, 103, 245, .16);
    --brand-text:    #a9a5ff;
    --ring:          rgba(133, 128, 255, .35);

    --success-soft: rgba(34, 197, 94, .13);  --success-text: #4ade80;
    --warning-soft: rgba(245, 158, 11, .14); --warning-text: #fbbf24;
    --danger-soft:  rgba(239, 68, 68, .14);  --danger-text:  #f87171;
    --info-soft:    rgba(14, 165, 233, .14); --info-text:    #38bdf8;
    --violet-soft:  rgba(139, 92, 246, .16); --violet-text:  #a78bfa;
    --pink-soft:    rgba(236, 72, 153, .15); --pink-text:    #f472b6;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, .6);
    --shadow-lg: 0 18px 44px -8px rgba(0, 0, 0, .7);
    --shadow-pop: 0 0 0 1px rgba(255, 255, 255, .07), 0 16px 40px -6px rgba(0, 0, 0, .75);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    font-family: var(--font); font-size: var(--fs); line-height: 1.5; color: var(--text);
    background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01'; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
::selection { background: var(--brand-soft); color: var(--brand-text); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-xs); }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ─── Icon ─── */
.i {
    width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle;
    fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round;
}
.i-sm { width: 14px; height: 14px; }
.i-lg { width: 20px; height: 20px; }
.i-xl { width: 28px; height: 28px; stroke-width: 1.6; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Typography helpers ─── */
.h1 { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.h2 { font-size: var(--fs-lg); font-weight: 620; letter-spacing: -.012em; }
.h3 { font-size: var(--fs-md); font-weight: 600; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-xs); padding: 1px 5px; }

/* ─── Button ─── */
.btn {
    --btn-h: 34px;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: var(--btn-h); padding: 0 13px; border-radius: var(--r);
    font-size: var(--fs-sm); font-weight: 550; line-height: 1; white-space: nowrap; user-select: none;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    box-shadow: var(--shadow-xs);
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn .i { width: 15px; height: 15px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .3), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(.94); background: var(--success); }
.btn-danger { color: var(--danger-text); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-solid-danger:hover:not(:disabled) { background: var(--danger); border-color: var(--danger); color: #fff; filter: brightness(.92); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.btn-ghost.is-active { background: var(--brand-soft); color: var(--brand-text); }
/* ghost + danger: red text, soft red hover (must come after .btn-ghost) */
.btn-ghost.btn-danger { color: var(--danger-text); }
.btn-ghost.btn-danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger-text); }
.btn-sm { --btn-h: 28px; padding: 0 10px; font-size: var(--fs-xs); gap: 6px; border-radius: var(--r-sm); }
.btn-lg { --btn-h: 40px; padding: 0 18px; font-size: var(--fs); }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn-block { width: 100%; }
.btn .kbd { margin-left: 2px; }

/* ─── Form controls ─── */
.input, .select, .textarea {
    height: 34px; width: 100%; padding: 0 11px; border-radius: var(--r);
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    font-size: var(--fs-sm); box-shadow: var(--shadow-xs);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.select {
    appearance: none; padding-right: 30px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b8b94' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}
.input-sm, .select-sm { height: 28px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
input[type="date"].input { padding-right: 6px; }
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.8); }

.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .i { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.input-icon > .input { padding-left: 32px; }
.input-icon > .kbd { position: absolute; right: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: var(--s-4); }
.label { font-size: var(--fs-sm); font-weight: 550; color: var(--text); }
.hint { font-size: var(--fs-xs); color: var(--text-3); }
.error-text { font-size: var(--fs-xs); color: var(--danger-text); font-weight: 500; }

/* Switch */
.switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.switch span {
    position: absolute; inset: 0; border-radius: var(--r-full); background: var(--border-strong);
    transition: background var(--t) var(--ease);
}
.switch span::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform var(--t) var(--ease);
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
.switch input:disabled + span { opacity: .45; cursor: not-allowed; }

/* Segmented control */
.seg {
    display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r);
    background: var(--surface-3); border: 1px solid var(--border);
}
.seg button {
    height: 26px; padding: 0 11px; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 550;
    color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.seg button:hover { color: var(--text); }
.seg button.active, .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .seg button.active { background: var(--surface-3); box-shadow: 0 0 0 1px var(--border-strong); }
.seg .i { width: 14px; height: 14px; }
/* Tam genişlik seg (ör. kullanıcı menüsündeki tema seçici): butonlar eşit paylaşır, taşmaz */
.seg-fill { display: flex; width: 100%; min-width: 0; }
.seg-fill button { flex: 1 1 0; min-width: 0; justify-content: center; padding: 0 4px; gap: 4px; overflow: hidden; }
/* Menü dar (≈220px): tema seçicide ikon üstte, etiket altta — "Sistem" taşmaz */
.menu-theme .seg-fill button { flex-direction: column; height: 44px; gap: 3px; font-size: .6875rem; }
.menu-theme .seg-fill .i { width: 15px; height: 15px; }
.menu-theme { padding: 2px 5px 6px; }

/* Checkbox */
input[type="checkbox"].cb {
    appearance: none; width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; cursor: pointer;
    border: 1.5px solid var(--border-strong); background: var(--surface); display: inline-grid; place-content: center;
    transition: background var(--t-fast), border-color var(--t-fast);
}
input[type="checkbox"].cb::before {
    content: ''; width: 9px; height: 9px; transform: scale(0); transition: transform var(--t-fast) var(--ease);
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); background: #fff;
}
input[type="checkbox"].cb:checked { background: var(--brand); border-color: var(--brand); }
input[type="checkbox"].cb:checked::before { transform: scale(1); }
input[type="checkbox"].cb:indeterminate { background: var(--brand); border-color: var(--brand); }
input[type="checkbox"].cb:indeterminate::before { transform: scale(1); clip-path: inset(40% 10% 40% 10%); }

/* ─── Badge / status pill ─── */
.badge {
    display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
    border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 550; white-space: nowrap;
    background: var(--surface-3); color: var(--text-2); border: 1px solid transparent;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-sm { height: 18px; padding: 0 6px; font-size: .6875rem; gap: 4px; }
.badge-outline { background: transparent; border-color: var(--border); }
.badge-brand   { background: var(--brand-soft);   color: var(--brand-text); }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger-text); }
.badge-info    { background: var(--info-soft);    color: var(--info-text); }
.badge-violet  { background: var(--violet-soft);  color: var(--violet-text); }
.badge-pink    { background: var(--pink-soft);    color: var(--pink-text); }
/* Order status: 1 Yeni · 2 Hazırlanıyor · 3 Kargoda · 4 Teslim · 5 İade · 6 İptal */
.st-1 { background: var(--warning-soft); color: var(--warning-text); }
.st-2 { background: var(--info-soft);    color: var(--info-text); }
.st-3 { background: var(--violet-soft);  color: var(--violet-text); }
.st-4 { background: var(--success-soft); color: var(--success-text); }
.st-5 { background: var(--pink-soft);    color: var(--pink-text); }
.st-6 { background: var(--surface-3);    color: var(--text-3); }
.st-6 .dot { background: var(--danger); }

.count {
    min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--r-full);
    font-size: .6875rem; font-weight: 600; font-variant-numeric: tabular-nums;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-3); color: var(--text-2);
}
.count-alert { background: var(--danger); color: #fff; }

/* ─── Kbd ─── */
.kbd, kbd {
    display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
    font-family: var(--font); font-size: .6875rem; font-weight: 550; color: var(--text-3);
    background: var(--surface); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
}

/* ─── Card ─── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.card-title { font-size: var(--fs-md); font-weight: 600; letter-spacing: -.01em; }
.card-desc { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.card-body { padding: var(--s-5); }
.card-foot {
    display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2);
    padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); background: var(--surface-2);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.card-foot .spacer { margin-right: auto; }

/* ─── KPI tile ─── */
.kpi {
    position: relative; text-align: left; padding: 14px 16px 13px; border-radius: var(--r-lg); overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: var(--fs-xs); font-weight: 550; color: var(--text-2); }
.kpi-ic { width: 28px; height: 28px; border-radius: var(--r); display: grid; place-items: center; }
.kpi-ic .i { width: 15px; height: 15px; }
.kpi-value { font-size: var(--fs-2xl); font-weight: 680; letter-spacing: -.03em; line-height: 1.15; margin-top: 6px; }
.kpi-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tone-warning { background: var(--warning-soft); color: var(--warning-text); }
.tone-info    { background: var(--info-soft);    color: var(--info-text); }
.tone-violet  { background: var(--violet-soft);  color: var(--violet-text); }
.tone-success { background: var(--success-soft); color: var(--success-text); }
.tone-brand   { background: var(--brand-soft);   color: var(--brand-text); }
.tone-danger  { background: var(--danger-soft);  color: var(--danger-text); }

/* ─── Table ─── */
.tbl { width: 100%; font-size: var(--fs-sm); }
.tbl th {
    position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 550; font-size: var(--fs-xs);
    color: var(--text-3); background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background var(--t-fast); }
.tbl-hover tbody tr:hover { background: var(--hover); }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }

/* ─── Notice / alert ─── */
.notice {
    display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--r);
    font-size: var(--fs-sm); line-height: 1.5; background: var(--info-soft); color: var(--info-text);
    border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}
.notice .i { margin-top: 2px; }
.notice-warning { background: var(--warning-soft); color: var(--warning-text); }
.notice-danger  { background: var(--danger-soft);  color: var(--danger-text); }
.notice-success { background: var(--success-soft); color: var(--success-text); }
.notice b, .notice strong { font-weight: 600; }

/* ─── Empty state ─── */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 56px 24px; text-align: center; color: var(--text-2); }
.empty-icon { width: 44px; height: 44px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); margin-bottom: 6px; }
.empty-icon .i { width: 22px; height: 22px; }
.empty-title { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.empty-desc { font-size: var(--fs-sm); max-width: 360px; }

/* ─── Skeleton ─── */
.skel {
    display: block; height: 12px; border-radius: var(--r-xs);
    background: linear-gradient(90deg, var(--surface-3) 0%, var(--hover) 50%, var(--surface-3) 100%);
    background-size: 200% 100%; animation: skel 1.3s ease-in-out infinite;
}
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ─── Avatar ─── */
.avatar {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: inline-grid; place-items: center;
    font-size: .72rem; font-weight: 650; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.avatar-sm { width: 22px; height: 22px; font-size: .625rem; }

/* ─── Tooltip (data-tip) ─── */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    padding: 5px 8px; border-radius: var(--r-sm); background: #18181b; color: #fafafa; font-size: .72rem; font-weight: 500;
    white-space: nowrap; pointer-events: none; z-index: var(--z-toast); box-shadow: var(--shadow-md);
    animation: fadeIn var(--t-fast) var(--ease);
}
[data-tip-pos="bottom"]:hover::after { bottom: auto; top: calc(100% + 6px); }
[data-tip-pos="right"]:hover::after { bottom: auto; top: 50%; left: calc(100% + 8px); transform: translateY(-50%); }
[data-theme="dark"] [data-tip]:hover::after { background: #fafafa; color: #18181b; }

/* ─── Dropdown menu ─── */
.menu {
    position: absolute; z-index: var(--z-overlay); min-width: 200px; padding: 5px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
    animation: popIn var(--t) var(--ease);
}
.menu-item {
    display: flex; align-items: center; gap: 9px; width: 100%; height: 32px; padding: 0 9px; border-radius: var(--r-sm);
    font-size: var(--fs-sm); color: var(--text); text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item .i { color: var(--text-3); }
.menu-item .kbd { margin-left: auto; }
.menu-item.danger { color: var(--danger-text); }
.menu-item.danger .i { color: currentColor; }
.menu-sep { height: 1px; background: var(--border); margin: 5px -5px; }
.menu-label { padding: 6px 9px 4px; font-size: .6875rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.menu-item .cb { margin: 0; }
.menu-item.is-active { font-weight: 600; }
.menu-item.is-active::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-left: auto; flex-shrink: 0; }
.menu-empty { padding: 6px 9px; font-size: var(--fs-xs); color: var(--text-3); }
.dd { position: relative; display: inline-flex; }
.dd > .menu { top: calc(100% + 6px); right: 0; }
.dd > .menu.menu-left { right: auto; left: 0; }
.dd > .menu.menu-up { top: auto; bottom: calc(100% + 10px); }

/* ─── Dialog (native <dialog>) ─── */
dialog.dialog {
    margin: auto; width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--border);
    border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
    overflow: hidden; display: flex; flex-direction: column;
}
dialog.dialog:not([open]) { display: none; }
dialog.dialog[open] { animation: popIn var(--t) var(--ease); }
dialog.dialog::backdrop { background: rgba(9, 9, 11, .45); backdrop-filter: blur(3px); animation: fadeIn var(--t) var(--ease); }
.dialog-lg { width: min(860px, calc(100vw - 32px)) !important; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; }
.dialog-title { font-size: var(--fs-lg); font-weight: 620; letter-spacing: -.01em; }
.dialog-desc { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.dialog-check { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: var(--fs-sm); font-weight: 550; cursor: pointer; }
.dialog-check input { margin-top: 2px; flex-shrink: 0; }
.dialog-body { padding: 4px 20px 18px; overflow: auto; flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; }
/* Form sarmalayıcı da esnek sütun olmalı; yoksa gövde kaymaz, alt butonlar taşar */
dialog.dialog > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.dialog-head, .dialog-foot { flex-shrink: 0; }
/* Mobil klavye açıkken: pencereyi görünür alana (visualViewport) sığdır — core.js --vvt/--vvh yazar */
html.kb-open dialog.dialog { position: fixed; top: calc(var(--vvt, 0px) + 8px); bottom: auto; margin: 0 auto; max-height: calc(var(--vvh, 100dvh) - 16px); animation: none; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ─── Toast ─── */
.toasts { position: fixed; z-index: var(--z-toast); right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px;
    padding: 11px 12px 11px 14px; border-radius: var(--r-lg); font-size: var(--fs-sm); font-weight: 500;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    animation: toastIn var(--t-slow) var(--ease);
}
.toast.leaving { animation: toastOut var(--t) var(--ease) forwards; }
.toast > .i { width: 18px; height: 18px; }
.toast.success > .i { color: var(--success); }
.toast.error > .i   { color: var(--danger); }
.toast.info > .i    { color: var(--brand); }
.toast.warning > .i { color: var(--warning); }
.toast-msg { flex: 1; }
.toast-action { font-weight: 600; color: var(--brand-text); padding: 4px 8px; border-radius: var(--r-sm); }
.toast-action:hover { background: var(--brand-soft); }
@keyframes toastIn  { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

/* ─── Animations ─── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn  { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }

/* ─── Utilities ─── */
.row { display: flex; align-items: center; gap: var(--s-2); }
.row-3 { display: flex; align-items: center; gap: var(--s-3); }
.col { display: flex; flex-direction: column; gap: var(--s-2); }
.grow { flex: 1; min-width: 0; }
.ml-auto { margin-left: auto; }
.divider-v { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }

/* ─── Touch devices (phones / tablets) ───
   iOS Safari zooms the page into any focused field whose font-size is < 16px.
   Keep form text at 16px on touch screens (pinch-zoom stays available) and give
   small controls finger-sized hit areas. */
@media (pointer: coarse) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
    select, textarea, [contenteditable="true"] { font-size: 16px !important; }
    .input-sm, .select-sm { height: 36px; }
    .btn-sm { --btn-h: 34px; }
    .menu-item { min-height: 40px; }
}
@media (max-width: 560px) {
    .toasts { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); }
    .toast { min-width: 0; max-width: none; }
}

/* No mouse / keyboard (phones, tablets): keyboard hints and hover-only UI are noise */
@media (hover: none) and (pointer: coarse) {
    .kbd, kbd { display: none !important; }
    [data-tip]:hover::after, [data-tip]:focus-visible::after { display: none !important; }   /* tooltips stick after a tap */
    a[href$="ayarlar/kisayollar"] { display: none !important; }                                /* keyboard shortcuts page */
    .copy-btn, .view-del { opacity: 1 !important; }                                              /* were visible on hover only */
}
/* Phone-width screens: tools that only make sense at a desk (export, column picker, density, printer format…) */
@media (max-width: 760px) {
    .desktop-only { display: none !important; }
}

/* ─── Filter chip (shared: Siparişler, Ürünler) ─── */
.chip {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-full);
    font-size: var(--fs-xs); font-weight: 550; color: var(--text-2); background: var(--surface);
    border: 1px dashed var(--border-strong); transition: all var(--t-fast);
}
.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip[aria-pressed="true"] { border-style: solid; border-color: color-mix(in srgb, var(--brand) 50%, transparent); background: var(--brand-soft); color: var(--brand-text); }

/* ─── Floating bulk bar (shared: Siparişler, Ürünler) ─── */
.bulkbar {
    position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: var(--z-overlay);
    display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 14px; border-radius: var(--r-xl);
    background: #18181b; color: #fafafa; box-shadow: 0 20px 48px -12px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06);
    animation: barIn var(--t-slow) var(--ease);
}
[data-theme="dark"] .bulkbar { background: #232329; box-shadow: 0 20px 48px -12px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .1); }
@keyframes barIn { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
.bulk-count { font-size: var(--fs-sm); white-space: nowrap; margin-right: 2px; }
.bulk-count b { font-variant-numeric: tabular-nums; }
.bulk-sum { font-size: var(--fs-sm); font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; padding: 3px 9px; border-radius: var(--r-full); background: rgba(255, 255, 255, .1); cursor: default; }
.bulk-sum:empty { display: none; }
.bulkbar .divider-v { background: rgba(255, 255, 255, .14); margin: 0 4px; }
.bulkbar .btn-ghost { color: #a1a1aa; }
.bulkbar .btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .08); color: #fff; }
.bulk-btn { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); color: #fafafa; box-shadow: none; }
.bulk-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .12) !important; }
.bulkbar .kbd { background: transparent; border-color: rgba(255, 255, 255, .18); color: #a1a1aa; }
@media (max-width: 760px) {
    .bulkbar { left: 12px; right: 12px; transform: none; overflow-x: auto; animation: none; bottom: max(12px, env(safe-area-inset-bottom)); }
    .bulk-btn .kbd { display: none; }
}
