/* K2K — Google Pay inspired theme */
:root {
  --k2k-blue: #1a73e8;
  --k2k-blue-dark: #1557b0;
  --k2k-blue-light: #e8f0fe;
  --k2k-green: #1e8e3e;
  --k2k-green-light: #e6f4ea;
  --k2k-red: #d93025;
  --k2k-red-light: #fce8e6;
  --k2k-yellow: #f9ab00;
  --k2k-gray-900: #202124;
  --k2k-gray-700: #3c4043;
  --k2k-gray-500: #5f6368;
  --k2k-gray-300: #dadce0;
  --k2k-gray-100: #f1f3f4;
  --k2k-gray-50: #f8f9fa;
  --k2k-white: #ffffff;
  --k2k-bg: #ffffff;
  --k2k-surface: #ffffff;
  --k2k-surface-2: #f8f9fa;
  --k2k-text: #202124;
  --k2k-text-muted: #5f6368;
  --k2k-border: #dadce0;
  --k2k-shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.08), 0 1px 3px 1px rgba(60, 64, 67, 0.06);
  --k2k-shadow-md: 0 1px 3px 0 rgba(60, 64, 67, 0.1), 0 4px 8px 3px rgba(60, 64, 67, 0.08);
  --k2k-shadow-lg: 0 2px 6px 2px rgba(60, 64, 67, 0.1), 0 8px 24px 4px rgba(60, 64, 67, 0.1);
  --k2k-radius-sm: 8px;
  --k2k-radius: 16px;
  --k2k-radius-lg: 24px;
  --k2k-radius-full: 999px;
  --k2k-font: 'Google Sans', 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --k2k-font-display: 'Google Sans', 'Roboto', sans-serif;
}

[data-theme="dark"] {
  --k2k-bg: #202124;
  --k2k-surface: #292a2d;
  --k2k-surface-2: #35363a;
  --k2k-text: #e8eaed;
  --k2k-text-muted: #9aa0a6;
  --k2k-border: #3c4043;
  --k2k-blue-light: #1a3559;
  --k2k-green-light: #1e3a24;
  --k2k-red-light: #4a1d1b;
  --k2k-gray-50: #292a2d;
  --k2k-gray-100: #35363a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--k2k-font);
  background: var(--k2k-bg);
  color: var(--k2k-text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--k2k-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--k2k-font-display); margin: 0 0 12px; font-weight: 500; color: var(--k2k-text); }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
p { margin: 0 0 12px; color: var(--k2k-text); }
small, .muted { color: var(--k2k-text-muted); font-size: 13px; }

/* Layout */
.k2k-app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--k2k-bg);
  position: relative;
  padding-bottom: 96px;
}

.k2k-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--k2k-bg);
  border-bottom: 1px solid var(--k2k-border);
}
.k2k-topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--k2k-font-display);
  font-weight: 600; font-size: 18px;
}
.k2k-topbar .brand .logo {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, #4285f4, #34a853, #fbbc04, #ea4335);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
}
.k2k-topbar .icon-btn {
  background: transparent; border: 0; padding: 8px; border-radius: 999px;
  cursor: pointer; color: var(--k2k-gray-700);
}
.k2k-topbar .icon-btn:hover { background: var(--k2k-gray-100); }

/* Sidebar */
.k2k-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 300px; height: 100%;
  background: var(--k2k-surface);
  box-shadow: var(--k2k-shadow-lg);
  z-index: 60;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  display: flex; flex-direction: column;
}
.k2k-sidebar.open { transform: translateX(0); }
.k2k-sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.3);
  z-index: 55; display: none;
}
.k2k-sidebar-backdrop.show { display: block; }
.k2k-sidebar .head { padding: 20px; border-bottom: 1px solid var(--k2k-border); display: flex; align-items: center; justify-content: space-between; }
.k2k-sidebar .nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.k2k-sidebar .nav a {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; color: var(--k2k-text); text-decoration: none; font-weight: 500;
}
.k2k-sidebar .nav a:hover { background: var(--k2k-gray-100); text-decoration: none; }
.k2k-sidebar .nav a .material-symbols-outlined { color: var(--k2k-blue); }
.k2k-sidebar .footer { border-top: 1px solid var(--k2k-border); padding: 16px 20px; }
.k2k-sidebar .footer small { color: var(--k2k-text-muted); }

