* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f1f2f4;
  --sidebar-bg: #1d2125;
  --sidebar-hover: #2c3439;
  --sidebar-active: #1c5096;
  --sidebar-text: #b6c2cf;
  --sidebar-sub: #7c8a99;
  --primary: #1c5096;
  --primary-dark: #0f3a73;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --card: #ffffff;
  --border: #cbd5e1;
  --text: #172b4d;
  --muted: #5e6c84;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ================ SIDEBAR ================ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 16px 10px;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.25s;
}
.side-head {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 10px 14px; border-bottom: 1px solid #373d44;
  margin-bottom: 10px;
}
.avatar-big {
  width: 40px; height: 40px;
  background: var(--sidebar-active);
  color: white; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 14px;
}
.side-title { color: white; font-weight: bold; font-size: 14px; }
.side-sub { color: var(--sidebar-sub); font-size: 11px; }

.side-section-title {
  color: var(--sidebar-sub);
  font-size: 10px; font-weight: bold; letter-spacing: 0.5px;
  padding: 12px 12px 4px;
}
.side-link, .side-act {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 6px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 13px; margin: 1px 0;
  transition: background 140ms ease, color 140ms ease;
}
.side-link span { flex: 1; }
.side-link:hover, .side-act:hover { background: var(--sidebar-hover); }
.side-link:active, .side-act:active { background: var(--sidebar-active); }
.side-act.active { background: var(--sidebar-active); color: white; }

.dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  text-indent: -9999px; line-height: 0; overflow: hidden;
}
.dot-FTTH     { background: #16a34a; }
.dot-Business { background: #f59e0b; }
.dot-B2BFTTH  { background: #3b82f6; }
.dot-IMES     { background: #a855f7; }
.dot-SAV      { background: #dc2626; }

.side-foot {
  position: absolute; bottom: 10px; left: 10px; right: 10px;
  border-top: 1px solid #373d44; padding-top: 10px;
}
.side-logout {
  display: block; color: #f87171; text-decoration: none;
  padding: 8px 12px; border-radius: 6px; font-size: 12px; font-weight: bold;
}
.side-logout:hover { background: var(--sidebar-hover); }

/* ================ TOPBAR MOBILE ================ */
.topbar-mobile { display: none; }
.overlay { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 2px 0 12px rgba(0,0,0,0.2); }
  .topbar-mobile {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 50;
    background: var(--sidebar-bg);
    padding: 10px 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  .burger {
    background: transparent; border: none; color: white;
    font-size: 22px; cursor: pointer; padding: 0 4px;
  }
  .brand-mobile {
    color: white; font-weight: bold; font-size: 16px;
    text-decoration: none; flex: 1;
  }
  .cta-mobile {
    background: var(--success); color: white;
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; font-size: 22px; font-weight: bold;
  }
  .sidebar.open ~ .overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); z-index: 99;
  }
  .main-area { margin-left: 0 !important; }
}

/* ================ MAIN AREA ================ */
.main-area {
  margin-left: 240px;
  padding: 20px 24px 40px;
  min-height: 100vh;
}

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}

.muted { color: var(--muted); }
.back-link {
  display: inline-block; color: var(--primary);
  text-decoration: none; margin-bottom: 12px;
  font-weight: bold; font-size: 13px;
}

/* ================ HERO ================ */
.hero {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--primary); color: white;
  padding: 18px 22px; border-radius: 12px;
  margin-bottom: 14px;
}
.hero-sub { font-size: 10px; font-weight: bold; color: #bfdbfe; }
.hero-title { font-size: 20px; font-weight: bold; }
.hero-count { text-align: right; }
.hero-count .big { font-size: 28px; font-weight: bold; }
.hero-count .small { font-size: 11px; color: #bfdbfe; }

/* ================ DATE NAV ================ */
.date-nav {
  display: flex; gap: 6px; align-items: center;
  margin-bottom: 14px; flex-wrap: wrap;
}
.date-btn, .date-input {
  background: white; color: var(--primary); text-decoration: none;
  padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); font-weight: bold; font-size: 12px;
  cursor: pointer; font-family: inherit;
}
.date-btn.today { background: var(--success); color: white; border-color: var(--success); }

/* ================ KANBAN ================ */
.kanban {
  display: flex; gap: 10px; overflow-x: auto;
  padding-bottom: 10px; -webkit-overflow-scrolling: touch;
}
.column {
  flex: 0 0 260px; min-width: 260px;
  background: #ebecf0; border-radius: 10px;
  padding: 8px;
  border: 1px solid var(--border);
}
.col-header {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: bold; padding: 4px 8px 10px;
}
.badge-count {
  background: #dfe1e6; color: var(--muted);
  padding: 2px 8px; border-radius: 10px; font-size: 11px;
}
.col-body { display: flex; flex-direction: column; gap: 6px; }
.card {
  display: block;
  background: white; border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
  text-decoration: none; color: var(--text);
}
.card.draggable { cursor: grab; }
.card.draggable:active { cursor: grabbing; }
.card.dragging { opacity: 0.5; }
.drop-zone { min-height: 40px; border-radius: 6px; transition: background 0.1s; }
.drop-zone.over { background: #bfdbfe; outline: 2px dashed #1c5096; }
.drop-indicator { height: 3px; background: #1c5096; border-radius: 2px; margin: 0; box-shadow: 0 0 6px rgba(28, 80, 150, 0.7); pointer-events: none; }
.card.draggable { transition: box-shadow 0.12s ease; }
.card.draggable:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.card-top { margin-bottom: 4px; }
.mini-id { font-size: 10px; color: var(--muted); font-weight: bold; margin-right: 6px; }
.mini-client { font-size: 13px; }
.mini-sub { font-size: 11px; color: var(--muted); margin: 4px 0 6px; }
.mini-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10px;
}

/* ================ FEED (tickets list) ================ */
.feed { display: flex; flex-direction: column; gap: 8px; }
.feed-card {
  display: flex; background: white; border-radius: 10px;
  border: 1px solid var(--border); overflow: hidden;
  text-decoration: none; color: var(--text);
}
.feed-strip { width: 6px; background: var(--primary); }
.strip-Nouveau  { background: #3b82f6; }
.strip-Affecte  { background: #8b5cf6; }
.strip-RDVpris  { background: #f59e0b; }
.strip-Encours  { background: #f97316; }
.strip-Sursite  { background: #eab308; }
.strip-Termine  { background: #10b981; }
.strip-Cloture  { background: #16a34a; }
.feed-body { padding: 12px; flex: 1; }
.feed-head strong { font-size: 15px; }
.feed-head .avatar-xs { margin-right: 8px; }
.feed-sub { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.feed-foot {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  font-size: 11px;
}
.feed-date { color: var(--muted); margin-left: auto; }

/* ================ CHIPS / BADGES ================ */
.chip {
  padding: 3px 8px; border-radius: 12px;
  font-size: 11px; font-weight: bold;
  display: inline-block;
}
.statut-chip { background: var(--primary); color: white; }
.chip-basse   { background: #e2e8f0; color: #475569; }
.chip-normale { background: #dbeafe; color: #1e40af; }
.chip-haute   { background: #fed7aa; color: #c2410c; }
.chip-urgente { background: #fecaca; color: #991b1b; }
.avatar-xs {
  background: var(--primary); color: white;
  padding: 3px 7px; border-radius: 4px;
  font-weight: bold; font-size: 10px;
}

/* ================ PANELS / DETAIL ================ */
.detail-hero {
  background: white; padding: 18px 22px;
  border-radius: 12px; border: 1px solid var(--border);
  margin-bottom: 12px;
}
.detail-id { font-size: 11px; color: var(--muted); font-weight: bold; letter-spacing: 0.5px; }
.detail-hero h1 { font-size: 22px; margin: 4px 0; }
.detail-badges {
  display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}

.panel {
  background: white; padding: 14px 16px;
  border-radius: 10px; border: 1px solid var(--border);
  margin-bottom: 10px;
}
.panel h3 { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.panel.danger-panel { background: #fff5f5; border-color: #fca5a5; }

.pill-form { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 6px 12px; border-radius: 20px;
  background: #e2e8f0; color: var(--text);
  border: none; font-size: 12px; font-weight: bold;
  cursor: pointer;
}
.pill.active { background: var(--primary); color: white; }

.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form select, .inline-form input {
  flex: 1; padding: 10px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; background: white;
  -webkit-appearance: none;
}

.info-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; }
.info-list dt { font-weight: bold; color: var(--muted); font-size: 12px; }
.info-list dd { font-size: 13px; }

/* ================ COMMENTS ================ */
.comments { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.comment {
  background: #f1f5f9; padding: 10px 12px;
  border-radius: 8px; font-size: 13px;
}
.comment-head { margin-bottom: 4px; font-size: 12px; }
.comment-form {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 10px;
}
.comment-form textarea {
  padding: 10px; border: 1px solid var(--border);
  border-radius: 8px; font-family: inherit; font-size: 13px;
  resize: vertical;
}

/* ================ FORMS ================ */
.form-new { display: flex; flex-direction: column; gap: 4px; }
.form-new label { font-weight: bold; font-size: 12px; margin-top: 8px; color: var(--muted); }
.form-new input, .form-new textarea, .form-new select {
  padding: 12px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 14px; background: white; font-family: inherit;
  -webkit-appearance: none;
}
.form-new textarea { resize: vertical; }
.form-row { display: flex; gap: 8px; }
.form-row > div { flex: 1; }

.search-bar {
  display: flex; gap: 6px; margin-bottom: 14px;
}
.search-bar input {
  flex: 1; padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 14px; background: white;
}
.search-bar button {
  padding: 10px 16px; border-radius: 8px; border: none;
  background: var(--primary); color: white; font-weight: bold;
  cursor: pointer;
}

.btn-primary {
  padding: 12px; border-radius: 10px; border: none;
  background: var(--success); color: white;
  font-size: 14px; font-weight: bold; margin-top: 14px;
  cursor: pointer; text-decoration: none;
  display: inline-block; text-align: center;
}
.btn-primary.small-btn { padding: 8px 14px; margin: 0; font-size: 12px; }
.btn-primary:active { background: #15803d; }

.btn-danger {
  padding: 10px 16px; border-radius: 8px; border: none;
  background: var(--danger); color: white;
  font-weight: bold; cursor: pointer; font-size: 13px;
}
.btn-danger.small-btn { padding: 6px 10px; font-size: 11px; }

.empty-state {
  text-align: center; color: var(--muted);
  font-style: italic; padding: 30px;
}

/* ================ LOGIN ================ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1c5096 0%, #0f3a73 100%);
  padding: 20px;
}
.login-card {
  background: white; padding: 32px 30px;
  border-radius: 18px;
  width: 100%; max-width: 380px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.login-card h1 { text-align: center; color: var(--primary); font-size: 24px; }
.login-card p { text-align: center; margin: 4px 0 20px; color: var(--muted); }
.login-card input {
  width: 100%; padding: 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; -webkit-appearance: none;
}
.login-card button { width: 100%; margin-top: 8px; }

/* ================ AGENDA ================ */
.week-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.week-col {
  background: #ebecf0; border-radius: 8px;
  border: 1px solid var(--border);
  min-height: 200px; padding: 6px;
}
.week-col.today {
  background: #dbeafe; border-color: var(--primary); border-width: 2px;
}
.week-head { text-align: center; padding: 6px 2px; }
.week-day { font-size: 10px; color: var(--muted); font-weight: bold; }
.week-num { font-size: 20px; font-weight: bold; color: var(--primary); }
.week-mois { font-size: 9px; color: var(--muted); }
.week-body { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; }
.week-card {
  background: white; border: 1px solid var(--border);
  border-radius: 6px; padding: 6px;
  text-decoration: none; color: var(--text); display: block;
}
.week-card-id { font-size: 9px; color: var(--muted); }
.week-card-title { font-size: 11px; font-weight: bold; }
.week-card-tech { font-size: 9px; color: var(--muted); }

@media (max-width: 900px) {
  .week-grid { grid-template-columns: repeat(7, minmax(120px, 1fr)); overflow-x: auto; }
}

.flash {
  padding: 10px 16px; margin: 8px 0;
  border-radius: 8px; font-size: 13px;
}
.flash.error { background: #fecaca; color: #991b1b; }

@media (max-width: 600px) {
  .main-area { padding: 14px; }
  .hero { padding: 14px; }
  .hero-title { font-size: 16px; }
  .hero-count .big { font-size: 22px; }
  .column { flex: 0 0 240px; min-width: 240px; }
  .detail-hero h1 { font-size: 18px; }
  .form-row { flex-direction: column; }
}
