/* ============================================================
   EcoCredit NG — mobile-native layer
   Thumb-reachable navigation, comfortable touch targets,
   and sheets instead of browser dialogs.
   ============================================================ */

/* ---------- BOTTOM TAB BAR ---------- */
.tabbar{
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex;
  background: rgba(11,23,20,0.96);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line-2);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a{
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  padding: 9px 4px 8px;
  min-height: 56px;                 /* comfortable thumb target */
  color: var(--ink-3);
  font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.tabbar a .ic{ font-size: 19px; line-height: 1; }
.tabbar a.on{ color: var(--green); }
.tabbar a:active{ background: rgba(108,200,163,0.08); }
.tabbar a .badge{
  position: absolute; transform: translate(14px,-8px);
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700; line-height: 1;
  padding: 3px 5px; border-radius: 999px;
}
body{ padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
@media (min-width: 900px){
  .tabbar{ display: none; }
  body{ padding-bottom: 60px; }
}

/* ---------- BALANCE CARD ---------- */
.bal-card{
  background: linear-gradient(158deg, rgba(31,122,94,0.4), rgba(18,43,35,0.9));
  border-color: rgba(108,200,163,0.32);
}
.quick{ display: flex; gap: 9px; margin-top: 18px; }
.quick-b{
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 13px 6px;
  min-height: 62px;
  background: rgba(11,23,20,0.5);
  border: 1px solid var(--line-2); border-radius: 13px;
  color: var(--ink); font-size: 12.5px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, transform .12s;
}
.quick-b span{ font-size: 17px; line-height: 1; }
.quick-b:active{ transform: scale(.97); border-color: var(--green); }

/* ---------- AMOUNT INPUT ---------- */
.amt-wrap{ position: relative; margin-bottom: 6px; }
.amt-cur{
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  font-size: 25px; font-weight: 700; color: var(--ink-3); pointer-events: none;
}
.amt-wrap input{
  font-size: 30px; font-weight: 700; letter-spacing: -.02em;
  padding: 16px 14px 16px 42px; margin-bottom: 0;
  font-variant-numeric: tabular-nums;
}
.chips{ display: flex; gap: 7px; flex-wrap: wrap; margin: 10px 0 16px; }
.chip{
  background: transparent; border: 1px solid var(--line-2); color: var(--ink-2);
  border-radius: 999px; padding: 8px 14px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; min-height: 36px;
  -webkit-tap-highlight-color: transparent;
}
.chip:active{ background: var(--green); color: #06140F; border-color: var(--green); }

/* ---------- FEE BREAKDOWN ---------- */
.bd{
  background: rgba(11,23,20,0.55);
  border: 1px solid var(--line-2); border-radius: 13px;
  padding: 14px 16px; margin: 4px 0 6px;
}
.bd-row{
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 7px 0; font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}
.bd-row span:first-child{ color: var(--ink-2); }
.bd-fee span:last-child{ color: var(--amber); }
.bd-free span:last-child{ color: var(--green-2); font-weight: 600; }
.bd-pct{
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px;
  color: var(--ink-3); border: 1px solid var(--line-2);
  border-radius: 999px; padding: 2px 6px; margin-left: 6px;
}
.bd-total{
  border-top: 1px solid var(--line-2); margin-top: 5px; padding-top: 12px;
  font-size: 17px; font-weight: 700;
}
.bd-total span:first-child{ color: var(--ink); }
.bd-total span:last-child{ color: var(--green-2); }
.bd-note{
  font-size: 12px; color: var(--ink-3); margin-top: 10px;
  padding-top: 10px; border-top: 1px dashed var(--line);
  line-height: 1.5;
}

/* ---------- ACTIVITY ROWS ---------- */
.act{
  display: flex; align-items: center; gap: 13px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.act:last-child{ border-bottom: none; }
.act-ic{
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; border: 1px solid var(--line-2);
}
.act-ic.in{ color: var(--green-2); background: rgba(31,122,94,0.2); border-color: var(--green-deep); }
.act-ic.out{ color: var(--ink-2); background: rgba(240,235,222,0.05); }
.act-mid{ flex: 1; min-width: 0; }
.act-t{ font-size: 14.5px; font-weight: 600; }
.act-s{ font-size: 12px; color: var(--ink-3); margin-top: 2px;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-amt{ text-align: right; flex: none; font-weight: 700; font-size: 14.5px;
          font-variant-numeric: tabular-nums; }
.act-amt.in{ color: var(--green-2); }
.act-amt.out{ color: var(--ink); }
.act-bal{ font-size: 11px; color: var(--ink-3); font-weight: 500; margin-top: 2px; }

/* ---------- PAYEE ---------- */
.payee{
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; margin: 0 0 16px;
  border: 1px solid var(--green-deep); border-radius: 13px;
  background: rgba(31,122,94,0.14);
}
.payee-av{
  width: 42px; height: 42px; flex: none; border-radius: 50%;
  background: var(--green-deep); color: var(--green-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px;
}
.payee-nm{ font-weight: 600; font-size: 15px; }
.payee-sub{ font-size: 12.5px; color: var(--ink-3); margin-top: 2px; text-transform: capitalize; }
.sh-payee{
  padding: 12px 14px; border-radius: 12px; margin-bottom: 12px;
  background: rgba(11,23,20,0.5); border: 1px solid var(--line-2);
}

/* An element carrying the hidden attribute must NEVER render, even when a
   class sets `display`. A class selector outranks the browser's own
   [hidden]{display:none}, so without this the confirm sheet below stayed
   in the layout at opacity 0 — an invisible full-screen layer that
   swallowed every tap on the page, including the tab bar beneath it. */
[hidden]{ display: none !important; }

/* ---------- BOTTOM SHEET ---------- */
.sheet{
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.62);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .22s;
  pointer-events: none;          /* belt and braces: cannot catch taps unless shown */
}
.sheet.show{ opacity: 1; pointer-events: auto; }
.sheet-box{
  width: 100%; max-width: 480px;
  background: var(--bg-2);
  border: 1px solid var(--line-2); border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(18px); transition: transform .22s;
  max-height: 88vh; overflow-y: auto;
}
.sheet.show .sheet-box{ transform: translateY(0); }
.sheet-grab{
  width: 40px; height: 4px; border-radius: 999px;
  background: var(--line-2); margin: 4px auto 16px;
}
.sheet-box h3{ font-size: 19px; margin-bottom: 14px; }
@media (min-width: 560px){
  .sheet{ align-items: center; }
  .sheet-box{ border-radius: 22px; border-bottom: 1px solid var(--line-2); padding-bottom: 24px; }
}

/* ---------- OFFLINE / INSTALL ---------- */
.netbar{
  position: fixed; left: 0; right: 0; top: 0; z-index: 90;
  background: var(--amber); color: #241703;
  font-size: 13px; font-weight: 600; text-align: center;
  padding: 8px 12px; transform: translateY(-100%); transition: transform .25s;
}
.netbar.show{ transform: translateY(0); }
.installbar{
  position: fixed; left: 12px; right: 12px; z-index: 70;
  bottom: calc(74px + env(safe-area-inset-bottom));
  display: none; align-items: center; gap: 12px;
  background: var(--bg-3); border: 1px solid var(--green-deep);
  border-radius: 15px; padding: 13px 15px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.installbar.show{ display: flex; }
.installbar .txt{ flex: 1; font-size: 13.5px; line-height: 1.4; }
.installbar .txt b{ display: block; margin-bottom: 2px; }
.installbar button{
  flex: none; border: none; border-radius: 10px; cursor: pointer;
  padding: 10px 14px; font-size: 13px; font-weight: 700;
  background: var(--green); color: #06140F;
}
.installbar .no{ background: transparent; color: var(--ink-3); padding: 10px 6px; }

/* ---------- TOUCH COMFORT ---------- */
@media (max-width: 900px){
  input, select, textarea{
    font-size: 16px;              /* stops iOS zooming the page on focus */
    padding: 15px 14px;
    min-height: 52px;
  }
  .btn{ min-height: 54px; font-size: 16px; }
  .tab{ min-height: 40px; padding: 9px 16px; }
  .linkbtn{ min-height: 40px; padding: 0 6px; }
  .wrap{ padding: 0 16px; }
  .card{ padding: 18px 16px; border-radius: 18px; }
  .balance{ font-size: 44px; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .sheet, .sheet-box, .netbar, .quick-b{ transition: none; }
}
.hidden{ display: none !important; }
