/* =====================================================================
   Türkistan Teklif — tasarım sistemi
   Renkler logodan alındı: yeşil #009951, turkuaz #00A4D4.
   Tema üç durumludur: açık (varsayılan), koyu (işletim sistemi), koyu (buton).
   Bütün renkler token üzerinden verilir; hiçbir bileşen doğrudan renk yazmaz.
   ===================================================================== */

:root {
  /* Marka */
  --brand-green:   #009951;
  --brand-teal:    #00A4D4;

  /* Zemin ve yüzeyler — nötrler yeşile doğru hafif kaydırıldı */
  --ground:        #F4F7F6;
  --surface:       #FFFFFF;
  --surface-2:     #EDF2F1;
  --surface-sunk:  #E4EBE9;

  /* Metin */
  --ink:           #0D2320;
  --ink-2:         #3C5551;
  --ink-muted:     #6C8480;
  --ink-inverse:   #FFFFFF;

  /* Çizgiler */
  --line:          #DBE4E2;
  --line-strong:   #C3D0CD;

  /* Vurgu */
  --accent:        #00849E;
  --accent-hover:  #006B82;
  --accent-soft:   #E1F2F6;
  --accent-ink:    #FFFFFF;

  --green:         #007D43;
  --green-soft:    #E2F3EA;

  /* Anlamsal */
  --ok:            #0F7B45;
  --ok-soft:       #E2F3EA;
  --warn:          #9A6300;
  --warn-soft:     #FBF0DC;
  --bad:           #B32D2D;
  --bad-soft:      #FBE7E7;
  --info:          #00728C;
  --info-soft:     #E1F2F6;
  --neutral:       #67807C;
  --neutral-soft:  #EAEFEE;

  /* Kâr / zarar — para sütunlarında */
  --profit:        #0F7B45;
  --loss:          #B32D2D;

  /* Ölçüler */
  --radius:        8px;
  --radius-sm:     5px;
  --radius-lg:     14px;
  --shadow-sm:     0 1px 2px rgba(13,35,32,.06), 0 1px 3px rgba(13,35,32,.05);
  --shadow:        0 2px 4px rgba(13,35,32,.05), 0 8px 20px rgba(13,35,32,.07);
  --shadow-lg:     0 10px 40px rgba(13,35,32,.14);
  --sidebar-w:     236px;
  --topbar-h:      56px;

  --font-ui:   'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:       #0A1513;
    --surface:      #111F1C;
    --surface-2:    #172926;
    --surface-sunk: #0D1B18;

    --ink:          #E7EFEC;
    --ink-2:        #B4C6C2;
    --ink-muted:    #859B97;
    --ink-inverse:  #06110F;

    --line:         #22342F;
    --line-strong:  #31463F;

    --accent:       #34BEDE;
    --accent-hover: #58CEE9;
    --accent-soft:  #10302F;
    --accent-ink:   #06110F;

    --green:        #34C37B;
    --green-soft:   #0E2A1E;

    --ok:           #3FC97F;
    --ok-soft:      #0E2A1E;
    --warn:         #D9A441;
    --warn-soft:    #2C2415;
    --bad:          #F0736D;
    --bad-soft:     #2E1717;
    --info:         #46BEDB;
    --info-soft:    #10302F;
    --neutral:      #90A5A1;
    --neutral-soft: #1A2A27;

    --profit:       #3FC97F;
    --loss:         #F0736D;

    --shadow-sm:    0 1px 2px rgba(0,0,0,.4);
    --shadow:       0 2px 4px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg:    0 12px 44px rgba(0,0,0,.5);
  }
}

