/* Portail staff — en-tête et tons type console d’administration classique */
:root {
  --staff-header-bg: #417690;
  --staff-header-bar: #79aec8;
  --staff-link: #417893;
  --staff-link-hover: #036;
  --staff-bg: #f8f8f8;
  --staff-panel-bg: #fff;
  --staff-accent: #417690;
  --staff-accent-hover: #205067;
  --staff-accent-warm: #ba2121;
  --staff-danger: #ba2121;
  --staff-border: #ccc;
  --staff-text: #333;
  --staff-muted: #666;
  --staff-row-head: #f6f6f6;
  --staff-tab-hover: #e8e8e8;
}

.staff-body {
  margin: 0;
  font-family: "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--staff-bg);
  color: var(--staff-text);
  line-height: 1.5;
  font-size: 14px;
}

.staff-header {
  background: var(--staff-header-bg);
  color: #fff;
  border-bottom: 8px solid var(--staff-header-bar);
}

.staff-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.staff-brand {
  color: #f5dd5d;
  font-weight: 300;
  font-size: 1.28rem;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.staff-brand:hover {
  color: #fff;
}

.staff-header-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.35rem;
  flex: 1 1 auto;
  min-width: min(100%, 12rem);
}

.staff-header-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
}

.staff-header-nav-link {
  color: #b4d1e8;
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.35;
  padding: 0.15rem 0;
  white-space: nowrap;
}

.staff-header-nav-link:hover {
  color: #fff;
  text-decoration: underline;
}

.staff-header-nav-link.is-active {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
}

.staff-user {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.staff-user-name {
  font-size: 0.85rem;
  opacity: 0.9;
}

.staff-logout-form {
  margin: 0;
}

.staff-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.staff-main-wrap {
  width: 100%;
}

.staff-main {
  max-width: none;
  margin: 0;
  padding: 1.25rem 0 0;
}

@media (max-width: 720px) {
  .staff-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .staff-user {
    align-self: flex-end;
  }
}

.staff-messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.staff-msg {
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.35rem;
}

.staff-msg-success {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
}

.staff-msg-error,
.staff-msg-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.staff-msg-info,
.staff-msg-debug {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.staff-msg-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.staff-help {
  color: var(--staff-muted);
  font-size: 0.95rem;
  max-width: 52rem;
}

.staff-intro {
  color: var(--staff-muted);
  font-size: 0.95rem;
  max-width: 52rem;
  margin: 0 0 1.25rem;
}

.staff-subtitle {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.65rem;
  color: var(--staff-text);
}

.staff-list-plain {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--staff-text);
}

.staff-inline-form {
  margin-bottom: 1.5rem;
}

.staff-inline-form .staff-field {
  margin-bottom: 0.75rem;
}

.staff-table-action-form {
  margin: 0;
  display: inline;
}

.staff-portal-create-link {
  margin: 0 0 1.25rem;
}

.staff-form-actions-row {
  margin-top: 1rem;
}

.staff-table-actions-cell {
  white-space: nowrap;
}

.staff-main .staff-table-text-link {
  font-size: 0.88rem;
  margin-right: 0.75rem;
  color: var(--staff-link);
}

.staff-main .staff-table-text-link:hover {
  color: var(--staff-link-hover);
}

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

.staff-main .staff-table-text-link-danger:hover {
  color: #991b1b;
}

.staff-btn-small {
  padding: 0.25rem 0.55rem;
  font-size: 0.82rem;
}

.staff-branding-preview-wrap {
  margin: 0.5rem 0 0;
}

.staff-branding-bg-preview {
  display: block;
  max-width: 100%;
  width: 640px;
  height: auto;
  max-height: 360px;
  object-fit: cover;
  border: 1px solid var(--staff-border);
  border-radius: 4px;
}

.staff-main a {
  color: var(--staff-link);
}

.staff-main a:hover {
  color: var(--staff-link-hover);
}

.staff-main a.staff-btn {
  text-decoration: none;
}

.staff-main a.staff-btn-primary,
.staff-main a.staff-btn-primary:hover {
  color: #fff;
}

.staff-main a.staff-btn-danger,
.staff-main a.staff-btn-danger:hover {
  color: #fff;
}

.staff-main a.staff-btn-ghost {
  color: var(--staff-text);
}

.staff-main a.staff-btn-ghost:hover {
  color: var(--staff-link-hover);
}

.staff-btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.88rem;
  border: 1px solid var(--staff-border);
  background: #eee;
  cursor: pointer;
  color: var(--staff-text);
}

.staff-btn-primary {
  background: var(--staff-accent);
  border-color: var(--staff-accent);
  color: #fff;
}

.staff-btn-primary:hover {
  background: var(--staff-accent-hover);
  border-color: var(--staff-accent-hover);
}

.staff-btn-ghost {
  background: transparent;
  color: var(--staff-text);
  border-color: var(--staff-border);
}

/* Déconnexion header : priorité sur les styles UA des <button> */
.staff-header button.staff-btn.staff-btn-logout {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-weight: 600;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.85);
  text-shadow: none;
}

