/* ==========================================================================
   WorkplaceGPT — Customer Sign-in · "Porcelain" theme
   Split layout: dark brand panel + warm-paper form. Single emerald accent.
   ========================================================================== */

:root {
  --paper: #f4f3ef;
  --paper-2: #efeee9;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --line: rgba(40, 38, 30, 0.10);
  --line-2: rgba(40, 38, 30, 0.14);

  --ink: #181814;
  --ink-2: #5c5a53;
  --ink-3: #8c8980;
  --ink-4: #b3afa4;

  --accent: #0B6E54;
  --accent-2: #0E8364;
  --accent-soft: rgba(11, 110, 84, 0.10);

  --err: #C23434;
  --err-bg: rgba(194, 52, 52, 0.10);
  --err-line: rgba(194, 52, 52, 0.22);

  --btn: #181814;
  --btn-text: #ffffff;

  --shadow-sm: 0 1px 2px rgba(40, 38, 30, 0.05);
  --shadow: 0 1px 2px rgba(40, 38, 30, 0.04), 0 6px 14px -8px rgba(40, 38, 30, 0.14);
  --shadow-lg: 0 2px 4px rgba(40, 38, 30, 0.04), 0 30px 60px -24px rgba(40, 38, 30, 0.22);

  --t-fast: 130ms ease-out;
  --t-base: 200ms ease-out;
}

[data-theme="dark"] {
  --paper: #0f100d;
  --paper-2: #0c0d0a;
  --surface: #16170f;
  --surface-2: #14150f;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.13);

  --ink: #ecebe3;
  --ink-2: #a8a496;
  --ink-3: #7c7868;
  --ink-4: #5a5648;

  --accent: #3ddc97;
  --accent-2: #2cc285;
  --accent-soft: rgba(61, 220, 151, 0.14);

  --err: #f0807b;
  --err-bg: rgba(240, 128, 123, 0.14);
  --err-line: rgba(240, 128, 123, 0.28);

  --btn: #ffffff;
  --btn-text: #181814;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 36px -22px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.5), 0 30px 60px -24px rgba(0, 0, 0, 0.9);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh; color: var(--ink); line-height: 1.5; letter-spacing: -0.005em;
  background: var(--paper);
}

/* Layout ----------------------------------------------------------------- */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

