/* DTDESK CRM — Zoho-inspired auth (viewport-fit, mobile-first) */
:root {
  --zh-red: #e42527;
  --zh-red-dark: #c8201f;
  --zh-blue: #0091ff;
  --zh-blue-dark: #0070cc;
  --zh-text: #1a1a2e;
  --zh-muted: #5c6570;
  --zh-border: #d4d7dc;
  --zh-bg: #f4f5f7;
  --zh-white: #ffffff;
  --zh-aside-bg: linear-gradient(145deg, #fff5f0 0%, #ffe8dc 35%, #ffd4c4 70%, #ffc9b8 100%);
  --zh-font: "Zoho Puvi", "Segoe UI", system-ui, -apple-system, sans-serif;
  --zh-vh: 100vh;
  --zh-gap: 14px;
  --zh-input-h: 40px;
}

@supports (height: 100dvh) {
  :root { --zh-vh: 100dvh; }
}

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

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

body.zh-auth {
  height: var(--zh-vh);
  max-height: var(--zh-vh);
  margin: 0;
  overflow: hidden;
  font-family: var(--zh-font);
  background: var(--zh-bg);
  color: var(--zh-text);
  -webkit-font-smoothing: antialiased;
}

/* ── Shell: always exactly one screen ── */
.zh-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: var(--zh-vh);
  max-height: var(--zh-vh);
  overflow: hidden;
}

/* ── Left aside — always visible ── */
.zh-aside {
  background: var(--zh-aside-bg);
  padding: clamp(16px, 3vh, 40px) clamp(20px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.zh-aside::before,
.zh-aside::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.zh-aside::before {
  width: clamp(160px, 28vw, 280px);
  height: clamp(160px, 28vw, 280px);
  background: rgba(228, 37, 39, 0.08);
  top: -60px;
  right: -40px;
}

.zh-aside::after {
  width: clamp(100px, 18vw, 180px);
  height: clamp(100px, 18vw, 180px);
  background: rgba(0, 145, 255, 0.06);
  bottom: 20px;
  left: -30px;
}

.zh-aside-inner {
  position: relative;
  z-index: 1;
  max-width: 400px;
}

.zh-illustration {
  margin-bottom: clamp(12px, 2vh, 24px);
}

.zh-illustration svg {
  width: 100%;
  max-width: clamp(180px, 32vw, 300px);
  height: auto;
  max-height: clamp(100px, 18vh, 180px);
}

.zh-aside h2 {
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 8px;
  color: var(--zh-text);
}

.zh-aside p {
  font-size: clamp(12px, 1.4vw, 14px);
  line-height: 1.5;
  color: var(--zh-muted);
  margin: 0 0 clamp(10px, 1.5vh, 16px);
}

.zh-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.zh-features li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: clamp(11px, 1.2vw, 13px);
  color: var(--zh-muted);
  line-height: 1.4;
}

.zh-features li i {
  color: var(--zh-red);
  margin-top: 1px;
  flex-shrink: 0;
  font-size: 12px;
}

/* ── Main form panel ── */
.zh-main {
  background: var(--zh-white);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.zh-main-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(12px, 2vh, 24px) clamp(16px, 4vw, 32px);
}

.zh-form-wrap {
  width: 100%;
  max-width: 380px;
  margin: auto 0;
}

/* ── Logo ── */
.zh-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: clamp(12px, 2vh, 20px);
}

