/*
 * Uygulamanın ortak stil dosyası.
 *
 * Renkler ve ölçüler Faz 0'da onaylanan taslaktan alındı (PROJE_GUNLUGU.md, Bölüm 7.1).
 * Sıkı CSP nedeniyle HTML içinde style="..." kullanılamaz; bütün stiller bu dosyada durur.
 */

/* --- Tasarım değişkenleri (renk, ölçü, yazı tipi) --- */
:root {
  --color-primary: #1F7A4D;
  --color-primary-dark: #165C39;
  --color-bg: #F6F7F4;
  --color-surface: #FFFFFF;
  --color-text: #16201A;
  --color-text-soft: #3A4540;
  --color-text-muted: #5B665F;
  --color-border: #DDE2DE;
  --color-border-strong: #C9D0CB;
  --color-warning-text: #8A5300;
  --color-warning-bg: #FFF1D6;
  --color-danger-text: #A3221B;
  --color-danger-bg: #FDE7E5;
  --color-focus: #1D5FA8;

  --radius-md: 12px;
  --radius-lg: 16px;
  /* Dokunma alanlarının en küçük boyutu (Bölüm 7, madde 3). */
  --tap-min: 44px;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

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

/* "hidden" özelliği, display kuralları olan öğelerde de her zaman gizlesin. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
}

/* Klavyeyle gezinirken odaklanılan öğe belirgin olsun. */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: var(--color-primary);
  font-weight: 600;
}

a:hover {
  color: var(--color-primary-dark);
}

.text-muted {
  color: var(--color-text-muted);
}

.small {
  font-size: 14px;
}

/* --- Yerleşim --- */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 48px 16px;
}

/* Giriş, kayıt ve benzeri ekranların dikey düzeni. */
.auth {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.auth-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --- Bileşenler --- */
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--color-primary);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap-min);
  align-self: flex-start;
  text-decoration: none;
}

/* Bilgi ekranlarındaki yuvarlak simge (ör. "hesap aktif değil"). */
.status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
}

.status-icon-warning {
  color: var(--color-warning-text);
  background: var(--color-warning-bg);
}

/* Django mesajları (ör. "çıkış yapıldı"). */
.messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.message {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
}

/* İşlem yapılamadığında (ör. geçersiz kritik seviye) mesaj kırmızı; yeşil "oldu" sanılmasın. */
.message.message-error {
  color: var(--color-danger-text);
  background: var(--color-danger-bg);
}

/* --- Formlar --- */
.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 15px;
  font-weight: 600;
}

/* Yazı boyutu en az 16 px: iOS Safari daha küçük kutulara dokununca sayfayı yakınlaştırıyor. */
.field input,
.field select {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 17px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-md);
}

.field input[aria-invalid="true"] {
  border-color: var(--color-danger-text);
}

/* Davet kodu kutusu: eşit genişlikli harfler, büyük harf. */
.field input.input-code {
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-hint {
  font-size: 14px;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.field-hint.is-ok {
  font-weight: 600;
  color: var(--color-primary);
}

.field-error p,
.form-errors p {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-danger-text);
}

.form-errors {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-danger-bg);
}

/* Şifre kutusu ve içindeki göster/gizle düğmesi. */
.password-input {
  position: relative;
}

.field .password-input input {
  padding-right: 56px;
}

.password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: var(--color-text-muted);
  background: transparent;
  cursor: pointer;
}

/* --- Düğmeler --- */
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  color: #FFFFFF;
  background: var(--color-primary);
}

.button-primary:hover {
  color: #FFFFFF;
  background: var(--color-primary-dark);
}

.button-secondary {
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-strong);
}

.button-secondary:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

/* --- "Telefonuna uygulama olarak ekle" rehberi --- */
.install-guide {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

/* "Uygulamayı yükle" düğmesi rehberin üstünde; betik tarayıcı izin verirse gösterir. */
.install-guide .install-button {
  width: calc(100% - 32px);
  margin: 16px 16px 4px;
}

/* Uygulama zaten kurulu olarak açıldıysa (ana ekrandaki simgeden) rehbere gerek yok. */
@media (display-mode: standalone) {
  .install-guide {
    display: none;
  }
}

.install-guide summary {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
}

.install-guide-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px 16px;
  font-size: 14px;
  color: var(--color-text-soft);
}

