:root {
  --accent: #2563eb;
  --accent-light: #60a5fa;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-border: rgba(255, 255, 255, 0.65);
  --text: #0f172a;
  --mute: #64748b;
  --btn: #1d4ed8;
  --btn-hover: #1e40af;
  --input-bg: rgba(255, 255, 255, 0.92);
  --border: rgba(37, 99, 235, 0.18);
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.12), 0 4px 16px rgba(37, 99, 235, 0.08);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.22);
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.04) 0px,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 6px
    ),
    linear-gradient(
      180deg,
      #ddd0f0 0%,
      #d4e4f8 38%,
      #b8ddf5 72%,
      #9ed4f2 100%
    );
  background-attachment: fixed;
  padding: calc(12px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-shell {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  justify-content: center;
  gap: 8px;
}

.brand {
  text-align: center;
  width: 100%;
  margin-bottom: 4px;
}

.brand-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 96px;
  height: 96px;
  margin: 0 auto;
  filter: drop-shadow(0 8px 24px rgba(15, 23, 42, 0.18));
}

.brand-icon svg {
  width: 96px;
  height: 96px;
  display: block;
}

.page-title {
  margin: 0 0 16px;
  font-weight: 800;
  font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  letter-spacing: -0.02em;
  text-align: center;
  color: #0c1a3a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: clamp(20px, 5vw, 28px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.card h3 {
  margin: 0 0 18px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.field-group:last-of-type {
  margin-bottom: 0;
}

.field-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--mute);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.phone-entry {
  display: flex;
  gap: 8px;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
}

.cc-wrap {
  position: relative;
  flex: 0 0 auto;
}

.cc-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-width: 108px;
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  min-height: 48px;
  box-shadow: none;
  cursor: pointer;
}

.cc-toggle:focus {
  border-color: var(--accent-light);
  box-shadow: var(--focus-ring);
  outline: none;
}

.cc-flag {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.cc-flag-img {
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  display: block;
}

.cc-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 100;
  width: min(280px, calc(100vw - 48px));
  max-height: min(320px, 50vh);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}

.cc-panel.open {
  display: flex;
  flex-direction: column;
}

#ccSearch {
  margin: 10px 10px 6px;
  width: calc(100% - 20px);
  padding: 10px 12px;
  font-size: 16px;
}

.cc-list {
  list-style: none;
  margin: 0;
  padding: 4px 6px 8px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.cc-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  min-height: 44px;
  box-shadow: none;
  cursor: pointer;
}

.cc-option:hover,
.cc-option.active {
  background: color-mix(in srgb, var(--accent) 8%, #fff);
}

.cc-option .cc-name {
  flex: 1;
  min-width: 0;
}

.cc-option .cc-dial {
  color: var(--mute);
  font-weight: 600;
  white-space: nowrap;
}

#phLocal {
  flex: 1 1 auto;
  min-width: 0;
}

input {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  font: inherit;
  font-size: 16px;
  line-height: 1.25;
}

input::placeholder {
  color: #94a3b8;
}

input:focus {
  border-color: var(--accent-light);
  box-shadow: var(--focus-ring);
}

button {
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--btn) 100%);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  min-height: 48px;
  box-shadow: 0 6px 18px rgba(29, 78, 216, 0.35);
}

button:hover:not(:disabled) {
  background: linear-gradient(180deg, #3b82f6 0%, var(--btn-hover) 100%);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#otpMsg {
  margin: 16px 0 0;
  font-size: 0.875rem;
  color: var(--mute);
  line-height: 1.45;
  word-break: break-word;
}

@media (min-width: 480px) {
  .field-row {
    flex-direction: row;
    align-items: stretch;
  }

  .phone-entry {
    flex: 1 1 auto;
  }

  input:not(#ccSearch) {
    flex: 1 1 auto;
  }

  button:not(.cc-toggle):not(.cc-option) {
    width: auto;
    flex: 0 0 auto;
    min-width: 120px;
    align-self: stretch;
  }
}

@media (min-width: 768px) {
  body {
    padding-top: calc(24px + var(--safe-top));
  }

  .login-shell {
    max-width: 480px;
  }
}
