/*
  Panel bileşenleri — belirteç tabanlı. İlk hâli fiyat motorunun `app.css`inden
  uyarlandı (14 Eylül 2026); UI-1'de (29 Eylül 2026) tasarım sistemi v1.1'e
  göre "çerçeveli panel" görünümüne getirildi: koyu sol menü, beyaz üst şerit,
  başlık şeritli paneller, yapışkan başlıklı zebra tablolar.

  SINIF ADLARI DEĞİŞMEZ: şablonlar (Faz 1'inkiler dahil) aynı sınıfları
  kullanır; yalnız görünüm değişir. Renk, yazı, gölge ve ölçü `tokens.css`ten
  gelir; bu dosya ham renk yazmaz.

  UI-2: kayıt kartı (başlık, gösterge şeridi, sekmeler, panel ızgarası, düzenleme
  paneli) ve kayıt penceresi (`window.js`).

  UI-1b: "Canlı Mavi" palet; tablodaki kimlik değerleri (kod, barkod, belge no)
  ve rakamlar normal yazı + eşit genişlikli rakam (mono yalnız sürüm, JSON, `code`);
  tablo bağlantıları metin gibi, satır tıklanır; liste sayfalarında tek kaydırma.

  UI-1c (30 Eylül 2026): "Google tarzı içerik + lacivert menü" (Material): açık gri
  zemin, gölgesiz beyaz paneller, beyaz panel başlık şeridi, kalın başlıklar
  (`--weight-title`), dolu mavi birincil / çerçeveli ikincil / zeminsiz metin düğmesi,
  hap biçimli seçili menü öğesi, 3 px alt çizgili sekme, 4 px köşeli 36 px denetimler.
  Bağlantılar ve ikincil düğme yazısı `--accent-deep` (zeminde 4,5:1 için).

  UI-1d (30 Eylül 2026): 48 px üst şerit ve `<details>` kullanıcı menüsü (tema seçici
  orada); sayfa başlığı = sayfa yolu (`.page-head` yok, `h1` görsel gizli); liste
  paneli tek parça (UI-1e: tek ince filtre satırı — sık filtreler, "Diğer Filtreler",
  sağda sayı ve düğmeler —, tablo, sayfalama);
  kayıt penceresi içerik alanının ortasında, 8 tutamakla boyutlanır; birincil düğme
  menü laciverti, vurgu çizgileri `--accent-deep`.

  Bölümler: temel · kabuk (menü, şerit, rozetler, seçiciler) · sayfa başlığı ·
  bileşenler (panel, tablo, rozet, düğme, form, bildirim) · liste sayfası ·
  kimlik kartları · erişilebilirlik · yönetim/katalog ekleri · dar ekran.
  Ayrıntı: `docs/ui/TASARIM_SISTEMI.html`, `docs/ARAYUZ_DESENLERI.md`.
*/

/* ------------------------------------------------------------------ temel */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-sans);
  font-weight: var(--weight-title);
  line-height: 1.3;
  text-wrap: balance;
}

h2 {
  font-size: var(--text-md);
  margin: var(--space-5) 0 var(--space-3);
}

h3 {
  font-size: var(--text-base);
  margin: var(--space-4) 0 var(--space-2);
}

p {
  margin: 0 0 var(--space-3);
  max-width: 80ch;
}

strong,
b {
  font-weight: 500;
}

/* Bağlantılar koyu vurgu: `--accent` beyazda 4,51 ama zeminde 4,5'in altında. */
a {
  color: var(--accent-deep);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--accent-deep);
  text-decoration-thickness: 2px;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

code {
  font-size: 0.9em;
  background: var(--surface-2);
  border-radius: 4px;
  padding: 1px 5px;
}

ul,
ol {
  margin: 0 0 var(--space-3);
  padding-left: 1.3rem;
}

li + li {
  margin-top: 3px;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-4) 0;
}

/* ------------------------------------------------------------------ kabuk */
.frame {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  min-height: 100vh;
}

/* Sol menü: iki temada da koyu; çerçeveyi belirginleştirir. */
.rail {
  background: var(--rail-bg);
  color: var(--rail-ink);
  padding: var(--space-3) 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 10px;
  border-bottom: 1px solid var(--rail-line);
  text-decoration: none;
  color: var(--rail-ink-hi);
}

.brand:hover {
  color: var(--rail-ink-hi);
}

.brand .logo {
  width: 30px;
  height: 30px;
  border-radius: var(--r-ctl);
  background: var(--rail-mark);
  color: var(--rail-bg);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--text-sm);
  flex: none;
}

.brand .brand-name {
  display: block;
  font-weight: 500;
  font-size: var(--text-base);
  line-height: 1.2;
}

.brand .brand-sub {
  display: block;
  font-size: var(--text-xs);
  color: var(--rail-ink-2);
}

/* Menü grupları (UI-4): simgeli, tıklanır başlık satırı; aralarında ince çizgi. */
.menu {
  display: flex;
  flex-direction: column;
}

.menu > * + * {
  border-top: 1px solid var(--rail-line);
}

/* Grup başlığı (`summary` ya da tek öğeli grupta bağlantı): ≈ 36 px. Sol kenara
   yapışık (menünün 10 px iç boşluğunu geri alır); seçili grupta solda 3 px çizgi. */
.menu-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  margin: 2px 0 2px -10px;
  padding: 0 8px 0 18px;
  border-radius: 0 18px 18px 0;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--rail-ink);
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.menu-head::-webkit-details-marker {
  display: none;
}

.menu-head:hover {
  background: var(--rail-hover);
  color: var(--rail-ink-hi);
}

.menu-icon {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--rail-ink-2);
}

.menu-name {
  flex: 1;
  min-width: 0;
}

.menu-caret {
  flex: none;
  width: 16px;
  text-align: center;
  font-size: var(--text-md);
  line-height: 1;
  color: var(--rail-ink-2);
  transition: transform 0.15s ease;
}

.menu-group[open] > .menu-head .menu-caret {
  transform: rotate(90deg);
}

/* Seçili sayfanın grubu: beyaz yazı, açık mavi simge ve sol çizgi; grup kapalıyken de. */
.is-current > .menu-head,
.menu-link.is-current {
  color: var(--rail-ink-hi);
}

.is-current > .menu-head .menu-icon,
.menu-link.is-current .menu-icon {
  color: var(--rail-mark);
}

.is-current > .menu-head::before,
.menu-link.is-current::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--rail-mark);
}

/* Alt öğeler: 16 px girintili, solda ince dikey kılavuz çizgi. */
.menu-group ul {
  list-style: none;
  margin: 0 0 6px 16px;
  padding: 0;
  border-left: 1px solid var(--rail-line);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.menu-group li + li {
  margin: 0;
}

.menu-sub {
  padding: 10px 8px 3px 12px;
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rail-ink-2);
}

/* Menü öğesi: ≈ 30 px, kılavuz çizgiden başlayan hap; sağ köşeler yuvarlak. */
.nav {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px 5px 12px;
  border-radius: 0 16px 16px 0;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--rail-ink);
  text-decoration: none;
}

