/* Mithra Makina yerel panel — kurumsal arayüz katmanı.
   Tipografi: Inter (SIL OFL 1.1, dist/fonts/). Renk/ölçü: 4-8 px ızgara.
   Yalnız görsel katman; app.js işlev, ID ve aria sözleşmesi korunur. */

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/Inter-Regular.ttf") format("truetype");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/Inter-SemiBold.ttf") format("truetype");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/Inter-Bold.ttf") format("truetype");
}

:root {
  color-scheme: light;
  --canvas: #f5f7fa;
  --surface: #fff;
  --ink: #101c2c;
  --muted: #5b6b80;
  --line: #e3e8ef;
  --line-strong: #c7d1dd;
  --accent: #1f5fd6;
  --accent-hover: #1749a8;
  --accent-soft: #eef3fc;
  --success: #1f7a4d;
  --success-soft: #e9f7ef;
  --warning: #a16207;
  --warning-soft: #fdf6e3;
  --danger: #b42318;
  --danger-soft: #fef1f0;
  --purple: #6b4fa8;
  --purple-soft: #f1edfa;
  --teal: #14666b;
  --teal-soft: #e6f4f4;
  --radius-card: 8px;
  --radius-control: 6px;
  --shadow-card: 0 1px 2px rgba(16, 28, 44, .04), 0 8px 24px rgba(16, 28, 44, .04);
  --shadow-pop: 0 12px 40px rgba(16, 28, 44, .16);
  --sidebar: 232px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 0; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button, input, select, textarea, a, summary { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
h1, h2, h3, p { overflow-wrap: break-word; }
h1 { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -.03em; }
h2 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
h3 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.5; }
p { margin: 0; line-height: 1.55; }
a { color: var(--accent); }
.muted, .muted-text { color: var(--muted); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px;
  padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
:where(.control):focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #dce8fb;
}
.skip-link {
  position: fixed; top: -80px; left: 12px; z-index: 200;
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 10px 14px; border-radius: var(--radius-control);
  background: var(--ink); color: #fff; text-decoration: none;
}
.skip-link:focus { top: 10px; }
.initial-loading { padding: 96px 24px; text-align: center; color: var(--muted); }

/* Kabuk: 232 px sidebar; içerik en fazla 1500 px. */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; z-index: 30;
  height: 100vh; min-width: 0;
  display: flex; flex-direction: column;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 2px 8px 22px; }
