/* =====================================================================
   GİRİŞ KONTROL — Tasarım sistemi
   Tema: endüstriyel kapı kontrol · mürekkep / çelik / kağıt / amber
   ===================================================================== */

:root {
  /* Palet */
  --ink: #101720;
  --ink-2: #1B2530;
  --ink-3: #26323F;
  --steel: #3C4A58;
  --steel-2: #5A6978;
  --steel-3: #8A96A3;
  --line: #D9DDE1;
  --line-2: #E8EBED;
  --paper: #F2F3F0;
  --paper-2: #E9EBE7;
  --card: #FFFFFF;
  --amber: #F0A32B;
  --amber-2: #D98C12;
  --amber-soft: #FDF1DC;
  --green: #1E9E58;
  --green-soft: #E3F5EA;
  --red: #D93636;
  --red-soft: #FBE4E4;
  --yellow: #E8B321;

  /* Tipografi */
  --font-head: "Archivo", "Segoe UI", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, "Courier New", monospace;

  /* Ölçüler */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow: 0 10px 30px rgba(16, 23, 32, 0.08), 0 1px 2px rgba(16, 23, 32, 0.06);
  --shadow-lg: 0 24px 60px rgba(16, 23, 32, 0.16);
  --max: 1080px;
  --max-wide: 1320px;
  --topbar-h: 64px;
}

/* ---------------------------------------------------------------------
   Sıfırlama / temel
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(rgba(16, 23, 32, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 8px;
  color: var(--ink);
}
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 19px; }
p { margin: 0 0 10px; }
a { color: var(--ink); }
img { max-width: 100%; height: auto; }
.mono { font-family: var(--font-mono); }
.strong { font-weight: 600; }
.small { font-size: 12.5px; }
.block { display: block; }
.muted { color: var(--steel-2); }
.nowrap { white-space: nowrap; }
.ta-right { text-align: right; }
.ta-center { text-align: center; }
.hidden { display: none !important; }
.inline { display: inline; }
.eyebrow {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber-2);
  margin-bottom: 6px;
}
.link-dim { color: var(--steel-2); font-size: 13px; text-decoration: none; }
.link-dim:hover { color: var(--ink); text-decoration: underline; }

/* ---------------------------------------------------------------------
   Üst bar
   --------------------------------------------------------------------- */
.topbar {
  background: var(--ink);
  color: #fff;
  border-bottom: 3px solid var(--amber);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-inner.wide { max-width: var(--max-wide); }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.brand-mark {
  width: 26px;
  height: 26px;
  background: var(--amber);
  clip-path: polygon(0 20%, 60% 20%, 60% 0, 100% 50%, 60% 100%, 60% 80%, 0 80%);
  flex: none;
}
.brand-word {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.14em;
}
.brand-word strong { font-weight: 800; color: var(--amber); }
.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.topnav > a:not(.btn) {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
.topnav > a:not(.btn):hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.topnav-user {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  padding: 0 12px;
  margin-left: 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}
.topnav-user-name { font-size: 13px; font-weight: 600; color: #fff; }
.topnav-user-role { font-size: 11px; color: var(--amber); letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------------------------------------------------------------------
   Sayfa gövdesi ve alt bilgi
   --------------------------------------------------------------------- */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 20px 48px;
}
.page.wide { max-width: var(--max-wide); }
.footer {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--steel-2);
  font-size: 12.5px;
}
.footer-inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-dim { opacity: 0.7; font-family: var(--font-mono); font-size: 12px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head p { margin: 4px 0 0; max-width: 60ch; }
.page-head-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius-sm);
}
.meta-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--steel-2); }
.meta-value { font-weight: 600; font-family: var(--font-head); }
.meta-sub { font-size: 12.5px; color: var(--steel-2); }

.stat-row { display: flex; gap: 10px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  min-width: 88px;
  text-align: center;
}
.stat-value { display: block; font-family: var(--font-head); font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--steel-2); }

.section { margin-top: 32px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0; }