.nav:hover {
  background: var(--rail-hover);
  color: var(--rail-ink-hi);
}

/* Seçili öğe: dolu mavi hap, beyaz yazı. */
.nav[aria-current="page"] {
  background: var(--rail-active);
  color: var(--rail-ink-hi);
  font-weight: 500;
}

.rail .nav:focus-visible,
.rail .menu-head:focus-visible {
  outline: 2px solid var(--rail-mark);
  outline-offset: -2px;
}

/* Dar ekranda menüyü kapatan bağlantı; geniş ekranda gizli. */
.rail-close {
  display: none;
}

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

/* Üst şerit: beyaz, alt çizgili, 48 px (`--topbar-h`), tek satır; sayfa kayarken üstte kalır. */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 48px;
  height: var(--topbar-h, 48px);
  padding: 0 var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: nowrap;
  min-width: 0;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar .spacer {
  flex: 1;
}

.topbar form {
  margin: 0;
}

/* Menü düğmesi: yalnız dar ekranda görünür (aşağıda). `.btn`'in `display`ını
   yenmek için şeritle birlikte seçilir. */
.topbar .menu-toggle {
  display: none;
}

/* Sayfa yolu: menü grubu › öğe [› kayıt]. Son öğe sayfa başlığıdır (UI-1d); üst
   öğeler bağlantı. */
.crumb {
  font-size: var(--text-sm);
  color: var(--ink-3);
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumb b {
  color: var(--ink);
  font-weight: 500;
}

.crumb a {
  color: var(--ink-3);
  text-decoration: none;
}

.crumb a:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}

/* --- Giz modu rozeti --- */
.mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  border-radius: var(--r-pill);
  padding: 0 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
}

.mode::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.mode-readonly {
  background: var(--good-soft);
  color: var(--good);
}

.mode-stage {
  background: var(--attn-soft);
  color: var(--attn);
}

/* --- veri güncellik rozeti --- */
a.freshness {
  text-decoration: none;
}

a.freshness:hover {
  text-decoration: underline;
}

.topbar .chip {
  margin: 0;
  min-height: 22px;
  padding: 0 8px;
  line-height: 20px;
}

/* --- şirket seçici --- */
.company-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.company-switch select {
  font-size: var(--text-sm);
  min-height: 32px;
  padding-top: 2px;
  padding-bottom: 2px;
}

.company-switch .company-single {
  font-size: var(--text-sm);
  font-weight: 500;
}

/* --- tema seçici: "Tema" etiketi + bitişik düğme grubu (kullanıcı menüsü, Hesabım) --- */
.theme-switch {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.theme-label {
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.theme-options {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  overflow: hidden;
}

.theme-switch button {
  min-height: 28px;
  padding: 2px 10px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 400;
}

.theme-switch button + button {
  border-left: 1px solid var(--line);
}

.theme-switch button:hover {
  background: var(--hover);
  color: var(--ink);
}

.theme-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
}

/* --- kullanıcı menüsü (UI-1d): baş harf + ad; açılınca ad/rol, Hesabım, Tema, Çıkış --- */
.user-menu {
  position: relative;
  margin: 0;
  flex: none;
}

.user-menu > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 2px 10px 2px 2px;
  border-radius: var(--r-pill);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.user-menu > summary::-webkit-details-marker {
  display: none;
}

.user-menu > summary:hover,
.user-menu[open] > summary {
  background: var(--hover);
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 230px;
  display: flex;
  flex-direction: column;
  padding: 4px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: var(--sh-2);
  z-index: 20;
}

.user-menu-head {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 8px 14px 10px;
  border-bottom: 1px solid var(--line-2);
}

.user-menu-head .name {
  font-size: var(--text-sm);
  font-weight: 500;
}

.user-menu-head .role {
  font-size: var(--text-xs);
  color: var(--ink-3);
}

.user-menu-panel form {
  margin: 0;
}

.user-menu-panel .me-link,
.user-menu-panel .logout {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 400;
  text-decoration: none;
  justify-content: flex-start;
}

.user-menu-panel .me-link:hover,
.user-menu-panel .logout:hover {
  background: var(--hover);
  color: var(--ink);
}

.user-menu-panel .me-link[aria-current="page"] {
  font-weight: 500;
  color: var(--accent-deep);
}

.user-menu-panel .theme-switch {
  justify-content: space-between;
  padding: 6px 14px;
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: grid;
  place-items: center;
  font-size: var(--text-xs);
  font-weight: 500;
  flex: none;
}

/* ------------------------------------------------------------ sayfa gövdesi */
.content {
  /* Donmuş tablo başlığı üst şeridin hemen altında (P1.15e). Yedek 48px: tokens.css eski
     önbellekten gelirse değişken tanımsız kalır, başlık yine şeridin altına oturur (P1.15f). */
  --sticky-top: var(--topbar-h, 48px);
  padding: var(--space-4) var(--space-4) var(--space-5);
  min-width: 0;
  width: 100%;
  flex: 1;
}

.content:focus {
  outline: none;
}

/* Sayfa başlığı = sayfa yolu (UI-1d): `h1` görsel gizli (`.visually-hidden`), görünür
   başlık satırı yok. `.page-sub` yalnız Faz 1 şablonlarının `subheading` bloğu için;
   boşken çizilmez. */
.page-sub {
  font-size: var(--text-sm);
  color: var(--ink-3);
  margin: 0 0 var(--space-3);
}

.page-sub:empty {
  display: none;
}

/* Alt bilgi: tek satır, küçük. */
.page-footer {
  padding: 6px var(--space-4);
  font-size: var(--text-xs);
  color: var(--ink-3);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.page-footer code {
  background: none;
  padding: 0;
}

.page-footer .dirty {
  color: var(--attn);
}

/* -------------------------------------------------------------- bileşenler */
/* Panel: 1 px çerçeve, gölge yok; beyaz başlık şeridi (alt çizgi) + beyaz gövde;
   paneller arası 16 px. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  margin: 0 0 var(--space-4);
  overflow: clip; /* hidden değil: hidden kaydırma kabı olur, içindeki yapışkan başlık sayfaya yapışamaz (P1.15e) */
  min-width: 0;
}

.card > header {
  display: flex;
  align-items: center;
  gap: 6px 10px;
  min-height: 44px;
  padding: 6px var(--space-4);
  background: var(--head);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.card > header h2 {
  font-size: var(--text-md);
  font-weight: var(--weight-title);
  color: var(--head-ink);
  margin: 0;
}

.card > header .hint {
  font-size: var(--text-xs);
  color: var(--ink-3);
}

.card > header .chip {
  margin: 0;
}

.card-body {
  padding: var(--space-4);
}

.card-body > :last-child {
  margin-bottom: 0;
}

.card-body > h3:first-child {
  margin-top: 0;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: var(--space-4);
  align-items: start;
}

.two-col > .card,
.two-col > div > .card:last-child {
  margin: 0;
}

/* --- tablolar --- */
/* Tablo kabı: yalnız yatay kaydırma; tablo sayfayla akar. Dikey kaydırma yalnız
   liste sayfasında (`.list-card`, aşağıda) — iç içe iki dikey kaydırma olmaz. */
/* Tablo sarmalayıcı. Donmuş başlık (P1.15e, `tables.js`): `overflow-x: auto` sarmalayıcı
   kendi kaydırma kabı olduğu için içindeki yapışkan başlık sayfa kaydırmasında çalışmaz.
   Betik tabloyu ölçer: sığıyorsa `is-fit` (sarmalayıcı kaymaz, başlık sayfaya / pencereye
   doğal yapışır), taşıyorsa `is-wide` (yatay kayar, ilk sütun sola yapışık, başlık betikle
   taşınır). Betiksiz bugünkü davranış. `no-sticky` kapatır (kısa tablolar). */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
}

.table-wrap.is-fit {
  overflow: visible;
}

.table-wrap.is-wide > table > thead > tr > th:first-child,
.table-wrap.is-wide > table > tbody > tr > th:first-child,
.table-wrap.is-wide > table > tbody > tr > td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}

