/* ── Portal SaaS Login ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand-bg:      #0f172a;
  --brand-surface: #1e293b;
  --brand-primary: #4f6df5;
  --brand-accent:  #38bdf8;
  --brand-text:    #f1f5f9;
  --radius:        12px;
  --font:          'Inter', system-ui, -apple-system, sans-serif;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--brand-bg);
  color: var(--brand-text);
  min-height: 100dvh;
  display: flex;
}

/* ── Two-column layout ─────────────────────────────────────────── */
.portal-layout {
  display: flex;
  width: 100%;
  min-height: 100dvh;
}

/* ── Brand panel (left) ────────────────────────────────────────── */
.brand-panel {
  flex: 1;
  background: linear-gradient(160deg, #1e293b 0%, #0f172a 55%, #080d1a 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3.5rem;
  position: relative;
  overflow: hidden;
}

/* dot-grid overlay */
.brand-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(79,109,245,.18) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

/* glow blob */
.brand-panel::after {
  content: '';
  position: absolute;
  top: -120px;
  left: -80px;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(79,109,245,.22) 0%, transparent 65%);
  pointer-events: none;
}

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

/* brand logo area */
.brand-logo-area {
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.brand-logo-area img {
  max-height: 44px;
  max-width: 160px;
  object-fit: contain;
}

.brand-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(79,109,245,.2);
  border: 1px solid rgba(79,109,245,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo-icon svg {
  width: 24px;
  height: 24px;
}

.brand-wordmark {
  font-size: 1.125rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -.01em;
}

/* heading + body */
.brand-inner h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.375rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: #f8fafc;
  margin-bottom: 1rem;
}

.brand-inner p {
  font-size: 1rem;
  line-height: 1.65;
  color: #94a3b8;
  margin-bottom: 2.5rem;
  max-width: 340px;
}

/* feature bullet list */
.brand-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.brand-features li {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .875rem;
  color: #94a3b8;
}

.brand-features li::before {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(79,109,245,.15) url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 10l3 3 5-5' stroke='%234f6df5' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat;
  border: 1px solid rgba(79,109,245,.3);
}

.brand-footer {
  position: relative;
  z-index: 1;
  font-size: .75rem;
  color: #334155;
}

/* ── Login panel (right) ────────────────────────────────────────── */
.login-panel {
  width: 500px;
  flex-shrink: 0;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  gap: 1.25rem;
}

/* ── Login card ─────────────────────────────────────────────────── */
.login-card {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid #e2e8f0;
  box-shadow:
    0 1px 2px rgba(0,0,0,.04),
    0 4px 16px rgba(0,0,0,.06),
    0 12px 40px rgba(0,0,0,.04);
  overflow: hidden;
}

/* card header */
.card-header {
  padding: 1.75rem 1.75rem 0;
}

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -.015em;
  margin-bottom: .25rem;
}

.card-header p {
  font-size: .875rem;
  color: #64748b;
}

/* ── Tabs ─────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: .25rem;
  padding: 1.25rem 1.75rem .25rem;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}

.tab-bar .tab {
  flex: 1;
  padding: .5625rem .75rem;
  font-size: .8125rem;
  font-weight: 500;
  font-family: var(--font);
  color: #64748b;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}

.tab-bar .tab:hover { color: #0f172a; background: #f8fafc; }

.tab-bar .tab.active {
  color: var(--brand-primary, #4f6df5);
  background: color-mix(in srgb, var(--brand-primary, #4f6df5) 8%, white);
  border-color: color-mix(in srgb, var(--brand-primary, #4f6df5) 25%, white);
}

/* ── Forms ──────────────────────────────────────────────────────── */
.tab-pane {
  display: none;
  flex-direction: column;
  gap: 1.125rem;
  padding: 1.5rem 1.75rem 1.75rem;
}

.tab-pane.active { display: flex; }

.field {
  display: flex;
  flex-direction: column;
  gap: .375rem;
}

.field label {
  font-size: .8125rem;
  font-weight: 500;
  color: #374151;
  letter-spacing: .005em;
}

.field input {
  padding: .65rem .9rem;
  font-size: .9375rem;
  font-family: var(--font);
  color: #0f172a;
  background: #ffffff;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}

.field input::placeholder { color: #9ca3af; }

.field input:focus {
  border-color: var(--brand-primary, #4f6df5);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary, #4f6df5) 15%, transparent);
}

.btn-primary {
  width: 100%;
  padding: .75rem 1rem;
  font-size: .9375rem;
  font-weight: 600;
  font-family: var(--font);
  color: #ffffff;
  background: var(--brand-primary, #4f6df5);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: filter .15s, transform .1s;
  margin-top: .125rem;
  letter-spacing: .005em;
}

.btn-primary:hover  { filter: brightness(1.08); }
.btn-primary:active { transform: scale(.99); }

/* ── Status messages ────────────────────────────────────────────── */
.form-status {
  font-size: .8125rem;
  line-height: 1.4;
  padding: .625rem .875rem;
  border-radius: 7px;
  display: none;
}

.form-status:not(:empty) { display: block; }
.form-status.ok  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.form-status.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── Legal / footer links ───────────────────────────────────────── */
.legal-links {
  padding: .875rem 1.75rem 1.25rem;
  font-size: .75rem;
  color: #94a3b8;
  text-align: center;
  border-top: 1px solid #f8fafc;
  line-height: 1.6;
}

.legal-links:empty { display: none; }

.legal-links a {
  color: #64748b;
  text-decoration: none;
  transition: color .12s;
}

.legal-links a:hover { color: #374151; text-decoration: underline; }

/* ── Session bar (shown after login) ───────────────────────────── */
.session-bar {
  width: 100%;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .875rem 1.25rem;
  background: #f0fdf4;
  border-radius: var(--radius);
  border: 1px solid #bbf7d0;
  font-size: .8125rem;
  color: #166534;
}

.session-bar[hidden] { display: none !important; }

.session-bar-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 500;
}

.session-bar-label::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(34,197,94,.2);
}

.btn-ghost {
  font-size: .8125rem;
  font-family: var(--font);
  font-weight: 500;
  color: #dc2626;
  background: transparent;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: .3125rem .875rem;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}

.btn-ghost:hover { background: #fef2f2; border-color: #f87171; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .portal-layout { flex-direction: column; }

  .brand-panel {
    padding: 2rem 1.75rem 1.75rem;
    flex: none;
    min-height: auto;
  }

  .brand-features { display: none; }

  .brand-inner p { margin-bottom: 0; }

  .login-panel {
    width: 100%;
    padding: 2rem 1.25rem 3rem;
    background: #f8fafc;
  }

  .login-card { max-width: 100%; }
  .session-bar { max-width: 100%; }
}

@media (max-width: 400px) {
  .brand-panel { padding: 1.5rem; }
  .tab-bar, .tab-pane { padding-left: 1.25rem; padding-right: 1.25rem; }
  .card-header { padding-left: 1.25rem; padding-right: 1.25rem; }
}
