@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --app-w: 100%;
  --radius: 1rem;
  /* Slightly cooler page bg so white cards separate clearly */
  --background: #eef2f6;
  --foreground: #102a43;
  --card: #ffffff;
  --card-foreground: #102a43;
  --primary: #10b981;
  --primary-foreground: #ffffff;
  --secondary: #e8eef5;
  --muted: #e8eef5;
  --muted-foreground: #475569;
  --accent: #ecfdf5;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --border: #c5d0dc;
  --navy: #102a43;
  --navy-foreground: #f8fafc;
  --navy-soft: #243b53;
  --success-dark: #047857;
  --success-soft: #d1fae5;
  --gold: #f5b942;
  --gold-soft: #fef9c3;
  --warning-soft: #fef3c7;
  --danger-soft: #fee2e2;
  --info: #3b82f6;
  --info-soft: #dbeafe;
  --chart-1: #10b981;
  --chart-2: #102a43;
  --chart-3: #f5b942;
  --shadow-card: 0 1px 2px rgb(16 42 67 / 6%), 0 8px 24px -10px rgb(16 42 67 / 14%);
  --header-bg: rgb(238 242 246 / 95%);
  --tabbar-bg: rgb(255 255 255 / 96%);
  --input-bg: #ffffff;
  --placeholder: #94a3b8;
  --sidebar: #102a43;
  --sidebar-foreground: #e2e8f0;
  --sidebar-accent: #243b53;
  --sidebar-accent-foreground: #ffffff;
  --sidebar-border: #334e68;
  --sidebar-primary: #10b981;
  --chrome: #07111b;
}

html.dark {
  --background: #0b1520;
  --foreground: #e8eef5;
  --card: #132033;
  --card-foreground: #e8eef5;
  --primary: #10b981;
  --primary-foreground: #ffffff;
  --secondary: #1a2a3d;
  --muted: #1a2a3d;
  --muted-foreground: #b6c4d6;
  --accent: #0f2f28;
  --destructive: #f87171;
  --destructive-foreground: #ffffff;
  --border: #2f4258;
  /* text-navy → light; bg-navy overridden below to keep brand surfaces */
  --navy: #e8eef5;
  --navy-foreground: #f8fafc;
  --navy-soft: #243b53;
  --navy-surface: #102a43;
  --success-dark: #6ee7b7;
  --success-soft: #0f2f28;
  --gold: #f5b942;
  --gold-soft: #3a2f12;
  --warning-soft: #3a2f12;
  --danger-soft: #3f1d1d;
  --info: #60a5fa;
  --info-soft: #172554;
  --chart-1: #10b981;
  --chart-2: #94a3b8;
  --chart-3: #f5b942;
  --shadow-card: 0 1px 2px rgb(0 0 0 / 25%), 0 8px 24px -8px rgb(0 0 0 / 45%);
  --header-bg: rgb(11 21 32 / 92%);
  --tabbar-bg: rgb(19 32 51 / 92%);
  --input-bg: #0f1c2b;
  --placeholder: #8fa3b8;
  --sidebar: #07111b;
  --sidebar-foreground: #e2e8f0;
  --sidebar-accent: #132033;
  --sidebar-accent-foreground: #ffffff;
  --sidebar-border: #243447;
  --sidebar-primary: #10b981;
  --chrome: #03070c;
}

html {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.dark {
  color-scheme: dark;
}

/* Keep navy surfaces (salio card, welcome, avatars) brand-dark in dark mode */
html.dark .bg-navy {
  background-color: var(--navy-surface) !important;
}
html.dark .text-navy-foreground {
  color: #f8fafc !important;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  margin: 0;
  min-height: 100dvh;
  touch-action: manipulation;
  font-feature-settings: "cv11", "ss01";
}

@media (min-width: 520px) {
  :root {
    --app-w: 430px;
  }
  /* Match React phone chrome — beat .bg-background !important */
  html:has(#app-phone),
  body:has(#app-phone) {
    background: var(--chrome) !important;
  }
  #app-phone {
    width: var(--app-w);
    margin-inline: auto;
    min-height: 100dvh;
    background: var(--background);
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.08),
      18px 0 50px rgba(0, 0, 0, 0.38),
      -18px 0 50px rgba(0, 0, 0, 0.38);
  }
}

.wk-logo-mark-only > span {
  display: none;
}

.wk-app-shell {
  display: flex;
  min-height: 100svh;
  background: var(--background);
}

.wk-app-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.wk-app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

* {
  -webkit-tap-highlight-color: transparent;
}

