/* Cash Manager – Vanilla CSS (no Tailwind)
   This file replaces the Tailwind CDN usage in index.html. */

/* ---------- Base ---------- */
:root{
  --bg-top: #f8fafc;      /* slate-50 */
  --text: #0f172a;        /* slate-900 */
  --muted: #475569;       /* slate-600 */
  --border: rgba(148,163,184,.45); /* slate-200-ish */
  --panel: rgba(255,255,255,.78);
  --panel-solid: #ffffff;
  --shadow-soft: 0 14px 40px rgba(15,23,42,0.10);
  --shadow-softer: 0 22px 60px rgba(15,23,42,0.16);
  --radius-lg: 16px;
  --radius-xl: 20px;
  --accent-green: #22c55e; /* emerald-500 */
  --accent-amber: #d97706; /* amber-600 */
  --accent-purple: #7c3aed; /* purple-600 */
  --accent-green-soft: rgba(34,197,94,.12);
  --accent-amber-soft: rgba(217,119,6,.12);
  --accent-purple-soft: rgba(124,58,237,.12);

  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(to bottom, var(--bg-top), #fff 45%, #fff 100%);
}

a{ color: inherit; text-decoration: none; }
button{ font-family: inherit; }

.hidden{ display: none !important; }

.container{
  max-width: 1024px; /* ~ Tailwind max-w-5xl */
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* ---------- Topbar ---------- */
.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: var(--safe-top);
  border-bottom: 1px solid rgba(226,232,240,.9);
  background: rgba(255,255,255,.78);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.topbar-inner{
  padding-top: 12px;
  padding-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Buttons ---------- */
.btn{
  appearance: none;
  border: 1px solid rgba(226,232,240,.95);
  background: rgba(255,255,255,.86);
  color: #1e293b;
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 1px 0 rgba(15,23,42,.02), 0 6px 18px rgba(15,23,42,.06);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn:hover{
  background: rgba(255,255,255,.96);
  box-shadow: 0 1px 0 rgba(15,23,42,.02), 0 10px 22px rgba(15,23,42,.10);
  transform: translateY(-1px);
}

.btn:active{
  transform: translateY(0);
  box-shadow: 0 1px 0 rgba(15,23,42,.02), 0 6px 18px rgba(15,23,42,.06);
}

.btn.pill{ padding: 10px 14px; }
.btn.logout{ padding: 10px 14px; }
.btn.verify{
  padding: 10px 14px;
  font-weight: 600;
}

/* Vertical divider inside logout button */
.divider-vert{
  width: 1px;
  height: 20px;
  background: rgba(226,232,240,.9);
}

/* ---------- Status pill ---------- */
.status-pill{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

/* ---------- Panels ---------- */
.panel{
  border: 1px solid rgba(226,232,240,.9);
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

/* ---------- Hero ---------- */
.hero{ padding-top: 12px; }
.hero-row{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.hero-title{
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.hero-subtitle{
  margin: 6px 0 0 0;
  font-size: 14px;
  color: var(--muted);
}

.badge-row{
  display: none;
  gap: 8px;
  align-items: center;
  color: #64748b;
  font-size: 12px;
}
.badge{
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(226,232,240,.9);
  background: rgba(255,255,255,.74);
}

@media (min-width: 640px){
  .hero-title{ font-size: 22px; }
  .badge-row{ display: inline-flex; }
}

/* ---------- Main grid cards ---------- */
.main-grid{
  padding-top: 12px;
  padding-bottom: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 640px){
  .main-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px){
  .main-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.card-link{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(226,232,240,.9);
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease, box-shadow .15s ease;
}

.card-link:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow-softer);
}

.card-title{
  font-weight: 700;
}

/* Icon chips */
.icon-chip{
  display: grid;
  place-items: center;
  height: 50px;
  width: 50px;
  border-radius: 12px;
  border: 1px solid rgba(226,232,240,.9);
  font-size: 25px; /* Material icons size */
}

.icon-blue{
  border-color: rgba(191,219,254,.9);
  background: rgba(239,246,255,.9);
  color: #2563eb;
}
.icon-emerald{
  border-color: rgba(167,243,208,.9);
  background: rgba(236,253,245,.9);
  color: #047857;
}
.icon-amber{
  border-color: rgba(253,230,138,.9);
  background: rgba(255,251,235,.9);
  color: #b45309;
}
.icon-purple{
  border-color: rgba(196,181,253,.9);
  background: rgba(243,232,255,.9);
  color: #7c3aed;
}

/* Admin divider line */
.admin-divider{ grid-column: 1 / -1; }
.divider-h{
  height: 1px;
  width: 100%;
  background: rgba(226,232,240,.9);
}

/* ---------- Versions panel ---------- */
.versions{ padding-bottom: 32px; }

.panel-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-kicker{
  margin: 0;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #334155;
}

.version-list{
  list-style: none;
  padding: 0;
  margin: 12px 0 0 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.version-item{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.9);
  background: rgba(255,255,255,.84);
}

.verify-out{
  margin-top: 16px;
  font-size: 14px;
  color: #475569;
  overflow-x: auto;
}

/* ---------- Connection pill dot helpers (your JS toggles these) ---------- */
.status-dot{
  width: .55rem;
  height: .55rem;
  border-radius: 999px;
  background: #94a3b8; /* slate-400 */
  box-shadow: 0 0 0 3px rgba(148,163,184,.20);
}

/* Your JS toggles these on #connectionStatus */
#connectionStatus.is-online .status-dot{
  background: #22c55e; /* green-500 */
  box-shadow: 0 0 0 3px rgba(34,197,94,.18);
}
#connectionStatus.is-offline .status-dot{
  background: #ef4444; /* red-500 */
  box-shadow: 0 0 0 3px rgba(239,68,68,.18);
}

/* Optional: when syncing/queue exists */
#connectionStatus.is-syncing .status-dot{
  background: #f59e0b; /* amber-500 */
  box-shadow: 0 0 0 3px rgba(245,158,11,.18);
}

/* ---------- Auth (login.html) ---------- */
.auth-page{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px 14px;
}
.auth-shell{
  width: min(980px, 100%);
}
.auth-card{
  width: min(460px, 100%);
  margin: 0 auto;
  border-radius: 18px;
  background: rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 44px rgba(15,23,42,.10);
  border: 1px solid rgba(226,232,240,.9);
  padding: 22px;
}
.auth-logo{
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(226,232,240,.9);
}
.auth-logo img{ width: 100%; height: 100%; object-fit: cover; }
.auth-title{
  margin: 12px 0 0 0;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.auth-subtitle{
  margin: 8px 0 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.auth-error{
  margin: 12px 0 0 0;
  color: #b91c1c;
  font-size: 13px;
  min-height: 18px;
}
.auth-form{ margin-top: 14px; display: grid; gap: 0px; }
.auth-form .row{ display: grid; gap: 10px; }
.auth-form input{
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.95);
  background: rgba(255,255,255,.92);
  font: inherit;
  font-size: 14px;
}
.auth-actions button{
  width: 100%;
  justify-content: center;
  border-radius: 999px;
  padding: 14px 14px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  border: 1px solid rgba(226,232,240,.95);
  background: rgba(255,255,255,.92);
  transition: transform .15s ease, filter .15s ease, background .15s ease;
}
.auth-actions button:hover{ transform: translateY(-1px); }
.auth-actions button:active{ transform: translateY(0); filter: brightness(.98); }

/* Primary: Continue with Google */
#btn-google{
  border: 0;
  background: var(--accent-green);
  color: #ffffff;
  box-shadow: 0 14px 32px rgba(34,197,94,.22);
}
#btn-google:hover{ filter: brightness(.98); }
#btn-google:active{ filter: brightness(.96); }

/* Secondary: Email */
#btn-email-login{
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(226,232,240,.95);
  color: #0f172a;
}

.auth-hint{
  margin: 12px 0 0 0;
  color: rgba(15,23,42,.60);
  font-size: 12px;
  line-height: 1.35;
}

/* Inline status pill (topbar) */
.status-pill-inline{
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34,197,94,.12);
  border: 1px solid rgba(34,197,94,.18);
  color: rgba(15,23,42,.85);
  font-size: 14px;
}
.status-dot{
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #94a3b8;
}

/* ======================================================================
   iOS PWA blur downgrade (perf)
   ====================================================================== */
body.ios .topbar,
body.ios .panel{
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  background: rgba(255,255,255,.92) !important;
}
