:root {
  --or-orange: #FF7900;
  --or-orange-dark: #DC5F00;
  --or-orange-tint: rgba(255,121,0,.16);
  --or-black: #000000;
  --or-bg: #0D0D0D;
  --or-surface: #1A1A1A;
  --or-surface-2: #242424;
  --or-border: #333333;
  --or-text: #F2F2F2;
  --or-muted: #9BA3AF;
  --or-radius: 2px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--or-bg);
  color: var(--or-text);
}
.sg, h1, h2 { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 700; letter-spacing: -.02em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
::placeholder { color: var(--or-muted); }
a { color: var(--or-orange); }
#form-tache input:focus, #form-tache select:focus, #form-tache textarea:focus, .search input:focus, select:focus {
  outline: none; border-color: var(--or-orange); box-shadow: 0 0 0 2px var(--or-orange);
}

/* Header */
.topbar { background: var(--or-orange); color: #000; padding: 11px 0; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-bottom: 10px; }
.eyebrow { font-size: 15px; letter-spacing: .1em; color: rgba(0,0,0,.6); font-weight: 700; text-transform: uppercase; }
.topbar h1 { margin: 1px 0 0; font-size: 18px; font-weight: 700; color: #000; letter-spacing: -.02em; }

.btn-primary {
  display: flex; align-items: center; gap: 8px;
  background: #000; color: #fff; border: none; border-radius: var(--or-radius);
  padding: 10px 16px; font-weight: 700; cursor: pointer; font-size: 14px;
}
.btn-primary.full { flex: 1; background: var(--or-orange); color: #000; border-radius: var(--or-radius); padding: 11px 0; justify-content: center; }
.btn-secondary { background: var(--or-surface-2); color: var(--or-text); border: none; border-radius: var(--or-radius); padding: 11px 18px; font-weight: 600; cursor: pointer; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--or-muted); font-size: 16px; }

/* Stats */
main.wrap, .wrap { padding-top: 24px; padding-bottom: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card { border-radius: var(--or-radius); padding: 10px 16px; display: flex; align-items: baseline; gap: 8px; }
.stat-card .val { font-size: 20px; font-weight: 700; }
.stat-card .lbl { font-size: 12.5px; font-weight: 600; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 220px; }
.search input, select {
  padding: 9px 12px; border-radius: var(--or-radius); border: 1px solid var(--or-border); font-size: 14px; background: var(--or-surface); color: var(--or-text); font-family: inherit;
}
.search input { width: 100%; }
.view-toggle { display: flex; background: var(--or-surface-2); border-radius: var(--or-radius); padding: 3px; margin-left: auto; }
.toggle { border: none; border-radius: var(--or-radius); padding: 7px 14px; background: transparent; color: var(--or-muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.toggle.active { background: var(--or-surface); color: var(--or-orange); box-shadow: 0 1px 3px rgba(0,0,0,.3); }

/* Navigation semaine (Kanban) */
.week-nav { display: flex; align-items: center; gap: 10px; margin: -6px 0 16px; padding: 8px 4px; }
.week-nav.hidden { display: none; }
.week-label { font-weight: 700; font-size: 14px; color: var(--or-text); min-width: 260px; text-align: center; }
.week-nav .icon-btn {
  border: 1px solid var(--or-border); background: var(--or-surface); border-radius: var(--or-radius);
  width: 32px; height: 32px; font-size: 16px; cursor: pointer; color: var(--or-text);
}
.week-nav .icon-btn:hover { background: var(--or-surface-2); }
.week-today { margin-left: auto; padding: 6px 12px; font-size: 12.5px; }

/* Table */
.table-wrap { background: var(--or-surface); border-radius: var(--or-radius); border: 1px solid var(--or-border); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead tr { background: var(--or-surface-2); text-align: left; }
th { padding: 11px 14px; font-weight: 700; color: var(--or-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--or-border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--or-border); vertical-align: top; }
tr.row-termine { background: #173D2C; }
tr.row-retard { background: #4A231C; }
.sujet-cell .pill-priorite { display: inline-block; margin-bottom: 4px; }
.sujet-cell .titre { font-weight: 600; }
.sujet-cell .projet { color: var(--or-muted); font-size: 12px; margin-top: 2px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.pill-priorite { padding: 2px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 700; }
.row-actions { display: flex; gap: 6px; }
.row-actions button { background: var(--or-surface-2); border: none; border-radius: var(--or-radius); padding: 6px 9px; cursor: pointer; color: var(--or-text); font-size: 13px; }
.row-actions .del { color: #FF6B52; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--or-muted); }

/* Kanban */
.kanban { display: grid; gap: 12px; overflow-x: auto; grid-template-columns: repeat(5, minmax(210px, 1fr)); }
.kcol { background: var(--or-surface-2); border-radius: var(--or-radius); border: 1px solid var(--or-border); min-width: 210px; }
.kcol-head { padding: 12px 14px; border-bottom: 1px solid var(--or-border); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kcol-head .name { font-weight: 700; font-size: 13px; flex: 1; }
.kcol-head .count { border-radius: 20px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; }
.kcol-chevron { display: none; font-size: 13px; font-weight: 700; transition: transform .15s; }
.kcol-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kcard { background: var(--or-surface); border-radius: var(--or-radius); padding: 10px; border: 1px solid var(--or-border); cursor: grab; transition: box-shadow .15s, opacity .15s; }
.kcard-termine { background: #173D2C; border-color: #1F5A3F; }
.kcard-retard { background: #4A231C; border-color: #6B2F23; }
.kcard .titre { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.kcard .resp { font-size: 11.5px; color: var(--or-muted); }
.kcard-projet { font-size: 11px; color: var(--or-muted); font-weight: 600; margin: 2px 0 6px; }
.kcard.dragging { opacity: .4; }
.kcol-body { transition: background .15s; border-radius: var(--or-radius); }
.kcol.drag-over .kcol-body { background: var(--or-orange-tint); outline: 2px dashed var(--or-orange); outline-offset: -4px; }

/* Roadmap */
.roadmap { background: var(--or-surface); border-radius: var(--or-radius); border: 1px solid var(--or-border); overflow: hidden; }
.rm-scroll { overflow-x: auto; }
.rm-inner { position: relative; }
.rm-header { display: flex; position: sticky; top: 0; background: var(--or-surface); z-index: 3; border-bottom: 1px solid var(--or-border); }
.rm-corner { width: 220px; flex-shrink: 0; position: sticky; left: 0; background: var(--or-surface); z-index: 4; border-right: 1px solid var(--or-border); }
.rm-header-timeline { position: relative; height: 52px; flex-shrink: 0; }
.rm-months { position: relative; height: 24px; border-bottom: 1px solid var(--or-border); }
.rm-month { position: absolute; top: 0; height: 24px; line-height: 24px; font-size: 11px; font-weight: 700; color: var(--or-muted); padding-left: 6px; border-left: 1px solid var(--or-border); text-transform: capitalize; white-space: nowrap; overflow: hidden; }
.rm-weeks { position: relative; height: 28px; }
.rm-week-tick { position: absolute; top: 0; height: 28px; line-height: 28px; font-size: 10.5px; color: var(--or-muted); padding-left: 4px; border-left: 1px solid var(--or-border); white-space: nowrap; }
.rm-body { position: relative; }
.rm-gridlines { position: absolute; top: 0; bottom: 0; right: 0; z-index: 0; }
.rm-gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--or-border); }
.rm-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--or-orange); z-index: 2; }
.rm-today span { position: absolute; top: -1px; left: 4px; font-size: 10px; font-weight: 700; color: var(--or-orange); background: var(--or-surface); padding: 0 4px; border-radius: 4px; white-space: nowrap; }
.rm-group-title { position: sticky; left: 0; z-index: 1; background: var(--or-surface-2); font-size: 11.5px; font-weight: 700; color: var(--or-muted); text-transform: uppercase; letter-spacing: .04em; padding: 8px 14px; border-bottom: 1px solid var(--or-border); width: fit-content; min-width: 100%; }
.rm-row { display: flex; border-bottom: 1px solid var(--or-border); position: relative; z-index: 1; }
.rm-row-label { width: 220px; flex-shrink: 0; position: sticky; left: 0; background: var(--or-surface); z-index: 1; padding: 8px 12px; border-right: 1px solid var(--or-border); }
.rm-row-label .titre { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-row-label .resp { font-size: 11px; color: var(--or-muted); margin-top: 2px; }
.rm-row-track { position: relative; height: 46px; flex-shrink: 0; }
.rm-bar { position: absolute; top: 10px; height: 26px; border-radius: var(--or-radius); display: flex; align-items: center; padding: 0 8px; cursor: pointer; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.rm-bar-label { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Alerte badge */
.alerte-retard { color: #FF6B52; font-weight: 700; font-size: 12.5px; }
.alerte-urgent { color: #F0C766; font-weight: 700; font-size: 12.5px; }
.alerte-ok { color: #6FCB9F; font-size: 12.5px; }
.alerte-fait { color: #8FB8F0; font-size: 12.5px; }
.alerte-vide { color: var(--or-muted); font-size: 12.5px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-backdrop.hidden { display: none; }
.modal { background: var(--or-surface); border-radius: var(--or-radius); padding: 24px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 19px; }
#form-tache label { display: block; font-size: 12.5px; font-weight: 600; color: var(--or-muted); margin-bottom: 12px; }
#form-tache input, #form-tache select, #form-tache textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border-radius: var(--or-radius); border: 1px solid var(--or-border); background: var(--or-surface-2); color: var(--or-text); font-size: 13.5px; font-family: inherit;
}
#form-tache textarea { resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-error { background: rgba(255,107,82,.15); color: #FF6B52; padding: 8px 12px; border-radius: var(--or-radius); font-size: 13px; margin-bottom: 12px; }
.form-error.hidden { display: none; }

/* Dashboard */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 14px; align-items: start; }
.dash-card { background: var(--or-surface); border-radius: var(--or-radius); border: 1px solid var(--or-border); padding: 16px 18px; }
.dash-card h3 { margin: 0 0 14px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--or-muted); }
.dash-empty { color: var(--or-muted); font-size: 13px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { width: 96px; flex-shrink: 0; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 8px; background: var(--or-surface-2); border-radius: 20px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 20px; transition: width .2s; }
.bar-value { width: 24px; flex-shrink: 0; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--or-text); }

.dash-card-metric { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.dash-big { font-size: 40px; font-weight: 700; color: var(--or-orange); line-height: 1; }
.dash-big span { font-size: 18px; font-weight: 700; margin-left: 2px; }
.dash-sub { margin-top: 8px; font-size: 12.5px; color: var(--or-muted); }

.week-chart { display: flex; align-items: flex-end; gap: 10px; height: 120px; }
.week-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.week-bar-track { width: 100%; max-width: 34px; flex: 1; display: flex; align-items: flex-end; background: var(--or-surface-2); border-radius: var(--or-radius); overflow: hidden; }
.week-bar-fill { width: 100%; background: var(--or-orange); min-height: 2px; transition: height .2s; }
.week-bar-value { font-size: 11.5px; font-weight: 700; margin-top: 6px; }
.week-bar-label { font-size: 10.5px; color: var(--or-muted); margin-top: 2px; white-space: nowrap; }

.dash-list { display: flex; flex-direction: column; gap: 10px; }
.dash-list-item { border-left: 3px solid #FF6B52; padding-left: 10px; }
.dash-list-item .titre { font-size: 13px; font-weight: 600; }
.dash-list-item .meta { font-size: 11.5px; color: var(--or-muted); margin-top: 2px; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .kcol-head { cursor: pointer; }
  .kcol-chevron { display: inline-block; }
  .kcol.collapsed .kcol-chevron { transform: rotate(-90deg); }
  .kcol.collapsed .kcol-body { display: none; }
}
