:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #fafbfe;
  --border: #e5e9f2;
  --text: #1b2436;
  --text-muted: #6b7690;
  --primary: #3457d5;
  --primary-dark: #2540a8;
  --primary-soft: #eaefff;
  --success: #17a673;
  --success-soft: #e5f8f1;
  --danger: #d64545;
  --danger-soft: #fdebeb;
  --warning: #d98c1f;
  --warning-soft: #fdf2e3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 26, 46, 0.04), 0 8px 24px -12px rgba(20, 26, 46, 0.12);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Inter", Arial, sans-serif;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}

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

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #17203a 0%, #101729 100%);
  color: #cfd6ea;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  font-weight: 700;
  font-size: 15.5px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand .logo-dot {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #6f8bff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #b6bedb;
  font-size: 13.8px;
  font-weight: 500;
  transition: background .15s, color .15s;
}

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

.sidebar-nav a.active {
  background: var(--primary);
  color: #fff;
}

.sidebar-nav .icon { width: 18px; text-align: center; opacity: .9; }

.sidebar-footer {
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12.5px;
  color: #8891b3;
}

.sidebar-footer .kullanici {
  color: #e7eaf7;
  font-weight: 600;
  margin-bottom: 6px;
}

.sidebar-footer a.cikis {
  color: #ff9d9d;
  font-weight: 600;
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 62px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 17px;
  margin: 0;
  font-weight: 700;
}

.badge-printer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge-printer .durum-noktasi {
  width: 8px; height: 8px; border-radius: 50%;
  background: #b9bfd1;
}
.badge-printer.bagli .durum-noktasi { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.badge-printer.bagli-degil .durum-noktasi { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.content {
  padding: 26px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Cards / grid ---------- */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.stat-card .label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 28px; font-weight: 800; margin-top: 6px; }
.stat-card .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.panel-header h2 { font-size: 15.5px; margin: 0; font-weight: 700; }
.panel-body { padding: 20px; }
.panel-body.no-pad { padding: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13.6px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .12s, transform .05s;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-outline { background: var(--panel); color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: #c4cbdd; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { filter: brightness(0.97); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
label { font-size: 12.8px; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 5px; }
.field { margin-bottom: 15px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

input[type=text], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.8px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; min-height: 90px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.4px; }
thead th {
  text-align: left;
  font-size: 11.8px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  padding: 11px 20px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 11px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }

.pill {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.8px;
  font-weight: 700;
}
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-muted { background: var(--panel-2); color: var(--text-muted); border: 1px solid var(--border); }

.mono { font-family: "Cascadia Code", "Consolas", monospace; font-size: 12.8px; letter-spacing: .02em; }

/* ---------- Alerts ---------- */
.alert {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.6px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: #0d6b4c; border-color: #bfeadd; }
.alert-danger { background: var(--danger-soft); color: #a12f2f; border-color: #f3c4c4; }
.alert-info { background: var(--primary-soft); color: var(--primary-dark); border-color: #cdd8ff; }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #1c2747, #0d1326 70%);
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 34px 30px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.45);
}
.auth-card .logo-dot {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #6f8bff);
  color: #fff; font-weight: 800; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.auth-card h1 { text-align: center; font-size: 18px; margin: 0 0 4px; }
.auth-card p.subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin: 0 0 24px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 11px; }

/* ---------- Utilities ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.small { font-size: 12.3px; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 34px; margin-bottom: 10px; }

.toast-area { position: fixed; top: 18px; right: 18px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #1b2436; color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 13.3px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5);
  min-width: 240px; display: flex; align-items: center; gap: 8px;
}
.toast.ok { border-left: 4px solid var(--success); }
.toast.err { border-left: 4px solid var(--danger); }

@media (max-width: 880px) {
  .sidebar { position: fixed; left: -260px; z-index: 40; transition: left .2s; }
  .sidebar.open { left: 0; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
}

/* ---------- USB/Windows yazdirma alani (agent gerektirmez) ---------- */
/* NOT: #yazdirma-alani KASITLI OLARAK flex DEGIL - her ".es-sayfa" (bir
   numune) kendi sayfasina ayrilmis TAM GENISLIKTE bir blok olmali. Flex
   yapilirsa tum sayfalar TEK SATIRDA sikisir ve her biri kardesleriyle
   genislik paylasip kucultur (2 sutunluk duzen 1 sutuna duser). */
#yazdirma-alani { display: none; }

@media print {
  body > *:not(#yazdirma-alani) { display: none !important; }
  #yazdirma-alani { display: block !important; }
}
