/* layout.css — Structure de page, login, topbar, panneaux, messages */

/* ── Login ── */

#login {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh
}

.lcard {
  width: 400px;
  max-width: 92vw;
  background: var(--wh);
  border: 1px solid var(--bd);
  border-radius: 16px;
  padding: 36px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04)
}

.llogo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px
}

.llogo img {
  width: 42px;
  height: 42px;
  object-fit: contain
}

.llogo h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--pri);
  text-align: left
}

.llogo span {
  font-size: 11px;
  color: var(--tx3);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: block
}

.ltabs {
  display: flex;
  gap: 2px;
  margin-bottom: 22px;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px
}

.ltabs button {
  flex: 1;
  padding: 8px;
  border: none;
  background: 0;
  color: var(--tx3);
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: .15s
}

.ltabs button.on {
  background: var(--wh);
  color: var(--pri);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06)
}

/* ── App Shell ── */

#app {
  display: none;
  height: 100vh;
  flex-direction: column
}

#app.on {
  display: flex
}

/* ── Topbar ── */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 54px;
  background: var(--wh);
  border-bottom: 1px solid var(--bd);
  flex-shrink: 0
}

.top-l {
  display: flex;
  align-items: center;
  gap: 10px
}

.top-l img {
  width: 30px;
  height: 30px;
  object-fit: contain
}

.top-brand {
  font-size: 16px;
  font-weight: 600;
  color: var(--pri)
}

.top-brand em {
  font-style: normal;
  font-weight: 400;
  color: var(--sec)
}

.top-r {
  display: flex;
  align-items: center;
  gap: 14px
}

/* ── Tabs navigation ── */

.tabs {
  display: flex
}

.tabs button {
  padding: 16px 20px;
  border: none;
  background: 0;
  color: var(--tx3);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: .15s
}

.tabs button.on {
  color: var(--pri);
  border-bottom-color: var(--pri)
}

.tabs button:hover:not(.on) {
  color: var(--tx2)
}

/* ── Panneaux principaux ── */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg)
}

.cpanel {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden
}

.cpanel.on {
  display: flex
}

/* ── Zone messages (chat) ── */

.msgs {
  flex: 1;
  overflow-y: auto;
  padding: 24px
}

.msgs-in {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px
}

.m {
  display: flex;
  gap: 12px;
  max-width: 92%
}

.m.ai {
  align-self: flex-start
}

.m.user {
  align-self: flex-end;
  flex-direction: row-reverse
}

.m-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden
}

.m.ai .m-av {
  background: var(--pbg)
}

.m.ai .m-av img {
  width: 22px;
  height: 22px;
  object-fit: contain
}

.m.user .m-av {
  background: #E5E7EB
}

.m.user .m-av svg {
  width: 16px;
  height: 16px;
  fill: var(--tx2)
}

.m-b {
  flex: 1;
  min-width: 0
}

.m-l {
  font-size: 13px;
  font-weight: 500;
  color: var(--tx2);
  margin-bottom: 6px
}

.m-c {
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.7;
  word-wrap: break-word;
  overflow-wrap: break-word
}

.m.ai .m-c {
  background: var(--wh);
  border: 1px solid var(--bd)
}

.m.user .m-c {
  background: linear-gradient(135deg, var(--pri), var(--sec));
  color: white
}

.m.ai .m-c h1,
.m.ai .m-c h2,
.m.ai .m-c h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--pri);
  margin: 14px 0 6px
}

.m.ai .m-c h1:first-child,
.m.ai .m-c h2:first-child,
.m.ai .m-c h3:first-child {
  margin-top: 0
}

.m.ai .m-c p {
  margin-bottom: 8px
}

.m.ai .m-c strong {
  font-weight: 600;
  color: var(--pri)
}

.m.ai .m-c ul {
  margin: 6px 0 6px 18px
}

.m.ai .m-c li {
  margin-bottom: 3px
}

.m.ai .m-c table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
  font-size: 13px
}

.m.ai .m-c th,
.m.ai .m-c td {
  border: 1px solid var(--bd);
  padding: 7px 10px
}

.m.ai .m-c th {
  background: var(--pbg);
  color: var(--pri);
  font-weight: 600
}

/* ── Fichier dans message ── */

