:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273449;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.topbar .brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.topbar nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar nav .user { color: var(--muted); }

.container { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.25rem; }

h1 { margin-top: 0; }
.muted { color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

/* Tuiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: 1.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-align: center;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.tile:hover { transform: translateY(-3px); border-color: var(--primary); background: var(--surface-2); text-decoration: none; }
.tile-icon { font-size: 2.2rem; }
.tile-name { font-weight: 600; }
.tile-path { color: var(--muted); font-size: .8rem; font-family: ui-monospace, monospace; }

/* Formulaires */
label { display: block; margin: .6rem 0; color: var(--muted); font-size: .9rem; }
label.check { display: flex; align-items: center; gap: .5rem; }
input[type=text], input[type=password], input[type=number], select {
  display: block;
  width: 100%;
  margin-top: .25rem;
  padding: .5rem .6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .95rem;
}
label.check input { width: auto; margin: 0; }
input:focus, select:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

.btn {
  display: inline-block;
  padding: .5rem .9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: .9rem;
  cursor: pointer;
  list-style: none;
}
.btn:hover { background: var(--border); text-decoration: none; }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.link { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; font-size: 1rem; }
.link:hover { text-decoration: underline; }

form.inline { display: inline-flex; gap: .4rem; align-items: center; margin: .35rem 0; }
form.stack { margin: .5rem 0; padding: .75rem; background: var(--bg); border-radius: 8px; max-width: 480px; }

/* Tableaux */
.grid { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; }
.grid th, .grid td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.actions details { margin: 0; }
.actions summary { display: inline-block; }
details > summary { cursor: pointer; }
details.new-form { margin-top: 1rem; }
details.new-form > summary { display: inline-block; margin-bottom: .5rem; }

/* Flash */
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash-success { background: rgba(34,197,94,.12); border-color: var(--success); color: #bbf7d0; }
.flash-error { background: rgba(239,68,68,.12); border-color: var(--danger); color: #fecaca; }

/* Login */
.login-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { text-align: center; font-size: 1.4rem; }
.login-card .btn { width: 100%; margin-top: .5rem; }