input, select, textarea, button {
  font-size: 16px;
  touch-action: manipulation;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

.card-surface {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.125rem;
  box-shadow: var(--shadow-card);
}

/* Light mode: clearer card edge + inset panels don't melt into the page */
html:not(.dark) .card-surface {
  border-color: #b8c5d4;
  box-shadow:
    0 0 0 1px rgb(16 42 67 / 3%),
    0 1px 2px rgb(16 42 67 / 5%),
    0 10px 28px -12px rgb(16 42 67 / 16%);
}

html:not(.dark) .wk-input,
html:not(.dark) .wk-pin-slot,
html:not(.dark) .wk-pin-toggle {
  border-color: #b8c5d4;
}

html:not(.dark) .wk-btn-outline {
  border-color: #b8c5d4;
}

.wk-input {
  width: 100%;
  height: 3rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0 0.875rem;
  font-size: 16px;
  background: var(--input-bg);
  box-sizing: border-box;
  color: var(--foreground);
  text-align: left;
}

.wk-input::placeholder {
  color: var(--placeholder);
  text-align: left;
  opacity: 1;
}

.wk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0 1rem;
  height: 2.5rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.wk-btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.wk-btn-navy {
  background: var(--navy);
  color: var(--navy-foreground);
}

/* Dark: --navy is light (for text); keep navy buttons brand-dark + white label */
html.dark .wk-btn-navy {
  background: var(--navy-surface, #102a43);
  color: #ffffff;
}

.wk-btn-outline {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--navy);
}

.wk-pin {
  letter-spacing: 0.35em;
  text-align: center;
  font-size: 1.25rem;
}

.wk-pin-slots {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--wk-pin-cols, 4), minmax(0, 1fr));
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.wk-pin-slot {
  display: grid;
  place-items: center;
  width: 100%;
  height: 3rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--input-bg);
  color: var(--foreground);
  text-align: center;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.wk-pin-slot.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}

.wk-pin-capture {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0.02;
  color: transparent;
  caret-color: transparent;
  background: transparent;
  font-size: 16px;
  letter-spacing: 2.5em;
  outline: none;
}

.wk-pin-toggle {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--input-bg);
  color: var(--muted-foreground);
  cursor: pointer;
}

.wk-pin-toggle:hover {
  background: var(--muted);
  color: var(--navy);
}

.wk-auth-signup {
  display: flex;
  height: 3rem;
  width: 100%;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  border: 2px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, #fff);
  font-size: 1rem;
  font-weight: 700;
  color: #047857;
  text-decoration: none;
}

.wk-auth-signup:hover {
  background: color-mix(in srgb, var(--primary) 14%, #fff);
}

/* Dark: avoid pale-green-on-white — solid outline + bright text on card */
html.dark .wk-auth-signup {
  background: transparent;
  border-color: var(--primary);
  color: #6ee7b7;
}

html.dark .wk-auth-signup:hover {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  color: #a7f3d0;
}

html.dark .wk-btn-primary {
  color: #ffffff;
}

html.dark .wk-pin-toggle:hover {
  color: var(--foreground);
}

.wk-pay-ok {
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success-dark);
  animation: wk-pay-pop 0.45s ease;
}

.wk-pay-ok svg {
  width: 2.25rem;
  height: 2.25rem;
}

@keyframes wk-pay-pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

.wk-pay-wait-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--primary);
  animation: wk-pay-pulse 1s ease-in-out infinite;
}

@keyframes wk-pay-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

.wk-amount-input {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: left;
  color: var(--foreground);
  height: 3.5rem;
}

.wk-theme-seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: var(--muted);
}

.wk-theme-seg.wk-theme-seg-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wk-theme-seg button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 3.25rem;
  border: 0;
  border-radius: 0.625rem;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.wk-theme-seg button[aria-pressed="true"] {
  background: var(--card);
  color: var(--navy);
  box-shadow: var(--shadow-card);
}

details > summary::-webkit-details-marker {
  display: none;
}

.divide-y > * + * {
  border-top: 1px solid var(--border);
}

.wk-admin-table thead th {
  padding-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
}

.wk-admin-table tbody tr {
  border-top: 1px solid var(--border);
}

.wk-admin-table tbody td {
  padding: 0.5rem 0.25rem;
  vertical-align: middle;
}

.wk-admin-tx-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.875rem;
  border: 1px solid var(--border);
  background: var(--card, #fff);
  padding: 0.65rem 0.75rem;
}

.wk-admin-tx-icon {
  display: grid;
  height: 2.5rem;
  width: 2.5rem;
  flex-shrink: 0;
  place-items: center;
  border-radius: 0.75rem;
}

