
  :root {
    --primary: #1a6fb4;
    --primary-dark: #145a94;
    --primary-light: #e8f2fb;
    --accent: #2eaadc;
    --success: #27ae60;
    --error: #e74c3c;
    --text: #1a2332;
    --text-muted: #6b7a8d;
    --border: #d0dde8;
    --bg: #f0f5fa;
    --card: #ffffff;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(26,111,180,0.12);
    --shadow-md: 0 8px 40px rgba(26,111,180,0.18);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

  body {
    font-family: 'Sarabun', sans-serif;
    background: linear-gradient(135deg, #e8f2fb 0%, #dff0f7 50%, #e0eaf5 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
  }

  /* ── CARD ── */
  .login-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 440px;
    padding: 36px 36px 32px;
    animation: fadeUp .35s ease;
  }
  @keyframes fadeUp {
    from { opacity:0; transform:translateY(18px); }
    to   { opacity:1; transform:translateY(0); }
  }

  /* ── LOGO ── */
  .logo-wrap {
    text-align: center;
    margin-bottom: 24px;
  }
  .logo-wrap img {
    height: 72px;
    object-fit: contain;
  }
  .clinic-name {
    font-family: 'Prompt', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 8px;
    letter-spacing: .3px;
  }
  .clinic-sub {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 2px;
  }

  /* ── TABS ── */
  .tab-bar {
    display: flex;
    gap: 4px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 24px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar { display: none; }

  .tab-btn {
    flex: 1;
    min-width: 70px;
    padding: 9px 6px;
    border: none;
    border-radius: 7px;
    background: transparent;
    font-family: 'Sarabun', sans-serif;
    font-size: .82rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    touch-action: manipulation;
    min-height: 44px;
  }
  .tab-btn.active {
    background: var(--card);
    color: var(--primary);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(26,111,180,0.12);
  }
  .tab-btn:hover:not(.active) { color: var(--primary); background: rgba(255,255,255,.6); }

  /* ── FORM ── */
  .form-label {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
  }
  .form-group { margin-bottom: 18px; }

  .input-wrap {
    position: relative;
  }
  .input-wrap svg {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
  }
  input[type="text"], input[type="password"] {
    width: 100%;
    height: 48px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 44px 0 42px;
    font-family: 'Sarabun', sans-serif;
    font-size: .95rem;
    color: var(--text);
    background: var(--bg);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    -webkit-appearance: none;
  }
  input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,111,180,0.12);
    background: #fff;
  }

  .toggle-pw {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }
  .toggle-pw:hover { color: var(--primary); }

  /* ── SUBMIT ── */
  .btn-login {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-family: 'Prompt', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s, box-shadow .2s;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: .3px;
  }
  .btn-login:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(26,111,180,0.28);
  }
  .btn-login:active:not(:disabled) { transform: scale(.98); }
  .btn-login:disabled { opacity: .65; cursor: not-allowed; }

  /* ── SPINNER ── */
  .spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .65s linear infinite;
    display: none;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .btn-login.loading .spinner { display: block; }
  .btn-login.loading .btn-text { display: none; }

  /* ── ALERT ── */
  .alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: .88rem;
    margin-bottom: 16px;
    display: none;
    align-items: flex-start;
    gap: 8px;
  }
  .alert.show { display: flex; }
  .alert-error { background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb; }
  .alert-success { background: #e8f8f0; color: #1e8449; border: 1px solid #b7e4cb; }
  .alert-info { background: #e8f2fb; color: var(--primary); border: 1px solid var(--border); }

  /* ── FOOTER ── */
  .card-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: .78rem;
    color: var(--text-muted);
  }

  /* ── ROLE BADGE ── */
  .role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 20px;
  }

  /* ── Responsive ── */
  @media (max-width: 480px) {
    .login-card { padding: 28px 20px 24px; }
    .logo-wrap img { height: 60px; }
  }
