/* Sign-in page styling. CSS custom properties match v39's :root so a
   branded login looks consistent with the app shell. Defaults applied
   inline below; bootstrap fetches /branding on load and overrides them. */

:root {
  --bg-primary: #1c1917;
  --bg-secondary: #292524;
  --bg-tertiary: #44403c;
  --text-primary: #fafaf9;
  --text-secondary: #a8a29e;
  --border: #57534e;
  --gold: #d4af37;
  --green: #37ac20;
  --plum: #5e3b5e;
  --danger: #dc2626;
  --danger-bg: #dc262633;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  gap: 1.5rem;
}

.login-header {
  text-align: center;
  max-width: 400px;
}

.login-header h1 {
  margin: 0;
  color: var(--gold);
  font-size: 1.5rem;
  font-weight: 600;
}

.login-header p {
  margin: 0.5rem 0 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  /* Allow flex/grid children to shrink below content's natural width.
     Without this, the password row's flex input keeps min-width:auto and
     can push the row past the viewport edge on narrow screens. */
  min-width: 0;
}

/* Mobile — tighten the shell padding so the card fills nearly edge-to-edge,
   then widen the input rows. The form is short enough not to need vertical
   scroll on standard phones; reducing chrome around it makes that obvious. */
@media (max-width: 480px) {
  .login-shell { padding: 1rem 0.75rem; gap: 1rem; }
  .login-card { padding: 1.25rem 1rem; max-width: none; }
  .login-header { max-width: none; }
  .tabs { margin: -1.25rem -1rem 0; }
}

/* Allow the password input to shrink below its default min-content width. */
.pw-row { min-width: 0; }
.pw-row input { min-width: 0; width: 100%; }

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: -1.5rem -1.5rem 0;
}

.tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  /* 44px tap target — accessibility constraint from CLAUDE.md (cataracts). */
  min-height: 44px;
}

.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.tab:hover:not(.active) {
  color: var(--text-primary);
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

input[type="email"],
input[type="password"] {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  /* 44px tap target. */
  min-height: 44px;
}

input:focus {
  outline: none;
  border-color: var(--gold);
}

.submit-btn {
  background: var(--gold);
  color: var(--bg-primary);
  border: none;
  border-radius: 6px;
  padding: 0.875rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  min-height: 44px;
  margin-top: 0.5rem;
}

.submit-btn:hover {
  filter: brightness(1.1);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error {
  margin: 0;
  min-height: 1.25rem;
  font-size: 0.875rem;
  color: var(--danger);
  text-align: center;
}

.error:not(:empty) {
  background: var(--danger-bg);
  border-radius: 4px;
  padding: 0.5rem;
}

/* Password row: input + eye-toggle button on the right */
.pw-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.pw-row input {
  flex: 1;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.pw-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-left: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
  color: var(--text-secondary);
  padding: 0 0.75rem;
  cursor: pointer;
  font-size: 1.125rem;
  min-height: 44px;
  font-family: inherit;
}

.pw-toggle:hover { color: var(--gold); }
.pw-toggle.active { color: var(--gold); }
