/* ============================================================
   Panel admin SS.Mada — outil interne, sobre et fonctionnel.
   ============================================================ */
:root {
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --ink: #0f172a;
  --gray-600: #475569;
  --gray-300: #cbd5e1;
  --sand: #f8fafc;
  --white: #ffffff;
  --success: #16a34a;
  --danger: #dc2626;
  --warn: #d97706;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--sand); color: var(--ink); }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-box {
  width: 100%; max-width: 380px; background: var(--white);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem;
  text-align: center;
}
.login-box h1 { font-size: 1.4rem; margin-bottom: .25rem; }
.login-box p { color: var(--gray-600); font-size: .9rem; margin-bottom: 1.5rem; }
.login-box input {
  width: 100%; padding: .7rem .9rem; border: 1px solid var(--gray-300);
  border-radius: 8px; font-size: 1rem; margin-bottom: 1rem;
}
.login-box button {
  width: 100%; padding: .75rem; border: none; border-radius: 8px;
  background: var(--brand); color: white; font-weight: 600; font-size: 1rem;
  cursor: pointer;
}
.login-box button:hover { background: var(--brand-dark); }
.login-error { color: var(--danger); font-size: .85rem; margin-top: .75rem; min-height: 1.2em; }

/* ---------- Layout app ---------- */
.app { display: none; }
.app.visible { display: block; }
.topbar {
  background: var(--white); border-bottom: 1px solid var(--gray-300);
  padding: .9rem 1.5rem; display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 1.1rem; margin: 0; }
.topbar button { background: none; border: 1px solid var(--gray-300); border-radius: 6px; padding: .4rem .8rem; cursor: pointer; }

.tabs { display: flex; gap: .25rem; padding: 0 1.5rem; background: var(--white); border-bottom: 1px solid var(--gray-300); overflow-x: auto; }
.tab-btn {
  padding: .75rem 1rem; border: none; background: none; cursor: pointer;
  font-size: .9rem; font-weight: 600; color: var(--gray-600);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-btn .badge {
  display: inline-block; margin-left: .35rem; background: var(--danger); color: white;
  border-radius: 999px; font-size: .7rem; padding: .05rem .4rem; min-width: 1.2em; text-align: center;
}

main { padding: 1.5rem; max-width: 1100px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.25rem; }
.stat-card .label { font-size: .8rem; color: var(--gray-600); }
.stat-card .value { font-size: 1.6rem; font-weight: 800; margin-top: .15rem; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: .5rem; margin-bottom: 1rem; }
.filters button {
  padding: .4rem .9rem; border: 1px solid var(--gray-300); border-radius: 999px;
  background: var(--white); cursor: pointer; font-size: .85rem;
}
.filters button.active { background: var(--brand); color: white; border-color: var(--brand); }

/* ---------- Cards list ---------- */
.item-card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.25rem; margin-bottom: .75rem;
}
.item-card .item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.item-card h3 { margin: 0 0 .2rem; font-size: 1rem; }
.item-card .meta { color: var(--gray-600); font-size: .85rem; line-height: 1.5; }
.item-card .actions { display: flex; gap: .5rem; margin-top: .75rem; }
.item-card .actions button {
  padding: .45rem 1rem; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: .85rem;
}
.btn-approve { background: var(--success); color: white; }
.btn-reject  { background: var(--danger); color: white; }
.btn-ghost   { background: var(--gray-300); color: var(--ink); }
.empty-state { color: var(--gray-600); text-align: center; padding: 2rem; }
.loading { color: var(--gray-600); text-align: center; padding: 2rem; }

/* ---------- Activity feed ---------- */
.activity-item { display: flex; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--sand); font-size: .85rem; }
.activity-item .type { font-weight: 700; color: var(--brand); }
.activity-item time { color: var(--gray-600); margin-left: auto; white-space: nowrap; }
