/* variables couleurs */
:root{
    --ink:#1c1f24;
    --paper:#ffffff;
    --line:#ffffff;
    --muted:#6b6f76;
    --accent:#3a5a7a;
  }
  *{box-sizing:border-box;}

  html, body{
    height:100%;
    overflow-x:hidden;
    max-width:100%;
  }

  body{
    margin:0;
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    background:var(--paper);
    color:var(--ink);
    display:flex;
    flex-direction:column;
  }
  header{
    padding:20px 24px 12px 38px;
    display: flex;
    align-items:center;
    justify-content: space-between;
  }
  header h1{
    margin:0 0 4px;
    font-size:1.3rem;
    font-weight:650;
    letter-spacing:-0.01em;
  }
  header p{
    margin:0;
    color:var(--muted);
    font-size:0.85rem;
  }
  header img{
    width: 130px;
    margin-right: 14px;
  }
.layout{
    display:flex;
    gap:20px;
    padding:20px 24px 40px;
    align-items:stretch;
    flex-wrap:wrap;
    flex:1 1 auto;
    min-height:0;
  }
  .legend{
    flex:0 0 220px;
    display:flex;
    flex-direction:column;
    align-self:flex-start;
    gap:8px;
    background:#fff;
    border:1px solid var(--line);
    border-radius:10px;
    padding:14px;
  }
  .legend h2{
    font-size:0.78rem;
    text-transform:uppercase;
    color:var(--ink);
    margin:0 0 8px;
  }
  .legend-group-title{
    font-size:0.78rem;
    font-weight:700;
    text-transform:uppercase;
    color:var(--muted);
    margin:14px 0 4px;
    padding-top:8px;
    border-top:1px solid var(--line);
  }
  .legend-group-title:first-child{
    margin-top:0;
    padding-top:0;
    border-top:none;
  }
.legend-actions{
    display:flex;
    align-items:center;
    gap:8px;
    padding: 6px 4px;
    margin-bottom:12px;
    padding-bottom:10px;
    border-bottom:1px solid var(--line);
    font-size:0.8rem;
    font-weight:600;
    cursor:pointer;
  }
  .legend-actions input{ accent-color:var(--accent); cursor:pointer; }
  
.cal-item{
    display:flex;
    align-items:center;
    gap:8px;
    padding:6px 4px;
    border-radius:6px;
    cursor:pointer;
    font-size:0.88rem;
    min-width:0;
  }
  .cal-name{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .cal-item:hover{ background:#f1f0ec; }
  .subscribe-btn{
    text-decoration:none;
    padding:4px 6px;
    border-radius:4px;
  }
  .subscribe-btn:hover{
    opacity:1;
    background:#d7d7d7;
  }
  .subscribe-btn img{
    max-width: 12px;
  }
  .cal-item input{ accent-color:var(--accent); cursor:pointer; }
  .dot{
    width:10px; height:10px; border-radius:50%; flex:0 0 10px;
  }
  .cal-item .status{
    margin-left:auto;
    font-size:0.7rem;
    color:var(--muted);
  }
  .cal-item.error .status{ color:#b3432b; }

  .fc{ font-size:0.85rem; }
  .fc-toolbar-title{ font-size:1.05rem !important; }

  .fc .fc-button-primary{
    background-color: #FFF;
    border-color: #000000;
    color:#000;
    border-radius: 20px;
  }
  #calendar{
    flex:1 1 480px;
    min-width:280px;
    background:#fff;
    border:1px solid var(--line);
    border-radius:10px;
    padding:14px;
    height:100%;
    overflow-y:auto;
  }

  .fc-ev-main{
    display:flex; gap:4px; align-items:baseline; line-height:1.2;
    overflow:hidden;
    /* white-space:nowrap; */
    text-overflow:ellipsis;
  }
  .fc-ev-time{ font-weight:600; font-size:0.72em; opacity:0.9; flex:0 0 auto; }
  .fc-ev-title{
    font-weight:500;
    overflow:hidden;
    text-overflow:ellipsis;
    /* white-space:nowrap; */
    min-width:0;
  }
  .fc-ev-location{
    font-size:0.85em;
    opacity:0.85;
    line-height:1.5;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .fc-ev-description{
    font-size:0.85em;
    opacity:0.75;
    line-height:1.25;
    margin-top:2px;
    display:-webkit-box;
    -webkit-line-clamp:4;
    -webkit-box-orient:vertical;
    overflow:hidden;
    white-space:pre-line;
  }

  .fc-event-main{
    padding: 0.4em !important;
    overflow: hidden;
  }

  .fc-h-event .fc-event-main,
  .fc-v-event .fc-event-main{
    color: #000000;
  }

.modal-backdrop{
    display:none;
    position:fixed;
    top:0;
    left:0;
    right:0;
    bottom:0;
    background:rgba(20,22,26,0.45);
    align-items:center;
    justify-content:center;
    z-index:1000;
    padding:20px;
    overflow-y:auto;
  }
  .modal-backdrop.open{ display:flex; }
.modal-card{
    position:relative;
    background:#fff;
    border-radius:12px;
    padding:24px 24px 22px;
    max-width:420px;
    width:100%;
    box-shadow:0 12px 40px rgba(0,0,0,0.22);
    margin:auto;
  }
  .modal-close{
    position:absolute;
    top:12px; right:12px;
    border:none;
    background:transparent;
    font-size:1rem;
    color:var(--muted);
    cursor:pointer;
    line-height:1;
    padding:6px;
  }
  .modal-close:hover{ color:var(--ink); }
  .modal-dot{
    width:12px; height:12px; border-radius:50%;
    margin-bottom:10px;
  }
  #modal-title{
    margin:0 0 4px;
    font-size:1.1rem;
    font-weight:650;
    padding-right:20px;
  }
  .modal-cal{
    font-size:0.78rem;
    color:var(--muted);
    margin-bottom:14px;
  }
  .modal-row{
    font-size:0.88rem;
    margin-bottom:8px;
    display:flex;
    gap:8px;
    align-items:flex-start;
  }
  .modal-row:empty{ display:none; }
  .modal-desc{
    font-size:0.85rem;
    color:var(--ink);
    margin-top:12px;
    padding-top:12px;
    border-top:1px solid var(--line);
    white-space:pre-wrap;
    max-height:220px;
    overflow-y:auto;
  }
  .modal-desc:empty{ display:none; border-top:none; margin-top:0; padding-top:0; }

  /* mobile */
@media (max-width: 768px){
    header{ padding:14px 16px 10px; }
    #logo-lmd{
      display: none;
    }
    .layout{
      display: flex !important;
      padding:12px 12px 30px;
      gap:12px;
    }
    #calendar{
      order: 1 !important;
      width: 100%;
      max-width: 100%;
      min-width: 0;
      margin-bottom: 10px;
    }
    .legend{
      order: 2 !important;
      flex: auto;
      width: 100%;
      max-width: 100%;
      min-width: 0;
      margin-top: 10px;
    }
    .fc-toolbar{
      flex-wrap:wrap;
      gap:8px;
      row-gap:6px;
    }
    .fc-toolbar-title{
      font-size:0.95rem !important;
    }
    .fc-button{
      padding:6px 10px !important;
      font-size:0.8rem !important;
    }
    .modal-card{
      padding:18px 16px 16px;
      max-width:100%;
    }
  }
