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

:root {
  --color-primary: #1d4ed8;
  --color-primary-hover: #1e40af;
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-error-bg: #fee2e2;
  --color-error-text: #991b1b;
  --color-info-bg: #eff6ff;
  --color-info-text: #1e40af;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

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

/* Header */
.auth-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 1.5rem;
}
.auth-header__inner {
  max-width: 900px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.auth-header__logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-primary);
}

/* Main */
.auth-main {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Card */
.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 420px;
  margin: 0 auto;
}
.auth-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

/* Form */
.auth-form__group {
  margin-bottom: 1rem;
}
.auth-form__group label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .375rem;
  color: var(--color-text);
}
.auth-form__group input[type="email"],
.auth-form__group input[type="password"],
.auth-form__group input[type="text"] {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: .9375rem;
  outline: none;
  transition: border-color .15s;
}
.auth-form__group input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(29,78,216,.15);
}

/* Button */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .5rem 1.25rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .9375rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  margin-top: .5rem;
}
.auth-btn:hover { background: var(--color-primary-hover); }
.auth-btn--secondary { background: #fff; color: var(--color-text); border: 1px solid var(--color-border); }
.auth-btn--secondary:hover { background: var(--color-bg); }
.auth-btn--danger { background: var(--color-danger); }
.auth-btn--danger:hover { background: var(--color-danger-hover); }
.auth-btn--sm { font-size: .8125rem; padding: .3rem .75rem; }
.auth-btn--xs { font-size: .75rem; padding: .2rem .5rem; margin-top: .25rem; }

/* Messages */
.auth-error {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: .625rem .875rem;
  margin-bottom: 1rem;
  font-size: .875rem;
}
.auth-info {
  background: var(--color-info-bg);
  color: var(--color-info-text);
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: .625rem .875rem;
  margin-bottom: 1rem;
  font-size: .875rem;
}

/* Admin */
.admin-wrap { max-width: 900px; }
.admin-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }
.admin-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.admin-section__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--color-border);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.admin-table th {
  text-align: left;
  padding: .5rem .75rem;
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
  color: var(--color-muted);
  font-size: .8125rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.admin-table td {
  padding: .625rem .75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.admin-table tr:last-child td { border-bottom: none; }

/* Permissions grid */
.perm-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem .75rem;
  margin-top: .375rem;
}
.perm-grid--sm { gap: .25rem .5rem; }
.perm-check {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .875rem;
  cursor: pointer;
}
.perm-check--admin { font-weight: 600; }

/* Badges */
.badge {
  display: inline-block;
  padding: .125rem .5rem;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
}
.badge--admin { background: #eff6ff; color: var(--color-primary); border-color: #bfdbfe; }

.text-muted { color: var(--color-muted); }
.text-sm { font-size: .8125rem; }

.auth-form--inline { max-width: 640px; }
.perm-form { display: inline-block; }

.action-cell { white-space: nowrap; }
.action-cell form { display: inline; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  padding: 2rem;
  width: min(460px, 92vw);
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}
.modal-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
}
