/* ============================================================
   CBANK design system — язык интерфейса построен на фигурах
   визуального 2FA-кода (круг/треугольник/квадрат × R/G/B).
   Это единственный по-настоящему уникальный материал продукта,
   поэтому он используется как сквозной визуальный мотив: в
   лоадерах, разделителях, состояниях успеха/ошибки, декоре.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  --ink: #0a0e1a;
  --surface: #131829;
  --surface-2: #1b2236;
  --surface-3: #232c45;
  --stroke: #262f4a;
  --paper: #f6f4ef;
  --muted: #8891a8;
  --muted-2: #5b6480;

  --red: #ff5c72;
  --green: #35d399;
  --blue: #4c8dff;

  --red-dim: #ff5c7222;
  --green-dim: #35d39922;
  --blue-dim: #4c8dff22;

  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
  overflow-x: hidden;
}

/* Ambient background — much like a night sky of the product's own
   authentication material, drifting very slowly, low opacity. */
.shape-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.shape-field span {
  position: absolute;
  opacity: 0.16;
  filter: blur(0.3px);
  animation: drift 30s ease-in-out infinite;
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(14px, -18px) rotate(12deg); }
}

a { color: inherit; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

.muted { color: var(--muted); }

/* ---------- brand mark ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--paper);
  text-decoration: none;
}
.brand-seal {
  position: relative;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.brand-seal span {
  position: absolute;
  display: block;
}
.brand-seal .c { width: 13px; height: 13px; border-radius: 50%; background: var(--red); top: 0; left: 8px; }
.brand-seal .t { width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 13px solid var(--green); bottom: 0; left: 0; }
.brand-seal .s { width: 12px; height: 12px; border-radius: 3px; background: var(--blue); bottom: 1px; right: 0; }

/* ---------- shape loader (signature motion) ---------- */
.shape-loader {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.shape-loader i {
  display: block;
  width: 12px;
  height: 12px;
  animation: pulse-shape 1.2s var(--ease) infinite;
}
.shape-loader i:nth-child(1) { background: var(--red); border-radius: 50%; animation-delay: 0s; }
.shape-loader i:nth-child(2) {
  width: 0; height: 0; background: none;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--green);
  animation-delay: 0.15s;
}
.shape-loader i:nth-child(3) { background: var(--blue); border-radius: 3px; animation-delay: 0.3s; }
@keyframes pulse-shape {
  0%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1.15); opacity: 1; }
}

/* ---------- layout shells ---------- */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
}
.topbar nav { display: flex; align-items: center; gap: 22px; }
.topbar nav a, .topbar nav button.linklike {
  font-size: 14px; color: var(--muted); text-decoration: none; background: none; border: none; cursor: pointer;
  transition: color 0.2s var(--ease);
}
.topbar nav a:hover, .topbar nav button.linklike:hover { color: var(--paper); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--stroke);
  background: var(--surface); color: var(--paper); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.94); }

main.container { max-width: 760px; margin: 0 auto; padding: 24px 24px 80px; }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface) 100%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 20px;
  animation: rise 0.5s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.card h2 { font-size: 20px; margin-bottom: 4px; }

/* ---------- forms ---------- */
label { display: block; font-size: 12.5px; color: var(--muted); margin: 18px 0 7px; letter-spacing: 0.02em; }
input[type=text], input[type=password], input[type=number] {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  color: var(--paper);
  font-size: 15px;
  font-family: var(--font-body);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
input::placeholder { color: var(--muted-2); }
input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
  background: var(--surface-3);
}

button.primary {
  margin-top: 22px;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
button.primary:hover { box-shadow: 0 6px 24px -6px rgba(246, 244, 239, 0.35); }
button.primary:active { transform: scale(0.98); }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

button.secondary {
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  color: var(--paper);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}
button.secondary:hover { background: var(--surface-3); }
button.secondary:active { transform: scale(0.97); }
button.danger { color: var(--red); border-color: var(--red-dim); }
button.danger:hover { background: var(--red-dim); }

a.linklike { color: var(--blue); font-size: 13px; cursor: pointer; text-decoration: none; background: none; border: none; padding: 0; }
a.linklike:hover { text-decoration: underline; }

.error { color: var(--red); font-size: 13.5px; margin-top: 12px; }
.success { color: var(--green); font-size: 13.5px; margin-top: 12px; }

/* ---------- tabs (sliding pill) ---------- */
.tabs { position: relative; display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; margin-bottom: 22px; }
.tabs button {
  position: relative; z-index: 1; flex: 1; padding: 10px; border: none; background: none; cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: 14px; color: var(--muted);
  transition: color 0.25s var(--ease);
}
.tabs button.active { color: var(--ink); }
.tabs .pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px);
  background: var(--paper);
  border-radius: 9px;
  transition: transform 0.35s var(--ease);
}
.tabs.reg-active .pill { transform: translateX(100%); }