.brand-mark {
  display: grid; place-items: center; flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--ink); color: #fff;
  font-size: 14px; font-weight: 700; line-height: 1;
}
.brand-name { font-size: 14px; font-weight: 700; line-height: 1.25; letter-spacing: -.02em; }
.brand-small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.35; letter-spacing: .04em; }
.navigation { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nav-button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: var(--radius-control);
  background: transparent; color: #405168;
  font-size: 13px; font-weight: 500; line-height: 1.4; text-align: left;
  box-shadow: inset 3px 0 0 transparent;
}
.nav-button svg { flex-shrink: 0; width: 18px; height: 18px; color: #7d8ba0; }
.nav-button:hover { background: #f2f5f9; }
.nav-button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-button.active svg { color: var(--accent); }
.nav-count {
  margin-left: auto; min-width: 20px; padding: 1px 6px;
  border-radius: 999px; background: #eef1f5; color: var(--muted);
  font-size: 11px; font-weight: 600; line-height: 1.5; text-align: center;
  font-variant-numeric: tabular-nums;
}
.nav-button.active .nav-count { background: #fff; color: var(--accent); }
.workspace { min-width: 0; background: var(--canvas); }
.main { width: 100%; max-width: 1500px; margin: 0 auto; padding: 24px 28px 36px; min-width: 0; }

/* Sayfa başlığı: h1 + tek satır açıklama + sağda ana eylem. */
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-heading-copy { min-width: 0; }
.page-heading .subtext { margin-top: 6px; font-size: 13px; color: var(--muted); }
.page-heading > .button { flex-shrink: 0; }

/* Kontroller. */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  background: var(--surface); color: #33475e;
  font-size: 13px; font-weight: 500; line-height: 1.4; text-decoration: none; white-space: nowrap;
}
.button svg { flex-shrink: 0; }
.button:hover { border-color: #9dacbd; background: #f8fafc; }
.button.primary { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; }
.button.primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.button.primary:focus-visible, .stock-action.primary:focus-visible { outline-color: var(--ink); }
.button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.button.ghost:hover { background: #eef2f7; color: var(--ink); }
.button.small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.button.danger { border-color: #e7c4c1; color: var(--danger); }
.button.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.button:disabled { border-color: var(--line); background: #f1f3f6; color: #8a94a6; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.icon-button {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: var(--radius-control);
  background: transparent; color: var(--muted);
}
.icon-button:hover { background: #eef2f7; color: var(--ink); }
.icon-button:disabled { background: #f1f3f6; color: #a6b0be; }
.control {
  width: 100%; min-width: 0; max-width: 100%; height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  background: var(--surface); color: var(--ink);
  font-size: 13px; line-height: 1.5;
}
.control::placeholder { color: #7a8798; }
.control:hover:not(:disabled) { border-color: #9dacbd; }
.control:disabled { border-color: var(--line); background: #f3f5f8; color: var(--muted); }
.control[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px #fbe3e1; }
textarea.control { height: auto; min-height: 84px; padding: 9px 11px; line-height: 1.55; resize: vertical; }
select.control { padding-right: 30px; }
.filter-field, .filter-label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filter-field { flex: 1 1 170px; }
.filter-caption {
  color: var(--muted); font-size: 11px; font-weight: 600;
  letter-spacing: .06em; line-height: 1.4; text-transform: uppercase;
}
.search-field { position: relative; min-width: 0; width: 100%; flex: 1; }
.search-field > svg { position: absolute; top: 50%; left: 11px; color: #7d8ba0; transform: translateY(-50%); pointer-events: none; }
.search-field input { padding-left: 34px; }
.toolbar {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px;
  min-width: 0; padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.toolbar > .search-field { flex: 1 1 240px; }
.toolbar > .control { flex: 1 1 170px; }
.toolbar .filter-field { flex: 0 1 170px; }
.toolbar > .filter-field:first-child { flex: 1 1 260px; }
.tab-switch {
  display: inline-flex; gap: 2px; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--radius-card);
  background: #eef1f5;
}
.tab-switch button {
  min-height: 32px; padding: 0 12px;
  border: 0; border-radius: 5px; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.tab-switch button:hover { color: var(--ink); }
.tab-switch button.active { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 28, 44, .1); }
.material-tabs { margin-bottom: 16px; max-width: 100%; }

/* Stok: kompakt tek satır eylem çubuğu. */
.stock-action-group { min-width: 0; margin-bottom: 18px; }
.inline-action-group { max-width: none; }
.stock-action-context { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; min-height: 20px; margin-bottom: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.stock-action-context:empty { display: none; }
.stock-action-context strong { color: var(--ink); font-size: 13px; font-weight: 600; }
.stock-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.stock-action {
  display: inline-flex; align-items: center; justify-content: flex-start; gap: 7px;
  min-height: 38px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  background: var(--surface); color: #33475e;
  font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.stock-action .action-icon { display: inline-grid; place-items: center; flex-shrink: 0; width: 18px; height: 18px; background: transparent; color: var(--accent); }
.stock-action .action-icon svg { width: 18px; height: 18px; }
.stock-action:hover:not(:disabled) { border-color: #9dacbd; background: #f8fafc; }
.stock-action.primary, .stock-action.action-sevk { border-color: var(--accent); background: var(--accent); color: #fff; }
.stock-action.primary .action-icon, .stock-action.action-sevk .action-icon { color: #fff; }
.stock-action.primary:hover:not(:disabled), .stock-action.action-sevk:hover:not(:disabled) { border-color: var(--accent-hover); background: var(--accent-hover); }
.stock-action.action-iade .action-icon { color: var(--success); }
.stock-action.action-giriş .action-icon { color: var(--accent); }
.stock-action.action-kayıp .action-icon { color: var(--danger); }
.stock-action:disabled, .stock-action.primary:disabled, .stock-action.action-sevk:disabled {
  border-color: var(--line); background: #f1f3f6; color: #8a94a6;
}
.stock-action:disabled .action-icon, .stock-action.primary:disabled .action-icon, .stock-action.action-sevk:disabled .action-icon { color: #a6b0be; }

/* Kart, tablo ve yapışkan başlık. */
.panel {
  min-width: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-card);
  background: var(--surface); box-shadow: var(--shadow-card);
}
.stock-workspace.panel { border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
.stock-workspace .toolbar { padding: 0 0 14px; border: 0; }
.stock-workspace .toolbar > .filter-field:first-child { flex-grow: 1.4; }
.stock-workspace .table-info { padding: 0 0 10px; border: 0; }
.stock-workspace .table-scroll { border: 1px solid var(--line); border-radius: var(--radius-card) var(--radius-card) 0 0; background: var(--surface); }
.stock-workspace .material-pagination { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-card) var(--radius-card); }
.table-scroll {
  width: 100%; max-width: 100%; max-height: 640px;
  overflow: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.data-table { width: 100%; min-width: 680px; border-collapse: collapse; text-align: left; font-size: 13px; line-height: 1.5; }
.data-table th {
  position: sticky; top: 0; z-index: 2;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc; color: var(--muted);
  font-size: 11px; font-weight: 600; letter-spacing: .06em; line-height: 1.4; text-transform: uppercase; white-space: nowrap;
}
.data-table td {
  height: 46px; padding: 6px 14px;
  border-bottom: 1px solid #eef1f5;
  color: #33475e; vertical-align: middle;
}
.data-table th:first-child, .data-table td:first-child { padding-left: 18px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 18px; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:not(.is-selected):hover { background: #f8fafc; }
.data-table .numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .code { color: var(--muted); font-size: 12px; }
.cell-secondary { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.45; overflow-wrap: anywhere; }
.date-cell { color: var(--muted); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-info { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; padding: 12px 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.5; }
.table-info strong { color: var(--ink); font-weight: 600; }
.info-hint { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 6px; color: #8a97a8; vertical-align: -3px; }
.info-hint:hover, .info-hint:focus-visible { color: var(--accent); }
.pagination {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px; min-height: 44px; padding: 6px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
}
.pagination-controls { display: flex; align-items: center; gap: 6px; }
.pagination-controls button {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--line); border-radius: 5px; background: var(--surface);
  color: var(--muted); font-size: 15px; line-height: 1;
}
.pagination-controls button:hover:not(:disabled) { border-color: #9dacbd; background: var(--accent-soft); color: var(--accent); }
.pagination-controls button:disabled { background: #f6f8fa; color: #a6b0be; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty > svg { margin-bottom: 12px; color: #9badc4; }
.empty h3 { margin-bottom: 6px; color: #3f5368; font-size: 15px; }
.empty p { max-width: 390px; margin: 0 auto 16px; font-size: 13px; }
.list-caption { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }

/* Malzeme tablosu: 10 sütun, kendi kabında kayar. */
.stock-table { table-layout: fixed; }
.stock-table.material-stock-table { min-width: 1080px !important; }
.material-stock-table th:first-child { width: 44px; }
.material-stock-table th:nth-child(2) { width: 92px; }
.material-stock-table th:nth-child(3) { width: 234px; }
.material-stock-table th:nth-child(4) { width: 160px; }
/* Hizalama: "Ürün adı" başlığı ürün adı metniyle aynı x'te (36 px görsel + 10 px boşluk). */
.data-table.material-stock-table th.name-head { padding-left: 72px; }
/* Toplam / Depo / Şantiye: başlık ve hücre içeriği ortalı (yalnız stok tablosu). */
.data-table.material-stock-table th.numeric,
.data-table.material-stock-table td.numeric { text-align: center; }
/* Sıralanabilir başlıklar: tıklanabilir, hover'da nötr çift ok, sıralıyken tek yön. */
th.sortable { cursor: pointer; }
.sort-button {
  display: inline-flex; align-items: center; justify-content: flex-start; gap: 4px;
  width: 100%; padding: 0; border: 0; background: none; color: inherit;
  font: inherit; letter-spacing: inherit; text-align: inherit; text-transform: inherit;
  white-space: nowrap; cursor: pointer;
}
.sortable.numeric .sort-button { position: relative; justify-content: center; }
/* Ortalı başlıklarda ok, metnin merkezini kaydırmasın diye sağ kenara yerleşir. */
.sortable.numeric .sort-icons { position: absolute; top: 50%; right: 0; transform: translateY(-50%); }
.sort-icons {
  display: inline-flex; flex: 0 0 10px; flex-direction: column;
  align-items: center; justify-content: center;
  color: #8a97a8; font-size: 9px; line-height: .72;
  opacity: 0; transition: opacity .12s ease;
}
.sortable:hover .sort-icons { opacity: .65; }
.sortable[aria-sort="ascending"] .sort-icons,
.sortable[aria-sort="descending"] .sort-icons { opacity: 1; }
.sortable[aria-sort="ascending"] .sort-down,
.sortable[aria-sort="descending"] .sort-up { display: none; }
.sortable[aria-sort="ascending"] .sort-up,
.sortable[aria-sort="descending"] .sort-down { color: var(--accent); font-weight: 700; }
.material-stock-table th:nth-child(5) { width: 64px; }
.material-stock-table th:nth-child(6),
.material-stock-table th:nth-child(7),
.material-stock-table th:nth-child(8) { width: 104px; }
.material-stock-table th:nth-child(9) { width: 108px; }
.material-stock-table th:last-child { width: 52px; }
.material-stock-table th.visually-hidden-heading { color: transparent; }
.material-stock-table td { height: 47px; padding: 1px 10px; }
.data-table.material-stock-table thead th { padding: 2px 10px; }
.data-table.material-stock-table th:first-child { padding-left: 0; }
.material-stock-table td:first-child { padding-left: 0; }
.material-stock-table tr.is-selected td { background: #f2f7ff; }
.material-stock-table tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.material-stock-table tr.is-selected:hover td { background: #eef4fe; }
.material-code { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.material-category { color: var(--muted); font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
.material-category-text { display: -webkit-box; max-width: 100%; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.material-stock-table .numeric { color: var(--ink); font-size: 13px; font-weight: 500; }
.material-stock-table .cell-secondary { white-space: nowrap; }
.product-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.product-art-wrap { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 6px; background: #f4f7fb; }
.product-art { display: block; width: 32px; height: 32px; object-fit: contain; }
.product-art.product-photo { border-radius: 4px; background: #fff; }
.product-copy { min-width: 0; }
.product-name-button, .product-link {
  display: block; max-width: 100%; padding: 0;
  border: 0; background: transparent; color: var(--ink);
  font-size: 13px; font-weight: 600; line-height: 1.4; text-align: left;
}
.product-name-button:hover, .product-link:hover { color: var(--accent); }
.product-code { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.4; font-variant-numeric: tabular-nums; }
.material-stock-table .product-name-button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-check { display: inline-flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; cursor: pointer; vertical-align: middle; }
.row-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.row-check:focus-within { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: 5px; }
.selection-col { padding: 0; text-align: center; }
.row-arrow {
  display: grid; place-items: center; width: 30px; height: 30px; margin-left: auto; padding: 0;
  border: 0; border-radius: 5px; background: transparent; color: #8a97a8;
}
.row-arrow:hover { background: var(--accent-soft); color: var(--accent); }
.row-arrow svg { transition: transform .18s ease; }
.row-arrow[aria-expanded="true"] svg { transform: rotate(90deg); }
.material-table-info { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.selection-summary { display: flex; align-items: center; gap: 6px; min-height: 34px; font-size: 12px; }
.material-pagination {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  gap: 8px 16px; padding: 6px 14px;
  border-top: 1px solid var(--line); background: var(--surface);
}
.stock-workspace .material-pagination .pagination { flex: 1 1 auto; min-height: 40px; padding: 0; border: 0; }
.material-pagination > .filter-field { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.material-pagination .filter-caption { white-space: nowrap; }
.material-pagination .control { width: 84px; height: 34px; }
.empty-page-count { color: var(--muted); font-size: 12px; }
.category-row th {
  padding: 8px 14px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: #f8fafc; color: var(--muted);
  font-size: 11px; font-weight: 600; letter-spacing: .06em; line-height: 1.4; text-align: left; text-transform: uppercase;
}
.category-heading { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.category-thumbnail { flex: 0 0 20px; width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 4px; background: #fff; object-fit: contain; }

/* Durum rozetleri: nokta + 11 px metin. */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 999px;
  background: #eef1f5; color: var(--muted);
  font-size: 11px; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.pill::before { flex-shrink: 0; width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.pill.blue { background: var(--accent-soft); color: var(--accent); }
.pill.green { background: var(--success-soft); color: var(--success); }
.pill.amber { background: var(--warning-soft); color: var(--warning); }
.pill.red { background: var(--danger-soft); color: var(--danger); }
.pill.purple { background: var(--purple-soft); color: var(--purple); }
.pill.teal { background: var(--teal-soft); color: var(--teal); }
/* Durum: normal satırda rozet değil; yeşil nokta + "Normal" metni. */
.status-dot {
  display: inline-block; flex-shrink: 0;
  width: 7px; height: 7px; margin: 0;
  border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 2px var(--success-soft);
  vertical-align: middle;
}
.status-normal { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; line-height: 1.4; white-space: nowrap; }

/* İkon eylemleri. */
.icon-action {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 32px;
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: var(--radius-control);
  background: transparent; color: var(--muted);
}
.icon-action:hover, .icon-action:focus-visible { background: #eef2f7; color: var(--ink); }
.icon-action.danger { color: var(--danger); }
.icon-action.danger:hover { background: var(--danger-soft); }
.icon-action::after {
  position: absolute; z-index: 40; top: calc(100% + 6px); right: 0;
  width: max-content; max-width: 230px; padding: 6px 9px;
  border-radius: 5px; background: var(--ink); color: #fff;
  content: attr(data-tooltip); font-size: 11px; line-height: 1.4;
  opacity: 0; pointer-events: none; transition: opacity .1s;
}
.icon-action:hover::after, .icon-action:focus-visible::after { opacity: 1; }
.inline-icon-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.inline-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.inline-toolbar .button { white-space: normal; }
.definition-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 4px; }

/* Satır altında açılan malzeme ayrıntısı. */
.inline-detail-row > td { height: auto; padding: 0 !important; background: #f7f9fc; white-space: normal; }
.inline-product-detail {
  position: sticky; left: 0;
  width: 100%; min-width: 0; max-width: calc(100vw - 288px);
  padding: 18px 22px;
  border-block: 1px solid #e6ecf4;
  color: var(--ink); font-size: 13px; line-height: 1.55; white-space: normal; overflow-wrap: anywhere;
}
.inline-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.detail-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.detail-photo { display: grid; place-items: center; flex: 0 0 56px; width: 56px; height: 56px; border-radius: 8px; background: #fff; }
.detail-photo .product-art { width: 48px; height: 48px; }
.detail-identity h2 { font-size: 17px; font-weight: 600; }
.detail-identity .subtext { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
/* Sade ürün detayı: araç satırı, 2 kolonlu stok dağılımı, tek satır özet. */
.inline-detail-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 16px; }
.inline-detail-tools .filter-field { flex: 0 1 240px; margin: 0; }
.inline-detail-tools .filter-caption { font-size: 10.5px; }
.detail-section-title { margin: 0 0 8px; color: var(--ink); font-size: 13px; font-weight: 600; }
.balance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.balance-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-width: 0; min-height: 30px; padding: 5px 0;
  border-bottom: 1px solid #eef1f5; color: var(--muted); font-size: 12.5px; line-height: 1.4;
}
.balance-name { min-width: 0; overflow-wrap: anywhere; }
.balance-value { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.balance-value.is-zero { color: #8a97a8; font-weight: 500; }
.balance-value.is-unknown { color: var(--warning); font-weight: 600; }
.balance-summary { margin: 10px 0 0; color: var(--ink); font-size: 12.5px; line-height: 1.5; }
.inline-description-block { margin-top: 16px; }
.detail-description-title { font-size: 11.5px; line-height: 1.4; }
.inline-description { margin: 6px 0 0; color: #33475e; font-size: 13px; line-height: 1.55; }
.action-hint { color: var(--muted); font-size: 12px; font-weight: 500; }
.inline-detail-grid { display: grid; grid-template-columns: minmax(220px, .9fr) minmax(280px, 1.1fr); gap: 28px; }
.inline-detail-grid > * { min-width: 0; }
.inline-balances { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 22px; }
.inline-balances .inspector-location,
.inspector-location {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-width: 0; min-height: 36px; padding: 7px 0;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: transparent; color: var(--muted); font-size: 12.5px; line-height: 1.4;
}
.inspector-location > span { min-width: 0; overflow-wrap: anywhere; }
.inspector-location strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.inspector-location.unknown strong, .inspector-location.is-unknown strong { color: var(--warning); }
.selected-sku-context { margin: 8px 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.inline-disclosure { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.inline-disclosure > summary { display: flex; align-items: center; min-height: 32px; color: var(--ink); font-size: 12px; font-weight: 600; cursor: pointer; }
.inline-disclosure p { margin: 6px 0 0; font-size: 12px; line-height: 1.6; }
.technical-details { color: var(--muted); font-size: 11.5px; }
.inline-history { max-height: 320px; padding-top: 6px; overflow: auto; }
.history-entry { padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.history-entry:last-child { border-bottom: 0; }
.history-entry > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.history-entry strong { color: #33475e; font-weight: 600; }
.history-entry time { font-size: 11px; }
.history-entry p { margin: 3px 0 0; font-size: 11.5px; overflow-wrap: anywhere; }
.photo-credit { min-width: 0; margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.photo-credit > summary { display: flex; align-items: center; min-height: 32px; color: #405168; cursor: pointer; }
.photo-credit p { margin: 3px 0 6px; font-size: 11px; }
.photo-credit a { color: var(--accent); }

/* Kayıt ayrıntısı (modal). */
.movement-detail { color: var(--muted); }
.inspector-hero { display: grid; place-items: center; position: relative; height: 112px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.inspector-hero img { display: block; width: 88px; height: 88px; object-fit: contain; }
.inspector-hero figcaption { position: absolute; bottom: 6px; color: var(--muted); font-size: 10.5px; }
.inspector-product-heading h2 { color: var(--ink); font-size: 18px; font-weight: 600; letter-spacing: -.01em; line-height: 1.4; overflow-wrap: anywhere; }
.inspector-more { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.inspector-more dl { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 12.5px; }
.inspector-more dt { color: var(--muted); }
.inspector-more dd { margin: 0; color: #33475e; overflow-wrap: anywhere; }

/* Hareketler. */
.movement-toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.movement-toolbar > .filter-field > .filter-caption { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.movement-toolbar > .filter-field { flex: 0 1 170px; }
.movement-toolbar > .date-filter + .filter-field { flex: 1 1 230px; }
.movement-toolbar > .icon-action { flex: 0 0 32px; }
.date-filter { position: relative; flex: 0 0 auto; min-width: 0; }
.date-filter-summary {
  display: flex; align-items: center; gap: 8px;
  width: fit-content; min-height: 38px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  background: var(--surface); color: #33475e; font-size: 12px; line-height: 1.4;
  cursor: pointer; list-style: none;
}
.date-filter-summary::-webkit-details-marker { display: none; }
.date-filter-summary:hover { border-color: #9dacbd; }
.date-filter-fields {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0;
  width: 320px; max-width: calc(100vw - 40px); margin: 0; padding: 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-card);
  background: var(--surface); box-shadow: var(--shadow-pop);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.date-filter:not([open]) .date-filter-fields { display: none; }
.movement-table { min-width: 900px; }
.movement-row { cursor: pointer; }
.movement-row:hover > td { background: #f8fafc; }
.movement-row.is-selected > td { background: #f2f7ff; }
.movement-table .product-cell { min-width: 170px; }
.movement-table .product-name-button { max-width: 240px; }
.movement-table .numeric { color: var(--ink); font-weight: 500; }
.inline-movement-detail { padding: 18px 24px; background: #f7f9fc; }
.movement-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 28px; margin: 0 0 8px; }
.movement-facts > div { min-width: 0; }
.movement-facts dt { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.movement-facts dd { margin: 0; color: var(--ink); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.technical-details summary { display: flex; align-items: center; min-height: 32px; color: #405168; cursor: pointer; }

/* Katalog. */
.catalog-table .product-copy .product-code { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.catalog-results { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.catalog-result {
  display: grid; gap: 2px; width: 100%; min-height: 52px; padding: 9px 12px;
  border: 0; border-bottom: 1px solid var(--line);
  background: var(--surface); color: #33475e; font-size: 12px; line-height: 1.45; text-align: left;
}
.catalog-result:last-child { border-bottom: 0; }
.catalog-result strong { color: var(--ink); font-size: 13px; font-weight: 600; }
.catalog-result small { overflow-wrap: anywhere; }
.catalog-result.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.catalog-result:hover { background: #f8fafc; }
.catalog-result-count, .catalog-selection-info { margin: 8px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; }
.picker-pagination { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 8px; }

/* Formlar ve modal. */
dialog {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: rgba(16, 28, 44, .42); }
#modal { overflow: hidden; }
#modal[open] { display: flex; }
.modal-form, .modal-shell {
  display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 0;
  max-height: calc(100dvh - 34px); margin: 0;
}
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-shrink: 0; padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.modal-header > div { min-width: 0; }
.modal-header h2 { margin-bottom: 3px; font-size: 18px; font-weight: 600; }
.modal-header p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal-body { min-height: 0; padding: 20px 24px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; flex-shrink: 0; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); background: #fbfcfd; }
.modal-footer .button { min-height: 38px; white-space: normal; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; line-height: 1.4; text-transform: uppercase; }
.field.full { grid-column: 1 / -1; }
.field small { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.5; }
.field-error { display: block; margin: 0; color: var(--danger); font-size: 11.5px; font-weight: 500; line-height: 1.5; }
.field-error:empty { display: none; }
.form-section { min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
.form-section:last-of-type { margin-bottom: 0; }
.form-section > legend {
  width: 100%; margin: 0 0 12px; padding: 0 0 7px;
  border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; line-height: 1.4; text-transform: uppercase;
}
.form-note { margin: 0 0 18px; padding: 10px 12px; border: 1px solid #f0e3c4; border-radius: var(--radius-control); background: var(--warning-soft); color: #8a5a0a; font-size: 12px; line-height: 1.55; }
.form-error { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-control); background: var(--danger-soft); color: var(--danger); font-size: 12.5px; line-height: 1.5; }
.form-error:empty { display: none; }
.form-error-summary { margin-top: 0; margin-bottom: 16px; border: 1px solid #edc9c5; }
.form-product-summary {
  display: flex; align-items: center; gap: 12px; min-width: 0; margin-top: 10px; padding: 10px 12px;
  border: 1px solid #d8e3f2; border-radius: var(--radius-card); background: #f5f8fd; color: #33475e;
  font-size: 12px; line-height: 1.45; overflow-wrap: anywhere;
}
.form-product-summary .product-copy { display: grid; gap: 2px; min-width: 0; }
.form-product-summary strong { color: var(--ink); font-size: 13px; font-weight: 600; }
.form-product-summary p, .form-product-summary small { margin: 0; color: var(--muted); font-size: 11px; }
.form-product-summary .product-art-wrap { background: #fff; }
.form-route { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-balances { margin-top: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-control); background: #f8fafc; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.form-balances:empty { display: none; }
.form-balances p { margin: 2px 0; }
.balance-warning { color: var(--warning); font-size: 11.5px; }
.filter-error { flex-basis: 100%; margin: 0; padding: 9px 11px; border: 1px solid #edc9c5; border-radius: var(--radius-control); background: var(--danger-soft); color: var(--danger); font-size: 12px; line-height: 1.5; }
.filter-error:empty { display: none; }

/* Görsel yükleme ve kütüphane. */
.image-upload-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; }
.image-upload-preview { width: 128px; min-height: 128px; padding: 5px; border: 1px solid var(--line); border-radius: var(--radius-card); background: #fff; }
.image-upload-preview img { display: block; width: 100%; height: 116px; object-fit: contain; border-radius: 5px; }
.preview-origin { display: block; padding-top: 5px; color: var(--muted); font-size: 10.5px; line-height: 1.4; }
.image-upload-preview .photo-credit { margin-top: 4px; font-size: 10.5px; }
.image-dropzone {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
  min-width: 0; min-height: 128px; padding: 12px;
  border: 1px dashed #aab4c1; border-radius: var(--radius-card);
  background: #f8fafc; color: var(--muted); font-size: 11.5px; line-height: 1.5;
  cursor: pointer; text-align: center;
}
.image-dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.image-dropzone strong { color: #33475e; font-size: 13px; font-weight: 600; }
.image-dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.image-file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.image-dropzone .button { margin-top: 4px; }
.image-upload-preview[hidden] + .image-dropzone { grid-column: 1 / -1; }
.image-upload-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.upload-help, .image-upload-status { display: block; margin: 8px 0 4px; color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.image-upload .field-error { margin: 6px 0; }
.image-library { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-card); background: #f7f9fc; }
.image-library-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.image-library-toolbar input { flex: 1 1 180px; width: auto; }
.image-library-toolbar select { flex: 0 1 140px; width: auto; }
.image-library-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.image-library-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 0; min-height: 44px; padding: 8px;
  border: 1px solid var(--line); border-radius: var(--radius-control);
  background: #fff; color: inherit; cursor: pointer; text-align: center;
}
.image-library-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.image-library-item img { width: 100%; height: 74px; object-fit: contain; }
.image-library-item strong { font-size: 11px; font-weight: 600; overflow-wrap: anywhere; }
.image-library-item small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.image-library .picker-pagination { justify-content: space-between; }
.uploaded-credit { margin-top: 6px; }

/* Bildirimler ve durumlar. */
.toast {
  position: fixed; bottom: 24px; left: 50%; z-index: 120;
  max-width: min(90vw, 650px); padding: 11px 18px;
  border-radius: var(--radius-control); background: var(--ink); color: #fff;
  font-size: 12.5px; line-height: 1.5; text-align: center;
  opacity: 0; pointer-events: none; transform: translate(-50%, 12px);
  transition: opacity .16s, transform .16s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.error-state { max-width: 620px; margin: 80px auto; padding: 36px 28px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); text-align: center; box-shadow: var(--shadow-card); }
.error-state > svg { margin-bottom: 14px; color: #8da0b8; }
.error-state h1 { font-size: 22px; }
.error-state p { margin-top: 8px; color: var(--muted); font-size: 13px; }
.loading-overlay { opacity: .5; pointer-events: none; }

/* Duyarlı yerleşim: sayfa taşmaz, tablolar kendi kabında kayar. */
@media (max-width: 1279px) {
  .main { padding: 22px 24px 32px; }
}
@media (max-width: 1023px) {
  .page-heading { flex-wrap: wrap; gap: 14px; }
  .main { padding: 20px 22px 30px; }
  .movement-toolbar { flex-wrap: wrap; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static; top: auto; z-index: 30;
    width: 100%; height: auto; max-width: 100%;
    padding: 12px 18px 0;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0 0 10px; }
  .navigation {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px; width: 100%; max-width: 100%; padding-bottom: 8px;
    overflow: visible;
  }
  .nav-button {
    flex-direction: column; justify-content: center; gap: 3px;
    width: 100%; min-width: 0; min-height: 56px; padding: 6px 2px;
    font-size: 11px; line-height: 1.2; text-align: center;
    white-space: nowrap; box-shadow: none;
  }
  .nav-button svg { width: 18px; height: 18px; }
  .nav-button.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .nav-count { display: none; }
  .main { padding: 17px 18px 28px; }
  .stock-action { min-height: 44px; }
  .button, .button.small, .icon-button, .row-arrow, .pagination-controls button, .tab-switch button, .date-filter-summary { min-height: 44px; }
  .icon-button, .row-arrow { min-width: 44px; }
  .pagination-controls button { min-width: 44px; }
  .control, .field .control, .filter-field .control, .toolbar .control { min-height: 44px; }
  .button.small { min-height: 44px; }
  .icon-action { flex-basis: 44px; width: 44px; height: 44px; }
  .toolbar { padding: 14px 16px; }
  .stock-workspace .toolbar { padding: 0 0 14px; }
  .modal-header, .modal-body { padding: 18px 20px; }
  .modal-footer { padding: 12px 20px; }
  .modal-footer .button { min-height: 44px; }
  .movement-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .inline-detail-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .balance-grid { grid-template-columns: minmax(0, 1fr); }
  .inline-detail-tools .filter-field { flex: 1 1 100%; }
  .inline-product-detail { max-width: calc(100vw - 36px); padding: 16px 18px; }
}
@media (max-width: 600px) {
  .brand { padding-bottom: 8px; }
  .brand-small { font-size: 10.5px; }
  .main { padding: 17px 15px 26px; }
  h1 { font-size: 24px; }
  .page-heading .subtext { font-size: 12.5px; }
  .page-heading > .button { width: 100%; }
  .stock-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stock-action { justify-content: center; min-height: 44px; padding: 0 10px; }
  .stock-action-context { margin-bottom: 6px; }
  .tab-switch { width: 100%; }
  .tab-switch button { flex: 1; }
  .toolbar { gap: 10px; padding: 14px; align-items: stretch; }
  .toolbar > .filter-field, .toolbar > .search-field, .toolbar > .control { flex: 1 0 100%; width: 100%; max-width: 100%; }
  .movement-toolbar > .filter-field { flex: 1 1 calc(50% - 6px); }
  .movement-toolbar > .date-filter { flex: 1 1 100%; }
  .movement-toolbar .date-filter-summary { width: 100%; max-width: none; }
  .movement-toolbar > .date-filter + .filter-field { flex-basis: 100%; }
  .date-filter-fields { grid-template-columns: minmax(0, 1fr); width: min(320px, calc(100vw - 40px)); }
  .table-scroll { max-height: 560px; }
  .data-table { font-size: 12.5px; }
  .data-table th, .data-table td { padding-inline: 10px; }
  .data-table th:first-child, .data-table td:first-child { padding-left: 12px; }
  .data-table th:last-child, .data-table td:last-child { padding-right: 12px; }
  .stock-table.material-stock-table { min-width: 1000px !important; }
  .product-art-wrap { width: 32px; height: 32px; }
  .product-art { width: 28px; height: 28px; }
  .material-pagination { padding: 6px 12px; }
  .material-pagination > .filter-field { flex: 1 1 100%; }
  .pagination { padding-inline: 12px; }
  .form-grid, .detail-facts { grid-template-columns: minmax(0, 1fr); }
  .field.full { grid-column: auto; }
  #modal { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .modal-form, .modal-shell { max-height: calc(100dvh - 18px); }
  .modal-header { padding: 16px; }
  .modal-header h2 { font-size: 17px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  .modal-footer .button { flex: 1; padding-inline: 10px; }
  .inline-detail-heading { flex-wrap: wrap; gap: 8px; }
  .inline-icon-actions { margin-left: auto; }
  .detail-photo { flex-basis: 48px; width: 48px; height: 48px; }
  .detail-photo .product-art { width: 42px; height: 42px; }
  .inline-balances { column-gap: 16px; }
  .movement-facts { grid-template-columns: minmax(0, 1fr); }
  .movement-toolbar { padding: 14px; }
  .image-upload-grid { grid-template-columns: minmax(0, 1fr); }
  .image-upload-preview { width: 100%; }
  .image-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .image-library-toolbar .button { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* ===== Malzemeler v2: görsel kutusu, kompakt üst alan, katlanabilir katalog, uzun açıklama ===== */

/* A) Ürün görselleri: tüm satırlarda 44x44 aynı kutu, kırpma yok. */
.product-art-wrap {
  width: 44px; height: 44px; padding: 1px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.product-art { width: 100%; height: 100%; object-fit: contain; }
.product-art.product-photo { border-radius: 4px; background: #fff; }
.detail-photo { flex: 0 0 64px; width: 64px; height: 64px; padding: 2px; border: 1px solid var(--line); background: #fff; }
.detail-photo .product-art { width: 100%; height: 100%; }
.material-stock-table td { height: 52px; padding: 3px 10px; }
.catalog-table td { height: 52px; padding: 4px 14px; }

/* C) Sekmeler + eylemler tek satırda (stok ve katalog aynı yapı). */
.tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; margin: 0 0 14px; }
.material-tabs { margin: 0; }
.tabs-right { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 38px; }
.stock-actions-wrap { flex: 1 1 auto; justify-content: flex-end; }
.tabs-right .stock-action-context { display: flex; align-items: baseline; gap: 6px; flex: 0 1 auto; min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; }
.tabs-right .stock-action-context:empty { display: none; }
.tabs-right .stock-action-context strong { min-width: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs-right .stock-action-context span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-count { color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }

/* D) Katalog kategori başlıkları: katla/aç. */
.category-row th { padding: 0; }
.category-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 36px; padding: 8px 14px; border: 0; background: transparent;
  color: inherit; font: inherit; letter-spacing: normal; text-transform: none;
  text-align: left; cursor: pointer;
}
.category-chevron { display: inline-flex; flex-shrink: 0; color: var(--muted); transition: transform .15s ease; }
.category-toggle[aria-expanded="true"] .category-chevron { transform: rotate(90deg); }
.category-count { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.category-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* F) Uzun katalog açıklamaları: satırda tek satır, detayda düzenli liste. */
.catalog-table .product-copy .product-code {
  display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; -webkit-line-clamp: unset;
}
.catalog-result small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-description { margin: 12px 0 0; }
.description-text { margin: 0; color: #33475e; font-size: 13px; line-height: 1.55; }
.description-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; margin: 0; padding-left: 18px; color: #33475e; font-size: 12.5px; line-height: 1.5; }
.description-list li { min-width: 0; overflow-wrap: anywhere; }
.description-more { margin-top: 8px; }
.inline-description { display: -webkit-box; max-width: 100%; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

/* B) Masaüstünde Malzemeler tek ekrana sığar; tablo kendi içinde kayar. */
@media (min-width: 1024px) {
  .main.is-stock {
    height: 100dvh;
    padding: 14px 24px 12px;
    display: flex; flex-direction: column; overflow: hidden;
  }
  .main.is-stock .page-heading { align-items: center; margin-bottom: 8px; gap: 14px; flex: 0 0 auto; }
  .main.is-stock h1 { font-size: 24px; letter-spacing: -.02em; line-height: 1.15; }
  .main.is-stock .page-heading-copy { display: flex; align-items: baseline; gap: 10px; flex-wrap: nowrap; min-width: 0; }
  .main.is-stock .page-heading .subtext { margin: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .main.is-stock .page-heading > .button { min-height: 36px; padding: 0 12px; font-size: 12.5px; }
  .main.is-stock .tabs-row { flex: 0 0 auto; margin-bottom: 8px; min-height: 36px; }
  .main.is-stock .tab-switch { padding: 2px; }
  .main.is-stock .tab-switch button { min-height: 30px; padding: 0 11px; font-size: 12.5px; }
  .main.is-stock .tabs-right { min-height: 36px; flex: 0 0 auto; }
  .main.is-stock .stock-action { min-height: 36px; padding: 0 11px; font-size: 12.5px; gap: 6px; }
  .main.is-stock .stock-action .action-icon { width: 16px; height: 16px; }
  .main.is-stock .stock-action .action-icon svg { width: 16px; height: 16px; }
  .main.is-stock > .stock-workspace { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  .main.is-stock .toolbar { flex: 0 0 auto; flex-wrap: nowrap; padding: 0 0 8px; gap: 8px; align-items: flex-end; }
  .main.is-stock .filter-field { gap: 2px; }
  .main.is-stock .filter-caption { font-size: 10px; }
  .main.is-stock .toolbar .control { height: 34px; padding: 0 9px; font-size: 12.5px; }
  .main.is-stock .toolbar > .filter-field:first-child { flex: 1 1 240px; }
  .main.is-stock .search-field > svg { left: 11px; }
  .main.is-stock .toolbar .search-field input { padding-left: 36px; }
  .main.is-stock .stock-content { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  .main.is-stock .material-table-info { flex: 0 0 auto; height: 36px; padding: 0 0 4px; font-size: 11.5px; }
  .main.is-stock .material-table-info .selection-summary { min-height: 28px; }
  .main.is-stock .material-table-info .icon-action { width: 28px; height: 28px; flex-basis: 28px; }
  .main.is-stock .table-scroll { flex: 1 1 auto; min-height: 0; max-height: none; }
  .main.is-stock .material-pagination { flex: 0 0 auto; min-height: 40px; padding: 4px 12px; }
  .main.is-stock .material-pagination .pagination { min-height: 32px; }
  .main.is-stock .material-pagination .control { height: 32px; }
}

/* Mobil/tablet: mevcut sayfa akışı korunur; sekmeler ve eylemler alt alta sarar. */
@media (max-width: 1023px) {
  .tabs-row { flex-wrap: wrap; row-gap: 10px; }
  .tabs-right { width: 100%; min-height: 0; flex-wrap: wrap; }
  .stock-actions-wrap { justify-content: flex-start; }
  .stock-actions { flex-wrap: wrap; }
}

/* ===== Topbar kaldırıldı; sidebar daralt/genişlet (masaüstü >=821px) ===== */
.shell { transition: grid-template-columns .18s ease; }
@media (min-width: 821px) {
  .sidebar { width: 100%; transition: padding .18s ease; }
  .sidebar-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    min-width: 0; padding: 2px 4px 18px;
  }
  .sidebar-head .brand { padding: 0; min-width: 0; }
  .brand-text { min-width: 0; }
  .sidebar-toggle {
    display: inline-grid; place-items: center; flex: 0 0 30px;
    width: 30px; height: 30px; padding: 0;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--surface); color: var(--muted);
    cursor: pointer; transition: background .15s, color .15s;
  }
  .sidebar-toggle svg { transform: rotate(180deg); transition: transform .18s ease; }
  .sidebar-toggle:hover { background: #eef2f7; color: var(--ink); }
  .shell.is-collapsed { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar.is-collapsed { padding: 16px 8px; }
  .sidebar.is-collapsed .sidebar-head { flex-direction: column; gap: 10px; padding: 0 0 12px; }
  .sidebar.is-collapsed .brand { justify-content: center; width: 100%; }
  .sidebar.is-collapsed .brand-text,
  .sidebar.is-collapsed .nav-label,
  .sidebar.is-collapsed .nav-count { display: none; }
  .sidebar.is-collapsed .nav-button {
    justify-content: center; gap: 0; width: 44px; min-height: 44px;
    margin: 0 auto; padding: 0;
  }
  .sidebar.is-collapsed .nav-button svg { width: 20px; height: 20px; }
  .sidebar.is-collapsed .sidebar-toggle svg { transform: rotate(0deg); }
}
@media (max-width: 820px) {
  .sidebar-toggle { display: none; }
}

/* Arama: büyüteç ile placeholder çakışmasın (metin ikonun sağından başlar). */
.search-field input { padding-left: 36px; }
.main.is-stock .toolbar .search-field input { padding-left: 36px; }

/* ===== Sağ panel detay + kategori ikonları + büyük görseller + durum ikonları ===== */

/* 3) Ürün görselleri: satır 52x52 cover, detay paneli 72x72 contain */
.product-art-wrap {
  width: 52px; height: 52px; padding: 0;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden;
}
.product-art { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.product-art.product-photo { border-radius: 8px; background: #fff; }
.material-stock-table td { height: 60px; padding: 3px 10px; }
.detail-photo.panel-photo { flex: 0 0 72px; width: 72px; height: 72px; padding: 2px; border: 1px solid var(--line); background: #fff; }
.panel-photo .product-art { object-fit: contain; }

/* 2) Kategori ikonları */
.category-icon { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; display: block; }
.category-visual { display: inline-flex; align-items: center; flex-shrink: 0; }
.category-thumb-fallback { display: inline-flex; }
.category-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }

/* 4) Durum ikonları */
.status-signal { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; line-height: 1.4; white-space: nowrap; }
.status-signal svg { width: 16px; height: 16px; flex-shrink: 0; }
.status-ok svg { color: var(--success); }
.status-warning svg { color: var(--warning); }
.status-danger svg { color: var(--danger); }
.status-archived svg { color: #8a97a8; }
.status-label { color: var(--muted); }

/* 1) Sağ panel ürün detayı */
.detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90;
  width: 400px; max-width: 100vw;
  display: flex; flex-direction: column; overflow: hidden;
  border-left: 1px solid var(--line); background: var(--surface);
  box-shadow: -12px 0 40px rgba(16, 28, 44, .14);
}
.detail-panel[hidden] { display: none !important; }
.detail-panel-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 20px; scrollbar-width: thin; }
.detail-panel .inline-detail-heading { align-items: flex-start; margin-bottom: 12px; }
.detail-panel .detail-identity { min-width: 0; }
.detail-panel .detail-identity h2 { font-size: 17px; }
.detail-panel .panel-icon-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 170px; }
.panel-close { border: 1px solid var(--line); }
.panel-close:hover { background: var(--danger-soft); color: var(--danger); }
.panel-tools { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.panel-action-row { display: flex; flex-wrap: wrap; gap: 6px; }
.panel-action-row .stock-action { min-height: 36px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.panel-action-row .stock-action .action-icon { width: 16px; height: 16px; }
.panel-action-row .stock-action .action-icon svg { width: 16px; height: 16px; }
.panel-tools > .button.ghost { align-self: flex-start; padding-left: 2px; }
.panel-variant { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 8px 0 4px; }
.panel-variant .filter-field { flex: 1 1 200px; }
.panel-section { margin-top: 16px; }
.panel-stock { margin-top: 16px; }
.panel-stock .balance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel-description { margin: 6px 0 4px; }
.panel-description.is-expanded { display: block; overflow: visible; -webkit-line-clamp: unset; }
.panel-link {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0;
  border: 0; background: none; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer;
}
.panel-link:hover { text-decoration: underline; }
.panel-history { margin-top: 16px; }
.panel-history > summary { min-height: 36px; }

@media (max-width: 1023px) {
  .detail-panel { width: 100vw; border-left: 0; box-shadow: none; }
  .detail-panel-scroll { padding: 16px; }
  .panel-stock .balance-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Tanımlar > Kategoriler: ikon 28x28, satır 54px; stok/katalog 20px kalır. */
.definition-category-tr td { height: 54px; padding-top: 6px; padding-bottom: 6px; }
.definition-category-icon { display: inline-flex; align-items: center; flex-shrink: 0; }
.definition-category-icon .category-icon { width: 28px; height: 28px; }
.definition-category-tr .category-heading { gap: 10px; }

/* QA tur1: tarih popover hata şeridi tam görünsün. */
.date-filter-fields .filter-error { grid-column: 1 / -1; margin: 0; }
/* QA tur1: mobil Talepler/Hareketler menü-başlık boşluğu. */
@media (max-width: 820px) {
  .shell { grid-template-rows: auto 1fr; align-content: start; }
  .sidebar { align-self: start; }
}

/* QA tur1: Hareketler + Tanımlar masaüstünde tek ekran; içerik kendi içinde kayar. */
@media (min-width: 1024px) {
  .main.is-scroll-fit { height: 100dvh; padding: 14px 24px 12px; display: flex; flex-direction: column; overflow: hidden; }
  .main.is-scroll-fit .page-heading { flex: 0 0 auto; margin-bottom: 14px; }
  .main.is-scroll-fit > .tab-switch { flex: 0 0 auto; margin-bottom: 12px; }
  .main.is-scroll-fit > .panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  .main.is-scroll-fit .toolbar,
  .main.is-scroll-fit .movement-toolbar { flex: 0 0 auto; }
  .main.is-scroll-fit .scroll-content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .main.is-scroll-fit .scroll-content > .table-info { flex: 0 0 auto; }
  .main.is-scroll-fit .scroll-content > .table-scroll { flex: 1 1 auto; min-height: 0; max-height: none; }
  .main.is-scroll-fit .scroll-content > .pagination { flex: 0 0 auto; min-height: 44px; padding: 8px 14px; }
}

/* QA tur1: 390 Tanımlar — satırları stack'e çevir; tüm alanlar görünür, sayfa taşmaz. */
@media (max-width: 820px) {
  .definitions-table, .definitions-table thead, .definitions-table tbody,
  .definitions-table tr, .definitions-table th, .definitions-table td { display: block; width: 100%; }
  .definitions-table { min-width: 0; }
  .definitions-table thead { display: none; }
  .definitions-table tbody tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .definitions-table tbody td { height: auto; padding: 3px 0; border: 0; }
  .definitions-table tbody td:nth-child(2) { color: var(--muted); font-size: 12px; }
  .definitions-table .inline-toolbar { flex-wrap: wrap; margin-top: 6px; justify-content: flex-start; }
}

/* Mobilde ürün seçili değilken stok eylem çubuğu gizli: Stok/Katalog tablo üstü hizası. */
@media (max-width: 820px) {
  .stock-actions-wrap.is-empty { display: none; }
}
@media (max-width: 600px) {
  /* Stok/Katalog filtre alanları 2 kolon: iki sayfa tablo üstü aynı hizada. */
  .main.is-stock .stock-workspace .toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
  .main.is-stock .stock-workspace .toolbar > * { width: 100%; max-width: none; flex: none; }
  /* Katalog sayacı sekme satırında kalsın (satır yüksekliği Stok ile aynı). */
  .main.is-stock .tabs-row:has(.catalog-summary) { flex-wrap: nowrap; align-items: center; }
  .main.is-stock .tabs-row:has(.catalog-summary) .tab-switch { width: auto; flex: 1 1 auto; }
  .main.is-stock .tabs-row:has(.catalog-summary) .catalog-summary { width: auto; min-width: 0; flex: 0 0 auto; flex-wrap: nowrap; margin-left: 8px; }
}

/* ===== Oturum katmanı: giriş ekranı ve sidebar kullanıcı/çıkış ===== */
.login-screen {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
  background: var(--canvas);
}
.login-card {
  width: min(100%, 400px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.login-brand {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 22px; border-bottom: 1px solid var(--line);
}
.login-brand-text { min-width: 0; }
.login-title { margin-top: 22px; font-size: 24px; letter-spacing: -.02em; }
.login-description { margin-top: 6px; color: var(--muted); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.login-form .field { gap: 6px; }
.login-error { margin: 0; }
.login-submit { width: 100%; min-height: 42px; margin-top: 2px; }
.login-note { margin-top: 18px; color: var(--muted); font-size: 11.5px; line-height: 1.5; text-align: center; }

.sidebar-account {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; margin-top: auto; padding: 14px 4px 2px;
  border-top: 1px solid var(--line);
}
.account-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-name {
  overflow: hidden; color: var(--ink); font-size: 12.5px; font-weight: 600; line-height: 1.35;
  text-overflow: ellipsis; white-space: nowrap;
}
.account-role {
  margin-top: 1px; overflow: hidden; color: var(--muted);
  font-size: 10.5px; font-weight: 500; letter-spacing: .04em; line-height: 1.4;
  text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap;
}
.sidebar-logout, .sidebar-backup {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  flex-shrink: 0; min-height: 32px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--radius-control);
  background: var(--surface); color: var(--muted);
  font-size: 12px; font-weight: 500;
}
.sidebar-logout:hover, .sidebar-backup:hover { border-color: var(--line-strong); background: #eef2f7; color: var(--ink); }

@media (min-width: 821px) {
  .sidebar.is-collapsed .sidebar-account { flex-direction: column; gap: 6px; padding-top: 12px; }
  .sidebar.is-collapsed .account-meta,
  .sidebar.is-collapsed .logout-label, .sidebar.is-collapsed .backup-label { display: none; }
  .sidebar.is-collapsed .sidebar-logout, .sidebar.is-collapsed .sidebar-backup { width: 44px; height: 44px; padding: 0; }
}
@media (max-width: 820px) {
  .sidebar-account { margin-top: 0; padding: 0 0 12px; border-top: 0; }
  .sidebar-account .sidebar-logout, .sidebar-account .sidebar-backup { min-height: 44px; padding-inline: 10px; }
}
@media (max-width: 600px) {
  .login-screen { padding: 16px; align-items: flex-start; }
  .login-card { margin-top: 4vh; padding: 24px; }
  .login-title { font-size: 22px; }
}