:root[data-theme="dark"] {
  --ground:       #0A1513;
  --surface:      #111F1C;
  --surface-2:    #172926;
  --surface-sunk: #0D1B18;

  --ink:          #E7EFEC;
  --ink-2:        #B4C6C2;
  --ink-muted:    #859B97;
  --ink-inverse:  #06110F;

  --line:         #22342F;
  --line-strong:  #31463F;

  --accent:       #34BEDE;
  --accent-hover: #58CEE9;
  --accent-soft:  #10302F;
  --accent-ink:   #06110F;

  --green:        #34C37B;
  --green-soft:   #0E2A1E;

  --ok:           #3FC97F;
  --ok-soft:      #0E2A1E;
  --warn:         #D9A441;
  --warn-soft:    #2C2415;
  --bad:          #F0736D;
  --bad-soft:     #2E1717;
  --info:         #46BEDB;
  --info-soft:    #10302F;
  --neutral:      #90A5A1;
  --neutral-soft: #1A2A27;

  --profit:       #3FC97F;
  --loss:         #F0736D;

  --shadow-sm:    0 1px 2px rgba(0,0,0,.4);
  --shadow:       0 2px 4px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg:    0 12px 44px rgba(0,0,0,.5);
}

/* --------------------------------------------------------------- temel */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.011em; text-wrap: balance; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .94rem; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--ink-muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.profit { color: var(--profit); }
.loss   { color: var(--loss); }
.hidden { display: none !important; }

/* ------------------------------------------------------------ iskelet */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Logo yatay bir kilit (TURKISTAN PHARMA); kare kutuya sıkıştırılınca
   okunmaz hâle geliyordu. Tam genişlik verilip altına başlık konuyor. */
.sidebar__brand {
  display: block;
  padding: .85rem 1rem .7rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand img {
  display: block; width: 100%; max-width: 156px; height: auto;
}
.sidebar__brand span {
  display: block; margin-top: .25rem;
  font-size: .72rem; font-weight: 650; letter-spacing: .02em;
  color: var(--ink-muted);
}
/* Koyu temada logonun beyaz zemini yok; lacivert metin okunsun diye
   hafif parlaklık verilir. */
:root[data-theme="dark"] .sidebar__brand img { filter: brightness(1.25); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sidebar__brand img { filter: brightness(1.25); }
}

.nav { padding: .6rem .5rem; display: flex; flex-direction: column; gap: 1px; }
.nav__label {
  font-size: .67rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-muted); font-weight: 700;
  padding: .9rem .6rem .3rem;
}
.nav a {
  display: flex; align-items: center; gap: .55rem;
  padding: .46rem .6rem;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.nav svg { width: 17px; height: 17px; flex: none; stroke-width: 1.8; }
.nav .count {
  margin-left: auto; font-size: .72rem; font-weight: 650;
  background: var(--surface-sunk); color: var(--ink-muted);
  padding: 0 .38rem; border-radius: 999px; min-width: 1.3rem; text-align: center;
}

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar__title { font-weight: 650; font-size: .97rem; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.content { padding: 1.25rem; flex: 1; min-width: 0; }

/* ------------------------------------------------------------ butonlar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .42rem .8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-weight: 550; font-size: .86rem;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 15px; height: 15px; stroke-width: 1.9; }

.btn--primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn--green {
  background: var(--green); border-color: var(--green); color: var(--ink-inverse);
}
.btn--green:hover { filter: brightness(1.08); }

.btn--danger { color: var(--bad); border-color: var(--line-strong); }
.btn--danger:hover { background: var(--bad-soft); border-color: var(--bad); }

.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-2); }

.btn--sm { padding: .24rem .5rem; font-size: .78rem; }
.btn--icon { padding: .38rem; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------ kartlar */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}
.card__head {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--line);
}
.card__head h2, .card__head h3 { margin: 0; }
.card__head .btn-row { margin-left: auto; }
.card__body { padding: 1rem; }
.card__body--flush { padding: 0; }
.card__foot {
  padding: .7rem 1rem; border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
/* Huni kutuları: sayıları değişebildiği için sabit sütun yerine sığdıkça sarar. */
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.grid--sidebar { grid-template-columns: minmax(0,1fr) 320px; align-items: start; }
/* Telefonda sütun 1fr olur; geniş tablo sütunu (ve sayfayı) yana iterdi — sütun daralsın, tablo kendi içinde kaysın.
   Önce yalnız rehber.css'teydi: firma kartı düzelmiş, teklif/talep/sipariş/ana sayfa taşmaya devam etmişti. */
.grid--sidebar > * { min-width: 0; }

/* ------------------------------------------------------------- sayılar */
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem 1rem;
}
.stat__label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
               color: var(--ink-muted); font-weight: 650; }