.table-wrap.is-wide > table > tbody > tr > td:first-child {
  background: var(--surface);
}

.table-wrap.is-wide > table > thead > tr > th:first-child {
  z-index: 3; /* köşe hücresi: başlık ve ilk sütunun üstünde */
}

.table-wrap.is-wide > table > thead {
  position: relative;
  z-index: 2;
  will-change: transform;
}

.table-wrap.no-sticky thead th,
.table-wrap.no-sticky > table > tbody > tr > td:first-child,
.table-wrap.no-sticky > table > tbody > tr > th:first-child {
  position: static;
}

.card .table-wrap {
  border: 0;
  border-radius: 0;
  margin: 0;
  background: none;
}

.card-body .table-wrap {
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  margin: 0 0 var(--space-3);
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: var(--text-sm);
}

th {
  background: var(--thead);
  text-align: left;
  font-size: var(--text-sm);
  color: var(--ink-2);
  font-weight: var(--weight-title);
  padding: 6px 10px;
  height: var(--row-h);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

/* Sütun başlığı yapışkan: kayan liste tablosunda ve pencerede 0, sayfada üst şeridin altı
   (`--sticky-top`, P1.15e). Zemin `--thead` iki temada da opak. */
thead th {
  position: sticky;
  top: var(--sticky-top, 0px);
  z-index: 1;
}

/* Satır başlığı (kv ve ayrıntı tabloları): açık gri etiket sütunu. */
tbody th {
  background: var(--surface-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-3);
  width: 14rem;
  white-space: normal;
  border-bottom: 1px solid var(--line-2);
}

td {
  padding: 4px 10px;
  height: var(--row-h);
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}

tbody tr:last-child > td,
tbody tr:last-child > th {
  border-bottom: 0;
}

/* Zebra ve satır üstü (anahtar–değer tablosu hariç). */
table:not(.kv) > tbody > tr:nth-child(even) > td {
  background: var(--surface-2);
}

table:not(.kv) > tbody > tr:hover > td {
  background: var(--hover);
}

td.num,
th.num,
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Kimlik değerleri (kod, barkod, belge no, Giz kimliği) tabloda normal yazı: mono
   yalnız sürüm, JSON ve `code`. Şablonlardaki `.mono` sınıfı (Faz 1 dahil) burada
   etkisizleşir; rakam hizası için eşit genişlikli rakam kalır. */
td.mono,
td .mono,
th .mono,
table.kv .mono {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}

/* Tablo içindeki bağlantılar metin gibi; tıklanabilirliği satır üstü ve imleç
   gösterir, klavye odağında alt çizgi görünür. Düğme görünümlü bağlantılar hariç. */
table a:not(.btn) {
  color: inherit;
  font: inherit;
  text-decoration: none;
}

table a:not(.btn):hover {
  color: inherit;
}

table a:not(.btn):focus-visible {
  text-decoration: underline;
}

/* Satır tıklaması (`shell.js`): `tr[data-href]` ya da satırdaki `a.row-link`. */
tbody tr[data-href],
tbody tr:has(a.row-link) {
  cursor: pointer;
}

/* --- durum renkleri (metin) --- */
.ok {
  color: var(--good);
}

.warn {
  color: var(--attn);
}

.danger {
  color: var(--bad);
  font-weight: 500;
}

.muted {
  color: var(--ink-3);
}

/* --- rozetler --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  background: var(--surface-2);
  white-space: nowrap;
  margin: 0 0.25rem 0.25rem 0;
  line-height: 1.5;
}

td .chip {
  margin-bottom: 0;
}

.chip.attn {
  background: var(--attn-soft);
  border-color: transparent;
  color: var(--attn);
}

.chip.bad {
  background: var(--bad-soft);
  border-color: transparent;
  color: var(--bad);
}

.chip.good {
  background: var(--good-soft);
  border-color: transparent;
  color: var(--good);
}

.chip.acc {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-deep);
}

/* --- düğmeler (Material): 36 px, 4 px köşe, gölgesiz ---
   Varsayılan = ikincil: beyaz zemin, 1 px çerçeve, mavi yazı.
   `.primary` dolu mavi; `.danger` çerçeveli kırmızı yazı; `.quiet` zeminsiz metin düğmesi. */
button,
.btn {
  font: inherit;
  font-size: var(--text-base);
  font-weight: 500;
  min-height: var(--ctl-h);
  padding: 0 var(--space-4);
  border-radius: var(--r-ctl);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent-deep);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}

button:hover,
.btn:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

button.primary,
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

button.primary:hover,
.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-ink);
}

button.danger,
.btn.danger {
  background: var(--surface);
  border-color: var(--line);
  color: var(--bad);
}

button.danger:hover,
.btn.danger:hover {
  background: var(--bad-soft);
  border-color: var(--bad);
  color: var(--bad);
}

button.quiet,
.btn.quiet {
  background: none;
  border-color: transparent;
  color: var(--accent-deep);
  padding: 0 var(--space-2);
}

button.quiet:hover,
.btn.quiet:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

/* --- formlar --- */
form {
  margin: 0 0 var(--space-3);
}

label {
  color: var(--ink-2);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  min-height: var(--ctl-h);
  padding: 4px 8px;
  max-width: 100%;
}

/* Odakta 2 px vurgu çerçevesi: 1 px kenarlık + 1 px dış çizgi. */
input:focus,
select:focus,
textarea:focus {
  outline: 1px solid var(--focus);
  outline-offset: 0;
  border-color: var(--focus);
}

input::placeholder {
  color: var(--ink-3);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 var(--space-3);
}

.field label {
  font-size: var(--text-sm);
  color: var(--ink-3);
  font-weight: 500;
}

.field .help {
  font-size: var(--text-xs);
  color: var(--ink-3);
}

/* --- bildirimler: yumuşak zemin + solda renkli şerit --- */
.alert-error,
.alert-info,
.alert-warning {
  border-radius: var(--r-ctl);
  border-left: 3px solid currentColor;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-3);
  max-width: none;
}

