:root {
  --bg: #0b0d14;
  --bg-alt: #11141d;
  --surface: #161a26;
  --border: #262b3a;
  --text: #eef0f6;
  --text-muted: #a6acc0;
  --accent: #6c5ce7;
  --accent-light: #8a7cf0;
  --accent-contrast: #ffffff;
  --radius: 14px;
  --max-width: 1120px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; }
p { color: var(--text-muted); margin: 0 0 1em; }
a { color: inherit; }

.wrap { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 520px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: .95rem;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: var(--accent-contrast);
  box-shadow: 0 6px 20px -6px rgba(108,92,231,.55);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #9b8ff5, var(--accent-light));
  box-shadow: 0 10px 26px -6px rgba(108,92,231,.7);
}
.btn-lg { padding: 14px 30px; font-size: 1.02rem; }
.btn-submit { width: 100%; margin-top: 4px; }

/* Auth */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(108,92,231,.32), transparent 55%),
    radial-gradient(circle at 85% 15%, rgba(108,92,231,.2), transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(108,92,231,.12), transparent 50%),
    var(--bg);
  background-attachment: fixed;
}
.auth-wrap { width: 100%; padding: 24px; }
.auth-card {
  max-width: 380px;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(22,26,38,.9), rgba(17,20,29,.9));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 42px 36px 36px;
  text-align: center;
  box-shadow:
    0 20px 60px -20px rgba(0,0,0,.6),
    0 0 0 1px rgba(255,255,255,.02) inset,
    0 0 80px -30px rgba(108,92,231,.35);
  backdrop-filter: blur(20px);
  animation: auth-card-in .5s ease both;
}
@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.brand-mark-lg {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 65%, #4c3fb0);
  color: white;
  font-weight: 800;
  font-size: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px -6px rgba(108,92,231,.65);
}
.auth-card h1 {
  font-size: 1.55rem;
  letter-spacing: .06em;
  background: linear-gradient(135deg, var(--text), var(--accent-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-sub { margin-bottom: 28px; font-size: .92rem; }
.auth-form { display: flex; flex-direction: column; gap: 18px; text-align: left; }

.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: .88rem; color: var(--text-muted); }
.form-row input,
.form-row select,
.form-row textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: .98rem;
  font-family: inherit;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(108,92,231,.22);
}
.form-status { font-size: .88rem; margin: 0 0 18px; padding: 10px 14px; border-radius: 10px; border: 1px solid transparent; }
.form-status.success { color: #4ade80; background: rgba(74,222,128,.1); border-color: rgba(74,222,128,.25); }
.form-status.error { color: #f87171; background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.25); }

/* App shell */
.app-header {
  border-bottom: 1px solid var(--border);
  background: rgba(11,13,20,.85);
  backdrop-filter: blur(10px);
}
.app-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}
.brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; color: var(--text); }
.app-header-user { display: flex; align-items: center; gap: 18px; font-size: .92rem; color: var(--text-muted); }
.header-link { text-decoration: none; color: var(--text-muted); }
.header-link:hover { color: var(--text); }
.logout-form { margin: 0; display: inline; }
.header-link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: var(--text-muted);
}
.header-link-btn:hover { color: var(--text); }

.dashboard-center {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lifeos-title {
  font-size: clamp(2.6rem, 8vw, 5rem);
  letter-spacing: .08em;
  background: linear-gradient(135deg, var(--text), var(--accent-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section { padding: 48px 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.admin-form-card { max-width: 480px; margin-bottom: 40px; }
.signup-form { display: flex; flex-direction: column; gap: 16px; }
.user-list-heading { margin-top: 0; }
.user-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.user-table th, .user-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .92rem; }
.user-table th { color: var(--text-muted); font-weight: 600; }
.user-table tr:last-child td { border-bottom: none; }
