:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #e5e7eb;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #15803d;
  --shadow: 0 24px 60px rgba(15, 23, 42, .08);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mobile-only { display: none; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, .24), transparent 34%),
    linear-gradient(135deg, #f8fafc 0%, #e9f7f5 100%);
}
.login-card {
  width: min(460px, 100%);
  padding: 32px;
  border-radius: 28px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .7);
}
.brand-block, .sidebar-brand {
  display: flex;
  gap: 14px;
  align-items: center;
}
.brand-logo, .sidebar-brand img { width: 54px; height: 54px; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: .08em;
  font-size: 12px;
  text-transform: uppercase;
}
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: clamp(30px, 5vw, 42px); }
h2 { font-size: 28px; }
h3 { font-size: 18px; }
.login-form { margin-top: 30px; display: grid; gap: 16px; }
label { display: grid; gap: 8px; font-weight: 700; color: #344054; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(15, 118, 110, .65);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .12);
}
textarea { resize: vertical; }
.checkline { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.checkline input { width: auto; }
.hint, .muted { color: var(--muted); margin: 0; line-height: 1.55; }
.form-error { margin: 0; color: var(--danger); min-height: 18px; font-weight: 700; }

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--primary); color: white; box-shadow: 0 12px 26px rgba(15, 118, 110, .22); }
.btn.primary:hover { background: var(--primary-strong); }
.btn.ghost { background: #eef6f5; color: var(--primary-strong); }
.btn.danger-light { background: #fef2f2; color: var(--danger); }
.btn.full { width: 100%; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 280px;
  background: #0f172a;
  color: white;
  padding: 22px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand span { display: block; color: #94a3b8; font-size: 13px; margin-top: 2px; }
.nav-list { display: grid; gap: 8px; margin-top: 28px; }
.nav-btn {
  text-align: left;
  border: 0;
  color: #cbd5e1;
  background: transparent;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
}
.nav-btn:hover, .nav-btn.active { color: white; background: rgba(255, 255, 255, .1); }
.sidebar-footer { margin-top: auto; display: grid; gap: 10px; }
.sidebar-footer .btn { width: 100%; }

.main-area { flex: 1; min-width: 0; padding: 24px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar input { min-width: min(420px, 40vw); }
.view { display: none; }
.active-view { display: block; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.stat-card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px rgba(15, 23, 42, .05);
}
.stat-card { padding: 22px; }
.stat-card span { color: var(--muted); font-weight: 700; }
.stat-card strong { display: block; margin-top: 12px; font-size: 34px; }
.stat-card.warning strong { color: var(--warning); }
.stat-card.success strong { color: var(--success); }
.grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.panel { padding: 22px; }
.panel-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.panel-head span { color: var(--muted); }
.panel-head.between { flex-direction: row; justify-content: space-between; align-items: center; gap: 16px; }
.summary-list, .alert-list { display: grid; gap: 12px; }
.summary-item, .alert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.summary-item strong, .alert-item strong { font-size: 18px; }
.alert-item.danger { border-color: #fecaca; background: #fff7f7; }
.alert-item.warning { border-color: #fed7aa; background: #fffbeb; }

.table-actions { display: flex; gap: 12px; margin-bottom: 14px; }
.table-actions select { max-width: 240px; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f8fafc; font-size: 13px; color: #475467; text-transform: uppercase; letter-spacing: .04em; }
td { font-size: 14px; }
tr.low-stock td { background: #fffbeb; }
tr.empty-stock td { background: #fef2f2; }
.action-cell { display: flex; gap: 8px; }
.badge { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-weight: 800; font-size: 12px; }
.badge.ok { color: var(--success); background: #dcfce7; }
.badge.low { color: var(--warning); background: #fef3c7; }
.badge.empty { color: var(--danger); background: #fee2e2; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 12px; }
.spaced { margin-top: 20px; }
.single-field { max-width: 440px; margin-bottom: 18px; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.scan-box { display: flex; gap: 12px; }
.scan-result { margin-top: 18px; }
.product-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #f8fafc;
  display: grid;
  gap: 8px;
}
.product-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.product-card dt { color: var(--muted); font-weight: 700; }
.product-card dd { margin: 4px 0 0; font-weight: 800; }
.label-preview {
  width: 360px;
  max-width: 100%;
  min-height: 190px;
  border: 2px dashed #94a3b8;
  border-radius: 20px;
  padding: 18px;
  background: white;
}
.label-preview .label-code {
  font-family: "Courier New", monospace;
  letter-spacing: 3px;
  border: 1px solid #111827;
  padding: 8px;
  text-align: center;
  margin-top: 14px;
  font-weight: 900;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 14px 18px;
  border-radius: 16px;
  background: #111827;
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  font-weight: 800;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-two { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .mobile-only { display: inline-flex; }
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    transform: translateX(-105%);
    transition: transform .2s;
  }
  .sidebar.open { transform: translateX(0); }
  .main-area { padding: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions, .scan-box, .table-actions { width: 100%; flex-direction: column; }
  .topbar input { min-width: 0; width: 100%; }
  .cards-grid, .form-grid, .form-grid.compact { grid-template-columns: 1fr; }
}
@media print {
  body * { visibility: hidden; }
  .label-preview, .label-preview * { visibility: visible; }
  .label-preview { position: absolute; left: 0; top: 0; border: 0; width: 100%; }
}


/* ── Modern login screen ───────────────────────────────── */
.login-wrapper {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  min-height: min(720px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden;
  border-radius: 34px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(255,255,255,.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.login-bg-shapes, .login-shape { position: absolute; pointer-events: none; }
.login-bg-shapes { inset: 0; overflow: hidden; }
.login-shape { border-radius: 999px; filter: blur(2px); opacity: .45; }
.login-shape-1 { width: 260px; height: 260px; left: 5%; top: 7%; background: rgba(15,118,110,.22); }
.login-shape-2 { width: 220px; height: 220px; right: 12%; bottom: 12%; background: rgba(14,165,233,.18); }
.login-shape-3 { width: 150px; height: 150px; right: 28%; top: 16%; background: rgba(220,38,38,.12); }
.login-left {
  color: white;
  background: linear-gradient(145deg, #0f172a 0%, #0f766e 100%);
  padding: clamp(28px, 5vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}
.login-left-inner { display: grid; gap: clamp(30px, 5vw, 60px); }
.vf-logo-wrap, .login-card-header { display: flex; align-items: center; gap: 14px; }
.vf-logo-icon, .vf-dot-logo, .vf-sidebar-logo { width: 48px; height: 48px; object-fit: contain; }
.vf-brand-name { display: block; font-size: 20px; font-weight: 900; }
.vf-brand-sub { display: block; color: rgba(255,255,255,.72); font-size: 13px; margin-top: 2px; }
.login-left-text h1 { font-size: clamp(42px, 7vw, 72px); letter-spacing: -.04em; }
.login-left-text p { max-width: 520px; color: rgba(255,255,255,.82); line-height: 1.7; font-size: 17px; }
.login-left-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lf-item { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-radius: 16px; background: rgba(255,255,255,.10); font-weight: 800; }
.lf-icon { width: 34px; height: 34px; border-radius: 12px; display: inline-grid; place-items: center; background: rgba(255,255,255,.14); }
.login-left-footer, .sidebar-copyright { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.70); font-size: 12px; line-height: 1.45; }
.grafx-logo-img, .grafx-logo-sidebar { max-width: 112px; max-height: 32px; object-fit: contain; }
.grafx-logo-fallback { align-items: center; gap: 2px; color: white; font-weight: 900; }
.grafx-g { width: 24px; height: 24px; border-radius: 7px; display: inline-grid; place-items: center; background: white; color: #0f766e; }
.login-right { padding: clamp(28px, 5vw, 56px); display: grid; align-content: center; gap: 18px; }
.login-card-vf { width: min(440px, 100%); margin: 0 auto; padding: 30px; border-radius: 28px; background: white; border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(15,23,42,.08); }
.login-card-title { font-size: 28px; }
.login-card-sub, .login-right-copy { color: var(--muted); margin: 4px 0 0; }
.login-form-vf { display: grid; gap: 16px; margin-top: 28px; }
.vf-field > span { font-size: 13px; }
.vf-input-wrap { position: relative; }
.vf-input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.vf-input-wrap input { padding-left: 44px; }
.vf-checkline { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--muted); }
.vf-checkline input { width: auto; }
.btn-vf-login { width: 100%; border: 0; border-radius: 16px; padding: 14px 18px; background: var(--primary); color: white; font-weight: 900; cursor: pointer; box-shadow: 0 12px 26px rgba(15,118,110,.22); }
.btn-vf-login:hover { background: var(--primary-strong); }
.vf-error { margin-top: 2px; }
.login-right-copy { text-align: center; font-size: 12px; }

/* ── Missing layout helpers ───────────────────────────── */
.sidebar-user { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.08); }
.sidebar-user-avatar { width: 38px; height: 38px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.12); }
.sidebar-user strong, .sidebar-user span { display: block; }
.small { font-size: 12px; }
.required { color: var(--danger); }
.scan-panel { max-width: 820px; }
.loading-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; align-content: center; gap: 14px; background: rgba(248,250,252,.78); backdrop-filter: blur(8px); color: var(--text); font-weight: 900; }
.loading-spinner { width: 44px; height: 44px; border-radius: 999px; border: 4px solid #d1d5db; border-top-color: var(--primary); animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 920px) {
  .login-wrapper { grid-template-columns: 1fr; min-height: auto; }
  .login-left { min-height: 420px; }
}
@media (max-width: 820px) {
  .panel-head.between { flex-direction: column; align-items: stretch; }
  .button-row-tight .btn { width: 100%; }
  .login-screen { padding: 12px; }
  .login-left, .login-right { padding: 24px; }
  .login-left-features { grid-template-columns: 1fr; }
  .login-left-footer { flex-direction: column; align-items: flex-start; }
}

/* ── Secondary button ────────────────────────────────── */
.btn.secondary {
  background: #e0f2fe;
  color: #0369a1;
  border: 1.5px solid #bae6fd;
  border-radius: 10px;
  padding: 8px 16px;
  font-weight: 600;
  transition: background .15s;
}
.btn.secondary:hover { background: #bae6fd; }

/* ── Tight button row in panel-head ─────────────────── */
.button-row-tight {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Modal overlay & box ─────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(540px, 100%);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0);    }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 8px;
  transition: background .15s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-hint {
  margin: 0;
  font-size: .875rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 14px;
}

/* ── Barcode found card ───────────────────────────────── */
.barcode-found { border-left: 4px solid var(--primary); }
.barcode-found-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 8px;
  letter-spacing: .02em;
}

/* ── Group manage modal ───────────────────────────────── */
.group-add-row {
  display: flex;
  gap: 8px;
}
.group-add-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.group-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}
.group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--line);
  font-weight: 600;
}
.group-item small { font-weight: 400; }

@media (max-width: 820px) {
  .button-row-tight { justify-content: flex-start; }
}

/* Stok çıkışı barkodla ürün seçme alanı */
.movement-scan-box { margin-bottom: 18px; }
.inline-input-btn { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.inline-input-btn input { flex: 1; }
.inline-input-btn .btn { white-space: nowrap; }
.field-hint { display: block; margin-top: 8px; color: var(--muted); font-weight: 600; line-height: 1.4; }
.field-hint.ok { color: #047857; }
.field-hint.error { color: #dc2626; }
@media (max-width: 640px) {
  .inline-input-btn { flex-direction: column; align-items: stretch; }
  .inline-input-btn .btn { width: 100%; }
}


/* Stok çıkışı barkod butonu ve okutma alanı - kesin görünürlük */
.topbar-movement-barcode {
  white-space: nowrap;
  min-height: 48px;
  padding-inline: 18px;
}
.movement-barcode-form-row {
  border: 1px solid #d1fae5;
  background: #f0fdfa;
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 4px;
}
.movement-barcode-form-row .inline-input-btn {
  margin-top: 10px;
}
.movement-scan-box {
  border: 1px solid #d1fae5;
  background: #f0fdfa;
  border-radius: 16px;
  padding: 14px;
}
@media (max-width: 820px) {
  .topbar-actions { align-items: stretch; }
  .topbar-movement-barcode { width: 100%; }
}


/* Liste sayfalama */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.pagination-info {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.pagination-pages {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pagination-btn {
  min-width: 38px;
  padding-inline: 10px;
}
.pagination-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
@media (max-width: 640px) {
  .pagination { align-items: flex-start; flex-direction: column; }
}