/* Brand panel ------------------------------------------------------------ */
.brand-panel {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 3.25rem 3rem;
  color: #ece8df;
  background:
    radial-gradient(820px 520px at 80% -12%, rgba(11, 110, 84, 0.42), transparent 60%),
    linear-gradient(155deg, #13160f 0%, #0b0d08 100%);
}
.brand-grain {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.brand-top { position: relative; display: flex; align-items: center; gap: 0.75rem; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  color: #3ddc97; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.04);
}
.brand-name { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }

.brand-mid { position: relative; max-width: 30rem; }
.brand-headline { font-size: 2rem; font-weight: 600; line-height: 1.14; letter-spacing: -0.025em; }
.brand-sub { color: rgba(255, 255, 255, 0.55); margin-top: 1rem; font-size: 0.9375rem; line-height: 1.6; }
.brand-points { list-style: none; margin-top: 2.25rem; display: flex; flex-direction: column; gap: 1rem; }
.brand-points li { display: flex; align-items: center; gap: 0.875rem; font-size: 0.9rem; color: rgba(255, 255, 255, 0.82); }
.brand-points svg { color: #3ddc97; flex-shrink: 0; }
.brand-foot { position: relative; font-size: 0.75rem; color: rgba(255, 255, 255, 0.35); }

/* Form panel ------------------------------------------------------------- */
.form-panel {
  display: grid; place-items: center; padding: 2.5rem 1.5rem;
  background:
    radial-gradient(680px 460px at 50% -10%, var(--accent-soft), transparent 60%),
    var(--paper);
}
.form-wrap { width: 100%; max-width: 384px; }

.form-mark { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 2rem; font-weight: 600; font-size: 0.9375rem; color: var(--ink); }
.form-mark-badge { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .form-mark-badge { background: var(--accent); color: #06140d; }

.form-head { margin-bottom: 1.75rem; }
.form-head h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.025em; }
.form-head p { color: var(--ink-3); font-size: 0.9375rem; margin-top: 0.375rem; }

/* Form ------------------------------------------------------------------- */
.login-form { display: flex; flex-direction: column; gap: 1.125rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4375rem; }
.form-group label { font-size: 0.8125rem; font-weight: 600; color: var(--ink); }
.form-group input {
  padding: 0.75rem 0.9375rem; border: 1px solid var(--line-2); border-radius: 0.625rem;
  font-size: 0.9375rem; font-family: inherit; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm); transition: border-color var(--t-fast), box-shadow var(--t-fast); width: 100%;
}
.form-group input:hover { border-color: var(--ink-4); }
.form-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-group input::placeholder { color: var(--ink-4); }

/* Error ------------------------------------------------------------------ */
.error-message {
  display: flex; align-items: center; gap: 0.625rem; padding: 0.75rem 0.9375rem;
  background: var(--err-bg); border: 1px solid var(--err-line); border-radius: 0.625rem;
  color: var(--err); font-size: 0.8438rem; font-weight: 500; animation: shake 0.4s ease-out;
}
.error-message svg { flex-shrink: 0; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-4px); } 40%,80% { transform: translateX(4px); } }

/* Microsoft button (primary CTA) ----------------------------------------- */
.btn-microsoft {
  display: flex; align-items: center; justify-content: center; gap: 0.625rem;
  padding: 0.8125rem 1.25rem; margin-top: 0.25rem;
  background: var(--btn); color: var(--btn-text);
  border: 1px solid transparent; border-radius: 0.625rem;
  font-size: 0.9375rem; font-weight: 600; font-family: inherit; cursor: pointer;
  box-shadow: var(--shadow); transition: filter var(--t-fast), box-shadow var(--t-base), transform var(--t-fast);
}
.btn-microsoft:hover { filter: brightness(1.08); box-shadow: var(--shadow-lg); }
.btn-microsoft:active { transform: translateY(0.5px); }
.btn-microsoft:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-microsoft:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-microsoft svg { flex-shrink: 0; }

.form-foot { text-align: center; font-size: 0.8125rem; color: var(--ink-3); margin-top: 1.75rem; }

/* Loading skeleton ------------------------------------------------------- */
.loading { display: flex; flex-direction: column; gap: 1.125rem; }
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--line-2) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: 0.625rem;
  border: 1px solid var(--line);
}
.skeleton-label { height: 13px; width: 84px; border-radius: 5px; margin-bottom: 0.4375rem; border: 0; }
.skeleton-input { height: 46px; width: 100%; }
.skeleton-button { height: 47px; width: 100%; margin-top: 0.25rem; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Theme toggle ----------------------------------------------------------- */
.theme-toggle {
  position: fixed; top: 1.5rem; right: 1.5rem; width: 42px; height: 42px;
  border: 1px solid var(--line-2); border-radius: 0.625rem; background: var(--surface); color: var(--ink-2);
  cursor: pointer; box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: center;
  transition: color var(--t-fast), box-shadow var(--t-base), border-color var(--t-fast);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--ink-4); box-shadow: var(--shadow); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle .sun-icon, .theme-toggle .moon-icon { width: 19px; height: 19px; }
.sun-icon { display: none; }
.moon-icon { display: block; }
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
}
@media (max-width: 480px) {
  .form-panel { padding: 2rem 1.25rem; }
  .theme-toggle { top: 1rem; right: 1rem; }
}

/* Accessibility ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: var(--surface-2); }
  .error-message { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
@media (prefers-contrast: high) {
  .form-group input, .btn-microsoft, .theme-toggle { border-width: 2px; }
}
@media print { .brand-panel, .theme-toggle { display: none; } }
