:root {
  --bg: #0f1117;
  --bg-soft: #161a24;
  --card: #1b2130;
  --border: #2a3245;
  --text: #e6e9f0;
  --muted: #8b93a7;
  --accent: #5b8cff;
  --accent-2: #8a5bff;
  --green: #3ecf8e;
  --amber: #f5a623;
  --red: #ff5c5c;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1c2333 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  background: rgba(15, 17, 23, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; }

.logo {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 18px rgba(91, 140, 255, .35);
}

h1 { font-size: 20px; line-height: 1.2; }
.subtitle { color: var(--muted); font-size: 13px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: .15s;
}
.btn:hover { border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; color: #fff; font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.1); }

.searchbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}

#search {
  flex: 1; min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}
#search:focus { border-color: var(--accent); }

.status-filters { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
  transition: .15s;
}
.chip:hover { color: var(--text); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

main { max-width: 1200px; margin: 0 auto; padding: 24px; }

.count { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(91, 140, 255, .12);
}

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card h3 { font-size: 16px; line-height: 1.3; }

.badge {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge.actif { background: rgba(62, 207, 142, .15); color: var(--green); }
.badge.idée { background: rgba(245, 166, 35, .15); color: var(--amber); }
.badge.en-pause { background: rgba(139, 147, 167, .15); color: var(--muted); }
.badge.livré { background: rgba(91, 140, 255, .15); color: var(--accent); }

.card .desc {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.tag {
  font-size: 11.5px;
  color: var(--accent-2);
  background: rgba(138, 91, 255, .12);
  border: 1px solid rgba(138, 91, 255, .3);
  padding: 3px 9px;
  border-radius: 999px;
}

.card-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition: .15s;
}
.icon-btn:hover { border-color: var(--accent); background: rgba(91, 140, 255, .12); }
.icon-btn.danger:hover { border-color: var(--red); background: rgba(255, 92, 92, .12); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.hidden { display: none !important; }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 14, .72); backdrop-filter: blur(3px); }

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: transparent; color: var(--muted);
  border: none; font-size: 16px; cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.detail h2 { font-size: 20px; margin-bottom: 4px; padding-right: 28px; }
.detail .d-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.d-section { margin-top: 18px; }
.d-section h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent); margin-bottom: 8px;
}
.d-section ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.kv { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.kv .k { color: var(--muted); min-width: 110px; flex-shrink: 0; }
.kv .v { word-break: break-word; }

.row {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
}
.row .lbl { font-weight: 600; }
.row .mono { font-family: ui-monospace, Consolas, monospace; color: #9fb6ff; }

.acs-chip {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--green);
  background: rgba(62, 207, 142, .12);
  border-radius: 6px; padding: 2px 7px;
}

.sec-note { font-size: 12.5px; color: var(--amber); }
.d-actions { display: flex; gap: 8px; margin-top: 24px; }
.d-actions .btn.primary a { color: #fff; text-decoration: none; }

/* Form */
.form h2 { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.form input, .form select, .form textarea {
  width: 100%;
  margin-top: 5px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--accent); }
.form textarea { resize: vertical; }
.form fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.form legend { font-size: 12px; color: var(--accent); padding: 0 6px; text-transform: uppercase; letter-spacing: .05em; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .kv { flex-direction: column; gap: 2px; }
  .kv .k { min-width: 0; }
}