:root {
  --color-bg: #f5f5f5;
  --color-surface: #ffffff;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-error: #dc2626;
  --color-text: #1f2937;
  --color-label: #6b7280;
  --border-radius: 8px;
}

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

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topnav {
  background: var(--color-surface);
  border-bottom: 1px solid #e5e7eb;
  padding: 0 1.5rem;
  height: 3rem;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.topnav-brand {
  color: var(--color-primary);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
}

.topnav-brand:hover {
  color: var(--color-primary-hover);
}

.topnav-user {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.topnav-user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}

.topnav-user-email {
  font-size: 0.75rem;
  color: var(--color-label);
}

.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-container {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
}

.organizations {
  padding: 2.5rem 2rem;

  table {
    width: 100%;
  }
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

h2 {
  margin-bottom: 1rem;
  margin-top: 1.5rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.25rem;
  display: block;
}

input,
textarea:not([hidden]) {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: border-color 0.15s;
}

textarea:not([hidden]) {
  resize: vertical;
  min-height: 5rem;
  font-family: inherit;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field-hint {
  font-size: 0.825rem;
  color: var(--color-label);
  margin-bottom: 0.25rem;
}

input:focus {
  outline: none;
  border-color: var(--color-primary);
}

button {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.7rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.5rem;
}

button:hover {
  background: var(--color-primary-hover);
}

.dashboard-container {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.dashboard-container h1 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.subtitle {
  color: var(--color-label);
  margin-bottom: 1.5rem;
}

.btn-logout {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
  border-radius: var(--border-radius);
  padding: 0.625rem 1.25rem;
  font-size: 0.95rem;
  transition: background 0.15s;
}

.btn-logout:hover {
  background: var(--color-primary-hover);
}

.error {
  background: #fee2e2;
  color: var(--color-error);
  border-radius: var(--border-radius);
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.section-header h2 {
  margin: 0;
}

.btn-action {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
  border-radius: var(--border-radius);
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-action:hover {
  background: var(--color-primary-hover);
}

/* ── Page détail organisation ─────────────────────────────────────── */

.org-detail {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 2rem 2.5rem;
  width: 100%;
  max-width: 760px;
  align-self: flex-start;
}

.org-header {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.5rem;
}

.org-header h1 {
  text-align: left;
  margin-bottom: 0.25rem;
}

.org-description {
  color: var(--color-label);
  font-size: 0.925rem;
}

.org-section {
  margin-top: 1.75rem;
}

.token-field {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.375rem;
}

.token-input {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 0.875rem;
  background: #f3f4f6;
  color: var(--color-text);
  cursor: text;
  word-break: break-all;
}

.btn-copy {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  border-radius: var(--border-radius);
  padding: 0.4rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-top: 0;
  white-space: nowrap;
}

.btn-copy:hover {
  background: var(--color-primary);
  color: #fff;
}

.btn-copy:disabled {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
  cursor: default;
}

.member-list {
  list-style: none;
  border: 1px solid #e5e7eb;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.member-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.member-item:last-child {
  border-bottom: none;
}

.member-email {
  font-size: 0.9rem;
  font-weight: 500;
}

.member-name {
  font-size: 0.85rem;
  color: var(--color-label);
}

.apikey-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.apikey-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid #e5e7eb;
}

.apikey-table .th-actions {
  text-align: right;
}

.apikey-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.apikey-table tbody tr:last-child td {
  border-bottom: none;
}

.apikey-table tbody tr:hover {
  background: #f9fafb;
}

.td-muted {
  color: var(--color-label);
  font-size: 0.875rem;
}

.table-link {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}

.table-link:hover {
  text-decoration: underline;
}

.table-link--danger {
  color: var(--color-error);
}

.empty-state {
  color: var(--color-label);
  font-size: 0.9rem;
  font-style: italic;
  padding: 0.75rem 0;
}

/* ── Formulaire IPs autorisées ────────────────────────────────────── */

.ip-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ip-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ip-row .ip-input {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
}

.btn-remove {
  flex-shrink: 0;
  background: none;
  border: 1px solid #d1d5db;
  color: var(--color-label);
  border-radius: var(--border-radius);
  padding: 0 0.625rem;
  height: 2.375rem;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  margin-top: 0;
}

.btn-remove:hover {
  border-color: var(--color-error);
  color: var(--color-error);
  background: none;
}

.ip-toolbar {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.btn-secondary {
  background: none;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  border-radius: var(--border-radius);
  padding: 0.4rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-top: 0;
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: #fff;
}

.form-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e5e7eb;
}

.form-footer button {
  margin-top: 0;
}

.btn-cancel {
  color: var(--color-label);
  font-size: 0.9rem;
  text-decoration: none;
}

.btn-cancel:hover {
  color: var(--color-text);
  text-decoration: underline;
}
