:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e4e9;
  --text: #1c1f26;
  --text-muted: #6b7280;
  --primary: #2f5dff;
  --primary-hover: #2549cc;
  --danger: #e0433b;
  --danger-hover: #c23930;
  --success: #1d9a6c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar__nav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.topbar__nav a:hover { background: #f0f1f3; color: var(--text); }
.topbar__nav a.active { background: #eef1ff; color: var(--primary); }

.topbar__user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.topbar__user strong { color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: #a7b4e8; cursor: not-allowed; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f0f1f3; }

.btn-danger { background: #fff; color: var(--danger); border-color: #f3c9c6; }
.btn-danger:hover { background: #fdeceb; }

.btn-sm { padding: 6px 10px; font-size: 13px; }

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.card__header h1, .card__header h2 { margin: 0; font-size: 18px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-admin { background: #eef1ff; color: var(--primary); }
.badge-moderator { background: #fff4e0; color: #a5680a; }
.badge-director { background: #f3e8ff; color: #7c3aed; }
.badge-user { background: #eef2f5; color: var(--text-muted); }
.badge-inactive { background: #fdeceb; color: var(--danger); }
.badge-active { background: #e8f7f0; color: var(--success); }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Login page */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 32px;
}

.auth-card h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.auth-card p.subtitle {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input, .field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: #fff;
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 93, 255, 0.15);
}

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error { background: #fdeceb; color: var(--danger); }
.alert-success { background: #e8f7f0; color: var(--success); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.modal-wide {
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h2 { margin: 0 0 18px; font-size: 17px; }

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.field-group { margin-bottom: 18px; }

.field-group > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.dynamic-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.dynamic-row input { flex: 1; }

.btn-add-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

.btn-add-link:hover { text-decoration: underline; }

.manager-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  background: #fafbfc;
}

.manager-card .manager-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-right: 28px;
}

.manager-card .manager-grid input {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: #fff;
}

.manager-card .remove-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 22px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dropzone:hover { background: #fafbfc; }
.dropzone.dragover { background: #eef1ff; border-color: var(--primary); color: var(--primary); }

.doc-list { margin-top: 10px; }

.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.doc-item a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-item a:hover { color: var(--primary); text-decoration: underline; }
.doc-item .doc-meta { color: var(--text-muted); font-size: 12px; white-space: nowrap; }

.hidden { display: none !important; }

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.temp-password-box {
  background: #f6f7fb;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  text-align: center;
  margin: 10px 0 4px;
  letter-spacing: 0.5px;
}