.stat__value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em;
               font-variant-numeric: tabular-nums; margin-top: .15rem; }
.stat__sub { font-size: .78rem; color: var(--ink-muted); }

/* ------------------------------------------------------------- tablolar */
.table-wrap { overflow-x: auto; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .855rem; }
table.tbl th {
  text-align: left; font-weight: 650; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .045em;
  color: var(--ink-muted);
  padding: .5rem .6rem;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.tbl td {
  padding: .48rem .6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.tbl tbody tr:hover td { background: var(--surface-2); }
table.tbl tbody tr.is-selected td { background: var(--accent-soft); }
table.tbl tfoot td {
  font-weight: 650; border-top: 2px solid var(--line-strong);
  background: var(--surface-2); border-bottom: none;
}
table.tbl td.tight, table.tbl th.tight { width: 1%; white-space: nowrap; }
table.tbl.tbl--compact td { padding: .3rem .45rem; }
table.tbl a { font-weight: 550; }

.empty {
  padding: 2.5rem 1rem; text-align: center; color: var(--ink-muted);
}
.empty svg { width: 34px; height: 34px; opacity: .4; stroke-width: 1.5; margin-bottom: .5rem; }

/* ------------------------------------------------------------- rozetler */
.badge {
  display: inline-block; padding: .1rem .45rem;
  border-radius: 999px; font-size: .73rem; font-weight: 650;
  white-space: nowrap; line-height: 1.45;
}
.badge.is-new  { background: var(--info-soft);    color: var(--info); }
.badge.is-wait { background: var(--warn-soft);    color: var(--warn); }
.badge.is-work { background: var(--accent-soft);  color: var(--accent); }
.badge.is-sent { background: var(--green-soft);   color: var(--green); }
.badge.is-ok   { background: var(--ok-soft);      color: var(--ok); }
.badge.is-bad  { background: var(--bad-soft);     color: var(--bad); }
.badge.is-off  { background: var(--neutral-soft); color: var(--neutral); }

.tag {
  display: inline-block; padding: .05rem .4rem; border-radius: var(--radius-sm);
  background: var(--surface-sunk); color: var(--ink-2);
  font-size: .73rem; font-weight: 600;
}

/* --------------------------------------------------------------- form */
.field { display: flex; flex-direction: column; gap: .22rem; margin-bottom: .8rem; }
.field > label, .lbl {
  font-size: .76rem; font-weight: 650; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .04em;
}
.field .help { font-size: .76rem; color: var(--ink-muted); }
.field .err  { font-size: .78rem; color: var(--bad); font-weight: 550; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=tel], input[type=url],
select, textarea {
  width: 100%;
  padding: .4rem .55rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-size: .875rem;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[readonly], input[disabled], select[disabled], textarea[disabled] {
  background: var(--surface-sunk); color: var(--ink-muted); cursor: not-allowed;
}
textarea { min-height: 5rem; resize: vertical; line-height: 1.5; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236C8480' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .5rem center;
  padding-right: 1.7rem;
}
input.num-input { text-align: right; font-variant-numeric: tabular-nums; }

.check { display: flex; align-items: center; gap: .45rem; font-size: .86rem; }
.check input { width: auto; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin: 0 0 1rem; }
legend { font-size: .76rem; font-weight: 700; text-transform: uppercase;
         letter-spacing: .05em; color: var(--ink-muted); padding: 0 .35rem; }

.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); container-type: inline-size; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
/* İki 190px sütun sığmayınca ızgara tek sütuna düşer; "span 2" o zaman ekran dışında
   ikinci bir sütun açıyordu (telefonda talep/teklif/sipariş formları ~20px taşıyordu). */
@container (max-width: 395px) { .form-grid .span-2 { grid-column: 1 / -1; } }

/* ------------------------------------------------------------ filtreler */
.filters {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end;
  padding: .75rem 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 1rem;
}
.filters .field { margin: 0; min-width: 130px; }
.filters .field--grow { flex: 1 1 220px; }

/* ------------------------------------------------------------ mesajlar */
.flashes { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.flash {
  padding: .6rem .85rem; border-radius: var(--radius-sm);
  border-left: 3px solid var(--neutral); background: var(--neutral-soft);
  color: var(--ink); font-size: .875rem;
}
.flash.success { border-color: var(--ok);   background: var(--ok-soft); }
.flash.error   { border-color: var(--bad);  background: var(--bad-soft); }
.flash.warning { border-color: var(--warn); background: var(--warn-soft); }
.flash.info    { border-color: var(--info); background: var(--info-soft); }

.note {
  padding: .6rem .8rem; border-radius: var(--radius-sm);
  background: var(--warn-soft); border-left: 3px solid var(--warn);
  font-size: .84rem; margin-bottom: .8rem;
}
.note--info { background: var(--info-soft); border-color: var(--info); }

/* ------------------------------------------------------------ sayfalama */
.pager { display: flex; align-items: center; gap: .35rem; padding: .7rem 1rem; flex-wrap: wrap; }
.pager__info { color: var(--ink-muted); font-size: .82rem; margin-right: auto; }
.pager a, .pager span.cur {
  padding: .2rem .5rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); font-size: .82rem; font-weight: 550;
}
.pager span.cur { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager a:hover { background: var(--surface-2); text-decoration: none; }

/* ------------------------------------------------------------ sekmeler */
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs a {
  padding: .45rem .8rem; font-weight: 600; font-size: .87rem;
  color: var(--ink-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ------------------------------------------------------------ seçim kartı
   İki seçenekli radyo grubu (sipariş yönü gibi) — tıklama alanı büyük olsun. */
.radio-card {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .6rem .8rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius); cursor: pointer; background: var(--surface);
}
.radio-card:hover { border-color: var(--accent); }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.radio-card input { margin-top: .25rem; }

/* --------------------------------------------------- basit / detay modu
   Varsayılan BASİT: teklif = ürün, miktar, birim fiyat. Maliyet kırılımı,
   marj, ortak gider ve kur ayarları gizli durur; kullanıcı "Maliyet detayı"
   düğmesiyle açar. Tercih localStorage'da saklanır.
   `revert` kullanılıyor: th/td için table-cell, div için block'a döner. */
.detay-only { display: none; }
.mod-detay .detay-only { display: revert; }

/* Tedarikçi fiyat girişindeki menşe/üretici/lot satırı — varsayılan kapalı. */
.satir-detay { display: none; }
.mod-satir-detay .satir-detay { display: revert; }

/* ------------------------------------------------------- otomatik arama */
.ac { position: relative; }
/* Liste `fixed` konumlanır: satır editörü tabloları `.table-wrap` içinde ve
   onun `overflow-x: auto` değeri dikeyde de kırpma yapıyor — `absolute` liste
   tablonun altına taşınca görünmez oluyordu. Koordinatları JS yazar. */
.ac__list {
  position: fixed; z-index: 60;
  max-height: 300px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.ac__item { padding: .4rem .6rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.ac__item:last-child { border-bottom: none; }
.ac__item:hover, .ac__item.is-active { background: var(--accent-soft); }
.ac__item b { display: block; font-weight: 600; font-size: .86rem; }
.ac__item span { font-size: .76rem; color: var(--ink-muted); }

/* ---------------------------------------------------------- açılır kutu */
.dropdown { position: relative; display: inline-block; }
.dropdown__menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 60;
  min-width: 190px; padding: .3rem;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.dropdown__menu a, .dropdown__menu button {
  display: flex; align-items: center; gap: .45rem; width: 100%;
  padding: .38rem .55rem; border-radius: var(--radius-sm);
  color: var(--ink); font: inherit; font-size: .85rem; text-align: left;
  background: none; border: none; cursor: pointer;
}
.dropdown__menu a:hover, .dropdown__menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown__sep { height: 1px; background: var(--line); margin: .25rem 0; }

/* --------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8,20,18,.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 1rem 1rem; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  border: 1px solid var(--line);
}
.modal--wide { max-width: 900px; }
.modal__head { display: flex; align-items: center; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); }
.modal__head h3 { margin: 0; }
.modal__head .btn { margin-left: auto; }
.modal__body { padding: 1.1rem; }
.modal__foot { padding: .8rem 1.1rem; border-top: 1px solid var(--line);
               display: flex; gap: .5rem; justify-content: flex-end; }

/* ------------------------------------------------------- giriş ekranı */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 15% -10%, var(--accent-soft), transparent 65%),
    radial-gradient(700px 460px at 100% 110%, var(--green-soft), transparent 60%),
    var(--ground);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 1.75rem;
}
.login-card__brand { display: flex; flex-direction: column; align-items: center;
                     gap: .5rem; margin-bottom: 1.4rem; text-align: center; }
.login-card__brand img { width: 74px; height: auto; }
.login-card__brand small { color: var(--ink-muted); }

/* ------------------------------------------------- satır düzenleyici */
.line-editor { width: 100%; border-collapse: collapse; font-size: .83rem; }
.line-editor th {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-muted); font-weight: 700; text-align: left;
  padding: .35rem .3rem; border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.line-editor td { padding: .18rem .22rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.line-editor input, .line-editor select {
  padding: .28rem .4rem; font-size: .82rem; border-color: var(--line);
}
.line-editor input.num-input { min-width: 76px; }
.line-editor tr.is-removed { opacity: .45; }
.line-editor tr.is-removed input { text-decoration: line-through; }
.line-editor tfoot td { border-bottom: none; padding-top: .5rem; }
.line-editor .drag { cursor: grab; color: var(--ink-muted); user-select: none; }

/* satır sırası düğmeleri (⇈ ▲ ▼ ⇊): son sütunda, ✕'in solunda 2×2 küme (2 Kasım 2026: numara sütunu ekranı daraltıyordu) */
.line-editor .line-cell { white-space: nowrap; }
.line-editor .line-cell [data-line-no] { display: inline-block; min-width: 1.1rem; text-align: right; vertical-align: middle; }
.line-editor .line-actions { white-space: nowrap; text-align: right; }
.line-move { display: inline-grid; grid-template-columns: repeat(2, 26px); gap: 2px; margin-right: .3rem; vertical-align: middle; }
.line-move__btn { padding: 0; min-width: 0; width: 26px; height: 21px; font-size: .72rem; line-height: 1; justify-content: center; color: var(--ink); }
.line-move__btn[data-move-line="top"], .line-move__btn[data-move-line="bottom"] { font-size: 1.05rem; font-weight: 700; }
.line-move__btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-hover); }
.line-move__btn:disabled { opacity: .25; cursor: default; }
.line-editor tr.is-moved td { background: var(--accent-soft, rgba(0, 131, 160, .12)); }
.line-editor tr td { transition: background .6s; }
@media (pointer: coarse) {
  .line-move { grid-template-columns: repeat(2, 34px); gap: 3px; }
  .line-move__btn { width: 34px; height: 28px; font-size: .85rem; }
}

/* maliyet kırılımı satırı — ana satırın altında açılır */
.cost-row td { background: var(--surface-sunk); padding: .5rem .6rem .7rem; }
.cost-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px,1fr)); gap: .4rem .6rem; }
.cost-grid .field { margin: 0; gap: .1rem; }
.cost-grid label { font-size: .68rem; }