.alert-error {
  background: var(--bad-soft);
  color: var(--bad);
}

.alert-info {
  background: var(--good-soft);
  color: var(--good);
}

.alert-warning {
  background: var(--attn-soft);
  color: var(--attn);
}

/* ---------------------------------------------------------- liste sayfası */
/* Ana listeler (Ürünler, Satış Belgeleri, İz Kayıtları, Veri Akışları,
   Kullanıcılar, Barkod Denetimi): `<body class="list-page">` + tablo ve sayfalama
   `section.card.list-card` içinde. Sayfa kaymaz; panel kalan yüksekliği doldurur,
   yalnız tablo gövdesi kayar, başlık satırı yapışık, sayfalama panelin altında. */
body.list-page .main-area {
  height: 100vh;
}

body.list-page .content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: clip; /* hidden değil: hidden kaydırma kabı olur, içindeki yapışkan başlık sayfaya yapışamaz (P1.15e) */
}

body.list-page .content > * {
  flex: none;
}

body.list-page .content > .list-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.list-card > .table-wrap {
  --sticky-top: 0px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* Liste paneli tek parça (UI-1d/1e): başlık şeridi yok; ilk satır tek ince filtre satırı
   (`form.filter-bar`) ya da filtresiz listede araç satırı (`.list-toolbar`): solda sık
   filtreler + "Diğer Filtreler" (`details.filter-more`, ikinci satırda açılır) + dolu ek
   filtre çipleri, sağda (`.filter-side`) kayıt sayısı, Temizle ve sayfa düğmeleri; sonra
   tablo, sayfalama. Betik varken alan değişince liste yenilenir, "Filtrele" gizlenir. */
.list-card > .filter-bar,
.list-card > .list-toolbar,
.list-card > .bulk-form,
.list-card > .tabs {
  flex: none;
}

.list-card > .filter-bar,
.list-card > .list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-height: 52px;
  padding: var(--space-2) var(--space-4);
  margin: 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface);
}

.filter-side {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  white-space: nowrap;
}

.list-count {
  font-size: var(--text-sm);
  color: var(--ink-3);
  padding: 0 var(--space-1);
}

.filter-bar .btn,
.filter-bar button,
.list-toolbar .btn,
.list-toolbar button {
  min-height: 36px;
}

/* Filtre alanı: arama kutusu yer tutuculu; seçici ve tarih solda küçük etiketle tek parça. */
.ffield {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.ffield input[type="text"],
.ffield input[type="search"] {
  width: 200px;
  min-height: 36px;
}

.ffield.inline {
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
}

.ffield.inline:focus-within {
  border-color: var(--focus);
  outline: 1px solid var(--focus);
}

.ffield-label {
  font-size: var(--text-xs);
  color: var(--ink-3);
  padding: 0 var(--space-2);
  white-space: nowrap;
  border-right: 1px solid var(--line-2);
  line-height: 34px;
}

.ffield.inline select,
.ffield.inline input {
  border: 0;
  border-radius: 0 var(--r-ctl) var(--r-ctl) 0;
  min-height: 34px;
  max-width: 180px;
}

.ffield.inline input[type="date"] {
  width: 128px;
  padding-left: 6px;
  padding-right: 4px;
}

.ffield.inline select:focus,
.ffield.inline input:focus {
  outline: none;
}

.ffield .field-error {
  font-size: var(--text-xs);
  color: var(--bad);
  padding: 0 var(--space-2);
}

/* "Diğer Filtreler": özet satırda düğme, içerik ikinci satırda tam genişlik. */
details.filter-more {
  display: contents;
}

/* Chrome 131+ içeriği `::details-content` kutusuna sarar; kutu da akışa katılmasın ki
   panel (`order: 1`) ikinci satıra, sayı ve düğmeler ilk satırda kalsın. */
details.filter-more::details-content {
  display: contents;
}

/* Sarmalayıcı akışa katılmayınca kapalıyken gizleme işini bu kural yapar. */
details.filter-more:not([open]) .filter-more-panel {
  display: none;
}

details.filter-more > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

details.filter-more > summary::-webkit-details-marker {
  display: none;
}

details.filter-more[open] > summary {
  background: var(--accent-soft);
}

details.filter-more > summary .count {
  font-weight: 700;
}

.filter-more-panel {
  order: 1;
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px dashed var(--line-2);
}

.filter-chip {
  margin: 0;
  text-decoration: none;
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-deep);
  min-height: 24px;
}

.filter-chip:hover {
  background: var(--select);
  color: var(--accent-deep);
  text-decoration: none;
}

/* Betik varken alan değişimi listeyi yeniler; "Filtrele" yalnız betiksiz yedek. */
.filter-bar.is-live .filter-submit {
  display: none;
}

.list-card > .bulk-form {
  margin: 0;
}

.list-card > .bulk-form .bulk-bar {
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line-2);
  margin: 0;
}

.list-card > .tabs {
  margin: 0;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--line-2);
}

.list-card > .pagination {
  flex: none;
  margin: 0;
  padding: 6px var(--space-3);
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--text-xs);
}

/* ------------------------------------------------------- kayıt kartı (UI-2) */
/* Tam sayfa ve pencere aynı kart: başlık + gösterge şeridi + sekmeler + gövde +
   alt şerit (`catalog/_product_card.html`). */
.record-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.record-head {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
}

.record-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px var(--space-2);
}

.record-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-title);
  margin: 0 var(--space-2) 0 0;
}

h2.record-title {
  font-size: var(--text-lg);
}

.record-title-row .chip {
  margin: 0;
}

.record-sub {
  margin: 4px 0 0;
  font-size: var(--text-sm);
  color: var(--ink-3);
  max-width: none;
}

.record-sub a {
  color: var(--accent-deep);
}

/* Gösterge şeridi: 5 kutu, etiket · değer · açıklama. */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: var(--space-3) 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
}

.kpi {
  padding: var(--space-2) var(--space-3);
  border-right: 1px solid var(--line-2);
  background: var(--surface);
  min-width: 0;
}

.kpi:last-child {
  border-right: 0;
}

.kpi dt {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-3);
}

.kpi dd {
  margin: 0;
}

.kpi .kpi-value {
  font-size: 22px;
  font-weight: var(--weight-title);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  white-space: nowrap;
}

