/* Styles for server-rendered pages: login, register, dashboards, admin.
   Reuses the brand variables/tokens defined in styles.css. */

.auth-main {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 1.4rem;
  margin-bottom: 20px;
  text-align: center;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-elev-2);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.auth-panel { display: none; flex-direction: column; gap: 14px; }
.auth-panel.active { display: flex; }

.auth-panel label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 600;
}

.auth-panel input {
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.auth-panel input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn-block { width: 100%; }

.auth-error {
  color: #f27272;
  font-size: 0.85rem;
  margin: 0;
  min-height: 1.1em;
}

.auth-note {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin: -6px 0 0;
}

.auth-divider {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin: 20px 0 14px;
  position: relative;
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-switch {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-top: 20px;
}

.auth-switch a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* Dashboards */
.dash-main { padding: 40px 0 64px; }

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

.dash-header h1 { font-size: 1.6rem; }

.dash-features { margin-top: 48px; }

.dash-features h2 { font-size: 1.3rem; margin-bottom: 8px; }

.dash-features-subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 0 0 24px;
}

.dash-features .feature-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.feature-command {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.dash-table th, .dash-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.dash-table th { color: var(--text-dim); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

.dash-table tr:last-child td { border-bottom: none; }

.role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.role-badge.superadmin { background: color-mix(in srgb, var(--brand-primary) 20%, transparent); color: var(--brand-primary); }
.role-badge.user { background: var(--bg-elev-2); color: var(--text-dim); }

.dash-table-wrap { overflow-x: auto; }

.role-form button {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text);
  cursor: pointer;
}

/* --- Admin integrations page --- */
.integ-subtitle { color: var(--text-dim); font-size: 0.9rem; margin: 6px 0 0; max-width: 60ch; }

.integ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.integ-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.integ-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.integ-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.integ-icon { font-size: 1.4rem; }
.integ-title h2 { font-size: 1.1rem; margin: 0; }

.integ-pill {
  flex: none;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.integ-pill.connected { background: color-mix(in srgb, var(--brand-secondary) 22%, transparent); color: var(--brand-secondary); }
.integ-pill.saved { background: color-mix(in srgb, var(--brand-primary) 20%, transparent); color: var(--brand-primary); }
.integ-pill.notset { background: var(--bg-elev-2); color: var(--text-dim); }

.integ-desc { color: var(--text-dim); font-size: 0.9rem; margin: 0; }
.integ-note { font-size: 0.8rem; margin: 0; }
.integ-note.stored { color: var(--brand-primary); }
.integ-note.restart { color: var(--text-dim); }

.integ-form { display: flex; flex-direction: column; gap: 12px; }
.integ-field { display: flex; flex-direction: column; gap: 5px; }
.integ-field-label { font-size: 0.8rem; color: var(--text-dim); font-weight: 600; }
.integ-field input {
  font: inherit;
  font-size: 0.9rem;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.integ-field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.integ-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.integ-actions .btn { padding: 8px 16px; font-size: 0.9rem; }
.integ-feedback { font-size: 0.82rem; font-weight: 600; }
.integ-feedback.ok { color: var(--brand-secondary); }
.integ-feedback.err { color: #f27272; }

.integ-how { border-top: 1px solid var(--border); padding-top: 12px; }
.integ-how summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.integ-steps { margin: 12px 0 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 7px; }
.integ-steps li { font-size: 0.85rem; color: var(--text-dim); line-height: 1.5; }
