:root {
  --navy: #16215c;
  --navy-dark: #0c1436;
  --navy-mid: #1c2a6b;
  --blue: #2f5fd6;
  --blue-dark: #23439c;
  --blue-bright: #4d7bff;
  --blue-light: #eef2fd;
  --accent: #f59e0b;
  --accent-dark: #b9740a;
  --text: #1c2333;
  --text-muted: #5b6577;
  --border: #e2e6ef;
  --bg: #f3f5fb;
  --white: #ffffff;
  --danger: #d0342c;
  --danger-bg: #fdeceb;
  --success: #1f8a4c;
  --success-bg: #e9f8ef;
  --warn: #b8790a;
  --warn-bg: #fdf3e0;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 64, 0.05), 0 6px 20px rgba(16, 24, 64, 0.07);
  --shadow-lg: 0 10px 30px rgba(16, 24, 64, 0.14);
  --font: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

button { font-family: inherit; }

::selection { background: var(--blue); color: #fff; }

/* ---------------- Header / Nav ---------------- */

.app-header {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-mid) 55%, var(--navy) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 4px 18px rgba(10, 16, 48, 0.25);
}

.app-header__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  max-width: 1240px;
  margin: 0 auto;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.brand-mark {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.35));
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
}

.brand-text__name {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text__tagline {
  font-size: 0.72rem;
  font-weight: 500;
  color: #aab4e6;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

a.app-header__cta {
  display: none;
  align-items: center;
  gap: 6px;
}

.menu-toggle {
  background: transparent;
  border: none;
  width: 34px;
  height: 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.15s, opacity 0.15s;
}

.app-nav {
  display: none;
  flex-direction: column;
  background: rgba(9, 14, 40, 0.65);
  backdrop-filter: blur(6px);
  padding: 4px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.app-nav.open { display: flex; }

.app-nav a {
  padding: 13px 20px;
  font-size: 0.95rem;
  color: #cdd5f0;
  border-left: 3px solid transparent;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}

.app-nav a:hover { color: #fff; background: rgba(255,255,255,0.05); }

.app-nav a.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-left-color: var(--accent);
  font-weight: 700;
}

.nav-cikis-btn {
  background: transparent;
  border: none;
  color: #cdd5f0;
  padding: 13px 20px;
  font-size: 0.92rem;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 0.12s;
}

.nav-cikis-btn:hover { color: #fff; }

@media (min-width: 800px) {
  .app-header__bar { padding: 14px 24px; }
  .brand-text__name { font-size: 1.18rem; }
  a.app-header__cta { display: inline-flex; }
  .menu-toggle { display: none; }
  .app-nav {
    display: flex;
    flex-direction: row;
    background: rgba(9, 14, 40, 0.55);
    backdrop-filter: blur(6px);
    padding: 0 24px;
    max-width: 1240px;
    margin: 0 auto;
    border-top: 1px solid rgba(255,255,255,0.06);
  }
  .app-nav a { padding: 11px 16px; border-left: none; border-bottom: 3px solid transparent; }
  .app-nav a.active { border-left: none; border-bottom-color: var(--accent); }
  .nav-cikis-btn { margin-left: auto; padding: 11px 16px; }
}

/* ---------------- Layout ---------------- */

.app-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px;
}

@media (min-width: 800px) {
  .app-main { padding: 30px 24px 40px; }
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  margin: 4px 0 18px;
  letter-spacing: -0.01em;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 20px;
  transition: box-shadow 0.15s;
}

.card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfcff, #ffffff);
}

.card__header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--navy);
  font-weight: 700;
  letter-spacing: -0.005em;
}

.card__body {
  padding: 20px;
}

/* ---------------- Dashboard stat cards ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

@media (min-width: 700px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--blue);
}

.stat-card__icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card__icon svg { width: 20px; height: 20px; }

.stat-card__text { min-width: 0; }

.stat-card__label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card__value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--navy);
  margin-top: 1px;
  letter-spacing: -0.02em;
}

.stat-card--islemde::before { background: var(--blue); }
.stat-card--islemde .stat-card__icon { background: var(--blue-light); color: var(--blue-dark); }
.stat-card--tamamlandi::before { background: var(--success); }
.stat-card--tamamlandi .stat-card__icon { background: var(--success-bg); color: var(--success); }

/* ---------------- Forms ---------------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 700px) {
  .form-grid--2col { grid-template-columns: 1fr 1fr; }
}

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

.field label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--navy);
}

.field label .req { color: var(--danger); margin-left: 2px; }

.field .hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="search"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea { resize: vertical; min-height: 90px; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 95, 214, 0.13);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 560px) {
  .radio-group--row { flex-direction: row; flex-wrap: wrap; gap: 10px; }
}

label.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

label.radio-option:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-light);
}

.radio-option input { width: 17px; height: 17px; accent-color: var(--blue); }

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 22px 0;
}

.section-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 4px;
}

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s, filter 0.15s;
}

.btn:active { transform: translateY(1px); }

.btn--primary { background: linear-gradient(135deg, var(--blue-bright), var(--blue-dark)); color: #fff; box-shadow: 0 2px 10px rgba(47, 95, 214, 0.3); }
.btn--primary:hover { filter: brightness(1.06); box-shadow: 0 4px 14px rgba(47, 95, 214, 0.4); }

.btn--accent { background: linear-gradient(135deg, var(--blue-bright), var(--blue)); color: #fff; box-shadow: 0 2px 10px rgba(47, 95, 214, 0.3); }
.btn--accent:hover { filter: brightness(1.06); box-shadow: 0 4px 14px rgba(47, 95, 214, 0.4); }

.btn--ghost { background: var(--white); color: var(--navy); border-color: var(--border); }
.btn--ghost:hover { background: var(--blue-light); border-color: var(--blue); }

.btn--danger { background: var(--danger-bg); color: var(--danger); border-color: #f2c6c3; }
.btn--danger:hover { background: #f9dcda; }

.btn--block { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 0.85rem; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

/* ---------------- Filter bar ---------------- */

