/* KissBOT Admin Dashboard — styles propres et responsive */

:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1e2530;
  --border: #2a313c;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --primary: #d83a56;
  --primary-hover: #e84964;
  --ok: #2ea043;
  --warn: #d29922;
  --error: #f85149;
  --shadow: 0 2px 8px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
}
code { font-family: ui-monospace, monospace; font-size: 13px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}
.brand-name { font-weight: 600; letter-spacing: .3px; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.status-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.status-badge.ok { color: var(--ok); border-color: var(--ok); }
.status-badge.err { color: var(--error); border-color: var(--error); }

main { padding: 22px; max-width: 1280px; margin: 0 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card-login { max-width: 400px; margin: 80px auto; }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.card-header h2 { margin: 0; font-size: 16px; }

h1 { font-size: 20px; margin: 0 0 8px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--text-dim); }
.muted.center { text-align: center; }
.error { color: var(--error); }

label { display: block; font-size: 13px; font-weight: 500; margin: 14px 0 6px; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"] {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(216, 58, 86, 0.2);
}

button {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 6px;
  border: 0;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
button:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: white; font-weight: 500; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; color: var(--error); border: 1px solid var(--error); }
.btn-danger:hover { background: var(--error); color: white; }
.btn-warn { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
.btn-warn:hover { background: var(--warn); color: white; }

.form-inline {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch;
}
.form-inline input { flex: 1; min-width: 160px; }
.form-inline button { white-space: nowrap; }

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px;
}

.token-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px dashed var(--ok);
  border-radius: 6px;
}
.token-box code {
  display: block;
  padding: 6px 0;
  word-break: break-all;
  color: var(--ok);
  font-size: 14px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.stat-card.stat-active { border-left: 3px solid var(--ok); }
.stat-card.stat-warn { border-left: 3px solid var(--warn); }
.stat-card.stat-error { border-left: 3px solid var(--error); }
.stat-label { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 600; }

.table-wrap { overflow-x: auto; }
.licenses-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.licenses-table th, .licenses-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.licenses-table th {
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface-2);
}
.licenses-table tbody tr:hover { background: var(--surface-2); }
.licenses-table .actions { display: flex; gap: 6px; }
.licenses-table .actions button { padding: 4px 9px; font-size: 12px; }

.status-pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.status-pill.active { background: rgba(46, 160, 67, 0.15); color: var(--ok); }
.status-pill.exhausted { background: rgba(210, 153, 34, 0.15); color: var(--warn); }
.status-pill.disabled { background: rgba(248, 81, 73, 0.15); color: var(--error); }

.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 28px;
  max-width: 460px;
  width: 90%;
  box-shadow: var(--shadow);
}

.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface-2);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 6px;
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow);
  z-index: 200;
  max-width: 360px;
  font-size: 13px;
}
.toast.toast-ok { border-left-color: var(--ok); }
.toast.toast-error { border-left-color: var(--error); }

@media (max-width: 720px) {
  .topbar { padding: 10px 14px; }
  main { padding: 14px; }
  .card { padding: 16px; }
  .form-inline { flex-direction: column; }
  .form-inline input { width: 100%; }
  .licenses-table th, .licenses-table td { padding: 8px 10px; font-size: 12px; }
}