.staff-header button.staff-btn.staff-btn-logout:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.35);
  border-color: #ffffff;
}

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

.staff-field {
  margin-bottom: 1rem;
}

.staff-field label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.staff-input {
  width: 100%;
  max-width: 32rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--staff-border);
  border-radius: 4px;
  box-sizing: border-box;
}

.staff-form-block {
  max-width: 36rem;
}

.staff-form-wide {
  max-width: 52rem;
}

.staff-form-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.staff-form-table th,
.staff-form-table td {
  border: 1px solid var(--staff-border);
  padding: 0.5rem 0.65rem;
  vertical-align: top;
  text-align: left;
}

.staff-form-table th {
  width: 14rem;
  background: #fff;
}

.staff-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--staff-border);
  border-radius: 6px;
  overflow: hidden;
}

.staff-table th,
.staff-table td {
  border-bottom: 1px solid var(--staff-border);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

.staff-table thead th {
  background: var(--staff-row-head);
}

.staff-dl dt {
  font-weight: 600;
  margin-top: 0.75rem;
}

.staff-pre {
  background: #fff;
  border: 1px solid var(--staff-border);
  padding: 1rem;
  overflow: auto;
  max-height: 24rem;
  font-size: 0.8rem;
}

.staff-errors {
  color: var(--staff-danger);
}

.staff-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.staff-login-card {
  background: var(--staff-panel-bg);
  padding: 2rem;
  border-radius: 4px;
  border: 1px solid var(--staff-border);
  max-width: 22rem;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.staff-login-card h1 {
  margin-top: 0;
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--staff-header-bg);
}

.staff-footer {
  padding: 0.65rem 1rem;
  text-align: center;
  border-top: 1px solid var(--staff-border);
  background: var(--staff-panel-bg);
}

.staff-app-version,
.staff-footer .app-version {
  margin: 0.75rem 0 0;
  font-size: 0.72rem;
  color: var(--staff-muted, #6b7280);
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  text-align: center;
}

/* Onglets (kheops_console) */
.kheops-console-lead {
  max-width: 52rem;
}

.kheops-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--staff-border);
  margin: 1.25rem 0 1.5rem;
}

.kheops-tab {
  display: inline-block;
  padding: 10px 20px;
  margin-bottom: -1px;
  text-decoration: none;
  color: var(--staff-accent);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}

.kheops-tab:hover {
  background: var(--staff-tab-hover);
}

.kheops-tab-active {
  background: #fff;
  border-color: var(--staff-border);
  border-bottom-color: #fff;
  color: var(--staff-text);
  font-weight: 600;
}

.kheops-panel-title {
  font-size: 1.1rem;
  margin-top: 0;
}

.kheops-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  align-items: stretch;
}

.kheops-card {
  border: 1px solid var(--staff-border);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.kheops-card-actions {
  margin-top: auto;
  padding-top: 0.75rem;
}

.kheops-card-actions .staff-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  text-align: center;
}

.kheops-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.kheops-card .staff-help {
  margin-bottom: 0.75rem;
}

.kheops-callout {
  border-left: 4px solid var(--staff-accent-warm);
  padding: 0.5rem 0 0.5rem 12px;
  margin-bottom: 1rem;
}

.log-clear-form {
  margin-bottom: 1rem;
}

.staff-setting-group {
  border: 1px solid var(--staff-border);
  border-radius: 4px;
  background: var(--staff-panel-bg);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.staff-main .staff-setting-group[id] {
  scroll-margin-top: 0.75rem;
}

.staff-settings-layout {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  margin-top: 0.5rem;
}

.staff-settings-sections-nav {
  flex: 0 0 11.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.65rem 0;
  border-radius: 4px;
  background: var(--staff-panel-bg);
  border: 1px solid var(--staff-border);
  position: sticky;
  top: 0.5rem;
}

.staff-settings-section-link {
  display: block;
  padding: 0.35rem 0.75rem;
  font-size: 0.86rem;
  color: var(--staff-link);
  text-decoration: none;
  border-left: 3px solid transparent;
  line-height: 1.35;
}

.staff-settings-section-link:hover {
  background: var(--staff-tab-hover);
  color: var(--staff-link-hover);
}

.staff-settings-section-link.is-active {
  font-weight: 600;
  color: var(--staff-accent);
  background: var(--staff-row-head);
  border-left-color: var(--staff-accent);
}

.staff-settings-sections-stack {
  flex: 1;
  min-width: 0;
}

.staff-settings-panel[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .staff-settings-layout {
    flex-direction: column;
  }

  .staff-settings-sections-nav {
    flex: 1 1 auto;
    width: 100%;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem;
  }

  .staff-settings-section-link {
    border-left: none;
    border-radius: 4px;
    padding: 0.35rem 0.6rem;
  }

  .staff-settings-section-link.is-active {
    border-left: none;
    outline: 2px solid var(--staff-accent);
  }
}

.staff-section-identite {
  border-left: 4px solid var(--staff-header-bar);
}

.staff-section-access {
  border-left: 4px solid var(--staff-header-bg);
}

.staff-section-sms {
  border-left: 4px solid var(--staff-header-bar);
}

.staff-section-email {
  border-left: 4px solid #447e9b;
}

.staff-section-entra {
  border-left: 4px solid #5b80b2;
}

.staff-section-ip {
  border-left: 4px solid #7999a9;
}

.staff-section-quotas {
  border-left: 4px solid #93b7cc;
}

.staff-site-settings-actions {
  margin: 1.25rem 0 0;
}

.staff-settings-global-actions {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.staff-setting-tile-form {
  margin: 0;
}

.staff-setting-tile-actions {
  margin: 1.1rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--staff-border);
}

.staff-setting-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.staff-setting-subtitle {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
}

.staff-setting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.8rem 1rem;
}