/* teklif satırı geçmişi (🕘) — şerit ürün adının altında, liste satır grubunun sonunda açılır */
.gecmis-serit {
  display: inline-block; max-width: 100%; margin-top: .25rem; padding: .12rem .5rem;
  border: 1px solid var(--warn); border-radius: var(--radius-sm); background: var(--warn-soft);
  color: var(--warn); font: inherit; font-size: .76rem; line-height: 1.35; text-align: left;
  white-space: normal; cursor: pointer;
}
.gecmis-serit:hover, .gecmis-serit[aria-expanded="true"] { filter: brightness(.96); }
.gecmis-serit:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.gecmis-yok { margin-top: .2rem; font-size: .74rem; color: var(--ink-muted); }
.line-editor tr.gecmis-row > td { background: var(--warn-soft); padding: .4rem .6rem .55rem; }
.line-editor .gecmis-tablo { width: 100%; border-collapse: collapse; font-size: .78rem; }
.line-editor .gecmis-tablo th {
  font-size: .66rem; padding: .2rem .4rem; border-bottom: 1px solid var(--warn); color: var(--warn); background: transparent;
}
.line-editor .gecmis-tablo td { padding: .2rem .4rem; border-bottom: 1px dashed var(--line-strong); background: transparent; vertical-align: top; }
.line-editor .gecmis-tablo .num { text-align: right; }
.line-editor .gecmis-tablo tr.is-bu td { background: var(--ok-soft); }
.gecmis-bu { display: inline-block; margin-left: .3rem; padding: 0 .35rem; border-radius: 3px; background: var(--ok); color: var(--ink-inverse); font-size: .66rem; font-weight: 700; }
.gecmis-alt { margin-top: .3rem; font-size: .74rem; color: var(--ink-muted); }

