/* =============================================
   RESET & BASE
   ============================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --red:        #f14635;
  --red-dark:   #d63a2b;
  --red-light:  rgba(241,70,53,0.10);
  --success:    #34c759;
  --text1:      #1c1c1e;
  --text2:      #6c6c70;
  --text3:      #aeaeb2;
  --bg:         #f2f2f7;
  --white:      #ffffff;
  --border:     #e5e5ea;
  --shadow:     0 2px 12px rgba(0,0,0,0.07);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.13);
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text1);
  overflow-x: hidden;
}

/* =============================================
   SCREENS
   ============================================= */
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

.hidden { display: none !important; }

/* =============================================
   LOGIN
   ============================================= */
#screen-login {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.35s ease;
}

@keyframes fadeUp {
  from { opacity:0; transform:translateY(16px); }
  to   { opacity:1; transform:translateY(0); }
}

.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 36px;
}

.logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #f14635 0%, #d63a2b 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(241,70,53,0.35);
  flex-shrink: 0;
}

.logo-text {
  font-size: 28px;
  font-weight: 800;
  color: var(--text1);
  letter-spacing: -1px;
}

.logo-text span {
  color: var(--red);
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 28px;
  color: var(--text1);
  letter-spacing: -0.3px;
}

/* =============================================
   FORM ELEMENTS
   ============================================= */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 7px;
}

.form-group input,
.select-input {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text1);
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.select-input:focus {
  border-color: var(--red);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(241,70,53,0.10);
}

.select-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23999' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-color: var(--bg);
  padding-right: 38px;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn-primary, .btn-secondary, .btn-small {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 14px;
  font-weight: 600;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  width: 100%;
  padding: 15px 24px;
  font-size: 16px;
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 16px rgba(241,70,53,0.28);
  margin-top: 4px;
}
.btn-primary:hover { background: var(--red-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  width: 100%;
  padding: 13px 24px;
  font-size: 15px;
  background: var(--red-light);
  color: var(--red);
  border-radius: 12px;
  margin-bottom: 10px;
}
.btn-secondary:hover { background: rgba(241,70,53,0.15); }

.btn-small {
  padding: 8px 18px;
  font-size: 13px;
  background: var(--red);
  color: #fff;
  border-radius: 10px;
}
.btn-small:hover { background: var(--red-dark); }

/* =============================================
   MESSAGES
   ============================================= */
.error-msg {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
  background: rgba(241,70,53,0.08);
  color: var(--red);
  border: 1px solid rgba(241,70,53,0.18);
}

.success-msg {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-top: 14px;
  background: rgba(52,199,89,0.08);
  color: var(--success);
  border: 1px solid rgba(52,199,89,0.2);
}

/* =============================================
   TOP NAV
   ============================================= */
.top-nav {
  background: var(--red);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(241,70,53,0.25);
}

.top-nav-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-nav-logo {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo-icon {
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.top-nav-user {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}

.logout-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  transition: background 0.15s;
}
.logout-btn:hover { background: rgba(255,255,255,0.25); }

/* =============================================
   DASHBOARD BODY
   ============================================= */
.dash-body {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 20px 60px;
}

/* =============================================
   CATEGORY GRID (8 icons, 2 rows of 4)
   ============================================= */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  padding: 8px 0;
}

.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 12px;
}

.cat-item:hover { background: var(--bg); }

.cat-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--red-light);
  border-radius: 14px;
  color: var(--red);
}

.cat-item span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text1);
  text-align: center;
  line-height: 1.3;
}

/* =============================================
   ACCOUNT CARD
   ============================================= */
.account-card {
  background: var(--white);
  border-radius: 16px;
  padding: 20px 20px 0;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  overflow: hidden;
}

.account-card-top {
  margin-bottom: 6px;
}

.account-card-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
}

.account-card-label svg { color: var(--red); }

.account-balance {
  font-size: 36px;
  font-weight: 700;
  color: var(--text1);
  letter-spacing: -1px;
  margin-bottom: 4px;
  line-height: 1.1;
}

