* { box-sizing: border-box; }

:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --muted: #475569;
  --surface: #eff6ff;
  --border: #dbeafe;
  --text: #0f172a;
  --danger: #dc2626;
  --shadow: rgba(15, 23, 42, 0.08);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
}

body {
  min-height: 100vh;
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  padding: 12px 14px;
  cursor: pointer;
}

button.secondary {
  background: #e2e8f0;
  color: var(--text);
}

button.small-button {
  padding: 8px 10px;
  font-size: 0.82rem;
}

button.danger {
  background: var(--danger);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  color: var(--text);
  padding: 12px 14px;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 12px 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #0f172a, #2563eb);
  color: white;
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 12px 32px var(--shadow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  color: white;
  text-decoration: none;
  font-weight: 700;
}

.user-menu {
  position: relative;
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.2);
  z-index: 20;
}

.user-menu-panel .menu-action {
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.user-menu-panel .menu-action:hover {
  background: rgba(37, 99, 235, 0.08);
}

.user-menu-panel .menu-action.danger {
  color: var(--danger);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.4rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
}

.content {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 28px var(--shadow);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.auth-grid {
  display: grid;
  gap: 16px;
}

.panel {
  display: grid;
  gap: 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0 18px;
}

.stat-box {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.stat-box span {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-box strong {
  font-size: 1.7rem;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.item-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.item-list li {
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  padding: 12px;
}

.item-list strong {
  display: block;
  margin-bottom: 4px;
}

.muted,
.user-summary,
.secondary-link {
  color: var(--muted);
}

.secondary-link {
  text-decoration: none;
  font-weight: 700;
}

.fitplan-view-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.fitplan-view-nav .view-tab {
  background: #e2e8f0;
  color: var(--text);
  border: 1px solid transparent;
  padding: 10px 12px;
  font-weight: 700;
  flex: 1 1 120px;
}

.fitplan-view-nav .view-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}

.hidden {
  display: none !important;
}

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

@media (min-width: 700px) {
  .auth-grid {
    grid-template-columns: 1fr 1fr;
  }
}