.staff-setting-item label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.staff-setting-item input[type="text"],
.staff-setting-item input[type="number"],
.staff-setting-item input[type="url"],
.staff-setting-item input[type="email"],
.staff-setting-item input[type="password"],
.staff-setting-item textarea,
.staff-setting-item select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--staff-border);
  border-radius: 4px;
}

.staff-setting-item textarea {
  min-height: 5.5rem;
}

.staff-setting-item-wide {
  grid-column: 1 / -1;
}

.staff-cell-muted {
  font-size: 0.9rem;
  color: var(--staff-muted);
  max-width: 18rem;
  word-break: break-word;
}

.staff-otp-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.staff-otp-add-field {
  flex: 1 1 200px;
  min-width: 0;
}

.staff-otp-add-field .staff-help {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
}

.staff-otp-add-active {
  flex: 0 1 140px;
}

.staff-otp-add-actions {
  flex: 0 0 auto;
}

.staff-otp-add-compact {
  display: grid;
  grid-template-columns: minmax(140px, 2fr) minmax(100px, 1.4fr) auto auto;
  gap: 0.65rem 0.85rem;
  align-items: end;
  margin-bottom: 0.35rem;
}

.staff-otp-add-compact .staff-otp-add-field {
  min-width: 0;
}

.staff-otp-add-compact .staff-otp-add-active {
  justify-self: start;
}

.staff-otp-add-compact .staff-otp-add-actions {
  align-self: end;
}

.staff-otp-add-footnote {
  margin: 0 0 1rem;
  font-size: 0.88rem;
}

.staff-otp-add-form input[type="text"],
.staff-otp-add-form input[type="tel"],
.staff-otp-add-form input[type="email"] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--staff-border);
  border-radius: 4px;
}

@media (max-width: 720px) {
  .staff-otp-add-compact {
    grid-template-columns: 1fr 1fr;
  }

  .staff-otp-add-compact .staff-otp-add-actions {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

.staff-settings-section-link-tool {
  font-style: italic;
}

/* Accès par IP — diagnostic staff */
.staff-ip-panel {
  margin: 1.5rem 0 2rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--staff-border);
  border-radius: 6px;
  background: var(--staff-panel-bg);
}

.staff-ip-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.staff-ip-metric {
  padding: 0.75rem;
  border: 1px solid var(--staff-border);
  border-radius: 4px;
  background: #fff;
}

.staff-ip-metric-label {
  display: block;
  font-size: 0.78rem;
  color: var(--staff-muted, #6b7280);
  margin-bottom: 0.25rem;
}

.staff-ip-metric-ok {
  border-color: #2e7d32;
  background: #f1f8f2;
}

.staff-ip-metric-ko {
  border-color: #c62828;
  background: #fff5f5;
}

.staff-ip-h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.staff-ip-issues {
  list-style: none;
  margin: 0;
  padding: 0;
}

.staff-ip-issue {
  margin: 0.5rem 0;
  padding: 0.65rem 0.85rem;
  border-radius: 4px;
  border-left: 4px solid var(--staff-border);
  background: #fafafa;
}

.staff-ip-issue p {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.staff-ip-issue-error {
  border-left-color: #c62828;
  background: #fff5f5;
}

.staff-ip-issue-warning {
  border-left-color: #ed6c02;
  background: #fff8f0;
}

.staff-ip-issue-ok {
  border-left-color: #2e7d32;
  background: #f1f8f2;
}

.staff-ip-table {
  width: 100%;
  font-size: 0.88rem;
}

.staff-ip-table code {
  word-break: break-all;
}

.staff-ip-row-selected {
  background: #e8f5e9;
}

.staff-ip-pre {
  margin: 0.5rem 0 1rem;
  padding: 0.85rem 1rem;
  background: #1e1e1e;
  color: #e8e8e8;
  border-radius: 4px;
  font-size: 0.82rem;
  overflow-x: auto;
  white-space: pre-wrap;
}

.staff-ip-list {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.staff-ip-warn {
  color: #c62828;
}

.staff-ip-ok-text {
  color: #2e7d32;
}

.staff-ip-steps {
  margin: 0.5rem 0 1rem;
  padding-left: 1.35rem;
}

.staff-ip-steps li {
  margin: 0.45rem 0;
}

.staff-ip-tuto .staff-help {
  margin-bottom: 0.35rem;
}