.m-f {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--wh);
  border: 1px solid var(--bd);
  border-radius: 10px;
  margin-top: 10px
}

.m-f-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #FEE2E2;
  display: flex;
  align-items: center;
  justify-content: center
}

.m-f-icon svg {
  width: 14px;
  height: 14px;
  fill: var(--rd)
}

.m-f-info {
  font-size: 13px;
  font-weight: 500
}

.m-f-info span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--tx3)
}

/* ── Ecran d'accueil ── */

.welc {
  text-align: center;
  padding: 80px 20px;
  color: var(--tx2)
}

.welc-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px
}

.welc-icon img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  opacity: .5
}

.welc h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 8px
}

.welc p {
  font-size: 14px;
  line-height: 1.6;
  max-width: 460px;
  margin: 0 auto
}

/* ── Zone input ── */

.iarea {
  flex-shrink: 0;
  padding: 0 24px 20px;
  background: var(--bg)
}

.iin {
  max-width: 860px;
  margin: 0 auto
}

.irow {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--wh);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 6px 6px 6px 16px
}

.irow textarea {
  flex: 1;
  padding: 8px 0;
  background: 0;
  border: none;
  color: var(--tx);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  min-height: 22px;
  max-height: 120px
}

.irow textarea::placeholder {
  color: var(--tx3)
}

/* ── Status bar ── */

.sbar {
  flex-shrink: 0;
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--tx3);
  letter-spacing: .3px;
  text-transform: uppercase
}

/* ── Sidebar CU1 ── */

.cu1-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--wh);
  border-left: 1px solid var(--bd);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .25s ease, padding .25s ease
}

.cu1-sidebar.hidden {
  width: 0;
  padding: 0;
  border-left-color: transparent;
  overflow: hidden
}

.cu1-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--pri);
  text-transform: uppercase;
  letter-spacing: .8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bd)
}

.cu1-sidebar-title svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0
}

.cu1-sb-toggle {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border: none;
  background: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--tx3);
  flex-shrink: 0;
  transition: .15s;
  padding: 0
}

.cu1-sb-toggle:hover {
  background: var(--bd);
  color: var(--pri)
}

.cu1-sb-toggle svg {
  width: 13px;
  height: 13px
}

.cu1-show-sidebar-btn {
  position: absolute;
  right: 12px;
  top: 66px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--bd);
  background: var(--wh);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .1);
  z-index: 5;
  color: var(--tx2);
  transition: .15s
}

.cu1-show-sidebar-btn.on {
  display: flex
}

.cu1-show-sidebar-btn:hover {
  border-color: var(--pri);
  color: var(--pri)
}

.cu1-show-sidebar-btn svg {
  width: 14px;
  height: 14px
}

.cu1-uz {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 0
}

.cu1-launch-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--pri);
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: .15s;
  margin-top: 4px
}

.cu1-launch-btn:hover {
  background: var(--prl)
}

.cu1-sidebar-note {
  font-size: 11px;
  color: var(--tx3);
  text-align: center;
  line-height: 1.5
}

/* ── Panneau Copilot (CU4) ── */

.copanel {
  flex: 1;
  display: none;
  flex-direction: column
}

.copanel.on {
  display: flex
}

.coph {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 40px;
  text-align: center
}

.coph h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--tx)
}

.coph p {
  font-size: 14px;
  line-height: 1.6;
  max-width: 460px;
  color: var(--tx2)
}

.coph .lbtn {
  width: auto;
  padding: 10px 28px;
  margin-top: 8px
}

.coif {
  flex: 1;
  border: none;
  width: 100%
}

/* ── Dashboard inline (dans messages) ── */

.dash {
  font-size: 13px
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px
}

.dash-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--tx)
}

/* ── Responsive ── */

@media(max-width:900px) {
  .cu1-sidebar {
    width: 240px
  }
}

@media(max-width:768px) {
  .top {
    padding: 0 12px
  }

  .tabs button {
    padding: 14px 10px;
    font-size: 12px
  }

  .msgs {
    padding: 16px 12px
  }

  .iarea {
    padding: 0 12px 14px
  }

  .m {
    max-width: 98%
  }

  .top-brand {
    display: none
  }

  .dash-grid {
    grid-template-columns: 1fr 1fr
  }
}