/* ---------- shape divider (signature structural device) ---------- */
.shape-divider {
  display: flex; align-items: center; gap: 8px; margin: 26px 0; opacity: 0.55;
}
.shape-divider::before, .shape-divider::after { content: ''; flex: 1; height: 1px; background: var(--stroke); }
.shape-divider i { width: 6px; height: 6px; }
.shape-divider i:nth-child(1) { border-radius: 50%; background: var(--red); }
.shape-divider i:nth-child(2) { background: var(--green); }
.shape-divider i:nth-child(3) { border-radius: 1px; background: var(--blue); }

/* ---------- code display ---------- */
.code-wrap { text-align: center; margin: 20px 0; }
.code-wrap img {
  max-width: 240px; width: 100%;
  border-radius: 14px;
  background: var(--paper);
  padding: 14px;
  animation: materialize 0.6s var(--ease) both;
}
@keyframes materialize {
  from { opacity: 0; transform: scale(0.9); filter: blur(6px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}

/* ---------- drawer navigation ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(6, 8, 14, 0.6); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease); z-index: 40;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 280px;
  background: var(--surface); border-right: 1px solid var(--stroke);
  transform: translateX(-100%); transition: transform 0.35s var(--ease);
  z-index: 41; padding: 26px 20px; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer nav { display: flex; flex-direction: column; gap: 4px; margin-top: 30px; }
.drawer nav a, .drawer nav button.linklike {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px; color: var(--muted);
  text-decoration: none; font-size: 14.5px; font-weight: 500;
  background: none; border: none; cursor: pointer; text-align: left; width: 100%;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.drawer nav a:hover, .drawer nav button.linklike:hover { background: var(--surface-2); color: var(--paper); }
.drawer nav a.active { background: var(--surface-2); color: var(--paper); }
.drawer .drawer-dot { width: 7px; height: 7px; border-radius: 50%; }

/* ---------- account tiles / balances ---------- */
.accounts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.account-tile {
  border-radius: var(--radius); padding: 22px; color: var(--ink); position: relative; overflow: hidden;
  animation: rise 0.5s var(--ease) both;
}
.account-tile.checking { background: linear-gradient(135deg, #7fc2ff, var(--blue)); }
.account-tile.savings { background: linear-gradient(135deg, #7be8bf, var(--green)); }
.account-tile .label { font-size: 12.5px; opacity: 0.75; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.account-tile .amount { font-family: var(--font-display); font-size: 28px; font-weight: 700; margin-top: 8px; }

table.tx { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.tx td { padding: 12px 4px; border-bottom: 1px solid var(--stroke); font-size: 14px; }
table.tx td.amount.pos { color: var(--green); text-align: right; font-family: var(--font-mono); }
table.tx td.amount.neg { color: var(--red); text-align: right; font-family: var(--font-mono); }
table.tx td.date { color: var(--muted); width: 90px; font-family: var(--font-mono); font-size: 12.5px; }

.device-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--stroke); gap: 12px; }
.device-row:last-child { border-bottom: none; }
.device-row .device-name { font-weight: 600; }
.device-row .device-meta { color: var(--muted); font-size: 12.5px; font-family: var(--font-mono); }
.device-actions { display: flex; gap: 8px; flex-shrink: 0; }

.pill-badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; }
.pill-badge.locked { background: var(--red-dim); color: var(--red); }
.pill-badge.warn { background: #ffb02e22; color: #ffb02e; }

.credentials-box {
  background: var(--surface-2); border: 1px dashed var(--stroke); border-radius: var(--radius-sm);
  padding: 20px; margin: 18px 0; text-align: center;
}
.credentials-box .field { margin: 10px 0; }
.credentials-box .field .val { font-family: var(--font-mono); font-size: 20px; font-weight: 600; letter-spacing: 0.04em; color: var(--paper); }
.credentials-box .field .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* count-up number */
.count-up { font-variant-numeric: tabular-nums; }