/* Bottom nav */
.k2k-bottom {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: var(--k2k-surface);
  border-top: 1px solid var(--k2k-border);
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  z-index: 30;
}
.k2k-bottom .btn-pill {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--k2k-radius-full);
  background: var(--k2k-surface-2);
  border: 1px solid var(--k2k-border);
  font-weight: 500; color: var(--k2k-text); font-size: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none;
}
.k2k-bottom .btn-pill:hover { background: var(--k2k-gray-100); text-decoration: none; }
.k2k-bottom .scan {
  flex: 0;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--k2k-blue); color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--k2k-shadow-md);
  margin-top: -28px;
  border: 0; cursor: pointer; text-decoration: none;
}

/* Page container */
.k2k-page { padding: 20px; }

/* Cards */
.card {
  background: var(--k2k-surface);
  border: 1px solid var(--k2k-border);
  border-radius: var(--k2k-radius);
  padding: 20px;
  box-shadow: var(--k2k-shadow-sm);
}
.card + .card { margin-top: 16px; }

/* Balance block */
.balance-block { text-align: center; padding: 24px 16px 8px; }
.balance-block .price-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px; background: var(--k2k-green-light); color: var(--k2k-green);
  font-size: 13px; font-weight: 500; margin-bottom: 16px;
}
.balance-block .price-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--k2k-green); }
.balance-block .label { color: var(--k2k-text-muted); font-size: 14px; margin-bottom: 4px; }
.balance-block .amount { font-family: var(--k2k-font-display); font-size: 40px; font-weight: 500; line-height: 1.1; }
.balance-block .inr { color: var(--k2k-text-muted); margin-top: 6px; font-size: 14px; }

/* Quick actions (4 circles) */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 24px 0; }
.quick-actions a {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 4px; border-radius: var(--k2k-radius); text-decoration: none; color: var(--k2k-text);
  transition: background 0.15s;
}
.quick-actions a:hover { background: var(--k2k-gray-100); text-decoration: none; }
.quick-actions .ico {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--k2k-blue-light); color: var(--k2k-blue);
  display: flex; align-items: center; justify-content: center;
}
.quick-actions .lbl { font-size: 12px; font-weight: 500; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--k2k-radius-full);
  border: 0; cursor: pointer; font-weight: 500; font-size: 14px;
  font-family: inherit; text-decoration: none;
}
.btn-primary { background: var(--k2k-blue); color: white; }
.btn-primary:hover { background: var(--k2k-blue-dark); text-decoration: none; }
.btn-primary:disabled { background: var(--k2k-gray-300); cursor: not-allowed; }
.btn-secondary { background: var(--k2k-blue-light); color: var(--k2k-blue); }
.btn-secondary:hover { background: #d2e3fc; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--k2k-blue); }
.btn-ghost:hover { background: var(--k2k-blue-light); text-decoration: none; }
.btn-danger { background: var(--k2k-red); color: white; }
.btn-block { width: 100%; padding: 14px 20px; font-size: 15px; }

/* Inputs */
.input-field {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--k2k-border);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--k2k-surface);
  color: var(--k2k-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-field:focus { border-color: var(--k2k-blue); box-shadow: 0 0 0 3px var(--k2k-blue-light); }
.input-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 500; color: var(--k2k-text-muted); }
.input-group { margin-bottom: 16px; }

/* Limits card */
.limits-card { margin-top: 20px; }
.limits-card .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.limits-card .stat { padding: 12px; background: var(--k2k-surface-2); border-radius: 12px; }
.limits-card .stat .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--k2k-blue-light); color: var(--k2k-blue); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.limits-card .stat .lbl { color: var(--k2k-text-muted); font-size: 12px; }
.limits-card .stat .val { font-size: 22px; font-weight: 500; font-family: var(--k2k-font-display); }

