/* ============================================================
   Auto Perfectionnement – Admin Dashboard v1.3.0
   ============================================================ */

.apad-wrap {
  --ap-red:      #e8292d;
  --ap-red-h:    #c4191d;
  --ap-pink:     #fff0f0;
  --ap-border:   #e4e8ef;
  --ap-text:     #0f172a;
  --ap-muted:    #64748b;
  --ap-bg:       #f8fafc;
  --ap-white:    #ffffff;
  --ap-shadow:   0 2px 10px rgba(15,23,42,.09);
  --ap-radius:   13px;
  --ap-rsm:      9px;

  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px;
  width: 100%;
  min-height: 560px;
  background: var(--ap-bg);
  color: var(--ap-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  box-sizing: border-box;
}
.apad-wrap * { box-sizing: border-box; }

.apad-denied {
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: var(--ap-radius);
  padding: 24px;
  color: #7f1d1d;
}

/* ── Sidebar ── */
.apad-sidebar {
  padding: 24px 10px 18px 2px;
  background: var(--ap-bg);
  display: flex;
  flex-direction: column;
}

.apad-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--ap-muted);
  text-transform: uppercase;
  margin: 0 0 14px 12px;
}

.apad-nav {
  appearance: none;
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: var(--ap-rsm);
  background: transparent;
  color: var(--ap-text);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  margin: 0 0 5px;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-align: left;
  transition: background .14s, color .14s;
}
.apad-nav svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex: 0 0 16px;
}
.apad-nav:hover { background: var(--ap-pink); color: var(--ap-red); }
.apad-nav.is-active { background: var(--ap-red); color: #fff; }
.apad-nav.is-active:hover { background: var(--ap-red-h); }

.apad-line { height: 1px; background: var(--ap-border); margin: 12px 0; }

/* ── Main ── */
.apad-main { padding: 24px 30px 70px 0; min-width: 0; }
.apad-panel { display: none; }
.apad-panel.is-active { display: block; }
.apad-panel h1 {
  font-size: 26px; font-weight: 800; letter-spacing: -.02em;
  margin: 0 0 6px; color: var(--ap-text);
}
.apad-subtitle { font-size: 15px; color: #374151; margin: 0 0 24px; }
.apad-subtitle.compact { margin: 4px 0 0; }

/* ── Cards ── */
.apad-card {
  background: var(--ap-white);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  box-shadow: var(--ap-shadow);
}

/* ── Stats ── */
.apad-stats { display: grid; grid-template-columns: repeat(3, minmax(170px,1fr)); gap: 16px; }
.apad-stats-four { grid-template-columns: repeat(4, minmax(160px,1fr)); }
.apad-stat-card {
  height: 138px; padding: 20px 22px;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.apad-stat-icon {
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--ap-pink); color: var(--ap-red);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.apad-stat-icon svg { width: 19px; height: 19px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.apad-stat-card strong { font-size: 28px; font-weight: 800; line-height: 1; margin: 0 0 8px; }
.apad-stat-card span:last-child { font-size: 14px; color: var(--ap-muted); }

/* ── Toolbar ── */
.apad-headline-row {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 18px; margin: 0 0 22px;
}
.apad-select, .apad-search {
  height: 40px; border: 1px solid var(--ap-border); border-radius: var(--ap-rsm);
  background: var(--ap-white); color: var(--ap-text);
  padding: 0 14px; font-size: 14px;
  box-shadow: 0 1px 4px rgba(15,23,42,.07); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.apad-select:focus, .apad-search:focus {
  border-color: var(--ap-red);
  box-shadow: 0 0 0 3px rgba(232,41,45,.1);
}
.apad-select { min-width: 210px; appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2364748b' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.apad-search { width: 380px; max-width: 100%; margin: 10px 0 24px; }

/* ── List items ── */
.apad-list-card { min-height: 100px; padding: 0; overflow: hidden; }
.apad-empty { width: 100%; text-align: center; color: var(--ap-muted); font-size: 16px; padding: 44px 10px; }

.apad-res-list, .apad-doc-list { width: 100%; }
.apad-res-item, .apad-doc-item {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  gap: 18px; align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
}
.apad-res-item:hover { background: #fafbfc; }
.apad-res-item:last-child, .apad-doc-item:last-child { border-bottom: 0; }
.apad-doc-item { grid-template-columns: minmax(0,1fr) auto; }

.apad-res-item strong { font-size: 15px; display: block; margin-bottom: 5px; }
.apad-res-item span, .apad-doc-item span { display: block; color: var(--ap-muted); font-size: 13.5px; margin-bottom: 4px; }
.apad-res-item small, .apad-doc-item small { display: block; color: #94a3b8; font-size: 12px; }
.apad-res-item em { display: block; margin-top: 7px; color: #475569; font-style: normal; font-size: 12.5px; font-style: italic; }

.apad-price { font-weight: 800; font-size: 15px; white-space: nowrap; }
.apad-res-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

/* ── Badges ── */
.apad-badge {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; padding: 4px 11px;
  font-size: 11.5px; font-weight: 700; color: #fff; white-space: nowrap;
  background: var(--ap-text);
}
.apad-badge.is-green  { background: #16a34a; }
.apad-badge.is-red    { background: #dc2626; }
.apad-badge.is-amber  { background: #d97706; }
.apad-badge.is-dark   { background: #1e293b; }

/* ── Buttons ── */
.apad-primary, .apad-outline, .apad-danger {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 16px; border-radius: var(--ap-rsm);
  font-size: 13.5px; font-weight: 600;
  text-decoration: none !important; cursor: pointer;
  transition: background .15s, transform .12s, box-shadow .15s;
}
.apad-primary { background: var(--ap-red); border: 1px solid var(--ap-red); color: #fff !important; box-shadow: 0 4px 10px rgba(232,41,45,.2); }
.apad-primary:hover { background: var(--ap-red-h); transform: translateY(-1px); }
.apad-outline { background: #fff; border: 1px solid var(--ap-red); color: var(--ap-red) !important; }
.apad-outline:hover { background: var(--ap-pink); }
.apad-danger { background: #1e293b; border: 1px solid #1e293b; color: #fff !important; }
.apad-danger:hover { background: #0f172a; }

/* ── Clients ── */
.apad-client-grid { display: grid; grid-template-columns: repeat(2, minmax(240px,1fr)); gap: 14px; }
.apad-client-card {
  min-height: 110px; padding: 20px 22px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.apad-client-card strong { font-size: 15px; display: block; margin-bottom: 6px; }
.apad-client-card span { display: block; font-size: 13px; color: var(--ap-muted); margin-bottom: 4px; }
.apad-client-card small { font-size: 12px; color: #94a3b8; }

/* ── Documents ── */
.apad-doc-actions { display: flex; align-items: center; gap: 9px; }
.apad-doc-item strong { font-size: 14.5px; display: block; margin-bottom: 5px; }

/* ── Credits ── */
.apad-credit-list { width: 100%; }
.apad-credit-item {
  display: grid;
  grid-template-columns: minmax(0,1.5fr) 130px 160px 160px auto;
  gap: 14px; align-items: end;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}
.apad-credit-item:last-child { border-bottom: 0; }
.apad-credit-item strong { display: block; font-size: 14.5px; margin-bottom: 4px; }
.apad-credit-item span   { display: block; font-size: 13px; color: var(--ap-muted); margin-bottom: 3px; }
.apad-credit-item small  { display: block; font-size: 12px; color: #94a3b8; }
.apad-credit-item label  { font-size: 12px; font-weight: 700; color: #475569; display: flex; flex-direction: column; gap: 5px; }

.apad-input {
  height: 38px; border: 1px solid var(--ap-border); border-radius: var(--ap-rsm);
  background: #fff; padding: 0 10px; font-size: 13.5px;
  box-shadow: 0 1px 4px rgba(15,23,42,.07);
  transition: border-color .15s;
}
.apad-input:focus { outline: none; border-color: var(--ap-red); box-shadow: 0 0 0 3px rgba(232,41,45,.1); }

.apad-save-message { margin-left: 10px; font-weight: 700; color: #16a34a; font-size: 13px; }
.apad-is-hidden { display: none !important; }

/* ── Skills ── */
.apad-skill-card { padding: 18px 20px 14px; margin: 0 0 16px; }
.apad-skill-card h2 { font-size: 16px; font-weight: 800; margin: 0 0 12px; }
.apad-skill-row {
  display: grid; grid-template-columns: minmax(0,1fr) 200px;
  gap: 14px; align-items: start;
  border-top: 1px solid #f1f5f9; padding: 10px 0;
}
.apad-skill-row span { font-size: 13.5px; padding-top: 8px; }
.apad-skill-note-admin {
  width: 100%; min-height: 54px; margin-top: 8px;
  border: 1px solid var(--ap-border); border-radius: var(--ap-rsm);
  padding: 9px 11px; font-size: 13px; resize: vertical;
}
.apad-skill-note-admin:focus { outline: none; border-color: var(--ap-red); }

/* ── Responsive ── */
@media (max-width: 1050px) {
  .apad-wrap { grid-template-columns: 1fr; }
  .apad-sidebar { padding: 16px 10px; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .apad-kicker { width: 100%; margin: 0 0 4px; }
  .apad-nav { width: auto; }
  .apad-line { display: none; }
  .apad-main { padding: 10px 16px 50px; }
  .apad-stats, .apad-stats-four, .apad-client-grid { grid-template-columns: 1fr 1fr; }
  .apad-credit-item { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .apad-stats, .apad-stats-four, .apad-client-grid { grid-template-columns: 1fr; }
  .apad-res-item { grid-template-columns: 1fr; }
  .apad-res-actions { justify-content: flex-start; }
  .apad-headline-row { flex-direction: column; }
  .apad-select { width: 100%; }
  .apad-skill-row { grid-template-columns: 1fr; }
  .apad-credit-item { grid-template-columns: 1fr; }
}