.account-sub {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 20px;
}

/* 3 action buttons under balance */
.account-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  margin: 0 -20px;
  padding: 10px 12px;
}

.acc-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.acc-action-btn:hover { background: var(--bg); }

.acc-action-icon {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border-radius: 10px;
  color: var(--text1);
}

.acc-action-btn span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text1);
}

/* Business account row */
.biz-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  margin: 0 -20px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.biz-account-row:hover { background: var(--bg); }

.biz-account-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.biz-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border-radius: 10px;
  color: var(--text2);
}

.biz-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text1);
  margin-bottom: 2px;
}

.biz-balance {
  font-size: 13px;
  color: var(--text2);
}

/* =============================================
   TRANSFER BUTTON (big red)
   ============================================= */
.transfer-btn {
  width: 100%;
  padding: 17px;
  background: var(--red);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(241,70,53,0.30);
  transition: all 0.18s ease;
  margin-bottom: 24px;
}
.transfer-btn:hover { background: var(--red-dark); transform: translateY(-1px); }
.transfer-btn:active { transform: translateY(0); }

/* =============================================
   HISTORY
   ============================================= */
.history-section {}

.history-title-row {
  font-size: 20px;
  font-weight: 600;
  color: var(--text1);
  margin-bottom: 12px;
}

.history-list {
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.history-empty {
  text-align: center;
  color: var(--text3);
  padding: 40px 20px;
  font-size: 14px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--bg); }

.history-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.history-icon.income  { background: rgba(52,199,89,0.12); color: var(--success); }
.history-icon.expense { background: rgba(241,70,53,0.10); color: var(--red); }

.history-info { flex: 1; min-width: 0; }

.history-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text1);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-date {
  font-size: 12px;
  color: var(--text3);
}

.history-amount {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.history-amount.income  { color: var(--success); }
.history-amount.expense { color: var(--red); }

/* =============================================
   ADMIN TABS
   ============================================= */
.admin-tabs {
  display: flex;
  gap: 4px;
  background: var(--white);
  border-radius: 14px;
  padding: 6px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.admin-tab {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}
.admin-tab:hover { background: var(--bg); color: var(--text1); }
.admin-tab.active { background: var(--red); color: #fff; }

.admin-tab-content { animation: fadeIn 0.25s ease; }

@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* =============================================
   ADMIN SECTION
   ============================================= */
.admin-section {
  background: var(--white);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.admin-section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text1);
}

.admin-list { display: flex; flex-direction: column; gap: 10px; }

.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.admin-list-item:hover { background: #ebebf0; }

.admin-list-item-info { flex: 1; min-width: 0; }

.admin-list-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text1);
  margin-bottom: 3px;
}

.admin-list-item-subtitle {
  font-size: 12px;
  color: var(--text2);
}

.admin-list-item-actions {
  display: flex;
  gap: 6px;
  margin-left: 10px;
}

.btn-icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.15s;
  font-family: inherit;
}
.btn-icon:hover { background: var(--bg); }

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--white);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: modalUp 0.28s ease;
}

@keyframes modalUp {
  from { opacity:0; transform:translateY(18px); }
  to   { opacity:1; transform:translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.modal-title {
  font-size: 19px;
  font-weight: 600;
  color: var(--text1);
}

.modal-close {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border: none;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text2);
  transition: background 0.15s;
}
.modal-close:hover { background: #e5e5ea; }

.recipient-name {
  padding: 11px 14px;
  background: rgba(52,199,89,0.08);
  border: 1px solid rgba(52,199,89,0.2);
  border-radius: 10px;
  color: var(--success);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
}

/* Requisites rows */
.req-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.req-row:last-child { border-bottom: none; }
.req-label { font-size: 14px; color: var(--text2); }
.req-value { font-size: 14px; font-weight: 600; color: var(--text1); }

/* =============================================
   TOAST
   ============================================= */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 13px 22px;
  background: rgba(28,28,30,0.92);
  backdrop-filter: blur(16px);
  color: #fff;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  animation: toastUp 0.25s ease;
}

@keyframes toastUp {
  from { opacity:0; transform:translate(-50%,12px); }
  to   { opacity:1; transform:translate(-50%,0); }
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 500px) {
  .dash-body { padding: 14px 14px 60px; }
  .login-card { padding: 32px 22px; }
  .account-balance { font-size: 28px; }
  .cat-icon { width: 40px; height: 40px; }
  .cat-item { padding: 14px 6px; }
}

/* =============================================
   TRANSFER LOADING OVERLAY (Apple/Kaspi style)
   ============================================= */

#transfer-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tl-overlay-in 0.25s ease;
}