/* --------------------------------------------------- karşılaştırma tablosu */
.cmp-best { background: var(--ok-soft) !important; }
.cmp-best td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.cmp-diff-up   { color: var(--loss); }
.cmp-diff-down { color: var(--profit); }

/* ---------------------------------------------------------- zaman akışı */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline__item {
  display: grid; grid-template-columns: 8px 1fr; gap: .7rem;
  padding: .55rem 0; border-bottom: 1px solid var(--line);
}
.timeline__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: .42rem; }
.timeline__item:last-child { border-bottom: none; }
.timeline__meta { font-size: .76rem; color: var(--ink-muted); }

/* ------------------------------------------------------------ tanımlar */
.dl { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: .3rem .8rem; font-size: .87rem; }
.dl dt { color: var(--ink-muted); font-weight: 600; font-size: .8rem; }
.dl dd { margin: 0; }

.page-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .btn-row { margin-left: auto; }
.page-head__sub { color: var(--ink-muted); font-size: .85rem; }

/* ------------------------------------------------------- açılır satır (peek)
   Listede kaydın içindeki ürünleri kartına girmeden göstermek için. */
.peek__btn {
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 4px; cursor: pointer;
  font: inherit; font-size: .68rem; line-height: 1;
  padding: .16rem .3rem; margin-right: .35rem;
  color: var(--ink-muted); vertical-align: 1px;
}
.peek__btn:hover { border-color: var(--accent); color: var(--accent); }
.peek__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.peek__say { font-variant-numeric: tabular-nums; margin-left: .12rem; }
tr.is-peeking > td { background: var(--surface-2); }
tr.peek > td { background: var(--surface-sunk); padding: .35rem .6rem .5rem 2.1rem; }
.peek__tbl { width: 100%; border-collapse: collapse; font-size: .8rem; }
.peek__tbl td { padding: .16rem .5rem .16rem 0; border: none; }
.peek__tbl tr + tr td { border-top: 1px solid var(--line); }
.peek__ad { width: 100%; }
.peek__empty { font-size: .8rem; color: var(--ink-faint); }

