@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@500;600;700&display=swap');

:root {
  color-scheme: light;
  --navy: #0f4c81;
  --navy-pressed: #0b3a63;
  --ink: #0f1a24;
  --muted: #6b7a87;
  --lime: #e8f0d9;
  --moss: #1b4d3e;
  --warn: #b0552e;
  --low: #c9932b;
  --bg: #f6f5f1;
  --card: #ffffff;
  --line: rgba(15, 26, 36, 0.12);
  --line-soft: rgba(15, 26, 36, 0.08);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.display {
  font-family: 'Bricolage Grotesque', sans-serif;
}

button, input, select {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ---------------------------------------------------------------- shell */

.phone-shell {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

@media (min-width: 540px) {
  body {
    background: #e7e4dd;
  }
  .phone-shell {
    margin: 24px auto;
    min-height: calc(100vh - 48px);
    border-radius: 28px;
    box-shadow: 0 30px 70px rgba(15, 26, 36, 0.22);
    overflow: hidden;
  }
}

.screen {
  min-height: 100vh;
  position: relative;
}

@media (min-width: 540px) {
  .screen {
    min-height: calc(100vh - 48px);
  }
}

/* #appScreen'i tam viewport yüksekliğinde bir flex sütununa çeviriyoruz ki
   içerik kısa olsa bile tab bar her zaman altta sabit kalsın; #screenRoot
   kalan alanı alıp kendi içinde kaydırılıyor (min-height:0 flex'te scroll
   çalışması için gerekli). */
#appScreen {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#appScreen #screenRoot {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

@media (min-width: 540px) {
  #appScreen {
    height: calc(100vh - 48px);
  }
}

/* ------------------------------------------------------------- buttons */

.btn {
  border: none;
  border-radius: 13px;
  padding: 15px;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  background: var(--navy);
  color: #fff;
}
.btn:active { background: var(--navy-pressed); }

.btn-outline {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 13px;
  padding: 15px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn-outline:active { background: var(--bg); }

.btn-danger {
  border: none;
  border-radius: 13px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: var(--warn);
  color: #fff;
}

.pill {
  flex: none;
  padding: 6px 11px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.pill.on {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}

/* --------------------------------------------------------------- forms */

.field {
  display: block;
  margin-top: 13px;
}
.field label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field textarea {
  width: 100%;
  margin-top: 7px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  background: #fff;
  color: var(--ink);
}
.field input:focus, .field textarea:focus {
  outline: 2px solid var(--navy);
  outline-offset: -1px;
}

/* ---------------------------------------------------------------- home */

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}
.avatar {
  width: 38px; height: 38px; border-radius: 99px;
  background: var(--lime); color: var(--moss);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; cursor: pointer; border: none; flex: none;
}

.scan-cta {
  width: calc(100% - 40px);
  margin: 18px 20px 0;
  padding: 20px;
  border: none;
  border-radius: 18px;
  background: var(--navy);
  color: #fff;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
}
.scan-cta:active { background: var(--navy-pressed); }
.scan-cta .ic {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(232,240,217,.2);
  display: flex; align-items: center; justify-content: center; flex: none;
}

.search-shortcut {
  width: calc(100% - 40px);
  margin: 10px 20px 0;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: #fff;
  cursor: pointer; text-align: left; color: var(--muted); font-size: 15px;
}

/* -------------------------------------------------------------- lists */

.list-flat {
  background: #fff;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.row-item {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  border: none; border-bottom: 1px solid var(--line-soft);
  background: #fff; text-align: left; cursor: pointer;
}
.row-item:last-child { border-bottom: none; }
.row-item:active { background: #faf9f6; }

.thumb {
  border-radius: 9px; background: #eceae4;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #98a4ae; flex: none;
}

.chip-qty {
  padding: 2px 7px; border-radius: 6px; background: var(--bg);
  font-size: 11.5px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- sheet */

.overlay {
  position: absolute; inset: 0; z-index: 90;
  background: rgba(11,17,22,.45);
  display: flex; align-items: flex-end;
}
.overlay.center { align-items: center; justify-content: center; padding: 26px; }
.sheet {
  width: 100%; background: #fff; border-radius: 22px 22px 0 0;
  padding: 18px 20px 34px; animation: rise .22s ease-out;
  max-height: 86vh; overflow-y: auto;
}
.sheet-grip {
  width: 38px; height: 4px; border-radius: 99px;
  background: rgba(15,26,36,.18); margin: 0 auto 14px;
}
.pop-card {
  width: 100%; background: #fff; border-radius: 20px; padding: 20px;
  animation: pop .18s ease-out;
}

@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes scanline { 0% { top: 8%; } 50% { top: 88%; } 100% { top: 8%; } }

/* -------------------------------------------------------------- toast */

.toast {
  position: absolute; left: 16px; right: 16px; bottom: 96px; z-index: 95;
  padding: 13px 15px; border-radius: 14px; background: var(--moss); color: var(--lime);
  font-size: 13.5px; font-weight: 600; box-shadow: 0 12px 30px rgba(11,17,22,.3);
  animation: pop .2s ease-out; text-align: center;
}

/* ------------------------------------------------------------- tabbar */

.tabbar {
  position: sticky; bottom: 0; left: 0; right: 0; z-index: 70;
  padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 10px);
  background: rgba(246,245,241,.94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-soft);
  display: flex; align-items: center;
}
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 0; border: none; background: transparent; cursor: pointer; color: var(--muted);
}
.tabbar .tab-ic {
  width: 26px; height: 26px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
}
.tabbar .tab-label { font-size: 10.5px; font-weight: 700; }
.tabbar .tab-ic.active { background: var(--lime); }
.tabbar .tab-ic.scan { background: var(--navy); }

/* ------------------------------------------------------------- scroll */

.scroll-body {
  padding-bottom: 100px;
  overflow-y: auto;
}

.section-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}

.card-block {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
}

/* --------------------------------------------------------- login/scan */

.login-hero {
  min-height: 100vh;
  padding: 64px 26px 46px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy) 40%, var(--bg) 40%, var(--bg) 100%);
}
@media (min-width: 540px) { .login-hero { min-height: calc(100vh - 48px); } }

.scan-overlay {
  position: absolute; inset: 0; z-index: 88; background: #0b1116;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px;
}
.scan-frame {
  position: relative; width: 250px; height: 180px; border-radius: 16px; overflow: hidden;
  background: #16232c; box-shadow: 0 0 0 2px rgba(232,240,217,.35);
}
.scan-frame .line {
  position: absolute; left: 0; right: 0; height: 2px; background: var(--lime);
  box-shadow: 0 0 12px var(--lime); animation: scanline 1.1s linear infinite;
}

/* -------------------------------------------------------------- admin */

.admin-sheet .list { display: grid; gap: 10px; margin-top: 10px; }
.mini-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff;
}

/* ---------------------------------------------------------- scrollbar */

::-webkit-scrollbar { width: 0; height: 0; }