.kpi .kpi-note {
  font-size: var(--text-xs);
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Eşik: renk + açıklama birlikte (renk tek başına anlam taşımaz). */
.kpi.attn .kpi-value {
  color: var(--attn);
}

.kpi.bad .kpi-value {
  color: var(--bad);
}

.record-messages > :last-child {
  margin-bottom: var(--space-3);
}

/* Sekmeler kartta: rol tablist; seçili olan alt çizgi + vurgu. Çubuk taşınca KIRILMAZ,
   yatay kayar (UI-F1c): `.tabs` kuralı dosyada daha aşağıda olduğu için özgüllük iki
   sınıfla yükseltilir; sekmeler daralmaz, ince kaydırma çubuğu görünür. */
.tabs.record-tabs {
  margin-bottom: var(--space-3);
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}

.tabs.record-tabs > a,
.tabs.record-tabs > .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.tabs a[role="tab"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: var(--text-base);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink-2);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.tabs a[role="tab"]:hover {
  background: var(--hover);
  color: var(--ink);
}

.tabs a[role="tab"][aria-selected="true"] {
  border-bottom-color: var(--accent-deep);
  color: var(--accent-deep);
  font-weight: var(--weight-title);
}

.tab-pane[hidden] {
  display: none;
}

/* Kart gövdesi (sekme panelleri): geniş tablo kartı taşırmasın, kendi içinde kaysın. */
.record-body {
  min-width: 0;
}

/* Kart içi panel ızgarası: geniş ekranda yan yana, dar ekranda alt alta. */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-4);
  align-items: start;
  margin-bottom: var(--space-4);
}

.panel-grid > .card {
  margin: 0;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-3);
}

.history-group h3 {
  margin: 0 0 6px;
  font-size: var(--text-sm);
}

.card > header .header-action {
  margin-left: auto;
  min-height: 28px;
}

/* Düzenleme paneli: görünüm ↔ form ("Düzenle" / "Vazgeç"). Form girdileri gizliyken de
   gönderilir (tek ERP formu); `window.js` Vazgeç'te değerleri geri alır. */
.edit-panel > header .edit-toggle {
  margin-left: auto;
}

.edit-panel .panel-edit,
.edit-panel.is-editing .panel-view,
.edit-panel.is-editing .edit-toggle {
  display: none;
}

.edit-panel.is-editing .panel-edit {
  display: block;
}

.inline-panel {
  border-bottom: 1px solid var(--line-2);
  background: var(--surface-2);
}

.inline-panel .reason-form {
  background: none;
  border: 0;
  padding: 0;
  max-width: 28rem;
}

/* Alt şerit: son okuma solda, işlemler sağda. */
.record-foot {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  background: var(--surface);
  font-size: var(--text-xs);
}

.record-foot .spacer {
  flex: 1;
}

.record-foot .actions-row {
  margin: 0;
}

/* Kayıttan sonra filtreye artık uymayan satır (UI-2b): kalır ama soluk. */
tbody tr.is-stale > td {
  opacity: 0.55;
}

/* Listede pencerede açık kaydın satırı. */
tbody tr.is-selected > td {
  background: var(--select);
}

tbody tr.is-selected > td:first-child {
  box-shadow: inset 3px 0 0 var(--accent-deep);
}

/* ------------------------------------------------------- kayıt penceresi (UI-2) */
/* `window.js` kurar: koyu başlık çubuğu, kaydırılan gövde, sağ alt köşeden
   boyutlandırma; "Yana Sabitle" ile sağda tam yükseklik yan panel. */
.record-window {
  position: fixed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 560px;
  min-height: 380px;
  max-width: calc(100vw - 8px);
  max-height: calc(100vh - 8px);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: var(--sh-2);
  overflow: hidden;
}

.record-window[hidden] {
  display: none;
}

.rw-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 8px 6px 14px;
  background: var(--rail-bg);
  color: var(--rail-ink-hi);
  cursor: move;
  user-select: none;
  flex: none;
}

.rw-bar:focus-visible {
  outline: 2px solid var(--rail-mark);
  outline-offset: -2px;
}

.rw-title {
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.rw-title .rw-code {
  color: var(--rail-ink-2);
  font-weight: 400;
  margin-right: var(--space-2);
}

.rw-bar .spacer {
  flex: 1;
}

.rw-bar button,
.rw-bar a {
  min-height: 26px;
  padding: 0 8px;
  font-size: var(--text-xs);
  font-weight: 400;
  background: transparent;
  color: var(--rail-ink);
  border: 1px solid var(--rail-line);
  border-radius: 5px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  cursor: pointer;
}

.rw-bar button:hover,
.rw-bar a:hover {
  background: var(--rail-hover);
  color: var(--rail-ink-hi);
}

.rw-body {
  --sticky-top: calc(-1 * var(--space-3)); /* pencerede başlık gövdenin üst kenarına yapışır; gövde dolgusu kaydığı için eksi dolgu (record-foot gibi) */
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: var(--space-3);
}

.rw-body .record-foot {
  position: sticky;
  bottom: calc(-1 * var(--space-3));
}

.rw-status {
  padding: var(--space-4);
  color: var(--ink-3);
}

/* Kaydedilmemiş değişiklik onayı (UI-2b): başlığın altında şerit. */
.rw-confirm {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex: none;
  padding: var(--space-2) var(--space-3);
  background: var(--attn-soft);
  color: var(--attn);
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
  font-weight: 500;
}

.rw-confirm[hidden] {
  display: none;
}

.rw-confirm p {
  margin: 0 auto 0 0;
}

/* Sağ alt köşedeki görünür üçgen; yakalama işini `.rw-h-se` tutamağı yapar. */
.rw-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  pointer-events: none;
  background: linear-gradient(135deg, transparent 50%, var(--line) 50%);
}

/* 8 tutamak (UI-1d): 4 kenar 7 px, 4 köşe 14 px; görünmez ama yakalanır. */
.rw-h {
  position: absolute;
  z-index: 2;
}

.rw-h-n,
.rw-h-s {
  left: 14px;
  right: 14px;
  height: 7px;
  cursor: ns-resize;
}

.rw-h-e,
.rw-h-w {
  top: 14px;
  bottom: 14px;
  width: 7px;
  cursor: ew-resize;
}

.rw-h-n {
  top: 0;
}

.rw-h-s {
  bottom: 0;
}

.rw-h-e {
  right: 0;
}

.rw-h-w {
  left: 0;
}

.rw-h-ne,
.rw-h-nw,
.rw-h-se,
.rw-h-sw {
  width: 14px;
  height: 14px;
}

.rw-h-ne {
  top: 0;
  right: 0;
  cursor: nesw-resize;
}

.rw-h-sw {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}

.rw-h-nw {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}

.rw-h-se {
  bottom: 0;
  right: 0;
  cursor: nwse-resize;
}

.rw-dock-handle {
  display: none;
}

/* Yana sabitli: sağda tam yükseklik; liste solda daralır (`--rw-dock-w`). */
.record-window.docked {
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  height: 100vh !important;
  max-height: none;
  min-width: 420px;
  border-radius: 0;
  border-width: 0 0 0 1px;
}

.record-window.docked .rw-bar {
  cursor: default;
}

.record-window.docked .rw-resize,
.record-window.docked .rw-h {
  display: none;
}

.record-window.docked .rw-dock-handle {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
}

body.rw-docked .main-area {
  margin-right: var(--rw-dock-w, 560px);
}

/* Kart pencerede: başlık kutusu daha sıkı. */
.rw-body .record-head {
  padding: var(--space-3);
}

/* ------------------------------------------------------- kimlik kartları */
body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-5) var(--space-4);
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
}

.auth-brand {
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--rail-bg);
}

.auth-brand .brand-name {
  font-weight: 500;
  font-size: var(--text-base);
  color: var(--rail-ink-hi);
}

