*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  @keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  :root {
    --bg: #FAF6EE;
    --surface: #FFFFFF;
    --ink: #2B2723;
    --ink-soft: #6B6358;
    --border: #E8DCC4;
    --green: #1F4D3D;
    --green-soft: #3B7A57;
    --green-tint: #E7EFE9;
    --red: #B5453A;
    --red-tint: #F5DEDA;
    --radius: 18px;
    --radius-sm: 11px;
    --shadow: 0 2px 10px rgba(43, 39, 35, 0.06);
  }

  html, body {
    height: 100%;
  }
  body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
  }

  /* Full-viewport backdrop the card floats on top of - same light
     cream tone as the rest of the app (not a dark wash), so the card
     needs its own visible border/shadow to stand out instead of
     blending into a similarly light page. */
  .login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: var(--bg);
  }

  /* The floating card itself - two panels side by side. A visible
     border here is what separates it from the page now that the
     backdrop is the same light family of color as the card's own
     white left half, instead of a dark wash that did that job for
     free.

     Fixed height (not max-height) on purpose - Sign In is short and
     the later registration steps (ID/camera previews) are genuinely
     tall, so letting the card follow its content made it visibly
     grow and shrink switching tabs/steps. Pinning it to one height
     keeps the card the same size everywhere; .login-shell-form below
     scrolls internally on the steps that need more room than that. */
  .login-shell {
    width: 100%;
    max-width: 980px;
    height: 640px;
    max-height: calc(100vh - 56px);
    display: flex;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 26px;
    box-shadow: 0 20px 44px -18px rgba(43, 39, 35, 0.22);
    overflow: hidden;
  }

  .login-shell-form {
    flex: 1 1 480px;
    min-width: 0;
    height: 100%;
    padding: 40px 44px;
    overflow-y: auto;
  }

  .login-shell-image {
    flex: 1 1 420px;
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
  }
  .login-illustration {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
  .login-illustration-caption {
    position: relative;
    z-index: 1;
    padding: 28px 30px 32px;
    background: linear-gradient(to top, rgba(10, 26, 20, 0.75), transparent);
    width: 100%;
  }
  .login-illustration-caption p {
    font-family: 'Inter', sans-serif;
    font-size: 19px;
    font-weight: 500;
    line-height: 1.4;
    color: #fff;
  }

  @media (max-width: 860px) {
    .login-shell-image { display: none; }
    .login-shell { max-width: 460px; }
    .login-shell-form { padding: 34px 28px; }
  }
  @media (max-width: 480px) {
    .login-page { padding: 0; }
    .login-shell { border-radius: 0; max-height: 100vh; height: 100vh; }
    .login-shell-form { padding: 28px 20px; }
  }

  .page-wrapper {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
  }

  /* Brand */
  .brand {
    text-align: left;
    margin-bottom: 1.6rem;
    animation: fadeSlideIn 0.35s ease;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .brand-logo {
    width: 38px;
    height: 38px;
    background: var(--green);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
  }
  .brand-logo svg { width: 20px; height: 20px; }
  .brand-logo img { width: 100%; height: 100%; object-fit: cover; }
  .brand h1 {
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.3px;
    white-space: nowrap;
  }

  /* Card - sits directly on the shell's own surface now, no extra
     bordered box nested inside another card. */
  .card {
    animation: fadeSlideIn 0.35s ease;
  }

  /* Tabs */
  .tabs {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 3px;
    margin-bottom: 1.25rem;
  }
  .tab-btn {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: var(--ink-soft);
    cursor: pointer;
    transition: all 0.18s ease;
  }
  .tab-btn.active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 500;
    box-shadow: var(--shadow);
  }

  /* Forms */
  .form-panel { display: none; }
  .form-panel.active { display: block; animation: fadeSlideIn 0.25s ease; }

  .form-group { margin-bottom: 0.85rem; }
  label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 5px;
  }
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  select {
    width: 100%;
    height: 37px;
    padding: 0 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface);
    outline: none;
    transition: border-color 0.15s;
    appearance: none;
  }
  input:focus, select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(31, 77, 61, 0.1);
  }
  input::placeholder { color: #B4B2A9; }

  .input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* Password toggle */
  .input-wrap { position: relative; }
  .input-wrap input { padding-right: 40px; }
  .toggle-pw {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink-soft);
    padding: 0;
    line-height: 1;
  }
  .toggle-pw svg { width: 16px; height: 16px; }

  /* Helper text */
  .helper {
    font-size: 11.5px;
    color: var(--ink-soft);
    margin-top: 4px;
  }

  /* Divider */
  .divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1rem 0;
  }
  .divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 0.5px;
    background: var(--border);
  }
  .divider span { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }

  /* Buttons */
  .btn-primary {
    width: 100%;
    height: 44px;
    background: var(--green);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--surface);
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    margin-top: 0.25rem;
    box-shadow: 0 8px 18px -6px rgba(31, 77, 61, 0.5);
  }
  .btn-primary:hover { opacity: 0.88; }
  .btn-primary:active { transform: scale(0.98); }
  .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

  /* Forgot password */
  .forgot {
    text-align: right;
    margin-top: -0.6rem;
    margin-bottom: 1rem;
  }
  .forgot a {
    font-size: 12.5px;
    color: var(--green);
    text-decoration: none;
  }
  .forgot a:hover { text-decoration: underline; }

  /* Same "forgot" link styling, but used BELOW a button instead of
     above one (e.g. "Back to sign in") - needs a normal positive
     top margin instead of .forgot's negative one, which is tuned to
     sit right under a password field, not under a button. */
  .forgot-below {
    text-align: right;
    margin-top: 14px;
  }
  .forgot-below a {
    font-size: 12.5px;
    color: var(--green);
    text-decoration: none;
  }
  .forgot-below a:hover { text-decoration: underline; }

  /* Same underline-on-hover-only convention as the links above, for
     a plain-text button rather than an <a> (Resend code). */
  .text-link-btn { text-decoration: none; }
  .text-link-btn:hover { text-decoration: underline; }

  /* Checkbox */
  .checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 0.5rem;
  }
  .checkbox-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    min-width: 15px;
    margin-top: 2px;
    accent-color: var(--green);
  }
  .checkbox-row span {
    font-size: 12.5px;
    color: var(--ink-soft);
    line-height: 1.5;
  }
  .checkbox-row a { color: var(--green); text-decoration: none; }

  /* Step indicator (registration) */
  .steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 1.5rem;
  }
  .step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.2s;
  }
  .step-dot.active {
    width: 24px;
    border-radius: 4px;
    background: var(--green);
  }
  .step-dot.done { background: var(--green-soft); }

  .step-label {
    font-size: 12px;
    color: var(--ink-soft);
    margin-bottom: 1.25rem;
    text-align: center;
  }
  .step-label span { color: var(--green); font-weight: 500; }

  /* Step panels */
  .reg-step { display: none; }
  .reg-step.active { display: block; animation: fadeSlideIn 0.25s ease; }

  .btn-row {
    display: flex;
    gap: 8px;
    margin-top: 0.6rem;
  }
  .btn-back {
    flex: 0 0 80px;
    height: 42px;
    background: none;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--ink-soft);
    cursor: pointer;
    transition: border-color 0.15s;
  }
  .btn-back:hover { border-color: var(--ink-soft); color: var(--ink); }
  .btn-next {
    flex: 1;
    width: 100%;
    height: 42px;
    background: var(--green);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--surface);
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
  }
  .btn-next:hover { opacity: 0.88; }
  .btn-next:active { transform: scale(0.98); }
  .btn-next:disabled { opacity: 0.5; cursor: not-allowed; }

  /* File upload */
  .upload-box {
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: #FAFAF8;
    display: block;
  }
  .upload-box:hover { border-color: var(--green); background: var(--green-tint); }
  .upload-box input { display: none; }
  .upload-box p { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
  .upload-box strong { font-size: 13px; color: var(--green); }
  .upload-icon { color: var(--border); }

  /* Preview container with remove button */
  .preview-container {
    position: relative;
    display: inline-block;
    margin: 3px auto;
    z-index: 5;
    animation: fadeSlideIn 0.2s ease;
  }
  .remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--red);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 999;
    pointer-events: auto;
  }
  .remove-btn:hover { opacity: 0.85; transform: scale(1.1); }

  /* Notice */
  .notice {
    background: var(--green-tint);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 12.5px;
    color: var(--green-soft);
    line-height: 1.4;
    margin-top: 0.5rem;
  }
  .notice strong { color: var(--ink); }

  /* Success state */
  .success-card {
    text-align: center;
    padding: 1rem 0;
  }
  .success-icon {
    width: 52px;
    height: 52px;
    background: var(--green-tint);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
  }
  .success-icon svg { width: 24px; height: 24px; }
  .success-card h2 {
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
  }
  .success-card p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; }

  /* Error msg */
  .error-msg {
    font-size: 12px;
    color: var(--red);
    margin-top: 4px;
    display: none;
  }
  .error-msg.show { display: block; animation: fadeSlideIn 0.2s ease; }
  /* Email = typed name + fixed @gmail.com */
  .email-split { display: flex; align-items: center; gap: 6px; }
  .email-split input { flex: 1; min-width: 0; }
  .email-at { color: var(--ink-soft); font-size: 14px; }
  .email-domain-wrap { position: relative; flex-shrink: 0; }
  .email-domain-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    height: 37px; min-width: 128px; padding: 0 12px;
    border: 0.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink);
    font-family: 'Inter', sans-serif; font-size: 14px; cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .email-domain-trigger:hover { border-color: var(--green-soft); }
  .email-domain-wrap.open .email-domain-trigger { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31, 77, 61, 0.1); }
  .email-domain-arrow { font-size: 10px; color: var(--ink-soft); transition: transform 0.2s ease; }
  .email-domain-wrap.open .email-domain-arrow { transform: rotate(180deg); }
  .email-domain-menu {
    position: absolute; top: 100%; right: 0; margin-top: 4px; min-width: 100%; width: max-content;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12); z-index: 40; padding: 4px;
    opacity: 0; transform: translateY(-4px); visibility: hidden; pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
  }
  .email-domain-wrap.open .email-domain-menu {
    opacity: 1; transform: translateY(0); visibility: visible; pointer-events: auto;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
  }
  .email-domain-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
    text-align: left; padding: 8px 12px; font-size: 13px; font-family: 'Inter', sans-serif;
    border: none; background: none; cursor: pointer; color: var(--ink);
    border-radius: 8px; transition: background-color 0.12s ease;
  }
  .email-domain-item:hover { background: var(--bg); }
  .email-domain-item.active { background: var(--green-tint); color: var(--green); font-weight: 600; }
  .email-soon { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); background: var(--bg); padding: 1px 6px; border-radius: 999px; }

  /* Sign in with Google */
  .google-signin-wrap { margin-top: 14px; }
  .google-or { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 12px; margin-bottom: 12px; }
  .google-or::before, .google-or::after { content: ""; flex: 1; height: 1px; background: var(--border, #ddd); }
  #google-signin-btn { display: flex; justify-content: center; min-height: 40px; }

  /* Resident / Admin picker above the Sign in button */
  .role-switch { margin: 4px 0 14px; }
  .role-switch-label { display:block; font-size:13px; font-weight:500; margin-bottom:6px; }
  .role-switch-options { display:flex; gap:6px; padding:4px; background:#F8F4EC; border-radius:12px; }
  .role-opt {
    flex:1; padding:9px 12px; border:none; border-radius:9px; background:transparent;
    font-family:inherit; font-size:14px; font-weight:500; color:#6b675c; cursor:pointer;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
  }
  .role-opt.active { background:#fff; color:#1F4D3D; font-weight:600; box-shadow:0 1px 4px rgba(0,0,0,.1); }

  /* Sign-in fits on one screen (no scrolling to find the Google button) */
  #panel-login .form-group { margin-bottom: 0.65rem; }
  #panel-login .role-switch { margin: 2px 0 10px; }
  #panel-login .role-opt { padding: 7px 12px; }
  #panel-login .google-signin-wrap { margin-top: 10px; }
  #panel-login .google-or { margin-bottom: 8px; }
  #panel-login #google-signin-btn { min-height: 38px; }
  @media (max-height: 860px) {
    .login-shell-form { padding-top: 22px; padding-bottom: 18px; }
    .brand { margin-bottom: 0.7rem; }
    .tabs { margin-bottom: 0.8rem; }
    #panel-login .form-group { margin-bottom: 0.5rem; }
    #panel-login .btn-primary { height: 40px; }
    #panel-login .forgot { margin-bottom: 4px; }
  }

  .google-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; max-width: 320px; height: 40px;
    background: #fff; color: #3c4043; border: 1px solid #dadce0; border-radius: 4px;
    font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease;
  }
  .google-btn:hover { background: #f8f9fa; box-shadow: 0 1px 3px rgba(0,0,0,.15); }

  /* Street dropdown on the registration form - same look as the email provider dropdown */
  .street-wrap { position: relative; }
  .street-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; height: 37px; padding: 0 12px;
    border: 0.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink);
    font-family: 'Inter', sans-serif; font-size: 14px; cursor: pointer; text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .street-trigger:hover { border-color: var(--green-soft); }
  .street-wrap.open .street-trigger { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31, 77, 61, 0.1); }
  .street-wrap.open .email-domain-arrow { transform: rotate(180deg); }
  .street-placeholder { color: #B4B2A9; }
  .street-menu {
    position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 4px;
    max-height: 190px; overflow-y: auto; overscroll-behavior: contain;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12); z-index: 40; padding: 4px;
    opacity: 0; transform: translateY(4px); visibility: hidden; pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  }
  .street-wrap.open .street-menu {
    opacity: 1; transform: translateY(0); visibility: visible; pointer-events: auto;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
  }
  .street-menu::-webkit-scrollbar { width: 8px; }
  .street-menu::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
  .street-item {
    display: block; width: 100%; text-align: left; padding: 8px 12px; font-size: 13px;
    font-family: 'Inter', sans-serif; border: none; background: none; cursor: pointer;
    color: var(--ink); border-radius: 8px; transition: background-color 0.12s ease;
  }
  .street-item:hover { background: var(--bg); }
  .street-item.active { background: var(--green-tint); color: var(--green); font-weight: 600; }