/* ============================================================
   MAILIOS SUPER-ADMIN — Theme dark navy + teal
   ============================================================ */

:root {
  --navy-950: #060D1A;
  --navy-900: #0A1628;
  --navy-800: #0F2040;
  --navy-700: #142850;
  --navy-600: #1B3764;
  --navy-500: #234D8B;
  --teal-500: #129470;
  --teal-400: #17B88A;
  --teal-300: #20D4A0;
  --safe:     #16A34A;
  --moderate: #CA8A04;
  --elevated: #EA580C;
  --critical: #DC2626;
  --white:   #FFFFFF;
  --gray-50: #F8FAFC;
  --gray-100:#F1F5F9;
  --gray-200:#E2E8F0;
  --gray-300:#CBD5E1;
  --gray-400:#94A3B8;
  --gray-500:#64748B;
  --gray-600:#475569;
  --gray-700:#334155;
  --gray-800:#1E293B;
  --gray-900:#0F172A;
  --font: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--gray-700);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-500); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
code { font-family: 'SF Mono', Consolas, monospace; font-size: .9em; }
.mono { font-family: 'SF Mono', Consolas, monospace; font-size: 12px; }

/* ─── LOGIN ─── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(18,148,112,.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 90%, rgba(27,55,100,.6) 0%, transparent 60%),
    linear-gradient(160deg, var(--navy-900) 0%, var(--navy-950) 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(15,32,64,.7);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-brand-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--navy-500), var(--teal-500));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 900;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(18,148,112,.4);
}
.login-brand-name { color: var(--white); font-weight: 800; font-size: 16px; line-height: 1.1; }
.login-brand-sub  { color: var(--teal-300); font-size: 11px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }
.login-title { color: var(--white); font-size: 24px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 6px; }
.login-sub { color: rgba(255,255,255,.55); font-size: 13px; margin-bottom: 26px; line-height: 1.5; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field label {
  display: block;
  color: rgba(255,255,255,.7);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--white);
  outline: none;
  transition: border-color .15s;
}
.login-field input:focus { border-color: var(--teal-400); background: rgba(255,255,255,.06); }
.login-field input::placeholder { color: rgba(255,255,255,.3); }
.login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--teal-500);
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 10px;
  margin-top: 8px;
  box-shadow: 0 4px 16px rgba(18,148,112,.4);
  transition: all .2s;
}
.login-submit:hover { background: var(--teal-400); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(18,148,112,.5); }
.login-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 11px;
}
.login-footer a { color: rgba(255,255,255,.5); }
.login-footer a:hover { color: var(--white); text-decoration: none; }
.login-sec { color: rgba(255,255,255,.35); letter-spacing: .3px; }

/* ─── SHELL ADMIN ─── */
body.admin { display: grid; grid-template-columns: 240px 1fr; height: 100vh; overflow: hidden; }

.admin-sidebar {
  background: var(--navy-900);
  color: rgba(255,255,255,.85);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.05);
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.admin-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--navy-500), var(--teal-500));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 900;
  font-size: 18px;
}
.admin-brand-name { color: var(--white); font-weight: 800; font-size: 15px; line-height: 1; }
.admin-brand-sub { color: var(--teal-300); font-size: 10px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; margin-top: 3px; }

.admin-nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.6);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all .12s;
}
.admin-nav-link:hover {
  background: rgba(255,255,255,.05);
  color: var(--white);
  text-decoration: none;
}
.admin-nav-link.active {
  background: rgba(18,148,112,.15);
  color: var(--white);
  border-left: 3px solid var(--teal-400);
  padding-left: 9px;
}
.admin-nav-link svg { flex-shrink: 0; color: rgba(255,255,255,.4); }
.admin-nav-link.active svg { color: var(--teal-400); }
.admin-badge {
  margin-left: auto;
  background: var(--critical);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9999px;
}

.admin-sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.admin-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy-500);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 13px;
}
.admin-user-name { color: var(--white); font-size: 12px; font-weight: 600; line-height: 1.1; }
.admin-user-email { color: rgba(255,255,255,.4); font-size: 11px; }
.admin-logout-form { margin: 0; }
.admin-logout-btn {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.5);
  padding: 8px;
  border-radius: 8px;
  transition: all .15s;
}
.admin-logout-btn:hover { background: rgba(220,38,38,.2); color: #FCA5A5; }

.admin-main { padding: 28px 32px; overflow-y: auto; }

/* ─── PAGE COMMON ─── */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-head h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -.02em;
}
.page-sub { color: var(--gray-500); font-size: 14px; margin-top: 4px; }
.page-meta { font-size: 12px; color: var(--gray-400); font-weight: 500; }
.filters { display: flex; gap: 8px; }
.filters select {
  font-family: var(--font);
  font-size: 13px;
  padding: 7px 28px 7px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-700);
  cursor: pointer;
  outline: none;
}
.filters select:focus { border-color: var(--teal-400); }