.auth-brand .brand-sub {
  font-size: var(--text-xs);
  color: var(--rail-ink-2);
}

.auth-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0;
}

.auth-body h1 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-title);
}

.auth-body p {
  margin: 0;
  color: var(--ink-2);
}

.auth-body .field {
  margin: 0;
}

.auth-body button {
  justify-content: center;
}

.auth-footer {
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--line);
  background: var(--head);
  color: var(--ink-3);
  font-size: var(--text-xs);
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.auth-footer code {
  background: none;
  padding: 0;
}

/* ------------------------------------------------------- erişilebilirlik */
/* Görünür odak halkası: yalnızca klavyeyle gelindiğinde. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* İçeriğe geç: ilk Tab ile görünür olur, menüdeki öğeleri atlatır. */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -100px;
  z-index: 40;
  background: var(--accent);
  color: var(--accent-ink);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--r-ctl);
  font-weight: 500;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-3);
}

/* `.sr-only`: Faz 1 şablonlarının kullandığı eş ad. */
.visually-hidden,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------ yönetim ekranları (Paket 2) */
/* Sayfa üstü işlem düğmeleri (Yeni kullanıcı, Yeni şirket). */
.page-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: 0 0 var(--space-3);
}

/* Form paneli: dar, tek sütun. */
.form-card {
  max-width: 40rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0 var(--space-4);
}

.field input,
.field select,
.field textarea {
  width: 100%;
}

/* Onay kutusu ve seçenek düğmesi alan genişliğine uzamaz. */
.field input[type="checkbox"],
.field input[type="radio"] {
  width: auto;
}

.field .req {
  color: var(--bad);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--bad);
}

.field-error {
  font-size: var(--text-xs);
  color: var(--bad);
  margin: 0;
}

.field .help ul {
  margin: 0;
  padding-left: 1.1rem;
}

.form-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Yan yana kısa form (şirkete ekle). */
.inline-form {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
  flex-wrap: wrap;
}

.inline-form .field {
  margin: 0;
  min-width: 12rem;
}

/* Gerekçe zorunlu işlem: <details> içinde açılan küçük form. */
.actions-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: flex-start;
  margin: var(--space-3) 0 4px;
}

.reason-action > summary {
  list-style: none;
  user-select: none;
}

.reason-action > summary::-webkit-details-marker {
  display: none;
}

.reason-action[open] > summary {
  background: var(--accent-soft);
  border-color: var(--accent-deep);
  color: var(--accent-deep);
}

.reason-form {
  margin: var(--space-2) 0 0;
  padding: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  min-width: 16rem;
  max-width: 24rem;
}

.reason-form .field {
  margin-bottom: 10px;
}

/* Anahtar–değer tablosu: etiket sütunu açık gri zeminli, satırlar çizgili. */
table.kv {
  width: 100%;
  min-width: 18rem;
  margin: 0 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  overflow: hidden;
}

table.kv th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
  padding: 5px var(--space-3);
  width: 11rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-3);
  vertical-align: middle;
}

table.kv td {
  padding: 5px var(--space-3);
  overflow-wrap: anywhere;
}

/* Bir kez gösterilen geçici parola. */
.secret-box {
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-4);
  align-items: baseline;
}

.secret-box dt {
  font-size: var(--text-xs);
  color: var(--ink-3);
}

.secret-box dd {
  margin: 0;
}

code.secret {
  font-size: var(--text-lg);
  letter-spacing: 0.08em;
  padding: var(--space-2) 14px;
  user-select: all;
}

/* Filtre şeridi (panel dışı, eski düzen; liste panelindeki tek satır yukarıda). */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0 var(--space-3);
  align-items: end;
  padding: var(--space-3) var(--space-3) 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  margin: 0 0 var(--space-3);
}

.filter-bar .field {
  margin-bottom: var(--space-3);
}

.filter-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

/* Filtre şeridinde düğmeler kendi satırında, tek sıra. */
.filter-bar .filter-actions {
  grid-column: 1 / -1;
}

/* Sayfalama. */
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 var(--space-3);
}

.pagination-state {
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.btn.disabled {
  opacity: 0.5;
  cursor: default;
}

/* İz satırı: önce / sonra açılır alanı. */
.row-details {
  margin-top: 6px;
}

.row-details > summary {
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--accent-deep);
}

.json-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 10px;
  margin-top: var(--space-2);
}

.json-pair h4 {
  margin: 0 0 4px;
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
}

pre.json {
  margin: 0;
  padding: var(--space-2) 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  font-size: var(--text-xs);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 28rem;
}

td.reason {
  max-width: 18rem;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.nowrap {
  white-space: nowrap;
}

.empty-state {
  margin: 0;
  padding: 6px 0;
  color: var(--ink-3);
}

ul.plain {
  list-style: none;
  padding: 0;
}

.card > header .hint a,
.card > header a.hint {
  text-decoration: none;
}

/* ------------------------------------------------------- katalog (Paket 3) */
.tree-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tree-mark {
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.actions-row.compact {
  margin: 0;
  gap: 4px;
}

.actions-row.compact .btn,
.actions-row.compact summary {
  min-height: 26px;
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
}

.field.check label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink);
}

.check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.check-list label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--ink);
}

tr.muted td {
  color: var(--ink-3);
}

/* -------------------------------------------------------- Paket 5 ekleri */
/* Sekmeler (barkod denetimi, ürün kartı): alt çizgili, seçili olan vurgulu. */
.tabs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  margin: 0 0 var(--space-3);
  border-bottom: 1px solid var(--line);
}

.tabs a,
.tabs .btn {
  text-decoration: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--ink-2);
  font-size: var(--text-base);
  font-weight: 500;
  margin-bottom: -1px;
}

.tabs a:hover,
.tabs .btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.tabs a[aria-current="page"] {
  border-bottom-color: var(--accent-deep);
  color: var(--accent-deep);
  font-weight: var(--weight-title);
}

.tabs .count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-3);
}

/* Toplu işlem şeridi (kapsam dışı onayı): seçim + gerekçe + iki düğme. */
.bulk-bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  margin: 0 0 var(--space-3);
}

.bulk-bar .field {
  margin: 0;
  min-width: 18rem;
  flex: 1;
}

.bulk-bar .bulk-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

td.check-cell,
th.check-cell {
  width: 2.2rem;
  padding-right: 0;
}

/* Ana sayfa: 24 saatten eski veri akışı satırı. */
tr.stale td {
  color: var(--attn);
}

/* Geçmiş tabloları (fiyat / stok gözlemleri): sıkı satırlar. */
table.history td,
table.history th {
  height: 28px;
  padding-top: 2px;
  padding-bottom: 2px;
}

/* Ürün kartı: barkod satırı işlemleri. */
td.row-actions .actions-row {
  margin: 0;
}

/* ------------------------------------------------- Faz 1 ekranları (P1.14b) */
/* Satın alma, destek, ajanda ve görev ekranlarının UI'de karşılığı olmayan parçaları.
   Yalnız belirteç; ham renk yok. Kural belgesi: docs/ui/KURALLAR_YENI_EKRANLAR.html. */

