/* ============================================================
   SteelStep — Apple HIG tasarım sistemi
   Tek dosya: token'lar, iskelet, bileşenler, hareket, responsive
   ============================================================ */

/* ---------- Token'lar ---------- */
:root {
  /* UI/UX Pro Max tasarım sistemi (design-system/steelstep/MASTER.md):
     profesyonel lacivert/slate palet + mavi CTA, Fira Sans/Fira Code */
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #475569;
  --ink-3: #64748B;
  --hairline: #E2E8F0;
  --fill: #F1F5F9;
  --fill-2: #E8ECF1;

  --accent: #0369A1;
  --accent-hover: #0284C7;
  --accent-tint: rgba(3, 105, 161, 0.10);
  --green: #059669;
  --orange: #D97706;
  --red: #DC2626;
  --purple: #7C3AED;
  --teal: #0D9488;
  --gray: #64748B;
  --blue: #2563EB;

  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.05), 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-2: 0 4px 16px rgba(15, 23, 42, 0.12), 0 16px 48px rgba(15, 23, 42, 0.16);

  --radius: 12px;
  --radius-lg: 16px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);

  --bar-bg: rgba(248, 250, 252, 0.8);
  --bar-blur: saturate(160%) blur(18px);
  --topbar-h: 52px;
  --tabbar-h: 56px;
  --seg-active: #FFFFFF;

  --sidebar-bg: #0F172A;
  --sidebar-ink: #E2E8F0;
  --sidebar-muted: #94A3B8;
  --sidebar-hover: rgba(148, 163, 184, 0.12);
  --sidebar-active: rgba(56, 189, 248, 0.16);

  --font: "Fira Sans", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Fira Code", ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #020617;
  --surface: #0F172A;
  --surface-2: #1E293B;
  --ink: #F1F5F9;
  --ink-2: #94A3B8;
  --ink-3: #64748B;
  --hairline: rgba(148, 163, 184, 0.18);
  --fill: rgba(148, 163, 184, 0.09);
  --fill-2: rgba(148, 163, 184, 0.15);

  --accent: #0EA5E9;
  --accent-hover: #38BDF8;
  --accent-tint: rgba(14, 165, 233, 0.16);
  --green: #34D399;
  --orange: #FBBF24;
  --red: #F87171;
  --teal: #2DD4BF;
  --blue: #60A5FA;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.5), 0 16px 48px rgba(0, 0, 0, 0.6);

  --bar-bg: rgba(2, 6, 23, 0.8);
  --seg-active: #334155;

  --sidebar-bg: #0B1120;
  --sidebar-ink: #E2E8F0;
  --sidebar-muted: #7C8BA1;
  --sidebar-hover: rgba(148, 163, 184, 0.10);
  --sidebar-active: rgba(56, 189, 248, 0.18);
}

/* ---------- Sıfırlama + taban ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* hidden attribute'u yazar CSS'indeki display kurallarına (flex/grid/block)
   yenilmesin — JS mod gizle/göster mantığının güvencesi */
[hidden] { display: none !important; }

html { height: 100%; }

body {
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden; /* kaydırma .view içinde yaşar */
}

::selection { background: var(--accent-tint); }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ---------- Uygulama iskeleti ---------- */
.app { display: flex; height: 100dvh; }

.main { position: relative; flex: 1; min-width: 0; height: 100dvh; overflow: hidden; }

.view {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(var(--topbar-h) + 10px) 32px 56px;
  scroll-behavior: smooth;
}

/* ---------- Kenar çubuğu ---------- */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 12px 16px;
  border-right: 1px solid var(--hairline);
  background: var(--bar-bg);
  backdrop-filter: var(--bar-blur);
  -webkit-backdrop-filter: var(--bar-blur);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }

.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(165deg, #5AA2E8 0%, #0071E3 55%, #0055AB 100%);
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.35);
}
.brand-mark svg { width: 20px; height: 20px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 16.5px; font-weight: 700; letter-spacing: -0.02em; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }

.nav-sec {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 10px 5px;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 14px; font-weight: 500;
  color: var(--ink);
  transition: background 0.15s ease;
}
.nav-item:hover { background: var(--fill); }
.nav-item.active { background: var(--fill-2); font-weight: 600; }
.nav-item:active { transform: scale(0.985); }

