/* Sampath Vishwa / Sampath Bank */

:root {
  --sb-orange: #f97316;
  --sb-orange-dark: #ea580c;
  --sb-orange-deep: #ff6600;
  --sb-orange-light: #fff7ed;
  --sb-text: #111827;
  --sb-muted: #6b7280;
  --sb-border: #e5e7eb;
  --sb-input-bg: #f3f4f6;
  --sb-error: #dc2626;
  --sb-white: #ffffff;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--sb-white);
  color: var(--sb-text);
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  min-height: 100svh;
}

.screen.active { display: flex; }

/* ===== Login ===== */
.sb-login {
  background: var(--sb-white);
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 24px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
}

.sb-login-wrap {
  width: 100%;
  max-width: 380px;
}

.sb-logo {
  display: block;
  height: auto;
  object-fit: contain;
}

.sb-logo--login {
  width: min(120px, 38vw);
  margin: 0 auto 28px;
}

.sb-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.sb-brand--white {
  color: var(--sb-white);
}

.sb-brand--otp4 {
  display: flex;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 36px;
}

.sb-brand-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
}

.sb-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sb-brand-line {
  line-height: 1.15;
  white-space: nowrap;
}

.sb-brand-line--si {
  font-size: 0.95rem;
  font-weight: 700;
}

.sb-brand-line--ta {
  font-size: 0.82rem;
  font-weight: 600;
}

.sb-brand-line--en {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 700;
  margin-top: 2px;
}

.sb-card-header .sb-brand {
  justify-content: center;
}

.sb-title {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--sb-text);
}

.sb-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sb-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sb-text);
  margin-top: 12px;
}

.sb-input {
  width: 100%;
  padding: 16px 18px;
  border: none;
  border-radius: 14px;
  background: var(--sb-input-bg);
  font-size: 1rem;
  color: var(--sb-text);
  outline: none;
  margin-top: 8px;
}

.sb-input::placeholder { color: #9ca3af; }

.sb-input.input-error {
  box-shadow: 0 0 0 2px var(--sb-error);
}

.sb-password-wrap {
  position: relative;
  margin-top: 8px;
}

.sb-password-wrap .sb-input {
  margin-top: 0;
  padding-right: 52px;
}

.sb-eye-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #9ca3af;
  padding: 6px;
  cursor: pointer;
  display: flex;
}

.sb-eye-btn svg { width: 22px; height: 22px; }

.sb-btn-pill {
  width: 100%;
  margin-top: 28px;
  padding: 16px 24px;
  border: none;
  border-radius: 999px;
  background: var(--sb-orange);
  color: var(--sb-white);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sb-btn-pill:hover { background: var(--sb-orange-dark); }
.sb-btn-pill:disabled { opacity: 0.65; cursor: not-allowed; }

/* ===== 6-digit OTP sheet ===== */
.sb-otp-sheet {
  background: rgba(0, 0, 0, 0.35);
  align-items: flex-end;
  justify-content: flex-end;
}

.sb-sheet {
  width: 100%;
  background: var(--sb-white);
  border-radius: 24px 24px 0 0;
  padding: 12px 24px calc(env(safe-area-inset-bottom, 16px) + 28px);
  text-align: center;
  max-height: 92vh;
  overflow-y: auto;
}

.sheet-handle {
  width: 48px;
  height: 5px;
  background: #d1d5db;
  border-radius: 999px;
  margin: 8px auto 24px;
}

.sb-sheet-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 14px;
  line-height: 1.35;
  padding: 0 8px;
}

.sb-sheet-desc {
  font-size: 0.88rem;
  color: var(--sb-muted);
  line-height: 1.55;
  margin-bottom: 28px;
  padding: 0 4px;
}

.otp-boxes {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
  margin-bottom: 20px;
}

.otp-box {
  width: 46px;
  height: 52px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--sb-text);
  outline: none;
  background: var(--sb-white);
  padding: 0;
}

.otp-box:focus {
  border-color: var(--sb-orange);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.otp-box.input-error { border-color: var(--sb-error); }

.sb-resend-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--sb-text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 10px;
  margin-top: 8px;
}

.sb-resend-btn svg {
  width: 18px;
  height: 18px;
  color: var(--sb-muted);
}

.sb-resend-btn span {
  font-weight: 700;
}

/* ===== Card screen ===== */
.sb-card-screen {
  --sb-card-orange: #f37021;
  background: var(--sb-card-orange);
  height: 100dvh;
  height: 100svh;
  max-height: 100dvh;
  overflow: hidden;
}

.sb-card-header {
  flex: 0 0 clamp(130px, 25vh, 190px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 20px 28px;
  text-align: center;
}

.sb-brand--card {
  gap: 14px;
}

.sb-brand--card.sb-brand--white,
.sb-brand--card.sb-brand--white .sb-brand-line {
  color: var(--sb-white);
}

.sb-brand-icon--card {
  width: 54px;
  height: 54px;
  object-fit: contain;
  flex-shrink: 0;
}

.sb-brand--card .sb-brand-line--si {
  font-size: 0.95rem;
  font-weight: 700;
}

.sb-brand--card .sb-brand-line--ta {
  font-size: 0.82rem;
  font-weight: 600;
}

.sb-brand--card .sb-brand-line--en {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.55rem;
  font-style: italic;
  font-weight: 700;
  margin-top: 2px;
  letter-spacing: -0.02em;
}

.sb-card-header .sb-brand {
  justify-content: center;
}

.sb-card-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--sb-white);
  border-radius: 30px 30px 0 0;
  padding: 24px 20px calc(env(safe-area-inset-bottom, 0px) + 18px);
  overflow: hidden;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
}