/* Liste panelinde Faz 1 filtre alanı (`div.field`: etiket + kutu) UI'nin satır içi filtre
   alanı (`.ffield.inline`) görünümünde: solda küçük etiket, kutuyla tek parça. */
.list-card > .filter-bar .field {
  flex-direction: row;
  align-items: center;
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  min-width: 0;
}

.list-card > .filter-bar .field:focus-within {
  border-color: var(--focus);
  outline: 1px solid var(--focus);
}

.list-card > .filter-bar .field > label {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--ink-3);
  padding: 0 var(--space-2);
  white-space: nowrap;
  border-right: 1px solid var(--line-2);
  line-height: 34px;
}

.list-card > .filter-bar .field > select,
.list-card > .filter-bar .field > input {
  border: 0;
  border-radius: 0 var(--r-ctl) var(--r-ctl) 0;
  min-height: 34px;
  max-width: 180px;
}

.list-card > .filter-bar .field > input[type="number"] {
  width: 7rem;
}

.list-card > .filter-bar .field > select:focus,
.list-card > .filter-bar .field > input:focus {
  outline: none;
}

/* Onay kutulu filtre: çerçevesiz, etiket kutunun sağında. */
.list-card > .filter-bar .field.check {
  border: 0;
  background: none;
}

.list-card > .filter-bar .field.check > label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

/* Liste panelinde açıklama satırı ve yan yana paneller kenara yapışmaz. */
.list-card > p {
  margin: 0;
  max-width: none;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

.list-card > .two-col {
  padding: var(--space-4);
}

/* Faz 1 göstergesi tek `dd` içinde iki `span` (değer + açıklama): alt alta. */
.kpi span.kpi-value,
.kpi span.kpi-note {
  display: block;
}

/* Formda kutu dışı alan etiketi (onay kutusu listesinin başlığı). */
.field > .label {
  font-size: var(--text-sm);
  color: var(--ink-3);
  font-weight: 500;
}

/* Dar giriş kutusu: adet, oran, gün gibi kısa sayılar (tablo hücresinde, satır içi form). */
input.narrow {
  width: 7rem;
  min-width: 0;
}

td.num input.narrow {
  text-align: right;
}

/* Sıkı tablo (haftalık dağılım gibi çok sütunlu küçük tablolar). */
table.compact th,
table.compact td {
  padding: 2px 6px;
  height: auto;
  font-size: var(--text-xs);
}

/* Ara toplam ve genel toplam satırları (Bütçe Raporu, Görev Raporu): kalın, üst çizgili;
   zebra ve satır üstü rengi almaz. */
table:not(.kv) > tbody > tr.subtotal > td,
table:not(.kv) > tbody > tr.subtotal > th,
table > tfoot > tr.subtotal > td,
table > tfoot > tr.subtotal > th,
table:not(.kv) > tbody > tr.total > td,
table:not(.kv) > tbody > tr.total > th {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: var(--weight-title);
  border-top: 1px solid var(--line);
  width: auto;
}

table:not(.kv) > tbody > tr.total > td,
table:not(.kv) > tbody > tr.total > th {
  background: var(--thead);
  border-top: 2px solid var(--line);
}

/* Geciken görev satırı: solda kırmızı şerit + soft zemin (rozetle birlikte; renk tek
   başına anlam taşımaz). */
table:not(.kv) > tbody > tr.late > td {
  background: var(--bad-soft);
}

table:not(.kv) > tbody > tr.late > td:first-child {
  box-shadow: inset 3px 0 0 var(--bad);
}

/* İçe aktarma önizlemesi: hatalı satır soft kırmızı, atlanan soluk. */
table:not(.kv) > tbody > tr.plan-error > td {
  background: var(--bad-soft);
}

table:not(.kv) > tbody > tr.plan-skip > td,
.plan-note {
  color: var(--ink-3);
}

/* Tahsilat listesi: paylaştırma özeti dar sütunda kırılır. */
td.allocation-summary {
  white-space: normal;
  min-width: 14rem;
  font-size: var(--text-xs);
}

td.cp-note {
  white-space: normal;
  min-width: 12rem;
}

/* --- Öneri Listesi --- */
/* Tedarikçi grubu: liste panelinin içinde iç içe kart değil, başlık şeritli bölüm. */
.supplier-group {
  border-top: 1px solid var(--line);
}

/* Grup başlığı yapışkan (P1.15e): kendi `details` kapsayıcısında kalır, sonraki grubunki
   onunla yer değiştirir; grubun sütun başlığı grup başlığının altına yapışır (yükseklik
   `--group-head-h`, `tables.js` ölçer; betiksiz tek satır varsayımı `--row-h`). */
.supplier-group > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-height: var(--row-h);
  padding: 6px var(--space-4);
  background: var(--head);
  position: sticky;
  top: var(--sticky-top, 0px);
  z-index: 2;
  font-size: var(--text-sm);
  color: var(--ink-3);
  cursor: pointer;
  list-style: none;
}

.supplier-group > summary::-webkit-details-marker {
  display: none;
}

.supplier-group > summary::before {
  content: "▸";
  color: var(--ink-3);
  transition: transform 0.15s;
}

.supplier-group[open] > summary::before {
  transform: rotate(90deg);
}

.supplier-group > summary strong {
  color: var(--head-ink);
  font-size: var(--text-md);
}

.supplier-group > summary .chip {
  margin: 0;
}

.supplier-group > .inline-form {
  margin: 0;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--line-2);
}

.supplier-group > .table-wrap {
  border-top: 1px solid var(--line-2);
}

.supplier-group thead th {
  top: calc(var(--sticky-top, 0px) + var(--group-head-h, var(--row-h)));
}

/* Taşan (yatay kayan) tabloda başlık betikle taşınır; sarmalayıcı dikey kaymadığından
   `top` 0 olmalı — pozitif değer th'yi tablo içinde o kadar aşağı iter. */
.table-wrap.is-wide thead th {
  top: 0;
}

.group-more {
  margin: 0;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  border-top: 1px solid var(--line-2);
}

/* Öneri satırı: satırın her yeri gerekçeyi açar; "Gerekçe" küçük aç/kapa düğmesi. */
tr.suggestion-row {
  cursor: pointer;
}

tr.suggestion-row a.panel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  margin-right: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  line-height: 20px;
  color: var(--accent-deep);
  background: var(--surface);
}

tr.suggestion-row a.panel-toggle::before {
  content: "▸";
  transition: transform 0.15s;
}

