/* Zhan Shin Dojo — design system (portage de la version Next.js) */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f1f5f9; --panel: #fff; --ink: #0f172a; --muted: #64748b;
  --line: #e2e8f0; --brand: #4f46e5; --brand-ink: #3730a3; --brand-100: #e0e7ff;
}

html, body {
  background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; font-size: 16px;
}
a { color: inherit; text-decoration: none; }
[dir="auto"] { unicode-bidi: plaintext; }

/* ---- Composants ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
        box-shadow: 0 1px 2px rgba(15,23,42,.04); padding: 1.1rem; }
.card-flush { padding: 0; overflow: hidden; }

.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem .9rem;
       border-radius: 10px; font-weight: 600; font-size: .875rem; border: 1px solid transparent;
       cursor: pointer; white-space: nowrap; transition: .12s; font-family: inherit; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f8fafc; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: .35rem .6rem; font-size: .8rem; border-radius: 8px; }

.input, .select, .textarea { width: 100%; padding: .55rem .7rem; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; font-size: .9rem; color: var(--ink); font-family: inherit; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-100); }
.label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem;
         border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-red   { background: #fee2e2; color: #b91c1c; }
.badge-slate { background: #f1f5f9; color: #475569; }
.badge-blue  { background: #dbeafe; color: #1d4ed8; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em;
          color: var(--muted); font-weight: 700; padding: .6rem .75rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); font-size: .875rem; }
.tbl tr:hover td { background: #f8fafc; }

.stat-num { font-size: 1.75rem; font-weight: 800; line-height: 1; }

/* ---- Structure ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 244px; flex-shrink: 0; background: #0f172a; color: #e2e8f0;
           display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 1.15rem 1.1rem; border-bottom: 1px solid #1e293b;
                  display: flex; gap: .6rem; align-items: center; }
.sidebar nav { padding: .6rem; flex: 1; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem;
                 border-radius: 10px; margin-bottom: 2px; font-size: .88rem; font-weight: 600; color: #cbd5e1; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.sidebar nav a:hover:not(.active) { background: #1e293b; }
.sidebar .foot { padding: .8rem; border-top: 1px solid #1e293b; }

main.content { flex: 1; min-width: 0; padding: 1.6rem clamp(1rem, 3vw, 2.2rem);
               max-width: 1200px; margin: 0 auto; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between;
             flex-wrap: wrap; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.page-head p { color: var(--muted); margin-top: .25rem; font-size: .9rem; }

.grid { display: grid; gap: 1rem; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-21 { grid-template-columns: 2fr 1fr; }
.grid-12 { grid-template-columns: 1fr 1.3fr; }
.grid-form { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem; }

.flash { padding: .6rem .9rem; border-radius: 10px; font-size: .85rem; font-weight: 600; margin-bottom: 1rem; }
.flash-ok { background: #dcfce7; color: #15803d; }
.flash-err { background: #fee2e2; color: #b91c1c; }

.info-row { display: flex; justify-content: space-between; padding: .35rem 0;
            border-bottom: 1px solid var(--line); font-size: .85rem; }
.info-row span:first-child { color: var(--muted); }
.info-row span:last-child { font-weight: 600; text-align: right; }

/* Kanban grades */
.kb-col { border-radius: 14px; border: 1px solid var(--line); background: #fff; overflow: hidden;
          transition: box-shadow .12s, transform .12s; }
.kb-col.over { transform: scale(1.015); }
.kb-cards { padding: .5rem; min-height: 52px; display: flex; flex-direction: column; gap: .35rem; }
.kb-card { display: flex; align-items: center; gap: .45rem; padding: .4rem .55rem; border-radius: 8px;
           border: 1px solid var(--line); background: #fff; cursor: grab; font-size: .82rem;
           box-shadow: 0 1px 1px rgba(15,23,42,.04); }
.kb-card.dragging { opacity: .35; }

/* Mobile */
.mobile-toggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 50; }
@media (max-width: 820px) {
  .mobile-toggle { display: inline-flex; }
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  main.content { padding-top: 3.6rem; }
  .grid-2, .grid-21, .grid-12 { grid-template-columns: 1fr; }
}