/* --- Girişin 2. adımı (iki adımlı doğrulama, K-046) --- */
.step-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
}

/* Doğrulama kodu kutusu: büyük, ortalı, eşit genişlikli rakamlar. */
.field input.input-otp {
  height: 60px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.other-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.other-methods-title {
  font-size: 15px;
  color: var(--color-text-muted);
}

/* Bir cümlenin içindeki düğme bağlantı gibi görünür (ör. "çıkış yap"). */
.link-button {
  display: inline;
  padding: 0;
  border: 0;
  font: inherit;
  font-weight: 650;
  color: var(--color-primary);
  text-decoration: underline;
  background: none;
  cursor: pointer;
}

/* --- İki adımlı doğrulama sayfaları (K-046, K-047) --- */
.warning-note {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--color-warning-text);
  background: var(--color-warning-bg);
}

.card.security-section {
  gap: 14px;
  padding: 18px;
}

.security-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.security-section-head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-pill {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--color-text-muted);
  background: #EEF1EF;
}

.status-pill-on {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
}

.method-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.method-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #EEF1EF;
}

.method-row-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.method-row-name {
  font-weight: 650;
}

.row-link-danger {
  color: var(--color-danger-text);
}

.row-link-danger:hover {
  color: var(--color-danger-text);
}

.button-danger {
  color: #FFFFFF;
  background: var(--color-danger-text);
}

.button-danger:hover {
  color: #FFFFFF;
  background: #82190F;
}

/* Kurulum adımları: numaralı liste. */
.steps {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin: 0;
  padding-left: 22px;
}

/* Liste öğesi "list-item" kalmalı; esnek düzen (flex) verilirse adım numarası çizilmez. */
.steps li > * + * {
  margin-top: 10px;
}

.steps li::marker {
  font-weight: 700;
  color: var(--color-primary);
}

.step-heading {
  font-weight: 650;
}

/* QR kod: telefon kamerasının kolay okuması için beyaz zeminde ve kenar boşluklu. */
.qr {
  align-self: flex-start;
  padding: 12px;
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.qr svg {
  display: block;
  width: 200px;
  height: 200px;
}

.manual-key summary {
  min-height: var(--tap-min);
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
}

.secret-key,
.recovery-codes {
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 0.06em;
}

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 16px;
  list-style: none;
  text-align: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

/* ===========================================================================================
 * Platform yöneticisi paneli (K-045, Faz 0 taslakları)
 * Geniş ekranda solda menü; telefonda menü üstte, içerik altta.
 * =========================================================================================== */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.panel-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.panel-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.panel-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-primary);
}

.panel-brand-text {
  display: flex;
  flex-direction: column;
}

.panel-brand-name {
  font-weight: 700;
}

.panel-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.panel-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--tap-min);
  padding: 0 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-soft);
  text-decoration: none;
}

.panel-nav-link:hover {
  color: var(--color-text);
  background: #F3F5F3;
}

.panel-nav-link[aria-current="page"] {
  font-weight: 700;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
}

.count-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-warning-text);
  background: var(--color-warning-bg);
}

.panel-account {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px 0;
  border-top: 1px solid #EEF1EF;
}

.panel-account-name {
  font-weight: 650;
}

.panel-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  min-width: 0;
  max-width: 1180px;
  padding: 24px 16px 48px;
}

@media (min-width: 900px) {
  .panel {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .panel-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--color-border);
    border-bottom: 0;
  }

  .panel-nav {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .panel-account {
    margin-top: auto;
  }

  .panel-main {
    padding: 32px;
  }
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-header > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.tile-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.tile-value {
  font-size: 30px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.panel-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 16px;
}

.panel-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.panel-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.panel-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.panel-list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid #EEF1EF;
}