.zh-logo-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.zh-logo-blocks span:nth-child(1) { background: #e42527; border-radius: 3px 0 0 0; }
.zh-logo-blocks span:nth-child(2) { background: #0091ff; border-radius: 0 3px 0 0; }
.zh-logo-blocks span:nth-child(3) { background: #ffc600; border-radius: 0 0 0 3px; }
.zh-logo-blocks span:nth-child(4) { background: #00b050; border-radius: 0 0 3px 0; }

.zh-logo-text {
  font-size: clamp(16px, 2vw, 18px);
  font-weight: 700;
  color: var(--zh-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.zh-logo-text small {
  display: block;
  font-size: 9px;
  font-weight: 600;
  color: var(--zh-red);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Headings ── */
.zh-heading {
  font-size: clamp(20px, 2.8vw, 24px);
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--zh-text);
  line-height: 1.2;
}

.zh-subheading {
  font-size: clamp(12px, 1.5vw, 13px);
  color: var(--zh-muted);
  margin: 0 0 clamp(12px, 2vh, 18px);
  line-height: 1.4;
}

/* ── Alerts ── */
.zh-alert {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.zh-alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.zh-alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* ── Form ── */
.zh-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.zh-field {
  margin-bottom: var(--zh-gap);
}

.zh-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--zh-text);
  margin-bottom: 4px;
}

.zh-input {
  width: 100%;
  height: var(--zh-input-h);
  padding: 0 10px;
  font-size: 16px; /* prevents iOS zoom */
  font-family: inherit;
  color: var(--zh-text);
  background: var(--zh-white);
  border: 1px solid var(--zh-border);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.zh-input:focus {
  border-color: var(--zh-blue);
  box-shadow: 0 0 0 3px rgba(0, 145, 255, 0.12);
}

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

.zh-input-group { position: relative; }

.zh-input-group .zh-input { padding-right: 40px; }

.zh-input-toggle {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--zh-muted);
  padding: 6px;
  cursor: pointer;
}

/* ── CAPTCHA ── */
.zh-captcha-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.zh-captcha-badge {
  padding: 4px 10px;
  background: #f0f4ff;
  border: 1px solid #c7d7fe;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #1e40af;
  white-space: nowrap;
}

.zh-captcha-hint {
  font-size: 11px;
  color: var(--zh-muted);
  margin: 2px 0 0;
}

.zh-captcha-hint a {
  color: var(--zh-blue);
  text-decoration: none;
}

/* ── Row / links ── */
.zh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: var(--zh-gap);
}

.zh-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--zh-muted);
  cursor: pointer;
}

.zh-check input {
  accent-color: var(--zh-red);
  width: 14px;
  height: 14px;
}

.zh-link {
  font-size: 12px;
  color: var(--zh-blue);
  text-decoration: none;
  font-weight: 500;
}

.zh-link:hover { text-decoration: underline; }

/* ── Button ── */
.zh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: var(--zh-input-h);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--zh-red);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 2px;
}

.zh-btn:hover:not(:disabled) { background: var(--zh-red-dark); }
.zh-btn:disabled { opacity: 0.65; cursor: not-allowed; }

/* ── Footer links ── */
.zh-switch {
  text-align: center;
  margin-top: clamp(10px, 1.5vh, 14px);
  font-size: 13px;
  color: var(--zh-muted);
}

.zh-switch a {
  color: var(--zh-blue);
  font-weight: 600;
  text-decoration: none;
}

.zh-note {
  font-size: 11px;
  color: var(--zh-muted);
  margin-top: 8px;
  line-height: 1.4;
  text-align: center;
}

.zh-guide-promo {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  text-align: left;
}
.zh-guide-promo > i {
  font-size: 20px;
  color: #2563eb;
  margin-top: 2px;
  flex-shrink: 0;
}
.zh-guide-promo strong {
  display: block;
  font-size: 13px;
  color: #1e3a8a;
  margin-bottom: 4px;
}
.zh-guide-promo p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #334155;
}
.zh-guide-promo a {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
}
.zh-guide-promo a:hover { text-decoration: underline; }

/* ── Password meter ── */
.zh-meter {
  height: 3px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.zh-meter-bar {
  height: 100%;
  width: 0;
  transition: width 0.2s, background 0.2s;
}

.zh-meter-hint {
  font-size: 10px;
  color: var(--zh-muted);
  margin-top: 4px;
  line-height: 1.3;
}

/* ── Legal (sticky bottom bar) ── */
.zh-legal {
  flex-shrink: 0;
  padding: 8px clamp(16px, 4vw, 24px);
  border-top: 1px solid #eef0f3;
  background: var(--zh-white);
  font-size: 10px;
  color: #9ca3af;
  line-height: 1.4;
  text-align: center;
}

.zh-legal a {
  color: #6b7280;
  text-decoration: none;
}

.zh-legal a:hover { text-decoration: underline; }

/* ── Spinner ── */
.zh-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: zh-spin 0.7s linear infinite;
  display: none;
}

.zh-btn.is-loading .zh-spinner { display: block; }

@keyframes zh-spin { to { transform: rotate(360deg); } }

/* ── Short desktop screens: compact but keep left panel ── */
@media (max-height: 780px) {
  :root {
    --zh-gap: 10px;
    --zh-input-h: 36px;
  }

  .zh-illustration svg {
    max-height: clamp(70px, 12vh, 120px);
  }

  .zh-features li {
    font-size: 11px;
  }
}

@media (max-height: 680px) {
  .zh-illustration { margin-bottom: 8px; }
  .zh-illustration svg { max-height: 72px; }
  .zh-features { gap: 4px; }
  .zh-aside h2 { font-size: 17px; }
  .zh-aside p { font-size: 12px; margin-bottom: 8px; }
}