/* iOS Ayarlar tarzı renkli ikon kareleri */
.tile {
  width: 27px; height: 27px;
  border-radius: 7.5px;
  display: grid; place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.tile .icon { width: 16px; height: 16px; }
.tile-blue   { background: linear-gradient(180deg, #4AA5FF, #0A84FF); }
.tile-purple { background: linear-gradient(180deg, #C173E8, #AF52DE); }
.tile-green  { background: linear-gradient(180deg, #5BD778, #34C759); }
.tile-orange { background: linear-gradient(180deg, #FFB340, #FF9F0A); }
.tile-teal   { background: linear-gradient(180deg, #55C6DB, #30B0C7); }
.tile-gray   { background: linear-gradient(180deg, #A6A6AC, #8E8E93); }
.tile-red    { background: linear-gradient(180deg, #FF6B61, #FF3B30); }
.tile-indigo { background: linear-gradient(180deg, #7D7AFF, #5856D6); }
.tile-pink   { background: linear-gradient(180deg, #FF5C7F, #FF2D55); }
.tile-brown  { background: linear-gradient(180deg, #B99A75, #A2845E); }
.tile-yellow { background: linear-gradient(180deg, #FFD60A, #F5A623); color: #6B4A00; }
.tile-cyan   { background: linear-gradient(180deg, #64C7F0, #32ADE6); }
.tile-mint   { background: linear-gradient(180deg, #4DDDB5, #00A88E); }

.tile-lg { width: 40px; height: 40px; border-radius: 11px; }
.tile-lg .icon { width: 22px; height: 22px; }

/* Veritabanı durum göstergesi */
.sidebar-foot { padding: 10px 10px 2px; border-top: 1px solid var(--hairline); }

.db-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }

.db-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red);
  transition: background 0.3s ease;
}
.db-status[data-db="on"] .db-dot, .db-dot[data-db="on"] {
  background: var(--green);
  animation: db-pulse 2.4s ease-in-out infinite;
}
@keyframes db-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4); }
  50%      { box-shadow: 0 0 0 5px rgba(52, 199, 89, 0); }
}

/* ---------- Üst çubuk (buzlu) ---------- */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 30;
  display: flex; align-items: center;
  padding: 0 14px;
  background: var(--bar-bg);
  backdrop-filter: var(--bar-blur);
  -webkit-backdrop-filter: var(--bar-blur);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}
.topbar.scrolled { border-bottom-color: var(--hairline); }

.topbar-side { flex: 1; display: flex; align-items: center; gap: 8px; }
.topbar-right { justify-content: flex-end; }

/* Kompakt başlık: Large Title görünümden çıkınca belirir */
.topbar-title {
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s var(--ease);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 60%;
}
.topbar.scrolled .topbar-title { opacity: 1; transform: translateY(0); }

.topbar-db { display: none; }

.btn-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: background 0.15s ease, transform 0.15s var(--ease);
}
.btn-icon:hover { background: var(--fill); }
.btn-icon:active { transform: scale(0.9); }
.btn-icon .icon { width: 19px; height: 19px; }

/* Tema düğmesi ikon durumu */
.theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-moon { display: block; }
[data-theme="dark"] .theme-icon-sun { display: none; }
.theme-icon-sun, .theme-icon-moon { display: block; }
:root:not([data-theme="dark"]) .theme-icon-moon { display: none; }

/* ---------- Sayfa başlığı (Large Title) ---------- */
.page { animation: page-in 0.4s var(--ease) both; }

@keyframes page-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-head { padding: 10px 0 20px; }

.large-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.15;
}

.page-sub { margin-top: 4px; font-size: 14.5px; color: var(--ink-2); }

/* ---------- Araç çubuğu (arama + filtre + ekle) ---------- */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar-spacer { flex: 1; }

.search-field {
  display: flex; align-items: center; gap: 8px;
  background: var(--fill);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 220px;
  color: var(--ink-3);
  transition: box-shadow 0.2s ease, background 0.2s ease;
}
.search-field:focus-within {
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-tint), 0 0 0 1px var(--accent);
}
.search-field .icon { width: 16px; height: 16px; }
.search-field input {
  border: none; background: none; outline: none;
  width: 100%;
  font-size: 14.5px;
  color: var(--ink);
}
.search-field input::placeholder { color: var(--ink-3); }

/* Segmented control */
.seg {
  display: inline-flex;
  background: var(--fill);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.seg button.active {
  background: var(--seg-active);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* ---------- Düğmeler ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px;
  border-radius: 980px; /* Apple hap */
  font-size: 14.5px; font-weight: 500;
  transition: background 0.18s ease, transform 0.15s var(--ease), opacity 0.18s ease;
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn .icon { width: 16px; height: 16px; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--fill); color: var(--ink); }
.btn-secondary:hover { background: var(--fill-2); }

.btn-danger { background: rgba(255, 59, 48, 0.12); color: var(--red); }
.btn-danger:hover { background: rgba(255, 59, 48, 0.2); }

.btn-plain { color: var(--accent); padding: 9px 10px; }
.btn-plain:hover { background: var(--accent-tint); }

.btn[disabled] { opacity: 0.5; pointer-events: none; }

.btn-block { width: 100%; padding: 12px 18px; font-size: 15.5px; font-weight: 600; }

/* ---------- Kartlar ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 20px;
}

.card-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 12px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }

.stat-value {
  font-size: 26px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }

/* Sıralı giriş animasyonu */
.stagger > * { animation: page-in 0.5s var(--ease) backwards; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; }
.stagger > *:nth-child(4) { animation-delay: 0.14s; }
.stagger > *:nth-child(5) { animation-delay: 0.18s; }
.stagger > *:nth-child(6) { animation-delay: 0.22s; }
.stagger > *:nth-child(7) { animation-delay: 0.26s; }
.stagger > *:nth-child(8) { animation-delay: 0.30s; }

/* ---------- Liste / tablo (Apple inset grouped) ---------- */
.list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.list-head, .list-row {
  display: grid;
  grid-template-columns: var(--cols, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
}

.list-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  border-bottom: 1px solid var(--hairline);
  padding-top: 11px; padding-bottom: 9px;
}

/* HİZA GARANTİSİ: her satır kendi grid'i olduğundan hiçbir hücre
   (başlık dahil) içeriğiyle kolonunu genişletemez; fr payları tüm
   satırlarda birebir aynı çözülür ve veriler başlığın tam altına oturur */
.list-head > div,
.list-row > * { min-width: 0; }
.list-head > div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row {
  border-bottom: 1px solid var(--hairline);
  transition: background 0.15s ease;
  animation: page-in 0.35s var(--ease) both;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--fill); }

.list-row.removing,
.seg-row.removing {
  transition: opacity 0.3s ease, transform 0.3s var(--ease);
  opacity: 0;
  transform: translateX(24px);
}

.cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-primary { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.cell-sub { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 400; margin-top: 1px; }
.cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.cell .cell-label { display: none; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity 0.15s ease; }
.list-row:hover .row-actions, .list-row:focus-within .row-actions { opacity: 1; }

/* ---------- Rozetler ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px;
  border-radius: 980px;
  white-space: nowrap;
}
.badge-green  { background: rgba(52, 199, 89, 0.14);  color: #1D9B45; }
.badge-orange { background: rgba(255, 159, 10, 0.16); color: #C77A00; }
.badge-red    { background: rgba(255, 59, 48, 0.14);  color: #E0281C; }
.badge-blue   { background: rgba(10, 132, 255, 0.14); color: #0071E3; }
.badge-gray   { background: var(--fill);               color: var(--ink-2); }
.badge-purple { background: rgba(175, 82, 222, 0.14); color: #9A3EC8; }
.badge-teal   { background: rgba(48, 176, 199, 0.16); color: #1D8CA0; }

[data-theme="dark"] .badge-green  { color: #4ADE80; }
[data-theme="dark"] .badge-orange { color: #FFB340; }
[data-theme="dark"] .badge-red    { color: #FF6B61; }
[data-theme="dark"] .badge-blue   { color: #4AA5FF; }
[data-theme="dark"] .badge-purple { color: #C982EE; }
[data-theme="dark"] .badge-teal   { color: #55C6DB; }

/* ---------- Boş durumlar ---------- */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  animation: page-in 0.45s var(--ease) both;
}
.empty-icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  display: grid; place-items: center;
  margin: 0 auto 16px;
}
.empty-icon .icon { width: 30px; height: 30px; }
.tint-blue   { background: rgba(10, 132, 255, 0.12);  color: var(--blue); }
.tint-purple { background: rgba(175, 82, 222, 0.12);  color: var(--purple); }
.tint-green  { background: rgba(52, 199, 89, 0.12);   color: var(--green); }
.tint-orange { background: rgba(255, 159, 10, 0.14);  color: var(--orange); }
.tint-teal   { background: rgba(48, 176, 199, 0.14);  color: var(--teal); }
.tint-gray   { background: var(--fill);                color: var(--ink-3); }
.tint-red    { background: rgba(255, 59, 48, 0.12);   color: var(--red); }
.tint-indigo { background: rgba(88, 86, 214, 0.12);   color: #5856D6; }
[data-theme="dark"] .tint-indigo { color: #7D7AFF; }
.tint-pink   { background: rgba(255, 45, 85, 0.12);   color: #FF2D55; }
.tint-brown  { background: rgba(162, 132, 94, 0.16);  color: #A2845E; }
.tint-yellow { background: rgba(245, 166, 35, 0.16);  color: #C77A00; }
[data-theme="dark"] .tint-yellow { color: #FFD60A; }
.tint-cyan   { background: rgba(50, 173, 230, 0.13);  color: #1D8FC7; }
[data-theme="dark"] .tint-cyan { color: #64C7F0; }
.tint-mint   { background: rgba(0, 168, 142, 0.13);   color: #00806C; }
[data-theme="dark"] .tint-mint { color: #4DDDB5; }

.empty-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.empty-desc { font-size: 14px; color: var(--ink-2); margin: 6px auto 18px; max-width: 320px; }

/* ---------- Form alanları ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .field-full { grid-column: 1 / -1; }

/* ===== FORM ADIM BÖLÜMLERİ (satış/alış modalları) =====
   Renkli ikonlu adım başlıklı kartlar: alanlar mantıksal gruplara ayrılır,
   kullanıcı akışı adım adım izler (ADIM N numarası applyMode'da yazılır). */
.fsec {
  grid-column: 1 / -1;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow-1);
}
.fsec-head {
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 12px;
}
.fsec-head .tile { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; }
.fsec-head .tile svg { width: 18px; height: 18px; }
.fsec-titles { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fsec-step {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3);
}
.fsec-title { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.fsec-hint { font-size: 12px; color: var(--ink-3); }
.fsec-head .fsec-side { margin-left: auto; flex-shrink: 0; }

/* Kaynak kartları (Çıkış): renk kodlu, aç/kapa (progressive disclosure) */
.src-card {
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--src-color, var(--accent));
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
}
.src-card + .src-card { margin-top: 10px; }
.src-card > summary {
  list-style: none;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}
.src-card > summary::-webkit-details-marker { display: none; }
.src-card > summary .tile { width: 27px; height: 27px; flex-shrink: 0; }
.src-card > summary:hover { background: var(--fill); }
.src-title { font-size: 13.5px; font-weight: 650; }
.src-sum { font-size: 12px; color: var(--ink-3); margin-left: auto; text-align: right; flex-shrink: 0; }
.src-chevron { color: var(--ink-3); flex-shrink: 0; transition: transform 0.2s var(--ease); }
.src-card[open] .src-chevron { transform: rotate(90deg); }
.src-body { padding: 2px 12px 12px; }
.src-body .check-list { border: none; background: transparent; }
.src-hint { font-size: 12px; color: var(--ink-3); margin: 0 0 8px; }

/* Ödenecek Tutar özet şeridi: lacivert marka bandı, canlı toplam */
.fsum {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(135deg, var(--sidebar-bg, #0F172A), #1E293B);
  color: #F1F5F9;
  border-radius: 14px;
  padding: 13px 16px;
}
.fsum-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.75; }
.fsum-value {
  font-size: 22px; font-weight: 750; letter-spacing: -0.02em;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fsum-sub { font-size: 12px; opacity: 0.8; }

/* Kaynak kartı içindeki fiyat çipleri: yalnız girilmiş çaplar, renkli */
.src-prices { display: inline-flex; gap: 4px; flex-wrap: wrap; vertical-align: middle; }
@media (max-width: 560px) {
  .src-sum { display: none; }
  .fsum-value { font-size: 18px; }
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-2); }

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--hairline);
  background: var(--bg);
  font-size: 15px;
  color: var(--ink);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}
[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea { background: var(--surface-2); }

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-tint);
  background: var(--surface);
}
[data-theme="dark"] .field input:focus,
[data-theme="dark"] .field select:focus,
[data-theme="dark"] .field textarea:focus { background: var(--surface-2); }

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
  padding-right: 34px;
}

.field textarea { resize: vertical; min-height: 72px; }

/* Segment kart satırları (Satışlar tablosu): her satır, hücre başına
   ayrı beyaz kartlardan oluşur — ikon + büyük harf etiket + değer */
.seg-list { display: flex; flex-direction: column; gap: 10px; }
.seg-row {
  display: grid;
  grid-template-columns: 1.9fr 1fr 0.95fr 1.35fr 1.25fr 92px;
  gap: 10px;
  cursor: pointer;
}
.seg {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s ease, transform 0.15s var(--ease);
}
.seg-row:hover .seg { border-color: var(--fill-2); }
.seg-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.seg-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-3); white-space: nowrap;
}
.seg-value {
  font-size: 13.5px; font-weight: 650; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
/* Aksiyon hücresi kart DEĞİLDİR — satır sonunda, hücre kartlarıyla aynı
   dilde (yüzey + kenarlık + gölge) belirgin ikon butonlar */
.seg-actions {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  justify-content: center;
  gap: 6px;
}
.seg-actions .btn-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s ease, color 0.15s ease,
    background 0.15s ease, transform 0.15s var(--ease);
}
.seg-actions .btn-icon .icon { width: 17px; height: 17px; }
/* Düzenle hover'da vurgu rengine döner; sil butonunun satır içi kırmızısı
   currentColor üzerinden kenarlığa da yansır */
.seg-actions .btn-icon:hover {
  background: var(--surface);
  border-color: currentColor;
  color: var(--accent);
  transform: translateY(-1px);
}
/* Finans sayfaları varyantı: 4 veri hücresi + ok */
.seg-row.fin { grid-template-columns: 2fr 1.7fr 1.2fr 1.2fr 48px; }
/* Stok (depo çekişi) varyantı: 4 veri hücresi + aksiyonlar */
.seg-row.st { grid-template-columns: 1fr 0.9fr 1.9fr 1.3fr 92px; }
/* Detay başlığındaki istatistik şeridi */
.fin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

/* Çap fiyat seçimi — alış/satış modallarında dikey liste yerine tek
   satırda 3 kompakt kutu (modal ekrana kaydırmasız sığsın diye) */
.q-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.q-cell {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--hairline);
  border-radius: 11px;
  padding: 9px 10px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
[data-theme="dark"] .q-cell { background: var(--surface-2); }
.q-cell:hover { border-color: var(--fill-2); }
.q-cell:has(input[type="radio"]:checked) { border-color: var(--accent); background: var(--accent-tint); }
.q-cell-head { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.q-cell input[type="number"] { padding: 8px 10px; font-size: 14px; }

/* Checkbox listesi (iOS grouped list) — ör. teklifte banka seçimi */
.check-list {
  border: 1px solid var(--hairline);
  border-radius: 11px;
  overflow: hidden;
  background: var(--bg);
}
[data-theme="dark"] .check-list { background: var(--surface-2); }

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: background 0.15s ease;
}
.check-row:last-child { border-bottom: none; }
.check-row:hover { background: var(--fill); }
/* macOS tarzı onay kutusu ve radyo: 16px, ince kenarlık, işaretlenince
   Apple mavisi degrade dolgu — checkbox'ta keskin beyaz tik, radyoda beyaz nokta */
input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px; height: 16px;
  margin: 0;
  flex-shrink: 0;
  border: 0.5px solid rgba(0, 0, 0, 0.22);
  background: linear-gradient(180deg, #FFFFFF, #F5F5F7);
  box-shadow: inset 0 1px 1.5px rgba(0, 0, 0, 0.06);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s var(--ease);
}
[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"] {
  border-color: rgba(255, 255, 255, 0.28);
  background: linear-gradient(180deg, #48484A, #3A3A3C);
  box-shadow: inset 0 1px 1.5px rgba(0, 0, 0, 0.3);
}

input[type="checkbox"] { border-radius: 4.5px; }
input[type="radio"] { border-radius: 50%; }

input[type="checkbox"]:active,
input[type="radio"]:active { transform: scale(0.92); filter: brightness(0.96); }

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background: linear-gradient(180deg, #4394FF 0%, #0B63E5 100%);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.4), 0 0.5px 2px rgba(11, 99, 229, 0.35);
}
[data-theme="dark"] input[type="checkbox"]:checked,
[data-theme="dark"] input[type="radio"]:checked {
  background: linear-gradient(180deg, #3E90FF 0%, #0A66D6 100%);
  border-color: transparent;
}

/* Checkbox: keskin beyaz tik (kenarlık tekniği — mask'ten net render olur) */
input[type="checkbox"]::before {
  content: '';
  width: 3.5px; height: 8px;
  margin-top: -2px;
  border: solid #fff;
  border-width: 0 1.7px 1.7px 0;
  border-radius: 0.5px;
  transform: rotate(45deg) scale(0);
  transition: transform 0.18s var(--ease);
}
input[type="checkbox"]:checked::before { transform: rotate(45deg) scale(1); }

/* Radyo: ortada beyaz nokta (macOS) */
input[type="radio"]::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.15);
  transform: scale(0);
  transition: transform 0.18s var(--ease);
}
input[type="radio"]:checked::before { transform: scale(1); }

input[type="checkbox"]:disabled,
input[type="radio"]:disabled { opacity: 0.4; cursor: default; }
.check-name { font-weight: 600; font-size: 14px; flex-shrink: 0; }
.check-sub {
  font-size: 12px;
  color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* İnce ilerleme çubuğu — bağlantı kalan tonajı */
.progress {
  height: 5px;
  border-radius: 3px;
  background: var(--fill-2);
  overflow: hidden;
  margin-top: 5px;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.4s var(--ease);
}
.progress-fill.low { background: var(--orange); }
.progress-fill.out { background: var(--red); }

/* ---------- Sheet (form modalı) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sheet-backdrop.open { opacity: 1; }

.sheet {
  position: fixed;
  z-index: 91;
  background: var(--surface);
  display: flex; flex-direction: column;
  /* Form içeriği kaydırmasız tam görünsün diye yüksek tavan */
  max-height: min(94dvh, 960px);
  box-shadow: var(--shadow-2);
  /* Masaüstü: ortalanmış kart */
  left: 50%; top: 50%;
  width: min(680px, calc(100vw - 48px));
  border-radius: var(--radius-lg);
  transform: translate(-50%, -46%) scale(0.96);
  opacity: 0;
  transition: transform 0.35s var(--ease), opacity 0.25s ease;
}
.sheet.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }

/* Geniş sheet — satış modalı gibi yoğun formlar iki kolon + panellerle
   rahat sığsın (mobilde normal alttan-kayar sheet kuralları geçerli) */
.sheet-wide { width: min(880px, calc(100vw - 48px)); }

.sheet-grabber { display: none; }

.sheet-head {
  display: flex; align-items: center; justify-content: center;
  position: relative;
  padding: 14px 52px 4px;
}
.sheet-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; text-align: center; }
.sheet-close {
  position: absolute; right: 14px; top: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--ink-2);
  display: grid; place-items: center;
  transition: background 0.15s ease, transform 0.15s var(--ease);
}
.sheet-close:hover { background: var(--fill-2); }
.sheet-close:active { transform: scale(0.9); }
.sheet-close .icon { width: 15px; height: 15px; }

.sheet-body { padding: 12px 22px 6px; overflow-y: auto; }
.sheet-foot { padding: 12px 22px calc(16px + env(safe-area-inset-bottom)); }

/* Onay diyaloğu (iOS alert) */
.alert-card {
  position: fixed;
  z-index: 92;
  left: 50%; top: 50%;
  width: min(300px, calc(100vw - 80px));
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  text-align: center;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  transition: transform 0.3s var(--ease), opacity 0.2s ease;
  overflow: hidden;
}
.alert-card.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.alert-body { padding: 20px 20px 16px; }
.alert-title { font-size: 16px; font-weight: 600; }
.alert-msg { font-size: 13.5px; color: var(--ink-2); margin-top: 5px; }
.alert-actions { display: flex; border-top: 1px solid var(--hairline); }
.alert-actions button {
  flex: 1;
  padding: 12px;
  font-size: 15.5px;
  color: var(--accent);
  transition: background 0.15s ease;
}
.alert-actions button:hover { background: var(--fill); }
.alert-actions button + button { border-left: 1px solid var(--hairline); }
.alert-actions .destructive { color: var(--red); font-weight: 600; }

/* ---------- Action sheet (mobil "Diğer") ---------- */
.action-sheet {
  position: fixed;
  z-index: 91;
  left: 10px; right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateY(115%);
  transition: transform 0.42s var(--ease);
}
.action-sheet.open { transform: translateY(0); }

.action-group {
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-2);
}
.action-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  border-bottom: 1px solid var(--hairline);
  transition: background 0.15s ease;
  text-align: left;
}
.action-row:last-child { border-bottom: none; }
.action-row:hover { background: var(--fill); }
.action-cancel {
  margin-top: 9px;
  width: 100%;
  background: var(--surface);
  border-radius: 16px;
  padding: 15px;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--accent);
  box-shadow: var(--shadow-2);
}

/* ---------- Toast (Dynamic Island) ---------- */
#toast-root {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  z-index: 100;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: 10px;
  background: #000;
  color: #fff;
  padding: 11px 20px 11px 13px;
  border-radius: 980px;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  animation: island-in 0.55s var(--ease) both;
}
[data-theme="dark"] .toast { background: #1C1C1E; box-shadow: 0 8px 32px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.1); }

.toast.hide { animation: island-out 0.4s var(--ease) both; }

@keyframes island-in {
  0%   { transform: translateY(-150%) scale(0.6); opacity: 0; }
  60%  { transform: translateY(6%) scale(1.03);   opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}
@keyframes island-out {
  from { transform: translateY(0) scale(1);       opacity: 1; }
  to   { transform: translateY(-150%) scale(0.6); opacity: 0; }
}

.toast-badge {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #fff;
}
.toast-badge .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.toast-success .toast-badge { background: var(--green); }
.toast-error .toast-badge   { background: var(--red); }
.toast-info .toast-badge    { background: var(--blue); }

/* ---------- Yükleme iskeleti ---------- */
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--fill) 25%, var(--fill-2) 50%, var(--fill) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  height: 14px;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ---------- Alt sekme çubuğu (mobil) ---------- */
.tabbar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 5px 6px calc(4px + env(safe-area-inset-bottom));
  background: var(--bar-bg);
  backdrop-filter: var(--bar-blur);
  -webkit-backdrop-filter: var(--bar-blur);
  border-top: 1px solid var(--hairline);
}

.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3);
  font-size: 10px; font-weight: 500;
  border-radius: 10px;
  transition: color 0.2s ease, transform 0.15s var(--ease);
}
.tab .icon { width: 23px; height: 23px; }
.tab.active { color: var(--accent); }
.tab:active { transform: scale(0.92); }

/* ---------- Yardımcılar ---------- */
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .sidebar { display: none; }
  .tabbar { display: flex; }
  .topbar-db { display: block; }

  .view {
    padding: calc(var(--topbar-h) + 4px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  }

  .large-title { font-size: 30px; }
  .page-head { padding: 6px 0 16px; }

  .toolbar { gap: 10px; }
  .search-field { min-width: 0; flex: 1 1 100%; order: 3; }

  .form-grid { grid-template-columns: 1fr; }

  .q-grid { grid-template-columns: 1fr; }

  .seg-row, .seg-row.fin, .seg-row.st { grid-template-columns: 1fr 1fr; }
  .seg-actions { grid-column: 1 / -1; }

  /* Sheet mobilde alttan kayar */
  .sheet {
    left: 8px; right: 8px; top: auto; bottom: 8px;
    width: auto;
    max-height: 88dvh;
    border-radius: 22px;
    transform: translateY(112%);
    opacity: 1;
  }
  .sheet.open { transform: translateY(0); }
  .sheet-grabber {
    display: block;
    width: 36px; height: 4.5px;
    border-radius: 3px;
    background: var(--fill-2);
    margin: 8px auto 0;
  }

  /* Liste satırları kartlaşır: başlık gizlenir, hücreler alt alta */
  .list-head { display: none; }
  .list-row {
    grid-template-columns: 1fr auto !important;
    row-gap: 3px;
    padding: 13px 14px;
  }
  .list-row .cell { grid-column: 1; white-space: normal; }
  .list-row .cell-primary { font-size: 15px; }
  .list-row .cell-num { text-align: left; font-size: 13px; color: var(--ink-2); }
  .cell .cell-label { display: inline; color: var(--ink-3); font-size: 12.5px; margin-right: 5px; }
  .list-row .row-actions {
    grid-column: 2;
    grid-row: 1 / span 9;
    align-self: center;
    opacity: 1;
    flex-direction: column;
  }
  .cell-hide-m { display: none !important; }
}

@media (min-width: 768px) {
  .action-sheet { display: none; }
}

/* ---------- Hareket azaltma ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .view { scroll-behavior: auto; }
}


/* ============================================================
   SteelStep 2.0 — UI/UX Pro Max tema katmanı
   (design-system/steelstep/MASTER.md: lacivert admin paneli,
   Fira Sans + rakamlarda Fira Code, belirgin odak durumları)
   ============================================================ */

/* Rakamsal değerler teknik/mono yazıyla (dashboard hassasiyeti) */
[style*="tabular-nums"],
.cell-num,
.seg-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.seg-value { font-size: 13px; }

/* Başlıklar: Fira Sans yoğun kesim */
.large-title { font-weight: 700; letter-spacing: -0.03em; }

/* Lacivert kenar çubuğu — tüm sayfaların ortak kimliği */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(148, 163, 184, 0.14);
}
.sidebar .brand-name { color: #F8FAFC; }
.sidebar .brand-sub { color: var(--sidebar-muted); }
.sidebar .brand-mark { color: #38BDF8; }
.sidebar .nav-sec { color: var(--sidebar-muted); }
.sidebar .nav-item { color: var(--sidebar-ink); }
.sidebar .nav-item:hover { background: var(--sidebar-hover); }
.sidebar .nav-item.active {
  background: var(--sidebar-active);
  color: #F8FAFC;
}
.sidebar .db-status { color: var(--sidebar-muted); }

/* Belirgin klavye odakları (erişilebilirlik kontrol listesi) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible { outline-offset: 0; }

/* Tablolar: başlıklar slate, satır ayrımı net */
.list-head > div {
  color: var(--ink-3);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 11px;
}

/* Kart/segment yüzeyleri: ince slate çerçeve, yumuşak gölge */
.stat-card,
.seg,
.check-list { border-color: var(--hairline); }

/* Butonlar: CTA mavisi, yumuşak geçiş */
.btn { transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s var(--ease); }
.btn-primary { box-shadow: 0 1px 2px rgba(3, 105, 161, 0.35); }
[data-theme="dark"] .btn-primary { box-shadow: 0 1px 2px rgba(14, 165, 233, 0.35); }

/* Hareket azaltma tercihi */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


/* Detay tabloları — KLASİK TAM TABLO: başlık şeridi, hücre ayırım
   çizgileri (dikey + yatay), çerçeve, hafif zebra, sağa hizalı rakamlar */
.dtable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  font-size: 13.5px;
}
.dtable th {
  background: var(--fill);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.dtable td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
.dtable th + th,
.dtable td + td { border-left: 1px solid var(--hairline); }
.dtable tbody tr:last-child td { border-bottom: none; }
.dtable tbody tr:nth-child(even):not(.total) td {
  background: color-mix(in srgb, var(--fill) 45%, transparent);
}
.dtable th.num,
.dtable td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dtable tr.total td {
  background: var(--fill);
  font-weight: 700;
  border-top: 1px solid var(--hairline);
}