.panel-list-text {
  display: flex;
  flex: 1 1 180px;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.panel-list-title {
  font-size: 16px;
  font-weight: 650;
}

/* Geniş tablolar telefonda kendi kutusunda yatay kayar; sayfa kaymaz. "relative": tablodaki
   ekran okuyucu metinleri (.visually-hidden, position: absolute) bu kutuya göre konumlansın;
   yoksa kutunun dışına taşıp sayfayı yana kaydırıyorlar. */
.table-scroll {
  position: relative;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 15px;
}

.data-table th {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.data-table td {
  padding: 10px 12px;
  vertical-align: middle;
  border-bottom: 1px solid #EEF1EF;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 0;
}

.nowrap {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
  font-size: 14px;
}

.strong {
  font-weight: 650;
}

/* Üyelik durumu rozeti. */
.state-badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--color-text-muted);
  background: #EEF1EF;
}

.state-badge-pending {
  color: var(--color-warning-text);
  background: var(--color-warning-bg);
}

.state-badge-active {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
}

.state-badge-rejected {
  color: var(--color-danger-text);
  background: var(--color-danger-bg);
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button-text-danger {
  color: var(--color-danger-text);
}

.button-text-danger:hover {
  color: var(--color-danger-text);
}

.panel-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-filters .chips {
  margin: 0;
  padding: 0;
}

.search-form.panel-search {
  flex: 0 1 320px;
  margin-bottom: 0;
}

.code-reveal {
  align-items: flex-start;
  max-width: 560px;
}

.code-reveal-code {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* Sayfa başlığının yanındaki ve formların altındaki düğmeler: tam genişlikte değil. */
.button.button-inline {
  gap: 8px;
  width: auto;
  min-height: 46px;
  padding: 0 18px;
  font-size: 15px;
}

.action-group.action-group-start {
  justify-content: flex-start;
}

/* Açık form kartı (ör. "Yeni kurum") ana renkli kenarlıkla öne çıkar. */
.panel-card.panel-card-highlight {
  border: 1.5px solid var(--color-primary);
}

/* Yan yana form alanları; dar ekranda alt alta. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 14px;
}

/* --- Kurumlar --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 16px;
}

/* Kurum kartındaki üç küçük sayı. Ekran okuyucu etiketi önce okusun diye dt önce yazılıyor,
   ekranda sayı üstte görünüyor. */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.mini-stats div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.mini-stats dt {
  font-size: 13px;
  color: var(--color-text-muted);
}

.mini-stats dd {
  margin: 0;
  font-size: 22px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

/* --- Davet kodları --- */
.code-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1.5px solid var(--color-primary);
  border-radius: 14px;
  background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface));
}

.code-box-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

/* 16 karakterlik kod telefonda tek satıra sığsın; çok dar ekranda taşmak yerine bölünür. */
.code-box .code-reveal-code {
  font-size: clamp(18px, 5vw, 30px);
  overflow-wrap: anywhere;
}

.state-badge-used {
  color: var(--color-text-soft);
}

.state-badge-revoked {
  color: var(--color-danger-text);
  background: var(--color-danger-bg);
}

/* --- Ürün kataloğu --- */
/* Geniş ekranda liste solda, form sağda (Faz 0 taslağı); dar ekranda alt alta. */
.catalog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

@media (min-width: 1200px) {
  .catalog-layout {
    grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr);
  }
}

.data-table.data-table-compact {
  min-width: 560px;
}

/* Kartın içindeki arama kutusu. Kart dikey esnek düzende olduğu için panel aramasının
   "flex: 0 1 320px" kuralı burada yüksekliğe uygulanırdı; sıfırlanır. */
.search-form.catalog-search {
  flex: none;
  max-width: 420px;
}

.unit-pill {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-soft);
  background: #EEF1EF;
}

/* Çerçevesiz alan grubu (ör. "Stok birimi", "Kurumlara aç"). */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-group-label {
  padding: 0;
  font-size: 15px;
  font-weight: 600;
}

.unit-switch.unit-switch-wide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.package-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.package-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  align-items: start;
  gap: 8px;
}

