* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #080e1d;
  color: #e2e8f0;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ─── Auth ────────────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 60% 20%, #1a2a4a 0%, #080e1d 70%);
}

.card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 16px;
  padding: 28px;
  width: min(440px, 96vw);
}

.auth-card {
  width: min(440px, 96vw);
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(99,102,241,.12);
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.muted { color: #94a3b8; margin-top: 0; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tab {
  border: 1px solid #334155;
  background: transparent;
  color: #94a3b8;
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}
.tab:hover { color: #e2e8f0; border-color: #475569; }
.tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.form, .form-grid {
  display: grid;
  gap: 10px;
}
.form-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  align-items: end;
}

.field-inline-check {
  grid-column: 1 / -1;
  font-size: 13px;
  color: #94a3b8;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  line-height: 1.45;
}
.field-inline-check input {
  margin-top: 3px;
  flex-shrink: 0;
}

.link-btn {
  background: none;
  border: none;
  color: #93c5fd;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font: inherit;
}
.link-btn:hover {
  color: #bfdbfe;
}

input, select, textarea {
  border-radius: 10px;
  border: 1px solid #2d3a4e;
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  background: #0d1526;
  color: #e2e8f0;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #4b5a72; }
input:focus, select:focus, textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
select option { background: #0d1526; }
textarea { resize: vertical; min-height: 80px; }

/* ─── Buttons ─────────────────────────────────────────────── */
button {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 11px 16px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  transition: all .15s;
}
.btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-color: #2563eb;
}
.btn:hover { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.btn.secondary {
  background: #1e293b;
  border-color: #2d3a4e;
  color: #cbd5e1;
  font-weight: 500;
}
.btn.secondary:hover { background: #253347; border-color: #3b4f6b; color: #e2e8f0; }
.btn.danger { border-color: #b91c1c; background: #7f1d1d; color: #fca5a5; }
.btn.danger:hover { background: #991b1b; }
.btn.danger.secondary { background: #1e293b; color: #fca5a5; border-color: #7f1d1d; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.success {
  background: linear-gradient(135deg, #059669, #047857);
  border-color: #059669;
  color: #fff;
}
.btn.success:hover { background: linear-gradient(135deg, #10b981, #059669); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ─── Messages ────────────────────────────────────────────── */
.msg {
  min-height: 20px;
  color: #f87171;
  margin: 8px 0 0;
  font-size: 13px;
}
.msg.ok { color: #34d399; }
.msg.banner {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.2);
  color: #fca5a5;
  font-size: 13px;
}
.msg.banner:empty { display: none; }

/* ─── App shell ───────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.app-shell.no-sidebar {
  grid-template-columns: 1fr;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  border-right: 1px solid #1a2540;
  background: #0a1122;
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #475569;
  padding: 0 10px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .13s;
}
.nav-item:hover { background: #151f35; color: #e2e8f0; }
.nav-item.active {
  background: rgba(37,99,235,.15);
  border-color: rgba(37,99,235,.3);
  color: #93c5fd;
}

.sidebar-note {
  font-size: 11px;
  color: #374151;
  line-height: 1.5;
  margin-top: auto;
  padding: 0 4px;
}
.sidebar-note code { font-size: 10px; color: #4b5563; }

/* ─── Main content ────────────────────────────────────────── */
.main-wrap {
  padding: 28px 32px 60px;
  max-width: 960px;
  width: 100%;
}

.app-shell.no-sidebar .main-wrap {
  margin: 0 auto;
}

/* ─── Topbar ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid #1a2540;
}

.topbar-label {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #3b4f6b;
  margin: 0;
}
.topbar-email {
  margin: 3px 0 0;
  font-weight: 600;
  font-size: 15px;
  color: #e2e8f0;
}

/* ─── Views ───────────────────────────────────────────────── */
.view-title {
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.subsection-title {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #4b6080;
}

.panel {
  border: 1px solid #1a2540;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  background: #0c1525;
}

/* ─── Metrics grid ────────────────────────────────────────── */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric {
  border: 1px solid #1a2540;
  border-radius: 12px;
  padding: 16px;
  background: #0a1122;
  transition: border-color .15s;
}
.metric:hover { border-color: #2d3a4e; }
.metric strong {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1;
  margin-bottom: 6px;
}
.metric span {
  font-size: 11.5px;
  color: #4b6080;
  line-height: 1.4;
}

.hint {
  font-size: 12px;
  color: #3b4f6b;
  margin: 0;
  line-height: 1.5;
}

/* ─── Site cards (user dashboard) ────────────────────────── */
.sites-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.card-list {
  display: grid;
  gap: 10px;
}

.site-card {
  border: 1px solid #1a2540;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #0c1525;
  transition: border-color .15s, background .15s;
}
.site-card:hover { border-color: #263452; background: #0e1a2e; }

.site-card-info { min-width: 0; flex: 1; }
.site-card-domain {
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.site-card .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.site-card .links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.site-card .links a {
  text-decoration: none;
  color: #fff;
  background: #059669;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  transition: background .13s;
}
.site-card .links a:hover { background: #10b981; }
.site-card .links a.secondary {
  background: rgba(37,99,235,.18);
  border: 1px solid rgba(37,99,235,.3);
  color: #93c5fd;
}
.site-card .links a.secondary:hover { background: rgba(37,99,235,.28); }

.site-card.pending {
  border-color: rgba(234,179,8,.2);
  background: rgba(120,80,0,.08);
}

/* ─── Tables ──────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid #1a2540;
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #1a2540;
  vertical-align: top;
}
.data-table th {
  background: #0a1122;
  color: #4b6080;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #0e1a2e; }

.mono { font-family: ui-monospace, monospace; font-size: 11px; color: #4b6080; word-break: break-all; }

/* ─── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge.ok { background: rgba(20,83,45,.5); color: #4ade80; border: 1px solid rgba(74,222,128,.15); }
.badge.warn { background: rgba(113,63,18,.5); color: #fcd34d; border: 1px solid rgba(252,211,77,.15); }
.badge.neutral { background: rgba(30,41,59,.8); color: #94a3b8; border: 1px solid #1f2937; }
.badge.pending { background: rgba(120,80,0,.3); color: #fbbf24; border: 1px solid rgba(251,191,36,.15); }
.badge.paid { background: rgba(20,83,45,.4); color: #4ade80; border: 1px solid rgba(74,222,128,.12); }
.badge.free { background: rgba(30,41,59,.6); color: #64748b; border: 1px solid #1f2937; }

.user-expand {
  padding: 10px 14px 14px;
  background: #090f1d;
  font-size: 12px;
  color: #64748b;
}

/* ─── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn .15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: #0e1a2e;
  border: 1px solid #1f2f47;
  border-radius: 18px;
  padding: 28px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  animation: slideUp .18s ease;
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.modal-header p {
  margin: 4px 0 0;
  font-size: 13px;
  color: #4b6080;
}
.modal-close {
  background: transparent;
  border: 1px solid #1f2f47;
  color: #64748b;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: all .13s;
}
.modal-close:hover { background: #1a2a3e; color: #e2e8f0; }

.modal-form {
  display: grid;
  gap: 12px;
}

.field-group {
  display: grid;
  gap: 5px;
}
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.field-label span { color: #3b82f6; }

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

/* ─── Modal form extras ───────────────────────────────────── */
.field-opt {
  font-style: normal;
  font-weight: 400;
  color: #4b6080;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

.field-colors-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #94a3b8;
  cursor: pointer;
}
.field-colors-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #3b82f6;
  cursor: pointer;
  padding: 0;
  border-radius: 4px;
  border: 1px solid #2d3a4e;
}

.colors-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0d1526;
  border: 1px solid #2d3a4e;
  border-radius: 10px;
  padding: 8px 12px;
}
.color-input-wrap input[type="color"] {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  background: transparent;
}
.color-hex-val {
  font-size: 12px;
  font-family: ui-monospace, monospace;
  color: #94a3b8;
}

.logo-upload-area {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border: 1.5px dashed #2d3a4e;
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color .2s;
  background: transparent;
}
.logo-upload-area:hover { border-color: #3b82f6; }
.logo-upload-icon { font-size: 1.3rem; line-height: 1; flex-shrink: 0; }
.logo-upload-text { font-size: 13px; color: #4b6080; }
.logo-upload-preview {
  max-height: 40px;
  max-width: 110px;
  object-fit: contain;
  border-radius: 4px;
  margin-left: auto;
}

.quota-info {
  background: rgba(37,99,235,.07);
  border: 1px solid rgba(37,99,235,.18);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: #60a5fa;
  margin-bottom: 4px;
}
.quota-info.warn {
  background: rgba(234,179,8,.06);
  border-color: rgba(234,179,8,.18);
  color: #fbbf24;
}
.quota-info.full {
  background: rgba(239,68,68,.06);
  border-color: rgba(239,68,68,.18);
  color: #f87171;
}

/* ─── DNS record box (modale mise en ligne) ──────────────── */
.dns-record-box {
  background: rgba(15,23,42,.6);
  border: 1px solid #1e2d45;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0 18px;
  display: grid;
  gap: 10px;
}
.dns-record-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dns-record-label {
  font-size: 12px;
  color: #4b6080;
  min-width: 130px;
  flex-shrink: 0;
}
.dns-record-value {
  font-size: 13px;
  color: #cbd5e1;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,.08);
  border-top-color: #6979f8;
  border-radius: 50%;
  animation: spin .75s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #3b4f6b;
}
.empty-state svg { opacity: .3; margin-bottom: 10px; }
.empty-state p { margin: 0; font-size: 14px; }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #1a2540;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px 16px;
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-note { display: none; }
  .main-wrap { padding: 20px 18px 40px; }
}

@media (max-width: 600px) {
  .modal-box { padding: 20px 16px; }
}
