* { box-sizing: border-box; }

:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --text: #17221d;
  --muted: #64746b;
  --green: #136c47;
  --green-dark: #0c5034;
  --green-soft: #e8f3ed;
  --gold: #cfaa57;
  --border: #dfe8e3;
  --danger: #a43c3c;
  --shadow: 0 7px 18px rgba(17,55,39,.08);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(19,108,71,.08), transparent 28%),
    var(--bg);
}

a { color: inherit; }

.topbar {
  min-height: 76px;
  padding: 10px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display:flex; align-items:center; gap:12px; }
.logo { height: 52px; max-width: 205px; object-fit:contain; }
.brand-text { display:none; line-height:.95; }
.brand-name { font-size:24px; font-weight:900; color:var(--green); }
.brand-subtitle { margin-top:6px; font-size:11px; font-weight:700; letter-spacing:3px; color:var(--gold); }

.top-actions { display:flex; align-items:center; gap:18px; }
.datetime { text-align:right; }
#date { color:var(--muted); font-size:16px; margin-bottom:2px; text-transform:capitalize; }
#time { color:var(--green-dark); font-size:22px; font-weight:800; }

.admin-link {
  text-decoration:none;
  border:1px solid var(--border);
  background:#fff;
  color:var(--green-dark);
  font-weight:800;
  font-size:12px;
  padding:9px 12px;
  border-radius:10px;
}

.container {
  width: min(1500px, calc(100% - 34px));
  margin: 0 auto;
  padding: 28px 0 26px;
}

.hero { margin-bottom: 20px; }
.eyebrow { margin:0 0 5px; color:var(--green); font-size:10px; font-weight:800; letter-spacing:2px; }
.hero h1 { margin:0; font-size:clamp(25px,3vw,34px); line-height:1.1; }
.hero > p:last-child { margin:7px 0 0; color:var(--muted); font-size:14px; }

.apps-grid {
  display:grid;
  grid-template-columns:repeat(5, minmax(0,1fr));
  gap:13px;
}

.app-card {
  min-height: 145px;
  padding:15px;
  border:1px solid transparent;
  border-radius:14px;
  text-decoration:none;
  color:#fff;
  background-color: var(--button-color, #136c47);
  box-shadow:var(--shadow);
  display:flex;
  flex-direction:column;
  transition:transform .18s ease, box-shadow .18s ease;
  overflow:hidden;
}

.app-card:hover {
  transform:translateY(-3px);
  box-shadow:0 11px 24px rgba(17,55,39,.13);
}

.app-icon {
  width:48px;
  min-width:48px;
  height:44px;
  padding:0 5px;
  border-radius:11px;
  display:grid;
  place-items:center;
  text-align:center;
  font-size:10px;
  line-height:1.05;
  font-weight:900;
  letter-spacing:.2px;
  background:rgba(255,255,255,.15);
  border:1px solid rgba(255,255,255,.2);
  color:#fff;
}

.app-content { display:flex; flex-direction:column; flex:1; }
.app-content h2 { margin:11px 0 4px; font-size:14px; line-height:1.15; }
.app-content p { margin:0 0 9px; font-size:11px; line-height:1.3; color:rgba(255,255,255,.78); }
.launch { margin-top:auto; font-size:10.5px; font-weight:800; color:#fff; }

.alert, .empty-state {
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  padding:16px;
}
.alert.error { border-left:4px solid var(--danger); }
.alert small { display:block; margin-top:8px; color:var(--muted); }
.empty-state a { color:var(--green); font-weight:800; margin-left:8px; }

footer {
  width:min(1500px, calc(100% - 34px));
  margin:0 auto;
  padding:13px 0 20px;
  border-top:1px solid var(--border);
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  color:var(--muted);
  font-size:10px;
}

@media (max-width:1200px) {
  .apps-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
}
@media (max-width:900px) {
  .apps-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .topbar { padding:10px 20px; }
}
@media (max-width:650px) {
  .topbar { align-items:flex-start; }
  .logo { height:43px; max-width:155px; }
  .top-actions { gap:8px; }
  .admin-link { padding:7px 8px; font-size:10px; }
  #date { font-size:10px; }
  #time { font-size:18px; }
  .container { width:calc(100% - 22px); padding-top:20px; }
  .apps-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .app-card { min-height:135px; padding:12px; }
  .app-content h2 { font-size:12px; }
  .app-content p { font-size:10px; }
}
@media (max-width:390px) {
  .apps-grid { grid-template-columns:1fr; }
}


/* v2.3 - couleur individuelle provenant de MariaDB */
.apps-grid .app-card {
  background: var(--button-color, #136c47) !important;
  background-color: var(--button-color, #136c47) !important;
  border-color: transparent;
}
.apps-grid .app-card:hover {
  filter: brightness(0.93);
}


/* v2.4 - la couleur choisie s'applique aussi à la pastille de l'application */
.apps-grid .app-card .app-icon {
  background: var(--button-color, #136c47) !important;
  background-color: var(--button-color, #136c47) !important;
  border: 1px solid rgba(255,255,255,.55) !important;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}

/* v2.5 - vraies vignettes images */
.app-icon.has-thumbnail { padding:0 !important; overflow:hidden; background:#fff !important; }
.app-icon.has-thumbnail img { width:100%; height:100%; display:block; object-fit:cover; border-radius:inherit; }

/* v2.6 */
.apps-grid .app-card { background:var(--button-color,#136c47)!important; }
.apps-grid .app-card .app-icon { background:rgba(255,255,255,.14)!important; overflow:hidden; }
.apps-grid .app-card .app-icon.has-thumbnail { background:#fff!important; padding:0!important; }
.apps-grid .app-card .app-icon.has-thumbnail img {
 width:100%!important;height:100%!important;object-fit:cover!important;
 display:block!important;border-radius:inherit!important;
}