/* ── Tablet: stack — left panel on top, form below ── */
@media (max-width: 960px) {
  .zh-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, auto) minmax(0, 1fr);
  }

  .zh-aside {
    display: flex;
    padding: 14px 18px;
    justify-content: flex-start;
    max-height: 34vh;
  }

  .zh-illustration {
    margin-bottom: 8px;
  }

  .zh-illustration svg {
    max-width: 200px;
    max-height: 72px;
  }

  .zh-aside h2 {
    font-size: 16px;
    margin-bottom: 4px;
  }

  .zh-aside p {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .zh-features {
    gap: 4px;
  }

  .zh-features li {
    font-size: 11px;
  }

  .zh-main-inner {
    align-items: flex-start;
    padding: 12px 16px 8px;
  }
}

/* ── Mobile phone ── */
@media (max-width: 600px) {
  :root {
    --zh-gap: 10px;
    --zh-input-h: 38px;
  }

  .zh-aside {
    max-height: 28vh;
    padding: 12px 14px;
  }

  .zh-illustration svg {
    max-height: 56px;
    max-width: 160px;
  }

  .zh-features { display: none; }

  .zh-main-inner {
    padding: 10px 14px 6px;
  }

  .zh-logo { margin-bottom: 10px; }
  .zh-heading { font-size: 18px; }
  .zh-subheading { margin-bottom: 10px; font-size: 12px; }

  .zh-legal {
    font-size: 9px;
    padding: 6px 12px;
  }
}

/* ── Very small phones ── */
@media (max-width: 380px) {
  :root {
    --zh-gap: 8px;
    --zh-input-h: 36px;
  }

  .zh-aside {
    max-height: 22vh;
    padding: 10px 12px;
  }

  .zh-illustration { display: none; }

  .zh-main-inner {
    padding: 8px 12px 4px;
  }

  .zh-logo { margin-bottom: 8px; }
  .zh-heading { font-size: 17px; }

  .zh-meter-hint { display: none; }
  .zh-note { font-size: 10px; margin-top: 6px; }
}

/* Register page: tighter form so button stays visible */
body.zh-auth.zh-page-register {
  --zh-gap: 10px;
  --zh-input-h: 38px;
}

body.zh-auth.zh-page-register .zh-logo {
  margin-bottom: 10px;
}

body.zh-auth.zh-page-register .zh-subheading {
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  body.zh-auth.zh-page-register .zh-subheading { display: none; }
}

@media (max-height: 760px) {
  body.zh-auth.zh-page-register {
    --zh-gap: 9px;
    --zh-input-h: 36px;
  }

  body.zh-auth.zh-page-register .zh-subheading { display: none; }
  body.zh-auth.zh-page-register .zh-meter-hint { display: none; }
  body.zh-auth.zh-page-register .zh-note { margin-top: 6px; font-size: 10px; }
}

main.container > header,
main.container > footer { display: none !important; }

/* iOS install on login/register */
.dt-auth-ios-install {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  max-width: 420px;
  margin: 0 auto;
}
.dt-auth-ios-install[hidden] { display: none !important; }
.dt-auth-ios-install-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(30, 64, 175, 0.28);
  text-align: left;
}
.dt-auth-ios-install-btn strong { display: block; font-size: 13px; }
.dt-auth-ios-install-btn small { display: block; font-size: 11px; opacity: 0.9; margin-top: 2px; }
.dt-auth-ios-install-btn .bi-phone { font-size: 20px; }
.dt-auth-ios-install-btn .bi-chevron-right { margin-left: auto; opacity: 0.8; }

.dt-ios-install { position: fixed; inset: 0; z-index: 10100; display: flex; align-items: flex-end; justify-content: center; }
.dt-ios-install[hidden] { display: none !important; }
.dt-ios-install-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); }
.dt-ios-install-sheet {
  position: relative; width: min(100%, 440px); max-height: 88vh; overflow: auto;
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.2);
}
.dt-ios-install-handle { width: 40px; height: 4px; border-radius: 99px; background: #cbd5e1; margin: 0 auto 14px; }
.dt-ios-install-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.dt-ios-install-icon { border-radius: 14px; box-shadow: 0 8px 20px rgba(30, 64, 175, 0.25); flex: 0 0 56px; }
.dt-ios-install-head h2 { margin: 0 0 4px; font-size: 18px; font-weight: 800; color: #0f172a; }
.dt-ios-install-head p { margin: 0; font-size: 13px; color: #64748b; line-height: 1.45; }
.dt-ios-install-steps { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.dt-ios-install-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; }
.dt-ios-step-num { width: 28px; height: 28px; border-radius: 50%; background: #1e40af; color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; flex: 0 0 28px; }
.dt-ios-install-steps strong { display: block; font-size: 13px; color: #0f172a; margin-bottom: 2px; }
.dt-ios-install-steps span { font-size: 12px; color: #64748b; line-height: 1.4; }
body.dt-ios-install-open { overflow: hidden; }
