/**
 * Console Sonnette.
 *
 * Contrairement à l'app et à son administration, cette interface est faite pour
 * un écran large : c'est un tableau de bord d'exploitation, consulté assis.
 */

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

body, h1, h2, p, table, ul {
  margin: 0;
  padding: 0;
}

.op-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--sn-bg);
  color: var(--sn-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 3px solid var(--sn-accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------- En-tête */

.op-header {
  background: var(--sn-primary);
  color: var(--sn-on-primary);
}

.op-header__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.op-brand {
  font-weight: 700;
  font-size: 1.1rem;
}

.op-brand span {
  font-weight: 400;
  opacity: 0.7;
}

.op-header__user {
  margin-left: auto;
  font-size: 0.86rem;
  opacity: 0.85;
}

.op-logout {
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  min-height: 40px;
  cursor: pointer;
}

.op-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 22px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------------------------------------------------------- Indicateurs */

.op-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.op-stat {
  background: var(--sn-surface);
  border: 1px solid var(--sn-border);
  border-radius: 14px;
  padding: 16px 18px;
}

.op-stat--alert {
  border-color: #B87503;
  background: #FDF3E0;
}

.op-stat__value {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}

.op-stat__label {
  display: block;
  font-size: 0.8rem;
  color: var(--sn-muted);
  margin-top: 2px;
}

/* ---------------------------------------------------------- Cartes et formulaires */

.op-card {
  background: var(--sn-surface);
  border: 1px solid var(--sn-border);
  border-radius: 16px;
  padding: 20px;
}

.op-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.op-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.op-form--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
}

.op-form--inline .op-field {
  flex: 1;
  min-width: 170px;
}

.op-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.op-field > span {
  font-size: 0.82rem;
  font-weight: 600;
}

.op-field input,
.op-field select {
  font: inherit;
  font-size: 0.95rem;
  width: 100%;
  padding: 10px 12px;
  min-height: 42px;
  border: 1.5px solid var(--sn-border);
  border-radius: 10px;
  background: var(--sn-bg);
  color: var(--sn-text);
}

.op-field input:focus,
.op-field select:focus {
  outline: none;
  border-color: var(--sn-primary);
  box-shadow: 0 0 0 3px var(--sn-primary-soft);
}

.op-button {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  min-height: 44px;
  cursor: pointer;
}

.op-button--primary {
  background: var(--sn-primary);
  color: var(--sn-on-primary);
}

.op-button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.op-status {
  font-size: 0.86rem;
  font-weight: 600;
  min-height: 1.2em;
  margin-top: 8px;
}

.op-status.is-ok { color: #2E7D4F; }
.op-status.is-error { color: #B3261E; }

.op-credentials {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--sn-primary-soft);
  border: 1px solid var(--sn-primary);
  font-size: 0.88rem;
}

.op-credentials code {
  font-size: 0.92rem;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 5px;
}

/* ---------------------------------------------------------- Tableau du parc */

.op-table-wrap {
  overflow-x: auto;
}

.op-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 860px;
}

.op-table th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sn-muted);
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--sn-border);
}

.op-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--sn-border);
  vertical-align: middle;
}

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

.op-slug {
  display: block;
  font-size: 0.76rem;
  color: var(--sn-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.op-gauge {
  display: inline-block;
  width: 60px;
  height: 8px;
  border-radius: 999px;
  background: var(--sn-border);
  overflow: hidden;
  vertical-align: middle;
}

.op-gauge__bar {
  display: block;
  height: 100%;
  background: var(--sn-primary);
}

.op-gauge__value {
  font-size: 0.78rem;
  color: var(--sn-muted);
  margin-left: 6px;
}

.op-never,
.op-stale {
  color: #B87503;
  font-weight: 600;
}

.op-select {
  font: inherit;
  font-size: 0.85rem;
  padding: 7px 10px;
  min-height: 38px;
  border: 1.5px solid var(--sn-border);
  border-radius: 8px;
  background: var(--sn-bg);
  color: var(--sn-text);
  cursor: pointer;
}

.op-links {
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

.op-links a {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--sn-primary);
}

.op-empty {
  color: var(--sn-muted);
  font-size: 0.92rem;
}

.op-empty code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 5px;
}

/* ---------------------------------------------------------- Connexion et notifications */

.op-login {
  max-width: 360px;
  margin: 10vh auto 0;
  text-align: center;
}

.op-login__title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--sn-primary);
}

.op-login__sub {
  color: var(--sn-muted);
  margin-bottom: 22px;
}

.op-login .op-form {
  text-align: left;
}

.op-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  padding: 13px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.op-toast.is-ok { background: #1F6B3D; }
.op-toast.is-error { background: #8E241D; }
.op-toast[hidden] { display: none; }