#transfer-loading-overlay.tl-overlay-out {
  animation: tl-overlay-fade-out 0.4s ease forwards;
}

@keyframes tl-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes tl-overlay-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.tl-card {
  background: rgba(255,255,255,0.97);
  border-radius: 28px;
  padding: 44px 48px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.22);
  min-width: 260px;
  animation: tl-card-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes tl-card-in {
  from { opacity: 0; transform: scale(0.82) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Spinner */
.tl-spinner-wrap {
  width: 72px; height: 72px;
  transition: opacity 0.3s ease;
}

.tl-spinner-wrap.tl-fade-out {
  opacity: 0;
}

.tl-spinner {
  width: 72px; height: 72px;
  animation: tl-rotate 1s linear infinite;
}

@keyframes tl-rotate {
  100% { transform: rotate(360deg); }
}

.tl-spinner-track {
  stroke: #e5e5ea;
}

.tl-spinner-arc {
  stroke: var(--red);
  stroke-linecap: round;
  stroke-dasharray: 80 200;
  stroke-dashoffset: 0;
  animation: tl-dash 1.4s ease-in-out infinite;
}

@keyframes tl-dash {
  0%   { stroke-dasharray: 1 200; stroke-dashoffset: 0; }
  50%  { stroke-dasharray: 100 200; stroke-dashoffset: -30px; }
  100% { stroke-dasharray: 100 200; stroke-dashoffset: -125px; }
}

/* Success checkmark */
.tl-success-wrap {
  width: 72px; height: 72px;
}

.tl-success-wrap.tl-pop-in {
  animation: tl-pop 0.45s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes tl-pop {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

.tl-check {
  width: 72px; height: 72px;
}

.tl-check-circle {
  stroke: var(--success);
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: tl-circle-draw 0.5s ease forwards;
}

@keyframes tl-circle-draw {
  to { stroke-dashoffset: 0; }
}

.tl-check-mark {
  stroke: var(--success);
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: tl-check-draw 0.35s 0.35s ease forwards;
}

@keyframes tl-check-draw {
  to { stroke-dashoffset: 0; }
}

.tl-label {
  font-size: 17px;
  font-weight: 600;
  color: var(--text1);
  letter-spacing: -0.3px;
  text-align: center;
}

.tl-sublabel {
  font-size: 14px;
  color: var(--text2);
  text-align: center;
  letter-spacing: -0.1px;
}

/* =============================================
   RECIPIENT CARD (Apple style)
   ============================================= */

.recipient-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 4px 0 8px;
  animation: recipient-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes recipient-in {
  from { opacity: 0; transform: scale(0.92) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.recipient-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f14635 0%, #ff6b5b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  box-shadow: 0 4px 12px rgba(241,70,53,0.30);
}

.recipient-info {
  flex: 1;
  min-width: 0;
}

.recipient-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text1);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipient-card-num {
  font-size: 13px;
  color: var(--text2);
  margin-top: 2px;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

.recipient-check {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(52,199,89,0.35);
  animation: check-pop 0.35s 0.15s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes check-pop {
  from { opacity: 0; transform: scale(0); }
  to   { opacity: 1; transform: scale(1); }
}