/* Transaction row */
.tx-list { display: flex; flex-direction: column; }
.tx-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--k2k-border); }
.tx-row:last-child { border-bottom: 0; }
.tx-row .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--k2k-blue-light); color: var(--k2k-blue); display: flex; align-items: center; justify-content: center; font-weight: 500; }
.tx-row .info { flex: 1; min-width: 0; }
.tx-row .info .t1 { font-weight: 500; color: var(--k2k-text); }
.tx-row .info .t2 { color: var(--k2k-text-muted); font-size: 13px; margin-top: 2px; }
.tx-row .amount { font-weight: 500; font-family: var(--k2k-font-display); }
.tx-row .amount.pos { color: var(--k2k-green); }
.tx-row .amount.neg { color: var(--k2k-red); }

/* Demo banner */
.demo-badge {
  position: fixed; top: 10px; right: 10px;
  background: var(--k2k-yellow); color: #000;
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  z-index: 100; letter-spacing: 0.5px;
}

/* Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--k2k-text-muted); }
.text-sm { font-size: 13px; }
.text-lg { font-size: 17px; }
.font-medium { font-weight: 500; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--k2k-border); margin: 16px 0; }

/* Scanner overlay */
.scanner-overlay {
  position: fixed; inset: 0; background: #000;
  display: flex; flex-direction: column; z-index: 100;
}
.scanner-overlay .box {
  width: 260px; height: 260px; border: 3px solid var(--k2k-blue);
  border-radius: 24px; margin: auto;
}

/* Auth page specific */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--k2k-surface-2);
}
.auth-card {
  background: var(--k2k-surface);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 400px; width: 100%;
  box-shadow: var(--k2k-shadow-lg);
}
.auth-card .logo-xl {
  width: 64px; height: 64px; border-radius: 20px;
  background: linear-gradient(135deg, #4285f4, #34a853, #fbbc04, #ea4335);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 24px;
  margin: 0 auto 20px;
}

/* Promo carousel */
.promo {
  background: linear-gradient(135deg, #1a73e8, #174ea6);
  color: white; border-radius: var(--k2k-radius);
  padding: 20px; margin: 20px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.promo .p-text strong { display: block; font-size: 17px; margin-bottom: 4px; }
.promo .p-text small { color: rgba(255,255,255,0.85); }
.promo .btn { background: rgba(255,255,255,0.2); color: white; backdrop-filter: blur(4px); }

/* Toast */
.k2k-toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--k2k-gray-900); color: white;
  padding: 12px 20px; border-radius: var(--k2k-radius-full);
  font-size: 14px; z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.k2k-toast.show { opacity: 1; }

/* Dialog */
.k2k-dialog-back { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: flex-end; z-index: 80; }
.k2k-dialog-back.show { display: flex; }
.k2k-dialog {
  background: var(--k2k-surface); width: 100%; max-width: 480px; margin: 0 auto;
  border-radius: 24px 24px 0 0; padding: 24px; box-shadow: var(--k2k-shadow-lg);
}

/* OTP inputs */
.otp-group { display: flex; gap: 10px; justify-content: center; margin: 24px 0; }
.otp-group input {
  width: 48px; height: 56px; text-align: center; font-size: 22px;
  border: 1px solid var(--k2k-border); border-radius: 12px; background: var(--k2k-surface); color: var(--k2k-text);
}
.otp-group input:focus { border-color: var(--k2k-blue); outline: none; box-shadow: 0 0 0 3px var(--k2k-blue-light); }

/* QR placeholder */
.qr-box { width: 220px; height: 220px; margin: 20px auto; border: 1px solid var(--k2k-border); border-radius: 16px; padding: 12px; background: white; }
.qr-box canvas, .qr-box img { width: 100%; height: 100%; object-fit: contain; }

/* Merchant/amount large */
.amount-big { text-align: center; padding: 16px 0; }
.amount-big .cur { font-size: 28px; color: var(--k2k-text-muted); }
.amount-big .val { font-size: 56px; font-weight: 500; font-family: var(--k2k-font-display); letter-spacing: -1px; }

/* Keypad */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 24px; }
.keypad button {
  padding: 18px; font-size: 22px; font-weight: 500;
  background: transparent; border: 0; border-radius: 12px; cursor: pointer;
  color: var(--k2k-text); font-family: var(--k2k-font-display);
}
.keypad button:hover { background: var(--k2k-gray-100); }
