/* ============================================================
   PashaAutoTransfer — design tokens + components
   ============================================================ */

:root {
  /* canvas / surfaces */
  --canvas: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --surface-3: #F2F4F7;
  --border: #E7EAEE;
  --border-strong: #D8DCE3;

  /* text */
  --text: #161A20;
  --text-2: #5A6472;
  --text-3: #97A0AD;

  /* brand + status */
  --green: #00A859;
  --green-press: #008f4c;
  --green-soft: rgba(0, 168, 89, .10);
  --green-line: rgba(0, 168, 89, .28);
  --amber: #E08600;
  --amber-soft: rgba(224, 134, 0, .12);
  --amber-line: rgba(224, 134, 0, .30);
  --red: #E5484D;
  --red-soft: rgba(229, 72, 77, .11);
  --red-line: rgba(229, 72, 77, .30);
  --blue: #2A6FDB;
  --blue-soft: rgba(42, 111, 219, .11);
  --blue-line: rgba(42, 111, 219, .28);

  /* shadows */
  --shadow-sm: 0 1px 2px rgba(20, 26, 36, .05), 0 1px 1px rgba(20, 26, 36, .03);
  --shadow-md: 0 4px 14px rgba(20, 26, 36, .07), 0 1px 3px rgba(20, 26, 36, .04);
  --shadow-lg: 0 18px 50px rgba(20, 26, 36, .16), 0 4px 14px rgba(20, 26, 36, .08);
  --shadow-pop: 0 10px 34px rgba(20, 26, 36, .14);

  /* geometry */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --sidebar-w: 248px;
  --topbar-h: 64px;

  --mono: "Geist Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --canvas: #0D1014;
  --surface: #15191F;
  --surface-2: #1A1F26;
  --surface-3: #1F2630;
  --border: #262D37;
  --border-strong: #333C48;

  --text: #E9ECF1;
  --text-2: #98A2B0;
  --text-3: #69727F;

  --green: #1BB86C;
  --green-press: #16a35f;
  --green-soft: rgba(27, 184, 108, .14);
  --green-line: rgba(27, 184, 108, .32);
  --amber: #F0A027;
  --amber-soft: rgba(240, 160, 39, .15);
  --amber-line: rgba(240, 160, 39, .34);
  --red: #F0595E;
  --red-soft: rgba(240, 89, 94, .15);
  --red-line: rgba(240, 89, 94, .34);
  --blue: #4F8BEC;
  --blue-soft: rgba(79, 139, 236, .15);
  --blue-line: rgba(79, 139, 236, .32);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .42);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, .6);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--sans);
  background: var(--canvas);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { height: 100%; }

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "cv01" 1;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

::selection { background: var(--green-soft); }

button { font-family: inherit; }

.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100%;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 4px;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(150deg, var(--green), #00c768);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 17px;
  box-shadow: 0 4px 12px var(--green-soft);
  flex: none;
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; line-height: 1.1; }
.brand-name span { display: block; font-size: 11px; color: var(--text-3); font-weight: 400; letter-spacing: .02em; }

.nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  padding: 14px 10px 6px;
  font-weight: 500;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 13.5px;
  position: relative;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--green-soft); color: var(--green); font-weight: 600; }
.nav-item .ico { width: 18px; height: 18px; flex: none; }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 11px;
  background: var(--red);
  color: #fff;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  display: grid; place-items: center;
  padding: 0 5px;
  font-weight: 600;
}
.nav-item.active .nav-badge { background: var(--green); }
.sidebar-foot { margin-top: auto; padding: 10px; }

/* ---- Main ---- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}
.topbar {
  height: var(--topbar-h);
  flex: none;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 20;
}
.topbar .page-title { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.topbar .page-sub { font-size: 12.5px; color: var(--text-3); }
.topbar-spacer { flex: 1; }

.total-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 5px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  line-height: 1.15;
}
.total-pill .lbl { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.total-pill .val { font-size: 16px; font-weight: 600; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 26px 28px 80px;
  scroll-behavior: smooth;
}
.content-inner { max-width: 1180px; margin: 0 auto; }

/* ============================================================
   PRIMITIVES
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }

.section-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 18px;
}
.section-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.section-head .desc { color: var(--text-3); font-size: 13px; }
.section-head .grow { flex: 1; }

.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(4, 1fr); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(244px, 1fr)); }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s, box-shadow .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .ico { width: 16px; height: 16px; }
.btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 2px 8px var(--green-soft);
}
.btn-primary:hover { background: var(--green-press); border-color: var(--green-press); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.95); background: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* badges / pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge .ico { width: 13px; height: 13px; }
.badge-green { color: var(--green); background: var(--green-soft); border-color: var(--green-line); }
.badge-amber { color: var(--amber); background: var(--amber-soft); border-color: var(--amber-line); }
.badge-red   { color: var(--red);   background: var(--red-soft);   border-color: var(--red-line); }
.badge-blue  { color: var(--blue);  background: var(--blue-soft);  border-color: var(--blue-line); }
.badge-grey  { color: var(--text-2); background: var(--surface-3); border-color: var(--border); }

.badge-pulse .dot { animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  50% { box-shadow: 0 0 0 4px transparent; opacity: .55; }
}

/* toggle */
.toggle {
  position: relative;
  width: 40px; height: 23px;
  border-radius: 12px;
  background: var(--border-strong);
  border: none;
  cursor: pointer;
  transition: background .16s;
  flex: none;
  padding: 0;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .16s;
}
.toggle.on { background: var(--green); }
.toggle.on::after { transform: translateX(17px); }

/* inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.input, .select {
  height: 40px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.input.mono { letter-spacing: -.01em; }
.input-lg { height: 52px; font-size: 22px; font-weight: 600; }

.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search .ico { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 34px; }

/* table */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  font-weight: 600;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: var(--surface-2); }

/* OTP segmented input */
.otp {
  display: flex;
  gap: 9px;
}
.otp input {
  width: 46px; height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.otp input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.otp input.filled { border-color: var(--green-line); background: var(--green-soft); }
.otp.otp-sm input { width: 38px; height: 46px; font-size: 19px; }
.otp.err input { border-color: var(--red); animation: shake .32s; }
@keyframes shake {
  0%,100%{transform:translateX(0)} 20%{transform:translateX(-5px)} 40%{transform:translateX(5px)}
  60%{transform:translateX(-3px)} 80%{transform:translateX(3px)}
}

/* modal */
.overlay {
  position: fixed; inset: 0;
  background: rgba(16, 20, 28, .46);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
  animation: fade .14s ease;
}
[data-theme="dark"] .overlay { background: rgba(0,0,0,.6); }
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  animation: pop .18s cubic-bezier(.2,.9,.3,1.1);
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { padding: 22px 24px 4px; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.modal-head p { margin: 6px 0 0; color: var(--text-2); font-size: 13.5px; }
.modal-body { padding: 18px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; }
.modal-x {
  position: absolute; top: 16px; right: 16px;
  width: 30px; height: 30px;
  border-radius: 8px; border: none; background: var(--surface-3);
  color: var(--text-2); cursor: pointer;
  display: grid; place-items: center;
}
.modal-x:hover { background: var(--border); color: var(--text); }
.modal-wrap { position: relative; }

/* toasts */
.toast-host {
  position: fixed;
  right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
  width: 340px;
  max-width: calc(100vw - 40px);
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-3);
  border-radius: var(--r);
  box-shadow: var(--shadow-pop);
  padding: 13px 14px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  animation: toast-in .26s cubic-bezier(.2,.9,.3,1.05);
}
.toast.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
.toast.info { border-left-color: var(--blue); }
.toast .t-ico { width: 18px; height: 18px; margin-top: 1px; flex: none; }
.toast.success .t-ico { color: var(--green); }
.toast.error .t-ico { color: var(--red); }
.toast.warn .t-ico { color: var(--amber); }
.toast.info .t-ico { color: var(--blue); }
.toast .t-title { font-weight: 600; font-size: 13.5px; }
.toast .t-msg { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.toast .t-x { margin-left: auto; background: none; border: none; color: var(--text-3); cursor: pointer; padding: 2px; }

/* skeleton */
.skel {
  background: linear-gradient(100deg, var(--surface-3) 30%, var(--border) 50%, var(--surface-3) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* empty state */
.empty {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 48px 20px; text-align: center;
  color: var(--text-3);
}
.empty .e-ico { width: 40px; height: 40px; color: var(--text-3); opacity: .7; }
.empty .e-title { font-weight: 600; color: var(--text-2); font-size: 14px; }
.empty .e-msg { font-size: 13px; max-width: 320px; }

/* misc utility */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.kbd {
  font-family: var(--mono); font-size: 11px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px;
  color: var(--text-2);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .pay-grid { grid-template-columns: 1fr !important; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 880px) {
  :root { --sidebar-w: 68px; }
  .brand-name, .nav-label, .nav-item .nav-badge, .sidebar-foot { display: none; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-item .ico { margin: 0; }
  .brand { justify-content: center; padding: 6px 0 16px; }
  .topbar .page-sub { display: none; }
  .total-pill { display: none; }
  .content { padding: 18px 16px 80px; }
}
@media (max-width: 560px) {
  .grid-stats { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar .page-title { font-size: 15px; }
  .otp input { width: 40px; height: 50px; font-size: 20px; }
  .otp { gap: 7px; }
  .modal { max-width: 100%; }
}