.sb-card-form {
  flex: 1;
  min-height: 0;
  height: 100%;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.sb-card-fields {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}

.sb-card-footer {
  flex-shrink: 0;
}

.sb-card-form .sb-field {
  margin-bottom: 0;
  flex-shrink: 0;
}

.sb-card-form .sb-field-row {
  gap: 14px;
  margin-bottom: 0;
}

.sb-card-form .sb-field-row .sb-field {
  margin-bottom: 0;
}

.sb-card-form .sb-field label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 2px;
}

.sb-card-form .sb-hint {
  font-size: 0.76rem;
  color: #9ca3af;
  margin-bottom: 8px;
  line-height: 1.35;
}

.sb-card-form .sb-input--icon {
  padding: 12px 14px 12px 42px;
  font-size: 0.94rem;
  border-radius: 10px;
  background: var(--sb-white);
  border: 1px solid #d1d5db;
  margin-top: 0;
}

.sb-card-form .sb-input--icon:focus {
  border-color: var(--sb-card-orange);
  box-shadow: 0 0 0 2px rgba(243, 112, 33, 0.15);
}

.sb-card-form .sb-field-icon {
  left: 13px;
  color: var(--sb-card-orange);
}

.sb-card-form .sb-field-icon svg {
  width: 19px;
  height: 19px;
}

.sb-card-form .form-error {
  font-size: 0.72rem;
  margin-top: 4px;
}

.sb-card-form .sb-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0;
  flex-shrink: 0;
}

.sb-card-footer .sb-btn-submit {
  width: 100%;
  margin-top: 0;
  padding: 15px 18px;
  font-size: 1.02rem;
  font-weight: 700;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--sb-card-orange);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sb-btn-logo-wrap {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sb-card-form .sb-btn-logo {
  position: static;
  transform: none;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.sb-field { margin-bottom: 18px; }

.sb-field label {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.sb-hint {
  font-size: 0.78rem;
  color: var(--sb-muted);
  margin-bottom: 8px;
}

.sb-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.sb-input-icon-wrap {
  position: relative;
}

.sb-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sb-orange);
  display: flex;
  pointer-events: none;
}

.sb-field-icon svg { width: 20px; height: 20px; }

.sb-input--icon {
  padding-left: 44px;
  border: 1px solid var(--sb-border);
  background: var(--sb-white);
  border-radius: 12px;
  margin-top: 0;
}

.sb-divider {
  height: 1px;
  background: var(--sb-border);
  margin: 24px 0;
}

.sb-btn-submit {
  width: 100%;
  margin-top: 24px;
  padding: 16px 20px;
  border: none;
  border-radius: 14px;
  background: var(--sb-orange);
  color: var(--sb-white);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
}

.sb-btn-logo {
  position: absolute;
  left: 18px;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.sb-btn-submit:disabled { opacity: 0.65; cursor: not-allowed; }

/* ===== 4-digit OTP orange screen ===== */
.sb-otp4-screen {
  background: var(--sb-orange-deep);
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 32px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 32px);
}

.sb-otp4-inner {
  width: 100%;
  max-width: 360px;
  text-align: center;
  color: var(--sb-white);
}

.sb-otp4-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.sb-otp4-desc {
  font-size: 0.9rem;
  opacity: 0.95;
  line-height: 1.5;
  margin-bottom: 32px;
  padding: 0 12px;
}

.otp-boxes--4 {
  gap: 14px;
  margin-bottom: 24px;
}

.otp-box--white {
  width: 56px;
  height: 56px;
  border: 2px solid var(--sb-white);
  border-radius: 10px;
  background: transparent;
  color: var(--sb-white);
  font-size: 1.35rem;
}

.otp-box--white:focus {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
  border-color: var(--sb-white);
}

.sb-resend-btn--light {
  color: var(--sb-white);
}

.sb-resend-btn--light svg { color: var(--sb-white); }

/* ===== Errors & toast ===== */
.form-error {
  color: var(--sb-error);
  font-size: 0.82rem;
  margin-top: 6px;
  text-align: left;
}

.form-error--light {
  color: #fecaca;
  text-align: center;
}

.user-toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 16px) + 24px);
  transform: translateX(-50%) translateY(120%);
  z-index: 9999;
  max-width: min(340px, 90vw);
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.92);
  color: var(--sb-white);
  font-size: 0.88rem;
  text-align: center;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

.user-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.user-toast.error { background: rgba(220, 38, 38, 0.95); }

@media (max-width: 380px) {
  .otp-box {
    width: 40px;
    height: 46px;
    font-size: 1.1rem;
  }

  .otp-boxes { gap: 7px; }

  .otp-box--white {
    width: 48px;
    height: 48px;
  }
}

@media (max-height: 700px) {
  .sb-card-header {
    flex-basis: clamp(110px, 22vh, 150px);
    padding-bottom: 20px;
  }

  .sb-brand-icon--card {
    width: 46px;
    height: 46px;
  }

  .sb-brand--card .sb-brand-line--si { font-size: 0.82rem; }
  .sb-brand--card .sb-brand-line--ta { font-size: 0.72rem; }
  .sb-brand--card .sb-brand-line--en { font-size: 1.25rem; }

  .sb-card-body { padding-top: 16px; }

  .sb-card-form .sb-hint { margin-bottom: 6px; }

  .sb-card-form .sb-input--icon {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .sb-card-footer .sb-btn-submit {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}