/* Geri düğmesi: sayfa başlığındaki diğer eylemlerden ayrılsın — bir işlem
   değil, gezinme. Uzun sayfa adları düğmeyi taşırmasın diye kısaltılır. */
/* Geri düğmesi — "← Geri · <geldiğin sayfa>"
   Ok ve "Geri" etiketi sabit; yalnız sayfa adı kısalır. Kırpma düğmenin
   kendisinde DEĞİL ad parçasında yapılıyor, yoksa ortalı esnek kutuda taşma
   iki yandan kesiliyor ve düğmenin ne olduğu anlaşılmıyordu. */
.btn--geri {
  max-width: 24rem;
  justify-content: flex-start;
  gap: .3rem;
  color: var(--ink-muted);
}
.btn--geri:hover { color: var(--ink); }
.btn--geri__ok,
.btn--geri__et { flex: none; }
.btn--geri__ad {
  min-width: 0;                 /* esnek öğe içerik boyunun altına insin */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: .72;
  padding-left: .4rem;
  border-left: 1px solid var(--line);
}
/* Dar ekranda ad düşer, "← Geri" kalır. */
@media (max-width: 700px) { .btn--geri__ad { display: none; } }

/* ------------------------------------------------------------ hareketli */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* -------------------------------------------------------------- dar ekran */
@media (max-width: 1000px) {
  .grid--sidebar, .grid--4, .grid--3 { grid-template-columns: 1fr; }
  .grid--stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .grid--2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 90; left: 0; top: 0; width: var(--sidebar-w);
    transform: translateX(-100%); transition: transform .18s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .content { padding: .9rem; }
}
@media (min-width: 821px) { .menu-toggle { display: none; } }