/* ---------------------------------------------------------------------
   Kartlar / flash / boş durum
   --------------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-compact { padding: 14px 16px; }
.card-title { font-size: 16px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }

.flash-stack { margin-bottom: 18px; display: grid; gap: 8px; }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  border-left-width: 4px;
  font-weight: 500;
  background: var(--card);
}
.flash-success { border-color: rgba(30, 158, 88, 0.3); border-left-color: var(--green); background: var(--green-soft); color: #145F37; }
.flash-error { border-color: rgba(217, 54, 54, 0.3); border-left-color: var(--red); background: var(--red-soft); color: #8E1F1F; }
.flash-warning { border-color: rgba(240, 163, 43, 0.4); border-left-color: var(--amber); background: var(--amber-soft); color: #7A4E05; }
.flash-info { border-color: var(--line); border-left-color: var(--steel); color: var(--steel); }

.empty {
  padding: 28px;
  text-align: center;
  color: var(--steel-2);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------------
   Formlar
   --------------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}
.form-grid-3 { grid-template-columns: 1.3fr 1.3fr auto; align-items: end; }
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field-full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-btn { justify-content: flex-end; }
.field label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--steel);
}
.req { color: var(--red); }
.opt { color: var(--steel-3); font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="search"],
input[type="datetime-local"], input[type="number"], select, textarea {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
  min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(240, 163, 43, 0.2);
}
input::placeholder { color: var(--steel-3); }
.has-error input { border-color: var(--red); }
.field-error { color: var(--red); font-size: 12.5px; font-weight: 500; }
.input-mono { font-family: var(--font-mono); font-weight: 600; letter-spacing: 0.06em; }
.input-upper { text-transform: uppercase; }
.input-code {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-align: center;
  padding: 12px 8px 12px 0.5em;
  min-height: 64px;
}
.form-actions { margin-top: 22px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.form-inline-center { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.search-form { display: flex; gap: 10px; align-items: center; }
.search-form input { flex: 1; }

/* SAS satırları */
.sas-rows { display: grid; gap: 8px; }
.sas-row { display: grid; grid-template-columns: 32px 1fr 44px; gap: 8px; align-items: center; }
.sas-index {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--amber);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
}
.sas-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Butonlar
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 12px 18px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.08s, background 0.15s, box-shadow 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 3px solid rgba(240, 163, 43, 0.5); outline-offset: 2px; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--amber); }
.btn-primary:hover { background: var(--ink-2); }
.btn-amber { background: var(--amber); color: var(--ink); border-color: var(--amber); }
.btn-amber:hover { background: #F6B24A; }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--steel-3); background: var(--paper); }
.btn-ghost { background: transparent; color: var(--steel); }
.btn-ghost:hover { background: rgba(16, 23, 32, 0.06); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #BF2C2C; }
.btn-danger-ghost { background: transparent; color: var(--red); border-color: var(--line); }
.btn-danger-ghost:hover { background: var(--red-soft); border-color: var(--red); }
.btn-ghost-dark { background: rgba(255, 255, 255, 0.06); color: #fff; border-color: rgba(255, 255, 255, 0.18); }
.btn-ghost-dark:hover { background: rgba(255, 255, 255, 0.12); }
.btn-sm { padding: 7px 12px; min-height: 34px; font-size: 12.5px; }
.btn-lg { padding: 14px 22px; min-height: 50px; font-size: 15px; }
.btn-xl { padding: 16px 28px; min-height: 60px; font-size: 18px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; font-size: 20px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.topnav .btn-ghost { color: rgba(255, 255, 255, 0.85); border-color: rgba(255, 255, 255, 0.2); }
.topnav .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* ---------------------------------------------------------------------
   Tablolar
   --------------------------------------------------------------------- */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel-2);
  background: var(--paper);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #FAFBF9; }
.table-dense td, .table-dense th { padding: 8px 12px; }
.row-dim td { color: var(--steel-3); }
.row-dim .strong { color: var(--steel-2); }

.code-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.14em;
  background: var(--ink);
  color: var(--amber);
  padding: 4px 10px 3px 12px;
  border-radius: 6px;
  border-bottom: 2px solid var(--amber);
}
.code-chip-sm { font-size: 12px; padding: 2px 6px 1px 8px; }

/* Rozetler */
.badge {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  line-height: 1.3;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-active, .badge-in, .badge-ok { background: var(--green-soft); color: #145F37; border-color: rgba(30, 158, 88, 0.35); }
.badge-passive, .badge-late { background: var(--paper-2); color: var(--steel-2); border-color: var(--line); }
.badge-wait, .badge-warn { background: var(--amber-soft); color: #7A4E05; border-color: rgba(240, 163, 43, 0.5); }
.badge-fail { background: var(--red-soft); color: #8E1F1F; border-color: rgba(217, 54, 54, 0.35); }
.badge-role-admin { background: var(--ink); color: var(--amber); }
.badge-role-guard { background: var(--steel); color: #fff; }

/* ---------------------------------------------------------------------
   Giriş (auth) sayfaları
   --------------------------------------------------------------------- */
.auth-wrap {
  display: grid;
  grid-template-columns: minmax(0, 480px) minmax(0, 300px);
  gap: 32px;
  justify-content: center;
  align-items: start;
  margin-top: 24px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--amber);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}
.auth-head { margin-bottom: 20px; }
.auth-head h1 { font-size: 24px; }
.auth-foot { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.auth-foot p { margin: 0; }
.auth-side { padding-top: 12px; }
.steps { display: grid; gap: 12px; }
.step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.step div { display: flex; flex-direction: column; gap: 2px; }
.step strong { font-family: var(--font-head); font-size: 14px; }
.step span:last-child { font-size: 12.5px; color: var(--steel-2); }
.step-no {
  flex: none;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--steel);
  font-family: var(--font-mono);
  font-weight: 700;
}
.step.active { border-color: var(--amber); }
.step.active .step-no { background: var(--amber); color: var(--ink); }
.step.done .step-no { background: var(--ink); color: var(--amber); }

/* ---------------------------------------------------------------------
   Giriş kartı (shipment.php) — kapı plakası görünümü
   --------------------------------------------------------------------- */
.card-page { max-width: 720px; margin: 0 auto; }
.card-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card-toolbar-right { display: flex; align-items: center; gap: 12px; }

.gate-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hazard {
  background-color: var(--ink);
  background-image: repeating-linear-gradient(135deg, var(--amber) 0 14px, var(--ink) 14px 28px);
  position: relative;
}
.hazard::after {
  content: "";
  position: absolute;
  inset: 8px;
  background: var(--ink);
  border-radius: 8px;
}
.gate-card-head {
  padding: 26px 32px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.gate-card-head > * { position: relative; z-index: 1; }
.gate-card-title { display: flex; flex-direction: column; gap: 4px; }
.gate-card-brand { font-family: var(--font-head); font-weight: 600; letter-spacing: 0.16em; font-size: 14px; color: rgba(255, 255, 255, 0.8); }
.gate-card-brand strong { color: var(--amber); font-weight: 800; }
.gate-card-kind { font-family: var(--font-head); font-weight: 800; font-size: 22px; letter-spacing: 0.04em; }
.gate-card-date { text-align: right; display: flex; flex-direction: column; }
.gate-card-date .label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }
.gate-card-date .value { font-family: var(--font-mono); font-weight: 700; font-size: 18px; color: var(--amber); }

.gate-card-code { padding: 32px 32px 12px; text-align: center; }
.gate-card-code-label {
  display: block;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--steel-2);
  margin-bottom: 14px;
}
.digit-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.digit {
  width: 68px;
  height: 86px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 46px;
  border-radius: 10px;
  border-bottom: 5px solid var(--amber);
  box-shadow: 0 6px 14px rgba(16, 23, 32, 0.25);
}
.gate-card-hint { margin: 18px auto 0; max-width: 46ch; color: var(--steel-2); font-size: 13.5px; }

.gate-card-qr { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 32px 28px; }
.gate-card-qr img {
  width: 240px; height: 240px;
  border: 8px solid #fff;
  outline: 1px solid var(--line);
  border-radius: 10px;
  image-rendering: pixelated;
}

.tear-line { position: relative; height: 24px; margin: 0 -1px; }
.tear-line::before {
  content: "";
  position: absolute;
  left: 20px; right: 20px; top: 50%;
  border-top: 2px dashed var(--line);
}
.tear-line::before, .tear-line span::before, .tear-line span::after { pointer-events: none; }
.tear-line span::before, .tear-line span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 24px; height: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  transform: translateY(-50%);
}
.tear-line span::before { left: -12px; }
.tear-line span::after { right: -12px; }

.gate-card-summary { padding: 8px 32px 28px; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.summary-table th {
  text-align: left;
  width: 34%;
  padding: 10px 12px;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel-2);
  background: var(--paper);
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}
.summary-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.summary-table tr:last-child th, .summary-table tr:last-child td { border-bottom: none; }
.gate-card-foot {
  padding: 12px 32px;
  background: var(--paper);
  border-top: 1px solid var(--line-2);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--steel-2);
  font-family: var(--font-mono);
}

/* ---------------------------------------------------------------------
   Koyu tema — güvenlik ekranı
   --------------------------------------------------------------------- */
body.theme-dark {
  background: #0B1119;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 22px 22px;
  color: #E9EDF1;
}
body.theme-dark h1, body.theme-dark h2 { color: #fff; }
body.theme-dark .footer { background: #0B1119; border-color: rgba(255, 255, 255, 0.08); color: var(--steel-3); }
body.theme-dark .flash { background: var(--ink-2); border-color: rgba(255, 255, 255, 0.1); color: #E9EDF1; }
body.theme-dark .flash-success { border-left-color: var(--green); }
body.theme-dark .flash-error { border-left-color: var(--red); }
body.theme-dark .flash-warning { border-left-color: var(--amber); }
.eyebrow-amber { color: var(--amber); }
.muted-dark { color: var(--steel-3); }

.guard-wrap { max-width: 980px; margin: 0 auto; }
.guard-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.guard-head h1 { font-size: 30px; margin: 0; }
.guard-clock { font-family: var(--font-mono); font-size: 40px; font-weight: 700; color: var(--amber); line-height: 1; letter-spacing: 0.04em; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.04em;
  padding: 16px;
  background: var(--ink-2);
  color: rgba(255, 255, 255, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tab:hover { color: #fff; }
.tab.active { background: var(--amber); color: var(--ink); border-color: var(--amber); }

.guard-panel {
  background: var(--ink-2);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px;
}
.code-form { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.code-form-label { font-family: var(--font-head); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--steel-3); }
.code-input {
  width: min(100%, 520px);
  font-family: var(--font-mono);
  font-size: clamp(44px, 9vw, 76px);
  font-weight: 700;
  letter-spacing: 0.32em;
  text-align: center;
  color: var(--amber);
  background: var(--ink);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-bottom: 5px solid var(--amber);
  border-radius: 14px;
  padding: 18px 8px 14px 0.32em;
  min-height: 0;
  caret-color: var(--amber);
}
.code-input:focus { box-shadow: 0 0 0 5px rgba(240, 163, 43, 0.25); border-color: var(--amber); }
.code-input::placeholder { color: rgba(255, 255, 255, 0.12); }
.code-form-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.qr-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.qr-reader {
  width: min(100%, 460px);
  min-height: 120px;
  background: var(--ink);
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
}
.qr-reader video { border-radius: 12px; }
.qr-controls { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.qr-hint { margin: 0; text-align: center; max-width: 52ch; font-size: 14px; }

/* Sonuç paneli */
.result {
  margin-top: 16px;
  border-radius: 16px;
  padding: 22px 26px;
  border: 2px solid transparent;
  color: #fff;
  background: var(--ink-3);
}
.result-loading { border-color: rgba(255, 255, 255, 0.15); }
.result-ok { background: var(--green); border-color: #34C476; box-shadow: 0 0 0 6px rgba(30, 158, 88, 0.25), 0 20px 60px rgba(30, 158, 88, 0.45); }
.result-warn { background: var(--yellow); color: var(--ink); border-color: #FFD24A; box-shadow: 0 0 0 6px rgba(232, 179, 33, 0.25), 0 20px 60px rgba(232, 179, 33, 0.45); }
.result-fail { background: var(--red); border-color: #F05A5A; box-shadow: 0 0 0 6px rgba(217, 54, 54, 0.25), 0 20px 60px rgba(217, 54, 54, 0.45); }
.result-warn .muted-dark, .result-warn .detail-label { color: rgba(16, 23, 32, 0.65); }
.result-warn .btn-ghost-dark { color: var(--ink); border-color: rgba(16, 23, 32, 0.3); background: rgba(16, 23, 32, 0.08); }
.result-head { display: flex; align-items: center; gap: 18px; }
.result-icon {
  flex: none;
  width: 64px; height: 64px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 34px;
  font-weight: 800;
  font-family: var(--font-head);
}
.result-warn .result-icon { background: rgba(16, 23, 32, 0.15); }
.result-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.result-title { font-family: var(--font-head); font-weight: 800; font-size: clamp(22px, 4vw, 32px); letter-spacing: 0.04em; line-height: 1.1; }
.result-message { font-size: 15px; opacity: 0.95; }
.result-code { font-family: var(--font-mono); font-weight: 700; font-size: 26px; letter-spacing: 0.16em; opacity: 0.85; }
.result-detail { margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, 0.25); }
.result-warn .result-detail { border-top-color: rgba(16, 23, 32, 0.2); }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; }
.detail-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.detail-label { font-family: var(--font-head); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.8; }
.detail-value { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.detail-plate { grid-column: 1 / -1; }
.detail-plate .detail-value { font-size: clamp(30px, 6vw, 44px); font-weight: 700; letter-spacing: 0.06em; line-height: 1.1; }
.detail-sas { grid-column: 1 / -1; }
.detail-checkin { grid-column: 1 / -1; }
.result-foot { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.result .muted-dark { color: rgba(255, 255, 255, 0.75); }

@keyframes pop {
  0% { transform: scale(0.96); opacity: 0.4; }
  60% { transform: scale(1.015); opacity: 1; }
  100% { transform: scale(1); }
}
.result.pop { animation: pop 0.32s cubic-bezier(0.2, 0.8, 0.3, 1.2); }
@media (prefers-reduced-motion: reduce) {
  .result.pop { animation: none; }
  .btn { transition: none; }
}

/* Oturum geçmişi */
.history { margin-top: 28px; }
.history-head { margin-bottom: 8px; }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.history-item {
  display: grid;
  grid-template-columns: 70px 92px 64px 150px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--ink-2);
  border-radius: 10px;
  border-left: 4px solid var(--steel);
  font-size: 13.5px;
  color: #D5DBE1;
}
.history-ok { border-left-color: var(--green); }
.history-warn { border-left-color: var(--yellow); }
.history-fail { border-left-color: var(--red); }
.history-time { font-family: var(--font-mono); color: var(--steel-3); }
.history-code { font-weight: 700; letter-spacing: 0.12em; color: var(--amber); }
.history-status { font-family: var(--font-head); font-weight: 800; font-size: 11px; letter-spacing: 0.1em; }
.history-ok .history-status { color: #4ED68A; }
.history-warn .history-status { color: #FFD24A; }
.history-fail .history-status { color: #FF7A7A; }
.history-plate { font-weight: 600; color: #fff; }
.history-msg { color: var(--steel-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------------
   Yazdırma
   --------------------------------------------------------------------- */
@media print {
  body { background: #fff; }
  .topbar, .footer, .no-print, .flash-stack { display: none !important; }
  .page { padding: 0; max-width: none; }
  .card-page { max-width: none; }
  .gate-card { box-shadow: none; border: 1px solid #999; border-radius: 8px; page-break-inside: avoid; }
  .hazard { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .digit { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none; }
  .code-chip, .summary-table th, .gate-card-foot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------------------------------------------------------------------
   Duyarlı
   --------------------------------------------------------------------- */
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: minmax(0, 520px); }
  .auth-side { display: none; }
  .form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-item { grid-template-columns: 62px 84px 56px 1fr; }
  .history-msg { grid-column: 1 / -1; white-space: normal; }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .topbar-inner { height: auto; padding: 10px 14px; flex-wrap: wrap; }
  .topnav { width: 100%; justify-content: flex-start; gap: 2px; }
  .topnav > a:not(.btn) { font-size: 13px; padding: 6px 8px; }
  .topnav-user { display: none; }
  .page { padding: 20px 14px 40px; }
  .card { padding: 18px; }
  .auth-card { padding: 24px 20px; }
  .form-grid, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head-meta { align-items: flex-start; text-align: left; }
  .stat-row { flex-wrap: wrap; }
  .digit { width: 46px; height: 62px; font-size: 32px; border-radius: 8px; }
  .digit-row { gap: 6px; }
  .gate-card-head, .gate-card-code, .gate-card-summary, .gate-card-qr { padding-left: 18px; padding-right: 18px; }
  .gate-card-date { text-align: left; }
  .summary-table th { width: 40%; }
  .guard-head { flex-direction: column; align-items: flex-start; }
  .guard-clock { font-size: 32px; }
  .guard-panel { padding: 18px 14px; }
  .code-input { letter-spacing: 0.22em; padding-left: 0.22em; }
  .btn-xl { padding: 14px 18px; min-height: 54px; font-size: 16px; flex: 1; }
  .result { padding: 18px 16px; }
  .result-head { flex-wrap: wrap; }
  .result-code { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .search-form { flex-wrap: wrap; }
  .search-form input { flex-basis: 100%; }
  .btn-group { justify-content: flex-start; }
}

/* ---------------------------------------------------------------------
   Güvenlik ekranı — ad soyad çubuğu
   --------------------------------------------------------------------- */
.guard-name-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  align-items: center;
  background: var(--ink-2);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-left: 5px solid var(--amber);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 14px;
}
.guard-name-label {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}
.guard-name-input {
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 600;
  background: var(--ink);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  min-height: 52px;
  padding: 10px 14px;
}
.guard-name-input::placeholder { color: rgba(255, 255, 255, 0.3); font-weight: 400; }
.guard-name-input:focus { border-color: var(--amber); box-shadow: 0 0 0 4px rgba(240, 163, 43, 0.22); }
.guard-name-input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 4px rgba(217, 54, 54, 0.25); }
.guard-name-hint { grid-column: 2; font-size: 12.5px; }
.guard-question-label {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  align-self: end;
}
.guard-choice {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}
.guard-choice label { position: relative; cursor: pointer; }
.guard-choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.guard-choice span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 52px;
  padding: 10px 24px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  background: var(--ink);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.1em;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  user-select: none;
}
.guard-choice label:hover span { border-color: rgba(255, 255, 255, 0.35); }
.guard-choice input:focus-visible + span { box-shadow: 0 0 0 4px rgba(240, 163, 43, 0.22); border-color: var(--amber); }
.guard-choice-yes input:checked + span { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 0 18px rgba(30, 158, 88, 0.45); }
.guard-choice-no input:checked + span { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 0 18px rgba(217, 54, 54, 0.45); }
.guard-choice.is-invalid span { border-color: var(--red); }
.guard-choice.is-invalid input:checked + span { border-color: transparent; }
@media (max-width: 640px) {
  .guard-name-bar { grid-template-columns: 1fr; }
  .guard-name-hint { grid-column: 1; }
  .guard-choice { border-top: 0; padding-top: 0; margin-top: 0; }
  .guard-choice label { flex: 1; }
  .guard-choice span { width: 100%; }
}