.wk-admin-tx-icon.tone-success { background: var(--success-soft); color: var(--success-dark); }
.wk-admin-tx-icon.tone-navy { background: var(--secondary); color: var(--navy); }
.wk-admin-tx-icon.tone-info { background: var(--info-soft); color: var(--info); }
.wk-admin-tx-icon.tone-gold { background: var(--gold-soft); color: var(--foreground); }
.wk-admin-tx-icon.tone-muted { background: var(--muted); color: var(--muted-foreground); }

.wk-admin-tx-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.125rem 0.5rem;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.wk-admin-tx-badge::before {
  content: '';
  height: 6px;
  width: 6px;
  border-radius: 9999px;
  background: currentColor;
  opacity: 0.7;
}

.wk-admin-tx-badge.status-completed,
.wk-admin-tx-badge.status-paid { background: var(--success-soft); color: var(--success-dark); }
.wk-admin-tx-badge.status-pending,
.wk-admin-tx-badge.status-pending-review { background: var(--warning-soft); color: var(--foreground); }
.wk-admin-tx-badge.status-processing { background: var(--info-soft); color: var(--info); }
.wk-admin-tx-badge.status-failed { background: var(--danger-soft); color: var(--destructive); }
.wk-admin-tx-badge.status-reversed { background: var(--muted); color: var(--muted-foreground); }

.chart-flow {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 18rem;
}

.chart-flow-month {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  height: 100%;
}

.chart-flow-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.chart-flow-bars span {
  flex: 1;
  max-width: 0.65rem;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}

.chart-flow-bars .dep { background: var(--chart-1); }
.chart-flow-bars .wd { background: var(--chart-2); }
.chart-flow-bars .inv { background: var(--chart-3); }

.chart-flow-label {
  font-size: 10px;
  color: var(--muted-foreground);
  text-transform: capitalize;
}

.wk-switch {
  position: relative;
  display: inline-flex;
  width: 2.75rem;
  height: 1.55rem;
  flex-shrink: 0;
}
.wk-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
.wk-switch span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--muted);
  transition: background 0.15s ease;
}
.wk-switch span::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
  transition: transform 0.15s ease;
}
.wk-switch input:checked + span {
  background: var(--primary);
}
.wk-switch input:checked + span::after {
  transform: translateX(1.2rem);
}
.wk-switch input:focus-visible + span {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Fallbacks when Tailwind JIT has not run yet */
.bg-background { background-color: var(--background) !important; }
.bg-navy { background-color: var(--navy) !important; }
.bg-primary { background-color: var(--primary) !important; }
.bg-sidebar { background-color: var(--sidebar) !important; }
.text-navy { color: var(--navy) !important; }
.text-navy-foreground { color: var(--navy-foreground) !important; }
.text-primary-foreground { color: var(--primary-foreground) !important; }
.text-success-dark { color: var(--success-dark) !important; }
.text-primary { color: var(--primary) !important; }
.text-muted-foreground { color: var(--muted-foreground) !important; }
.bg-card { background-color: var(--card) !important; }
.border-border { border-color: var(--border) !important; }

html:not(.dark) .text-muted-foreground {
  color: #475569 !important;
}

html.dark .text-muted-foreground {
  color: #b6c4d6 !important;
}

/* Soft panels inside cards keep a hairline so content blocks stay readable */
html:not(.dark) .card-surface .bg-muted,
html:not(.dark) .card-surface .rounded-xl.bg-muted {
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
}

.wk-tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: var(--app-w);
  max-width: 100%;
  z-index: 40;
  background: var(--tabbar-bg);
  color: var(--foreground);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.wk-tabbar-inner {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 100%;
  margin: 0 auto;
}

.wk-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  height: 4rem;
  margin: 0;
  padding: 0;
  color: var(--muted-foreground);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  background: transparent;
  border-radius: 0;
  transform: none !important;
  transition: none !important;
  animation: none !important;
  touch-action: manipulation;
}

.wk-tab svg {
  flex-shrink: 0;
  transform: none !important;
  stroke-width: 1.8;
}

/* React: active tab = success-dark text only (no pill fill) */
.wk-tab.is-active {
  color: var(--success-dark);
  background: transparent;
}

.wk-tab.is-active svg {
  stroke-width: 2.4;
}

.wk-tab:active,
.wk-tab:focus,
.wk-tab:hover {
  transform: none !important;
}

#wk-invest-pay-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
}
#wk-invest-pay-modal.hidden {
  display: none !important;
}
