:root {
  /* IDIS mobil uygulama dili: lacivert zemin + kırmızı vurgu */
  --navy: #152744;
  --navy-2: #1d3559;
  --navy-3: #24406a;
  --red: #e2231a;
  --red-press: #bd1a13;
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --line: #dfe5ec;
  --text: #16202e;
  --text-2: #6b7b90;
  --success: #1f9d55;
  --danger: #e2231a;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
body { position: fixed; inset: 0; }

.screen { position: absolute; inset: 0; }
[hidden] { display: none !important; }

/* ---------------- Giriş ---------------- */
.login-screen { background: var(--surface); }
.login-scroll {
  position: absolute; inset: 0; overflow-y: auto;
  padding: calc(26px + var(--safe-top)) 20px calc(28px + var(--safe-bottom));
}
.login-head { text-align: center; margin-bottom: 26px; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; }
.mark { width: 20px; height: 23px; flex: 0 0 auto; }
.mark-lg { width: 34px; height: 39px; }
.logo-word { font-size: 34px; font-weight: 800; letter-spacing: -1px; color: var(--navy); }
.login-sub { color: var(--navy); font-size: 17px; font-weight: 600; margin: 12px 0 0; }

.big-field {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px;
  box-shadow: 0 3px 10px rgba(21,39,68,0.05);
  margin-bottom: 14px; transition: border-color .15s;
}
.big-field:focus-within { border-color: var(--red); }
.big-field input {
  flex: 1; min-width: 0; appearance: none; border: none; background: transparent;
  padding: 24px 18px; font-size: 17px; font-weight: 700; color: var(--text); outline: none;
}
.big-field input::placeholder { color: var(--navy); font-weight: 700; opacity: 1; }
.eye-btn {
  appearance: none; border: none; background: transparent; cursor: pointer;
  color: var(--navy); padding: 0 18px; height: 100%; display: grid; place-items: center;
}

.login-row { display: flex; align-items: center; gap: 12px; margin: 6px 2px 22px; }
.remember { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.remember input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch {
  width: 62px; height: 34px; border-radius: 999px; background: #c9d2dd;
  position: relative; transition: background .18s; flex: 0 0 auto;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 28px; height: 28px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25); transition: transform .18s;
}
.remember input:checked + .switch { background: var(--red); }
.remember input:checked + .switch::after { transform: translateX(28px); }
.remember-lbl { font-size: 16px; color: var(--text-2); }
.forgot {
  margin-left: auto; appearance: none; border: none; background: transparent;
  color: var(--text-2); font-size: 16px; cursor: pointer; padding: 6px 0;
}

.btn-login { padding: 20px 16px; font-size: 19px; border-radius: 16px; }

.login-error {
  background: #fdeceb; border: 1px solid #f5b7b4; color: #a8150e;
  border-radius: var(--radius); padding: 10px 12px; font-size: 14px; margin: 0 0 14px;
}

.login-info { margin-top: 30px; text-align: center; }
.info-strong { color: var(--navy); font-weight: 700; font-size: 15.5px; line-height: 1.55; margin: 0 0 16px; }
.info-link { color: var(--navy); text-decoration: underline; }
.info-soft { color: var(--text-2); font-size: 15px; line-height: 1.55; margin: 0; }
.info-title { color: var(--red); font-size: 17px; font-weight: 800; margin: 30px 0 12px; }

.btn {
  appearance: none; border: none; cursor: pointer;
  font-size: 16px; font-weight: 700; border-radius: var(--radius);
  padding: 14px 16px; transition: transform .06s, background .15s, opacity .15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { width: 100%; background: var(--red); color: #fff; }
.btn-primary:active { background: var(--red-press); }
.btn-tinted { background: #eef2f7; color: var(--navy); flex: 1; }
.btn-danger { background: #fdeceb; color: var(--danger); flex: 1; }

/* ---------------- ANA EKRAN ---------------- */
.home-screen { display: flex; flex-direction: column; background: var(--bg); }

.home-top {
  background: var(--navy);
  padding: calc(12px + var(--safe-top)) 18px 26px;
  border-radius: 0 0 26px 26px;
}
.home-top-row { display: flex; align-items: center; }
.logo-badge {
  display: flex; align-items: center; gap: 9px;
  background: #0f1d33; border-radius: 14px; padding: 8px 14px 8px 10px;
}
.logo-text { color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -0.3px; }
.avatar-btn {
  margin-left: auto; width: 42px; height: 42px; border-radius: 50%;
  background: #0f1d33; border: 1px solid rgba(255,255,255,0.14);
  color: #fff; cursor: pointer; display: grid; place-items: center;
}
.home-title { color: #fff; font-size: 19px; font-weight: 700; margin: 18px 0 0; }

.home-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 96px; }

.hero-card {
  background: var(--surface); border-radius: 18px; padding: 16px;
  box-shadow: 0 8px 22px rgba(21,39,68,0.08); margin-top: -14px;
}
.hero-inner { display: flex; align-items: center; gap: 14px; }
.hero-icon {
  width: 54px; height: 54px; border-radius: 16px; flex: 0 0 auto;
  background: #fdecea; color: var(--red); display: grid; place-items: center;
}
.hero-title { font-size: 17px; font-weight: 800; color: var(--navy); }
.hero-sub { font-size: 13.5px; color: var(--text-2); margin-top: 3px; line-height: 1.35; }

.home-stat {
  background: var(--surface); border-radius: 18px; padding: 18px 16px;
  margin-top: 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 6px 18px rgba(21,39,68,0.06);
}
.stat-num { font-size: 34px; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-lbl { font-size: 14px; color: var(--text-2); }
.stat-link {
  margin-left: auto; appearance: none; border: none; background: transparent;
  color: var(--red); font-weight: 700; font-size: 14px; cursor: pointer; padding: 6px;
}

.home-note {
  background: var(--surface); border-radius: 18px; padding: 16px;
  margin-top: 14px; box-shadow: 0 6px 18px rgba(21,39,68,0.06);
}
.note-title { color: var(--red); font-weight: 800; font-size: 16px; margin-bottom: 6px; }
.home-note p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }

/* Alt gezinme + ortadaki kırmızı kamera düğmesi */
.bottom-nav {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(74px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-around;
}
.nav-item {
  appearance: none; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-2); font-size: 12px; font-weight: 600;
  padding: 8px 18px; border-radius: 14px; min-width: 92px;
}
.nav-item.is-active { color: var(--red); background: #fdecea; }
.scan-fab {
  appearance: none; border: none; cursor: pointer;
  width: 68px; height: 68px; border-radius: 50%;
  background: var(--red); color: #fff;
  display: grid; place-items: center;
  margin-top: calc(-30px - var(--safe-bottom));
  box-shadow: 0 10px 24px rgba(226,35,26,0.42);
  transition: transform .08s, background .15s;
}
.scan-fab:active { transform: scale(0.94); background: var(--red-press); }

/* ---------------- TARAYICI (tam ekran kamera) ---------------- */
.scanner-screen { background: #000; overflow: hidden; }
.capture-element { position: absolute; inset: 0; background: #000; }

.scan-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 4;
  padding: calc(10px + var(--safe-top)) 20px 18px;
  background: linear-gradient(180deg, var(--navy) 62%, rgba(21,39,68,0.0) 100%);
  text-align: center; pointer-events: none;
}
.scan-top-row { display: flex; align-items: center; pointer-events: auto; }
.scan-help {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.6px solid var(--red); color: var(--red);
  display: grid; place-items: center; font-weight: 800; font-size: 16px;
}
.scan-close {
  margin-left: auto; appearance: none; border: none; background: transparent;
  color: #fff; font-size: 26px; line-height: 1; width: 40px; height: 40px; cursor: pointer;
}
.scan-title { color: #fff; font-size: 24px; font-weight: 800; margin: 8px 0 6px; }
.scan-desc {
  color: rgba(255,255,255,0.88); font-size: 14.5px; line-height: 1.4;
  margin: 0 auto; max-width: 340px;
}
.manual-open {
  pointer-events: auto; margin-top: 16px;
  appearance: none; cursor: pointer;
  background: rgba(255,255,255,0.06); color: #fff;
  border: 1.5px solid rgba(255,255,255,0.75); border-radius: 12px;
  padding: 14px 18px; font-size: 15.5px; font-weight: 700; width: 100%; max-width: 360px;
}
.manual-open:active { background: rgba(255,255,255,0.16); }

/* Kırmızı köşe çerçevesi */
.frame {
  position: absolute; z-index: 3; pointer-events: none;
  left: 8%; right: 8%; top: 42%; height: 26vh; max-height: 220px;
}
.frame .c { position: absolute; width: 42px; height: 42px; border: 6px solid var(--red); }
.frame .tl { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 12px 0 0 0; }
.frame .tr { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 12px 0 0; }
.frame .bl { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 12px; }
.frame .br { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 12px 0; }

.scan-status {
  position: absolute; left: 50%; bottom: calc(190px + var(--safe-bottom));
  transform: translateX(-50%); z-index: 6;
  background: rgba(0,0,0,0.62); color: #fff; font-size: 14px; font-weight: 600;
  padding: 8px 16px; border-radius: 999px; pointer-events: none;
  transition: opacity .3s; white-space: nowrap;
}

.scan-fail {
  position: absolute; z-index: 9; left: 20px; right: 20px; top: 50%;
  transform: translateY(-50%);
  background: var(--surface); border-radius: 18px; padding: 20px 18px; text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.fail-title { color: var(--danger); font-weight: 800; font-size: 17px; margin-bottom: 8px; }
.fail-msg {
  color: var(--text-2); font-size: 14.5px; line-height: 1.5; margin-bottom: 16px;
  word-break: break-word; white-space: pre-line; /* \n satır sonları korunur */
}

.scan-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 18px 20px calc(18px + var(--safe-bottom));
  background: linear-gradient(0deg, var(--navy) 60%, rgba(21,39,68,0.0) 100%);
  text-align: center;
}
.scan-counter { margin-bottom: 14px; }
.counter-num { color: #fff; font-size: 40px; font-weight: 800; line-height: 1; }
.counter-lbl { display: block; color: rgba(255,255,255,0.75); font-size: 13.5px; margin-top: 4px; }
.btn-continue {
  width: 100%; max-width: 380px; background: var(--red); color: #fff; font-size: 17px;
}
.btn-continue:active { background: var(--red-press); }

/* Manuel giriş katmanı (tarayıcı üzerinde) */
.manual-sheet {
  position: absolute; inset: 0; z-index: 8;
  background: rgba(8,15,26,0.72);
  display: flex; align-items: flex-end; justify-content: center;
}
.manual-box {
  width: 100%; background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(20px + var(--safe-bottom));
}
.manual-head {
  display: flex; align-items: center; font-weight: 800; color: var(--navy);
  font-size: 17px; margin-bottom: 12px;
}
.manual-close {
  margin-left: auto; appearance: none; border: none; background: transparent;
  color: var(--text-2); font-size: 22px; cursor: pointer; width: 36px; height: 36px;
}
#manual-input {
  width: 100%; padding: 14px; font-size: 18px; margin-bottom: 10px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; outline: none;
  text-transform: uppercase; letter-spacing: 1px; text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
#manual-input:focus { border-color: var(--red); }
.manual-error { color: var(--danger); font-size: 13.5px; margin-bottom: 10px; }

/* ---------------- TOPLANANLAR ---------------- */
.list-screen { display: flex; flex-direction: column; background: var(--bg); }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  background: var(--navy); color: #fff;
}
.topbar .who { font-size: 16px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.count-pill {
  background: rgba(255,255,255,0.12); padding: 6px 12px;
  border-radius: 999px; font-weight: 800; font-size: 15px;
}
.icon-btn {
  appearance: none; border: none; background: rgba(255,255,255,0.12);
  color: #fff; width: 40px; height: 40px; border-radius: 12px;
  font-size: 18px; cursor: pointer;
}

.list-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; }
.tags { list-style: none; margin: 0; padding: 0; }
.tag-row {
  margin-bottom: 8px; background: var(--surface);
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 12px;
  animation: pop .18s ease; overflow: hidden;
}
.tag-row.row-ok { border-left-color: var(--success); }
.tag-row.row-bad { border-left-color: var(--danger); }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.tag-main { display: flex; align-items: center; gap: 10px; padding: 13px 12px 13px 14px; cursor: pointer; }
.tag-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 17px; font-weight: 700; letter-spacing: 0.5px; }
.tag-dia {
  font-size: 14px; font-weight: 800; color: var(--navy);
  background: #eef2f7; padding: 4px 10px; border-radius: 8px; white-space: nowrap;
}
.tag-dia.dim { color: var(--text-2); font-weight: 700; }
.tag-src { font-size: 11px; color: var(--text-2); background: var(--surface-2); padding: 3px 8px; border-radius: 6px; }
.tag-state { margin-left: auto; font-size: 17px; font-weight: 800; }
.tag-state.ok { color: var(--success); }
.tag-state.bad { color: var(--danger); }
.tag-x {
  appearance: none; border: none; background: transparent;
  color: var(--text-2); font-size: 20px; width: 32px; height: 32px; cursor: pointer;
}
.tag-x:active { color: var(--danger); }
.tag-detail { padding: 0 14px 14px; border-top: 1px solid var(--line); margin-top: -1px; }
.tags-empty { color: var(--text-2); text-align: center; padding: 40px 16px; font-size: 15px; }

.q-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin-top: 12px; }
.q-l { color: var(--text-2); font-size: 13px; }
.q-v { color: var(--text); font-size: 14px; font-weight: 600; text-align: right; word-break: break-word; }
.q-msg { margin-top: 12px; color: #a8150e; font-size: 14px; }

.query-status {
  margin: 12px 12px 0; padding: 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
  text-align: center;
}
.query-status.is-ok { background: #e6f6ed; border-color: #bde5cd; color: #14743d; }
.query-status.is-bad { background: #fdeceb; border-color: #f5b7b4; color: #a8150e; }

.list-actions {
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 12px 12px calc(12px + var(--safe-bottom));
}
.query-actions-row { display: flex; gap: 10px; margin-bottom: 10px; }
.act-btn {
  appearance: none; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 12px; font-size: 15px; font-weight: 700; cursor: pointer;
  background: var(--surface-2); color: var(--text); width: 100%;
}
.query-actions-row .act-btn { flex: 1; }
.act-accept { color: #14743d; }
.act-ship { color: var(--navy); }
.act-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.query-hint { text-align: center; color: var(--text-2); font-size: 12px; margin-top: 8px; }

/* ---------------- Hesap menüsü ---------------- */
.menu-sheet {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(8,15,26,0.55);
  display: flex; align-items: flex-end;
}
.menu-box {
  width: 100%; background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 16px 14px calc(16px + var(--safe-bottom));
}
.menu-who { font-weight: 700; color: var(--navy); padding: 6px 8px 14px; font-size: 15px; }
.menu-item {
  display: block; width: 100%; appearance: none; border: none; cursor: pointer;
  background: var(--surface-2); color: var(--text); text-align: left;
  padding: 15px 16px; border-radius: 12px; font-size: 16px; font-weight: 600;
  margin-bottom: 8px;
}
.menu-danger { background: #fdeceb; color: var(--danger); }
.menu-plain { background: transparent; color: var(--text-2); text-align: center; }

@media (max-height: 640px) {
  .scan-title { font-size: 20px; }
  .scan-desc { font-size: 13px; }
  .frame { top: 46%; height: 22vh; }
  .counter-num { font-size: 32px; }
}