/* "Personelin göreceği" önizlemesi (betik doldurur). */
.preview-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.lock-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.lock-note svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.openings {
  padding-top: 14px;
  border-top: 1px solid #EEF1EF;
}

.open-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.open-row .checkbox-label {
  flex: 1 1 180px;
}

.open-row .field-error {
  flex-basis: 100%;
}

.critical-input,
.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.critical-input label {
  font-size: 14px;
  color: var(--color-text-soft);
}

/* Küçük sayı kutusu (kritik seviye). Yazı 16 px: iOS Safari daha küçüğünde yakınlaştırıyor. */
.input-small {
  width: 88px;
  height: var(--tap-min);
  padding: 0 10px;
  font-family: inherit;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-strong);
  border-radius: 10px;
}

.input-small[aria-invalid="true"] {
  border-color: var(--color-danger-text);
}

/* --- Denetim kaydı --- */
.audit-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.audit-filters .chips {
  margin: 0;
  padding: 0 0 4px;
}

.audit-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.audit-filter-form .field select {
  width: auto;
  min-width: 180px;
  height: 46px;
}

.data-table.data-table-wide {
  min-width: 900px;
}

/* Olayın kategorisi: renk, her zaman yazıyla birlikte (Bölüm 7, madde 5). */
.category-pill {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--color-text-soft);
  background: #EEF1EF;
}

.category-pill-account {
  color: #1D4F8C;
  background: #E6EEF8;
}

.category-pill-security {
  color: var(--color-warning-text);
  background: var(--color-warning-bg);
}

.category-pill-admin {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
}

/* --- Ekran okuyucuya açık, ekranda gizli --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ===========================================================================================
 * Giriş yapmış kullanıcının ekranları (Faz 2, Faz 0 taslakları)
 * =========================================================================================== */

/* --- Sayfa iskeleti: içerik ve ana menü --- */
.app {
  min-height: 100vh;
}

.app-main {
  max-width: 560px;
  margin: 0 auto;
  /* Alttaki menü içeriğin üstüne binmesin diye altta boşluk bırakılır. */
  padding: 20px 16px calc(104px + env(safe-area-inset-bottom));
}

h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

/* Telefonda altta sabit menü (Bölüm 7, madde 1). */
.app-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  padding: 0 6px calc(6px + env(safe-area-inset-bottom));
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

/* Görüntüleyicide "İşlem" sekmesi olmadığı için 4 sütun. */
.app-nav-no-action {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.app-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
}

.app-nav-link:hover {
  color: var(--color-text);
}

.app-nav-link[aria-current="page"] {
  font-weight: 700;
  color: var(--color-primary);
}

.app-nav-action {
  color: var(--color-text);
}

.app-nav-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-top: -18px;
  border-radius: 50%;
  color: #FFFFFF;
  background: var(--color-primary);
}

/* Geniş ekranda menü solda (Bölüm 7, madde 1). Menüsüz ekranlar (stok işlemi) ortalanır. */
@media (min-width: 960px) {
  .app:has(> .app-nav) {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .app-nav {
    position: sticky;
    top: 0;
    grid-row: 1;
    grid-column: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    height: 100vh;
    padding: 24px 12px;
    border-top: 0;
    border-right: 1px solid var(--color-border);
  }

  .app-main {
    grid-row: 1;
    grid-column: 2;
    width: 100%;
    max-width: 720px;
    padding: 32px 24px 48px;
  }

  .app-nav-link {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: 48px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    font-size: 15px;
  }

  .app-nav-link[aria-current="page"] {
    background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  }

  .app-nav-action-icon {
    width: 28px;
    height: 28px;
    margin-top: 0;
  }
}

/* --- Ekran başlıkları --- */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.screen-header-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.screen-header h1 {
  font-size: 26px;
}

.screen-kicker {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.role-pill {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
}

/* Tek işe odaklı ekranların üst çubuğu: kapat düğmesi ve başlık. */
.task-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: -8px -8px 12px;
}

.task-header .task-title {
  font-size: 20px;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  border-radius: 10px;
  color: var(--color-text);
}

.icon-button:hover {
  color: var(--color-text);
  background: #EEF1EF;
}

/* --- Bölümler --- */
.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-link,
.row-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.row-link {
  padding: 0 4px;
  font-size: 14px;
}

.step-title {
  margin: 4px 0 12px;
}

.day-label {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* --- Özet: hızlı işlem düğmeleri ve günlük sayılar --- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 100px;
  font-size: 15px;
  font-weight: 650;
  color: var(--color-text);
  text-decoration: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.quick-action:hover {
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.quick-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
}

.quick-action-icon-warning {
  color: var(--color-warning-text);
  background: var(--color-warning-bg);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 14px;
  color: var(--color-text-muted);
}

/* --- Listeler --- */
.list-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid #EEF1EF;
}

.list-row:last-child,
.movement-row:last-child {
  border-bottom: 0;
}

.list-row:hover {
  color: var(--color-text);
  background: #FAFBF9;
}

.list-row-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.list-row-title {
  font-size: 16px;
  font-weight: 650;
}

.list-row-meta {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-text-muted);
}