@media print {
  .sidebar, .topbar, .btn-row, .filters, .pager { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .card { border: none; box-shadow: none; }
  body { background: #fff; }
}

/* ------------------------------------------------------------ fiyat özeti
   Ürün kartında alış / teklif / sipariş fiyatının tek bakışta özeti.
   Her para birimi kendi satırında durur; toplanmaz. */
.ozet {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .6rem .75rem; background: var(--surface-2);
}
.ozet__ad {
  font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-soft); margin-bottom: .4rem;
}
.ozet__ad .muted { font-weight: 400; text-transform: none; letter-spacing: 0; }
.ozet__yok { font-size: .8rem; color: var(--ink-faint); }
.ozet__satir + .ozet__satir { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.ozet__son { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ozet__aralik { font-size: .74rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* Aynı etken maddeli ürün listesi — yan sütunda, sade. */
.alt-list { list-style: none; margin: 0; padding: 0; max-height: 22rem; overflow-y: auto; }
.alt-list li { padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .85rem; }
.alt-list li:last-child { border-bottom: none; }

/* Eksik ama sessiz kalmaması gereken alan — ör. para birimsiz hedef fiyat. */
.eksik {
  font-size: .72rem; color: var(--warn);
  border: 1px dashed currentColor; border-radius: 3px;
  padding: 0 .25rem; white-space: nowrap;
}

/* ------------------------------------------------------------ genel arama
   Üst çubuktaki tek kutu. Dashboard'a değil topbar'a konuldu: kullanıcı
   aramayı aklına geldiği an, bulunduğu ekranı terk etmeden yapabilsin. */
.topbar__ara {
  /* margin-left:auto YOK — .topbar__right zaten sağa yaslanıyor. İkisi de
     auto olsa boşluk ikiye bölünür ve kutu ortada asılı kalırdı. */
  display: flex; align-items: center; gap: .45rem;
  min-width: 15rem; max-width: 26rem; flex: 1 1 22rem;
  padding: 0 .55rem;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color .12s, background .12s;
}
.topbar__ara:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.topbar__ara svg { width: 15px; height: 15px; color: var(--ink-muted); flex: none; }
.topbar__ara input {
  flex: 1; min-width: 0;
  border: 0; background: none; outline: none;
  font: inherit; font-size: .86rem; color: var(--ink);
}
.topbar__ara input::-webkit-search-cancel-button { cursor: pointer; }
.topbar__ara kbd {
  flex: none;
  font: 600 .68rem/1 var(--font-mono);
  color: var(--ink-muted);
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 4px; padding: .18rem .3rem;
  background: var(--surface);
}
.topbar__ara:focus-within kbd { visibility: hidden; }

/* Üst çubuk daralınca arama kutusu başlıktan önce feda edilmez, başlık edilir. */
@media (max-width: 900px) {
  .topbar__title { display: none; }
  .topbar__ara kbd { display: none; }
}
@media (max-width: 560px) {
  .topbar__ara { min-width: 0; flex: 1 1 auto; }
}

/* Sonuç sayfasındaki grup atlama şeridi. */
.ara-ozet {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  margin-bottom: .9rem;
}
.ara-ozet a.tag { text-decoration: none; border: 1px solid transparent; }
.ara-ozet a.tag:hover { border-color: var(--accent); color: var(--accent); }

/* Kuyruk ekranındaki kip sekmeleri — .ara-ozet şeridini yeniden kullanır. */
.ara-ozet a.tag.is-selected {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.ara-ozet a.tag.is-selected:hover { color: var(--accent-ink); }