tr.suggestion-row a.panel-toggle[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

tr.suggestion-row a.panel-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

table:not(.kv) > tbody > tr.suggestion-row:has(a.panel-toggle[aria-expanded="true"]) > td {
  background: var(--select);
}

/* Açılan gerekçe satırı: zebra/satır üstü almaz; seçili satırla aynı sol çizgi. */
table:not(.kv) > tbody > tr.panel-row > td,
table:not(.kv) > tbody > tr.panel-row:hover > td {
  background: var(--surface-2);
  padding: 0;
  box-shadow: inset 3px 0 0 var(--accent-deep);
  cursor: auto;
  white-space: normal;
}

/* Gerekçe paneli (satır altında ya da ayrı sayfada). */
.suggestion-panel {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
}

.suggestion-panel h4 {
  font-size: var(--text-sm);
  font-weight: var(--weight-title);
  color: var(--ink);
  margin: var(--space-3) 0 var(--space-1);
}

.suggestion-panel .two-col > div > h4:first-child {
  margin-top: 0;
}

.suggestion-panel ul,
.suggestion-panel ol {
  margin: 0 0 var(--space-2);
  padding-left: 1.25rem;
}

.suggestion-panel li {
  margin: 2px 0;
}

.suggestion-panel .table-wrap {
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  margin: 0 0 var(--space-2);
  background: var(--surface);
}

.suggestion-panel .actions-row {
  border-top: 1px solid var(--line-2);
  padding-top: var(--space-3);
  margin-top: var(--space-3);
}

ol.effective-steps {
  font-size: var(--text-xs);
  color: var(--ink-2);
}

ul.agenda-signals {
  list-style: none;
  padding-left: 0;
}

/* MF kademesine yuvarlama satırı: teklif satırının altında girintili, soluk zemin. */
table:not(.kv) > tbody > tr.rounding-alt > td {
  background: var(--surface-2);
  font-size: var(--text-xs);
}

table:not(.kv) > tbody > tr.rounding-alt > td:first-child {
  padding-left: var(--space-5);
}

/* --- Satış Hızı: haftalık grafik --- */
svg.week-chart {
  display: block;
  color: var(--accent-deep);
  max-width: 100%;
  margin: 0 0 var(--space-3);
}

svg.week-chart text {
  fill: var(--ink-3);
}

/* --- Ajanda takvimi (gün / hafta / ay) --- */
.list-card > .calendar-nav strong {
  font-size: var(--text-md);
  color: var(--ink);
  margin-left: var(--space-2);
}

table.calendar-grid {
  table-layout: fixed;
  min-width: 42rem;
}

table.calendar-grid.calendar-day {
  min-width: 0;
}

table.calendar-grid thead th {
  text-align: center;
}

table.calendar-grid > tbody > tr > td.cal-day {
  vertical-align: top;
  height: 6.5rem;
  padding: 4px 6px;
  border-right: 1px solid var(--line-2);
  background: var(--surface);
  overflow: hidden;
}

table.calendar-grid.calendar-week > tbody > tr > td.cal-day {
  height: 18rem;
}

table.calendar-grid.calendar-day > tbody > tr > td.cal-day {
  height: auto;
  min-height: 12rem;
}

table.calendar-grid > tbody > tr > td.cal-day:last-child {
  border-right: 0;
}

table.calendar-grid > tbody > tr:hover > td.cal-day {
  background: var(--surface);
}

table.calendar-grid > tbody > tr > td.cal-out,
table.calendar-grid > tbody > tr:hover > td.cal-out {
  background: var(--surface-2);
}

table.calendar-grid > tbody > tr > td.cal-out .cal-date {
  color: var(--ink-3);
  font-weight: 400;
}

table.calendar-grid > tbody > tr > td.cal-today,
table.calendar-grid > tbody > tr:hover > td.cal-today {
  background: var(--accent-soft);
  box-shadow: inset 0 3px 0 var(--accent-deep);
}

.cal-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-2);
  margin: 0 0 4px;
}

.cal-date .chip {
  margin: 0;
}

ul.cal-items {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

li.cal-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  font-size: var(--text-xs);
  line-height: 1.4;
}

li.cal-item .chip {
  flex: none;
  margin: 0;
  padding: 0 6px;
  font-size: var(--text-2xs);
}

li.cal-item > a {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table.calendar-grid.calendar-day li.cal-item {
  font-size: var(--text-sm);
}

table.calendar-grid.calendar-day li.cal-item > a {
  white-space: normal;
}

table.calendar-grid li.cal-item > a:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}

/* Takvimde kayıt penceresinde açık öğe (P1.15c). */
table.calendar-grid li.cal-item > a.is-selected {
  color: var(--accent-deep);
  font-weight: 600;
}

/* ------------------------------------------------------------- dar ekran */
/* ≤ 900 px: menü gizlenir; üst şeritteki "Menü" açar. Betik yoksa bağlantı
   `#menu` hedefini açar (`:target`), betik varsa `.open` sınıfı. */
@media (max-width: 900px) {
  .frame {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 85vw);
    height: 100vh;
    z-index: 30;
    box-shadow: var(--sh-2);
  }

  .rail:target,
  .rail.open {
    display: flex;
  }

  .rail-close {
    display: inline-flex;
    align-self: flex-end;
    color: var(--rail-ink);
    font-size: var(--text-sm);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: var(--r-ctl);
  }

  .rail-close:hover {
    background: var(--rail-hover);
    color: var(--rail-ink-hi);
  }

  .topbar .menu-toggle {
    display: inline-flex;
  }

  .topbar {
    padding: 0 var(--space-3);
  }

  .topbar .mode {
    display: none;
  }

  .content {
    padding: var(--space-3) var(--space-3) var(--space-5);
  }

  tbody th {
    width: auto;
  }

  /* Kayıt penceresi dar ekranda tam ekran; sürükleme ve boyutlandırma yok. */
  .record-window,
  .record-window.docked {
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border-width: 0;
  }

  .rw-bar {
    cursor: default;
  }

  .rw-resize,
  .rw-h,
  .rw-dock-handle,
  .rw-bar [data-rw="dock"] {
    display: none !important;
  }

  body.rw-docked .main-area {
    margin-right: 0;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi {
    border-bottom: 1px solid var(--line-2);
  }

  .ffield input[type="text"],
  .ffield input[type="search"] {
    width: 160px;
  }

  /* Liste sayfası dar ekranda normal sayfa kaydırmasına döner. */
  body.list-page .main-area {
    height: auto;
  }

  body.list-page .content {
    display: block;
    overflow: visible;
  }

  /* `overflow-x: auto` yanında `overflow-y: visible` hesapta `auto` olur: sarmalayıcı yine
     dikey kaydırma kabıdır (kaymasa da), betik ona dokunmaz, yapışkan başlık ona göre ölçülür.
     Üst şerit payı (`--topbar-h`) burada başlığı ilk satırın üstüne iterdi (10F); 0 ile başlık
     tablonun başında durur. */
  .list-card > .table-wrap {
    --sticky-top: 0px;
    overflow-x: auto;
    overflow-y: visible;
  }
}

/* ≤ 600 px: dokunma hedefleri en az `--touch`. */
@media (max-width: 600px) {
  button,
  .btn,
  .nav,
  .menu-head,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  input[type="date"],
  select,
  .theme-switch button {
    min-height: var(--touch);
  }

  .crumb,
  .topbar .freshness,
  .user-menu > summary .name {
    display: none;
  }

  .two-col {
    grid-template-columns: minmax(0, 1fr);
  }
}
