/* ==========================================================================
   DentCell — Stok Yönetimi ekranı
   ========================================================================== */
.stk-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 22px; box-shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.12); overflow: hidden; }
.stk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding: 22px 24px 14px; background: linear-gradient(135deg, #0f172a, #1e293b); color: #fff; }
.stk-title { margin: 0; font-size: 1.3rem; font-weight: 800; }
.stk-crumb { color: #fbbf24; font-weight: 800; }
.stk-sub { margin: 4px 0 0; font-size: 0.8rem; color: #94a3b8; max-width: 640px; }
.stk-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stk-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 11px; border: 1px solid #e2e8f0; background: #fff; color: #0f172a; font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.stk-btn:hover { background: #f8fafc; }
.stk-btn:disabled { opacity: 0.6; cursor: wait; }
.stk-btn-primary { background: #0284c7; border-color: #0284c7; color: #fff; }
.stk-btn-primary:hover { background: #0369a1; }
.stk-btn-ai { background: linear-gradient(135deg, #7c3aed, #2563eb); border: none; color: #fff; }
.stk-btn-ai:hover { filter: brightness(1.08); background: linear-gradient(135deg, #7c3aed, #2563eb); }
.stk-btn-danger { background: #fff; border-color: #fecaca; color: #dc2626; }
.stk-btn-danger:hover { background: #fef2f2; }
.stk-btn-sm { padding: 6px 10px; font-size: 0.75rem; }
.stk-head .stk-btn:not(.stk-btn-primary):not(.stk-btn-ai) { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); color: #fff; }

.stk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 14px 24px; border-bottom: 1px solid #f1f5f9; }
.stk-stat { padding: 10px 14px; border-radius: 14px; background: #f8fafc; border: 1px solid #e2e8f0; display: flex; flex-direction: column; gap: 2px; }
.stk-stat span { font-size: 0.7rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.03em; }
.stk-stat strong { font-size: 1.25rem; font-weight: 800; color: #0f172a; font-family: 'JetBrains Mono', monospace; }
.stk-stat.red strong { color: #b91c1c; } .stk-stat.orange strong { color: #c2410c; } .stk-stat.gray strong { color: #475569; } .stk-stat.blue strong { color: #0369a1; }

.stk-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 24px; }
.stk-search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid #e2e8f0; border-radius: 11px; background: #f8fafc; color: #94a3b8; }
.stk-search:focus-within { border-color: #0284c7; background: #fff; }
.stk-search input { flex: 1; border: none; background: transparent; padding: 9px 0; font: inherit; font-size: 0.85rem; outline: none; min-width: 0; color: #0f172a; }
.stk-toolbar select { padding: 9px 10px; border: 1px solid #e2e8f0; border-radius: 11px; background: #fff; font: inherit; font-size: 0.8rem; color: #0f172a; max-width: 220px; }
.stk-levels { display: inline-flex; padding: 3px; background: #f1f5f9; border-radius: 11px; gap: 2px; }
.stk-levels button { border: none; background: transparent; padding: 6px 11px; border-radius: 8px; font: inherit; font-size: 0.76rem; font-weight: 700; color: #64748b; cursor: pointer; }
.stk-levels button.active { background: #fff; color: #0f172a; box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1); }

.stk-table-wrap { overflow: auto; max-height: calc(100vh - 340px); min-height: 280px; border-top: 1px solid #f1f5f9; }
.stk-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.78rem; }
.stk-table th { position: sticky; top: 0; z-index: 1; background: #f8fafc; color: #334155; font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; text-align: center; padding: 10px 8px; border-bottom: 1.5px solid #e2e8f0; white-space: nowrap; }
.stk-table td { padding: 8px; border-bottom: 1px solid #f1f5f9; text-align: center; color: #1e293b; vertical-align: middle; }
.stk-table tbody tr:nth-child(even) td { background: #fcfdfe; }
.stk-table tbody tr:hover td { background: #f0f9ff; }
.stk-table .r { text-align: right; } .stk-table .c { text-align: center; }
.stk-table .mono { font-family: 'JetBrains Mono', monospace; }
.stk-table .muted { color: #94a3b8; }
.stk-table.small { font-size: 0.78rem; }
.stk-table.small td, .stk-table.small th { text-align: left; }
.stk-table td small { display: block; color: #94a3b8; font-size: 0.68rem; margin-top: 2px; }
.stk-col-name { min-width: 180px; }
.stk-name { border: none; background: none; font: inherit; font-weight: 700; color: #0f172a; cursor: pointer; text-align: center; padding: 0; }
.stk-name:hover { color: #0284c7; text-decoration: underline; }
.stk-img-btn { border: 1px solid #e2e8f0; background: #fff; border-radius: 12px; padding: 2px; cursor: pointer; line-height: 0; }
.stk-img-btn:hover { border-color: #0284c7; }
.stk-ico { display: inline-block; line-height: 0; }
.stk-ico svg { display: block; }
.stk-log { font-size: 0.66rem; color: #475569; white-space: nowrap; line-height: 1.35; }
.stk-empty { padding: 36px !important; color: #94a3b8; text-align: center !important; }
.stk-foot { padding: 10px 24px; font-size: 0.74rem; color: #94a3b8; border-top: 1px solid #f1f5f9; }

.pill { display: inline-block; min-width: 38px; padding: 4px 8px; border-radius: 7px; font-family: 'JetBrains Mono', monospace; font-weight: 800; font-size: 0.78rem; background: #f1f5f9; color: #0f172a; }
.pill.plain { background: transparent; font-weight: 600; color: #475569; }
.pill.red { background: #991b1b; color: #fff; }
.pill.orange { background: #f59e0b; color: #fff; }
.pill.green { background: #dcfce7; color: #15803d; min-width: 0; font-family: inherit; }
.stk-table.small .pill.orange, .stk-table.small .pill.plain { min-width: 0; font-family: inherit; }
.stk-row-actions { white-space: nowrap; }
.stk-mini { width: 28px; height: 28px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; color: #475569; font-weight: 900; font-size: 1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.stk-mini.in { color: #16a34a; } .stk-mini.in:hover { background: #dcfce7; border-color: #86efac; }
.stk-mini.out { color: #ea580c; } .stk-mini.out:hover { background: #ffedd5; border-color: #fdba74; }
.stk-mini:hover { background: #f1f5f9; }

/* Pencereler */
.stk-overlay { position: fixed; inset: 0; z-index: 99990; background: rgba(15, 23, 42, 0.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.stk-dialog { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: #fff; border-radius: 22px; box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3); padding: 22px; }
.stk-dialog.wide { width: min(920px, 100%); }
.stk-dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.stk-dlg-head h3 { margin: 0; font-size: 1.15rem; font-weight: 800; color: #0f172a; display: flex; align-items: center; gap: 8px; }
.stk-x { width: 32px; height: 32px; border-radius: 50%; border: 1px solid #e2e8f0; background: #f8fafc; color: #64748b; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.stk-x:hover { background: #e2e8f0; }
.stk-form { display: flex; flex-direction: column; gap: 14px; }
.stk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stk-grid .span2 { grid-column: span 2; }
.stk-form label, .stk-inv-meta label { display: flex; flex-direction: column; gap: 5px; font-size: 0.74rem; font-weight: 700; color: #475569; }
.stk-form input, .stk-form select, .stk-inv-meta input, .stk-inv-table input, .stk-inv-table select { padding: 9px 10px; border: 1px solid #e2e8f0; border-radius: 10px; font: inherit; font-size: 0.84rem; color: #0f172a; background: #fff; min-width: 0; }
.stk-form input:focus, .stk-form select:focus { outline: none; border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12); }
.stk-img-edit { display: flex; gap: 16px; align-items: center; padding: 12px; border: 1px dashed #cbd5e1; border-radius: 16px; background: #f8fafc; }
.stk-img-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stk-img-tools select { max-width: 240px; }
.stk-err { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: 0.82rem; }
.stk-hint { margin: 8px 0 0; font-size: 0.75rem; color: #64748b; }
.stk-dlg-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.stk-move-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: #f8fafc; margin-bottom: 14px; }
.stk-move-item strong { display: block; color: #0f172a; }
.stk-move-item small { color: #64748b; font-size: 0.78rem; }
.stk-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.stk-seg label { flex-direction: row !important; align-items: center; gap: 6px !important; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 10px; cursor: pointer; }
.stk-seg label:has(input:checked) { border-color: #0284c7; background: #f0f9ff; color: #0369a1; }
.stk-history { max-height: 60vh; overflow: auto; }

/* Faturadan stok ekleme */
.stk-ai-badge { font-size: 0.68rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, #7c3aed, #2563eb); padding: 3px 9px; border-radius: 999px; }
.stk-drop { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 38px 20px; border: 2px dashed #c4b5fd; border-radius: 18px; background: #faf5ff; color: #6d28d9; cursor: pointer; transition: background 0.15s ease; }
.stk-drop.over, .stk-drop:hover { background: #f3e8ff; }
.stk-drop strong { color: #0f172a; font-size: 0.95rem; }
.stk-drop span { font-size: 0.78rem; color: #64748b; max-width: 520px; }
.stk-reading { display: flex; align-items: center; gap: 14px; padding: 28px 12px; }
.stk-reading small { display: block; color: #64748b; margin-top: 4px; }
.stk-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #e9d5ff; border-top-color: #7c3aed; animation: stk-spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes stk-spin { to { transform: rotate(360deg); } }
.stk-inv-meta { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.stk-inv-meta label { flex: 1 1 200px; }
.stk-inv-provider { font-size: 0.72rem; color: #7c3aed; font-weight: 700; padding-bottom: 10px; }
.stk-inv-table td { vertical-align: top; }
.stk-inv-table select { width: 100%; max-width: 320px; }
.stk-inv-table .inv-qty, .stk-inv-table .inv-price { width: 92px; text-align: right; }
.stk-inv-table .stk-table-wrap { max-height: 50vh; }

@media (max-width: 760px) {
  .stk-head, .stk-stats, .stk-toolbar { padding-left: 16px; padding-right: 16px; }
  .stk-grid { grid-template-columns: 1fr 1fr; }
  .stk-grid .span2 { grid-column: span 2; }
  .stk-table-wrap { max-height: none; }
}

/* Görünüm sekmeleri: stoktakiler / stokta olmayanlar / tüm katalog */
.stk-views { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 0 14px; }
.stk-views button { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; padding: 12px 16px; border-radius: 14px; border: 1.5px solid #e2e8f0; background: #fff; cursor: pointer; font: inherit; color: #334155; transition: all .18s ease; }
.stk-views button span { display: flex; flex-direction: column; font-weight: 800; font-size: .88rem; }
.stk-views button small { font-weight: 500; font-size: .72rem; color: #94a3b8; margin-top: 2px; }
.stk-views button b { min-width: 34px; padding: 4px 10px; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: .8rem; text-align: center; }
.stk-views button:hover { border-color: #93c5fd; }
.stk-views button.active { border-color: #0284c7; background: linear-gradient(135deg, #f0f9ff, #eff6ff); box-shadow: 0 6px 18px rgba(2,132,199,.14); color: #0f172a; }
.stk-views button.active b { background: #0284c7; color: #fff; }
@media (max-width: 760px) { .stk-views { grid-template-columns: 1fr; } }