.list-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
}

/* Miktarlarda rakamlar aynı genişlikte; alt alta düzgün hizalanır. */
.quantity {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.category-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--color-text-soft);
  background: #EEF1EF;
}

/* Stok durumu rozeti: renk, simge ve yazı birlikte (Bölüm 7, madde 5). */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge-low {
  color: var(--color-warning-text);
  background: var(--color-warning-bg);
}

.status-badge-out {
  color: var(--color-danger-text);
  background: var(--color-danger-bg);
}

/* Hareket satırı ve türünün etiketi. */
.movement-row {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #EEF1EF;
}

.movement-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.movement-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.movement-product {
  font-size: 15px;
  font-weight: 650;
}

.movement-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.kind-pill {
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-soft);
  background: #EEF1EF;
}

.kind-pill-receive {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
}

.kind-pill-waste {
  color: var(--color-warning-text);
  background: var(--color-warning-bg);
}

.kind-pill-correction {
  color: #1D4F8C;
  background: #E6EEF8;
}

/* Boş liste ve bilgi notları (Bölüm 7, madde 8). */
.empty-note {
  padding: 14px 16px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 16px;
  text-align: center;
}

.empty-state-title {
  font-size: 17px;
  font-weight: 650;
}

.info-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 2px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.info-note svg {
  flex-shrink: 0;
  margin-top: 2px;
}

/* --- Arama ve süzgeçler --- */
.search-form {
  position: relative;
  margin-bottom: 12px;
}

.search-form input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 44px;
  font-family: inherit;
  font-size: 17px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  appearance: none;
}

.search-icon {
  position: absolute;
  top: 16px;
  left: 14px;
  color: var(--color-text-muted);
  pointer-events: none;
}

/* Yatay kayan süzgeç düğmeleri; ekranın iki kenarına kadar uzanır. */
.chips {
  position: relative;
  display: flex;
  gap: 8px;
  margin: 0 -16px 12px;
  padding: 0 16px 4px;
  overflow-x: auto;
}

.chip {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
  color: var(--color-text);
  text-decoration: none;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-strong);
}

.chip:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.chip[aria-current="true"] {
  color: #FFFFFF;
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap-min);
  font-size: 15px;
  cursor: pointer;
}

.checkbox-label input {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
}

.button.button-small {
  width: auto;
  min-height: var(--tap-min);
  padding: 0 16px;
  font-size: 15px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.pagination .button {
  width: auto;
  min-height: var(--tap-min);
  font-size: 15px;
}

/* --- Ürün detayı --- */
.product-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 20px;
}

.product-header .category-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.product-header-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.product-header-text h1 {
  font-size: 26px;
}

.stock-card {
  gap: 14px;
  padding: 18px;
}

.stock-card-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.stock-card-amount {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.stock-amount {
  font-size: 36px;
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* Kritik seviye çubuğu. CSP nedeniyle genişlik style="..." ile verilemez; sınıflarla verilir. */
.level-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: #EEF1EF;
}

.level-bar-fill {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--color-primary);
}