/* ─── ALERTS ─── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}
.alert-success { background: #ECFDF5; border: 1px solid #6EE7B7; color: #065F46; }
.alert-error   { background: #FEF2F2; border: 1px solid #FECACA; color: #7F1D1D; }

/* ─── STATS ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 22px 24px;
  transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.06); }
.stat-card.highlight-new      { border-left: 4px solid var(--critical); }
.stat-card.highlight-progress { border-left: 4px solid var(--moderate); }
.stat-card.highlight-done     { border-left: 4px solid var(--safe); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--gray-500); letter-spacing: .3px; text-transform: uppercase; }
.stat-num { font-size: 36px; font-weight: 900; color: var(--gray-900); letter-spacing: -.02em; margin: 6px 0; }
.stat-trend { font-size: 12px; color: var(--gray-400); }

/* ─── CARDS ─── */
.dashboard-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.card-head h2 { font-size: 15px; font-weight: 700; color: var(--gray-800); }
.card-link { font-size: 13px; color: var(--teal-500); font-weight: 600; }
.card-body { padding: 16px 20px; }
.empty { padding: 32px 20px; text-align: center; color: var(--gray-400); font-size: 14px; }

/* ─── TABLES ─── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.data-table td {
  padding: 11px 12px;
  font-size: 13px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-50);
}
.data-table tbody tr { cursor: pointer; transition: background .12s; }
.data-table tbody tr:hover { background: var(--gray-50); }

/* ─── PILLS ─── */
.type-pill, .status-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: .5px;
}
.type-pill.type-demo     { background: #DBEAFE; color: #1E40AF; }
.type-pill.type-business { background: #FCE7F3; color: #9D174D; }
.type-pill.type-contact  { background: #E0E7FF; color: #3730A3; }
.type-pill.type-bug      { background: #FEE2E2; color: #991B1B; }
.status-pill.status-new          { background: #FEE2E2; color: #991B1B; }
.status-pill.status-in_progress  { background: #FEF3C7; color: #92400E; }
.status-pill.status-done         { background: #D1FAE5; color: #065F46; }
.status-pill.status-archived     { background: var(--gray-100); color: var(--gray-500); }

/* ─── REPARTITION ─── */
.type-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.type-bar-wrap { flex: 1; height: 8px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.type-bar { height: 100%; background: linear-gradient(90deg, var(--navy-500), var(--teal-500)); border-radius: 4px; transition: width .4s; }
.type-count { font-size: 13px; font-weight: 700; color: var(--gray-700); min-width: 30px; text-align: right; }

/* ─── SECURITY ROWS ─── */
.sec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-50);
}
.sec-row:last-child { border-bottom: none; }
.sec-label { font-size: 13px; color: var(--gray-600); }
.sec-val { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.sec-val.ok { color: var(--safe); }
.sec-val.danger { color: var(--critical); }
.code-block {
  background: var(--navy-900);
  color: var(--teal-300);
  padding: 12px 14px;
  border-radius: 8px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
  overflow-x: auto;
}

/* ─── DEMANDES LAYOUT ─── */
.demandes-layout { display: grid; grid-template-columns: 360px 1fr; gap: 16px; height: calc(100vh - 180px); }
.demandes-list { overflow-y: auto; }
.demandes-detail { overflow-y: auto; padding: 24px 28px; }
.req-list { list-style: none; }
.req-item {
  display: block;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  position: relative;
  text-decoration: none;
  color: inherit;
  transition: background .12s;
}
.req-item:hover { background: var(--gray-50); text-decoration: none; }
.req-item.active { background: #EFF6FF; border-left: 3px solid var(--teal-500); padding-left: 13px; }
.req-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.req-date { font-size: 11px; color: var(--gray-400); font-family: 'SF Mono', Consolas, monospace; }
.req-name { display: block; font-size: 14px; font-weight: 600; color: var(--gray-900); }
.req-email { display: block; font-size: 12px; color: var(--gray-500); font-family: 'SF Mono', Consolas, monospace; }
.req-new-dot { position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; background: var(--critical); border-radius: 50%; }
.req-item.status-new .req-name { font-weight: 700; }

/* ─── DETAIL ─── */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--gray-100); margin-bottom: 18px; }
.detail-head h2 { font-size: 22px; font-weight: 800; color: var(--gray-900); margin-top: 8px; letter-spacing: -.01em; }
.detail-meta { font-size: 13px; color: var(--gray-600); margin-top: 6px; }
.detail-meta-sub { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.detail-section { margin-bottom: 22px; }
.detail-section h3 { font-size: 12px; font-weight: 700; color: var(--gray-500); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 10px; }
.detail-message { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: 14px 16px; font-size: 14px; line-height: 1.65; color: var(--gray-700); white-space: pre-wrap; }
.detail-section textarea { width: 100%; border: 1px solid var(--gray-200); border-radius: 8px; padding: 10px 12px; font-family: var(--font); font-size: 13px; color: var(--gray-700); outline: none; resize: vertical; margin-bottom: 8px; }
.detail-section textarea:focus { border-color: var(--teal-400); }
.status-select { padding: 6px 12px; font-family: var(--font); font-size: 12px; font-weight: 600; border-radius: 9999px; border: none; cursor: pointer; }
.status-select.status-new          { background: #FEE2E2; color: #991B1B; }
.status-select.status-in_progress  { background: #FEF3C7; color: #92400E; }
.status-select.status-done         { background: #D1FAE5; color: #065F46; }
.status-select.status-archived     { background: var(--gray-100); color: var(--gray-500); }
.detail-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.btn-primary  { background: var(--teal-500); color: var(--white); }
.btn-primary:hover { background: var(--teal-400); text-decoration: none; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); text-decoration: none; }
.btn-danger { background: #FEF2F2; color: var(--critical); border: 1px solid #FECACA; }
.btn-danger:hover { background: var(--critical); color: var(--white); text-decoration: none; }
.inline-form { display: inline; margin: 0; }

@media (max-width: 1000px) {
  body.admin { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-cols, .demandes-layout { grid-template-columns: 1fr; }
}