.filter-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 700px) {
  .filter-bar { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; }
}

/* ---------------- Kayit list ---------------- */

.kayit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kayit-row {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 0.15s, transform 0.15s;
}

.kayit-row:active { transform: scale(0.995); }

.kayit-row__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.kayit-row__kartno {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--navy);
}

.kayit-row__meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.kayit-row__actions {
  margin-top: 4px;
}

@media (min-width: 800px) {
  .kayit-list--table {
    display: block;
  }
  table.kayit-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
  }
  table.kayit-table th {
    text-align: left;
    background: var(--blue-light);
    color: var(--blue-dark);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
  }
  table.kayit-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    vertical-align: middle;
  }
  table.kayit-table tr:last-child td { border-bottom: none; }
  table.kayit-table tr:hover td { background: #f7f9ff; }
}

/* ---------------- Status badge ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

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

.badge--islemde { background: var(--blue-light); color: var(--blue-dark); }
.badge--tamamlandi { background: var(--success-bg); color: var(--success); }

/* ---------------- Ayarlar (settings) ---------------- */

.ref-manager {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.ref-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.ref-add-form input { flex: 1; min-width: 120px; }

.ref-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ref-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  transition: border-color 0.15s;
}

.ref-item:hover { border-color: #c9d2e8; }

.ref-item__meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: #eceff3;
  color: #8a93a6;
  margin-right: 6px;
  letter-spacing: 0.01em;
}

.mini-badge--on {
  background: var(--success-bg);
  color: var(--success);
}

.tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tabs button {
  background: transparent;
  border: none;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color 0.12s;
}

.tabs button:hover { color: var(--navy); }

.tabs button.active {
  color: var(--blue-dark);
  border-bottom-color: var(--blue);
}

/* ---------------- Misc ---------------- */

.empty-state {
  text-align: center;
  padding: 44px 16px;
  color: var(--text-muted);
}

.loading {
  text-align: center;
  padding: 44px 16px;
  color: var(--text-muted);
}

.loading::after {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: 12px auto 0;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-banner {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f2c6c3;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.breadcrumb a { color: var(--blue-dark); font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: 90vw;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.toast--error { background: var(--danger); }
.toast.toast--success { background: var(--success); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 24px;
}

@media (min-width: 700px) {
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

.detail-item__label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
}

.detail-item__value {
  font-size: 0.98rem;
  color: var(--text);
  margin-top: 2px;
  font-weight: 500;
}

/* ---------------- Barkod / Karekod onizleme ---------------- */

.etiket-onizleme {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 260px;
  margin: 0 auto;
  padding: 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcff;
}

.etiket-onizleme__barkod {
  width: 100%;
}

.etiket-onizleme__barkod svg {
  width: 100%;
  height: auto;
  display: block;
}

.etiket-onizleme__satir {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  width: 100%;
}

.etiket-onizleme__karekod {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
}

.etiket-onizleme__karekod svg {
  width: 100%;
  height: 100%;
  display: block;
}

.etiket-onizleme__bilgi {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.etiket-onizleme__firma {
  font-weight: 700;
  color: var(--navy);
}

/* ---------------- Giris ekrani ---------------- */

body.giris-modu .app-header__cta,
body.giris-modu .menu-toggle,
body.giris-modu .app-nav {
  display: none !important;
}

body.giris-modu .app-main {
  padding: 0;
}

.login-wrap {
  min-height: calc(100vh - 66px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at 20% 15%, rgba(47, 95, 214, 0.10), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(245, 158, 11, 0.08), transparent 40%);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}

.login-brand .brand-mark {
  width: 84px;
  height: 84px;
}

.login-brand .brand-mark img {
  filter: drop-shadow(0 3px 10px rgba(22, 33, 92, 0.25));
}

.login-brand__name {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.login-brand__tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.login-card {
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}

.login-card .card__header {
  text-align: center;
  background: var(--white);
}

.login-card .card__header h2 {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 600;
}