.level-bar-low .level-bar-fill {
  background: #C98A1E;
}

.level-bar-out .level-bar-fill {
  background: var(--color-danger-text);
}

.bar-0 { width: 0; }
.bar-10 { width: 10%; }
.bar-20 { width: 20%; }
.bar-30 { width: 30%; }
.bar-40 { width: 40%; }
.bar-50 { width: 50%; }
.bar-60 { width: 60%; }
.bar-70 { width: 70%; }
.bar-80 { width: 80%; }
.bar-90 { width: 90%; }
.bar-100 { width: 100%; }

.button-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.button-pair .button {
  min-height: 50px;
  font-size: 16px;
}

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- Stok işlemi --- */
.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 14px;
  background: #E7EBE8;
}

.segment {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 650;
  color: var(--color-text-soft);
  text-decoration: none;
}

.segment:hover {
  color: var(--color-text);
}

.segment[aria-current="true"] {
  color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(22, 32, 26, 0.12);
}

.card.product-card {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 14px;
}

.product-card .category-icon {
  width: 44px;
  height: 44px;
}

.product-card-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.product-card-name {
  font-size: 17px;
  font-weight: 700;
}

.movement-form {
  gap: 20px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* kg / g seçimi: gerçek radyo düğmeleri; görünüşü bölmeli düğme. */
.unit-switch {
  display: flex;
  gap: 3px;
  margin: 0;
  padding: 3px;
  border: 0;
  border-radius: 10px;
  background: #E7EBE8;
}

.unit-option {
  position: relative;
}

.unit-option input {
  position: absolute;
  opacity: 0;
}

.unit-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: var(--tap-min);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 650;
  color: var(--color-text-soft);
  cursor: pointer;
}

.unit-option input:checked + span {
  color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(22, 32, 26, 0.12);
}

.unit-option input:focus-visible + span {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.quantity-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stepper {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-strong);
  cursor: pointer;
}

.stepper-plus {
  color: #FFFFFF;
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.quantity-box {
  position: relative;
  flex: 1;
}

.field .input-quantity {
  height: 60px;
  padding: 0 56px 0 16px;
  border-radius: var(--radius-lg);
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.quantity-unit {
  position: absolute;
  top: 50%;
  right: 16px;
  font-size: 18px;
  font-weight: 650;
  color: var(--color-text-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.quick-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-value {
  min-height: var(--tap-min);
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-strong);
  cursor: pointer;
}

.alert-error {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--color-danger-text);
  background: var(--color-danger-bg);
}

/* İşlemden sonraki stoğun önizlemesi (betik doldurur). */
.preview {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-soft);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.preview.is-error {
  font-weight: 600;
  color: var(--color-danger-text);
  background: var(--color-danger-bg);
  border-color: transparent;
}

.field textarea {
  width: 100%;
  min-height: 76px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.4;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  resize: vertical;
}

/* Kaydet düğmesi ekranın altında sabit kalır (Faz 0 taslağı). */
.form-footer {
  position: sticky;
  bottom: 0;
  margin: 0 -16px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
}

.button:disabled {
  color: var(--color-text-soft);
  background: var(--color-border-strong);
  cursor: not-allowed;
}

/* İşlemden sonraki "Kaydedildi" ekranı. */
.done {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 24px;
}

.done-text {
  font-size: 17px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-soft);
}

.status-icon-success {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 14%, var(--color-surface));
}

.card.correction-card {
  gap: 8px;
  margin-bottom: 20px;
  padding: 16px;
}

.correction-recorded {
  font-size: 16px;
}

/* --- Açık oturumlar (Hesabım ve Güvenlik ayarlarım, K-048) --- */
.session-icon {
  display: flex;
  flex-shrink: 0;
  color: var(--color-text-soft);
}

.security-sessions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- Hesabım --- */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

.info-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.info-list dt {
  color: var(--color-text-muted);
}

.info-list dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.account-note {
  margin: 16px 0;
}
