:root {
  --bg: #F4EFE5;
  --bg-card: #ffffff;
  --gold: #C2A572;
  --gold-dark: #A8894F;
  --gold-light: rgba(194, 165, 114, 0.15);
  --text: #1A1A1A;
  --text-muted: #6B6B6B;
  --border: #E0D8C8;
  --error-bg: #fdf2f2;
  --error: #C0392B;
  --success-bg: #f0fdf4;
  --success: #27AE60;
  --danger: #E74C3C;
  --danger-dark: #C0392B;
  --navy: #2C3E50;
  --navy-light: rgba(44, 62, 80, 0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Layout ── */
.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ── Header ── */
header {
  background: var(--bg-card);
  border-bottom: 2px solid var(--gold);
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

header .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold-dark);
  letter-spacing: 0.03em;
}

header .meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ── Card ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Login ── */
.login-card {
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold-dark);
  letter-spacing: 0.04em;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* ── Form elements ── */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  padding: 0.6rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-light);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--gold);
  color: #fff;
  width: 100%;
  justify-content: center;
  padding: 0.7rem;
  font-size: 1rem;
}
.btn-primary:hover:not(:disabled) { background: var(--gold-dark); }

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-dark); }

.btn-ghost {
  background: transparent;
  color: var(--gold-dark);
  padding: 0.4rem 0.75rem;
  border: 1.5px solid var(--gold);
  font-size: 0.8rem;
}
.btn-ghost:hover:not(:disabled) { background: var(--gold-light); }

/* ── Alerts ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #f5c6c6; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.alert-info { background: var(--gold-light); color: var(--gold-dark); border: 1px solid var(--border); }
.alert-hidden { display: none; }

/* ── Page title ── */
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
}

/* ── Admin table ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  font-size: 0.9rem;
}

th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef9c3; color: #854d0e; }

/* ── Questionnaire ── */
.scale-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
  padding: 0.875rem 1rem;
  background: var(--gold-light);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.scale-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.scale-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.question-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.question-block.invalid { border-color: var(--error); }

.question-text {
  font-weight: 600;
  margin-bottom: 0.875rem;
  font-size: 0.95rem;
}

.question-axis {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
  background: #fff;
  user-select: none;
}

.radio-label:hover { border-color: var(--gold); background: var(--gold-light); }

.radio-label input[type="radio"] { display: none; }

.radio-label.selected {
  border-color: var(--gold);
  background: var(--gold-light);
  font-weight: 600;
  color: var(--gold-dark);
}

.radio-value {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.radio-label.selected .radio-value {
  background: var(--gold);
  color: #fff;
}

/* ── Radar section ── */
.radar-section {
  margin-top: 2rem;
}

.radar-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.radar-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.radar-canvas-wrapper {
  max-width: 540px;
  margin: 0 auto 1.5rem;
}

.radar-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.radar-stat {
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.875rem 1.5rem;
  min-width: 140px;
}

.radar-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold-dark);
  line-height: 1;
}

.radar-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.panel-notice {
  text-align: center;
  padding: 0.75rem;
  background: var(--gold-light);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--gold-dark);
  border: 1px solid var(--border);
}

/* ── Password reveal ── */
.password-reveal {
  background: var(--success-bg);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}

.password-reveal strong { color: var(--success); }

.password-value {
  font-family: 'Courier New', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  background: #fff;
  border: 1.5px solid #bbf7d0;
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  display: inline-block;
  margin: 0.35rem 0;
  letter-spacing: 0.05em;
  cursor: pointer;
}

/* ── Admin create form ── */
.create-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.create-form .full-width { grid-column: 1 / -1; }

.input-with-btn {
  display: flex;
  gap: 0.5rem;
}

.input-with-btn input { flex: 1; }

/* ── Logout button ── */
.btn-logout {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
}
.btn-logout:hover { background: var(--bg); color: var(--text); }

/* ── Utility ── */
.hidden { display: none !important; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.text-center { text-align: center; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 600px) {
  .create-form { grid-template-columns: 1fr; }
  .create-form .full-width { grid-column: 1; }
  .radio-group { flex-direction: column; }
  .radar-summary { flex-direction: column; align-items: center; }
  header .meta span.company-name { display: none; }
}
