/* Cabinet IA — layout cabinet 3 colonnes pour site standalone */

/* ===== GATE ===== */
.gate-wrap {
  min-height: calc(100vh - 2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.gate-card {
  max-width: 420px;
  width: 100%;
  padding: 2.5rem 2rem;
  background: var(--ivory-soft);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow-elev);
  text-align: center;
}

.gate-card h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.gate-card > p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.gate-card form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.gate-card input {
  flex: 1;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: white;
  color: var(--ink);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gate-card input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(199, 169, 98, 0.15);
}

.gate-error {
  color: var(--burgundy);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

.gate-hint {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
  font-style: italic;
}

/* ===== CABINET LAYOUT 3 COLONNES ===== */
.cabinet {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  height: calc(100vh - 1.8rem);
  background: var(--ivory);
}

/* ===== SIDEBAR DOSSIERS ===== */
.cab-sidebar {
  background: var(--navy);
  color: var(--ivory);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(199, 169, 98, 0.15);
}

.cab-sidebar .brand {
  color: var(--ivory);
}

.cab-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(199, 169, 98, 0.15);
}

.cab-sidebar-meta {
  padding: 0.75rem 1.25rem;
  font-size: 0.7rem;
  color: var(--gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 600;
}

.cab-case-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.5rem;
}

.cab-case-item {
  display: block;
  padding: 0.9rem 1rem;
  margin: 0.25rem 0;
  border-radius: 0.5rem;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--ivory);
}

.cab-case-item:hover {
  background: rgba(199, 169, 98, 0.08);
}

.cab-case-item.active {
  background: rgba(199, 169, 98, 0.12);
  border-left-color: var(--gold);
}

.cab-case-item-title {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cab-case-item-sub {
  font-size: 0.7rem;
  opacity: 0.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cab-case-item-badges {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.4rem;
  font-size: 0.65rem;
}

.cab-case-item-badge {
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(199, 169, 98, 0.15);
  color: var(--gold-soft);
  letter-spacing: 0.05em;
  font-weight: 600;
}

.cab-case-item-stats {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.3rem;
  font-size: 0.65rem;
  opacity: 0.5;
}

.cab-case-item-empty {
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.5;
}

.cab-sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(199, 169, 98, 0.15);
}

.btn-text {
  background: none;
  border: none;
  color: var(--gold-soft);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-body);
  padding: 0.5rem 0;
  letter-spacing: 0.05em;
}

.btn-text:hover {
  color: var(--gold);
}

.btn-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: none;
  background: rgba(199, 169, 98, 0.1);
  color: var(--gold);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: rgba(199, 169, 98, 0.2);
}

.btn-icon.danger {
  color: #e87b7b;
  background: rgba(232, 123, 123, 0.08);
}

.btn-icon.danger:hover {
  background: rgba(232, 123, 123, 0.15);
}

/* ===== MAIN (chat + empty state) ===== */
.cab-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ivory-soft);
}

.cab-empty {
  margin: auto;
  text-align: center;
  padding: 3rem 2rem;
  max-width: 500px;
}

.cab-empty-icon {
  font-family: var(--font-display);
  font-size: 5rem;
  color: var(--gold);
  line-height: 1;
  opacity: 0.4;
  margin-bottom: 1rem;
}

.cab-empty h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--navy);
  margin-bottom: 1rem;
}

.cab-empty p {
  color: var(--muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.cab-case {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.cab-case-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  background: white;
}

.cab-case-title-wrap {
  min-width: 0;
  flex: 1;
}

.cab-case-title-wrap h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--navy);
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cab-case-sub {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cab-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.jurisdiction-switch {
  background: var(--ivory);
  border: 1px solid var(--border);
}

.jurisdiction-switch button {
  color: var(--muted);
}

.jurisdiction-switch button.active {
  background: var(--navy);
  color: var(--ivory);
}

.cab-chat {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.cab-welcome {
  max-width: 560px;
  margin: 2rem auto;
  text-align: center;
}

.cab-welcome-label {
  display: inline-block;
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  background: rgba(122, 28, 46, 0.08);
  color: var(--burgundy);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.cab-welcome p {
  color: var(--muted);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.cab-composer {
  padding: 1rem 2rem 0.5rem;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
}

.cab-composer textarea {
  flex: 1;
  min-height: 2.5rem;
  max-height: 12rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--ivory-soft);
  color: var(--ink);
  resize: none;
  line-height: 1.5;
}

.cab-composer textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}

.btn-send {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  padding: 0;
  flex-shrink: 0;
  align-self: flex-end;
}

.cab-composer-hint {
  padding: 0.5rem 2rem 1rem;
  font-size: 0.7rem;
  color: var(--muted);
  background: white;
  text-align: center;
}

/* ===== PIECES PANEL ===== */
.cab-pieces {
  background: white;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cab-pieces-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.cab-pieces-header h3 {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--navy);
  margin: 0;
}

.cab-drop-zone {
  margin: 1rem;
  padding: 1.25rem;
  border: 2px dashed var(--border);
  border-radius: 0.75rem;
  text-align: center;
  color: var(--muted);
  transition: all 0.2s ease;
  cursor: pointer;
}

.cab-drop-zone svg {
  color: var(--gold);
  margin-bottom: 0.5rem;
  display: inline-block;
}

.cab-drop-zone p {
  font-size: 0.85rem;
  margin: 0.25rem 0;
}

.cab-drop-zone small {
  font-size: 0.7rem;
  opacity: 0.7;
}

.cab-drop-zone.drag {
  border-color: var(--gold);
  background: rgba(199, 169, 98, 0.05);
  color: var(--navy);
}

.cab-pieces-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 1rem 1rem;
}

.cab-piece {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  background: var(--ivory-soft);
  transition: all 0.15s ease;
  cursor: pointer;
  position: relative;
}

.cab-piece:hover {
  border-color: var(--gold);
}

.cab-piece-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cab-piece-meta {
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  gap: 0.5rem;
}

.cab-piece-preview {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.cab-piece-delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.3rem;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.cab-piece:hover .cab-piece-delete {
  opacity: 1;
}

.cab-piece-delete:hover {
  color: var(--burgundy);
  background: rgba(122, 28, 46, 0.08);
}

.cab-pieces-empty {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* ===== CHAT MESSAGES ===== */
.cab-msg {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.cab-msg.user {
  flex-direction: row-reverse;
}

.cab-msg-avatar {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.cab-msg.user .cab-msg-avatar {
  background: var(--burgundy);
  color: var(--ivory);
}

.cab-msg.assistant .cab-msg-avatar {
  background: var(--navy);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1rem;
}

.cab-msg-bubble {
  max-width: calc(100% - 3rem);
  background: white;
  border: 1px solid var(--border);
  padding: 0.8rem 1.1rem;
  border-radius: 0.85rem;
  line-height: 1.6;
  font-size: 0.95rem;
  color: var(--ink);
}

.cab-msg.user .cab-msg-bubble {
  background: rgba(122, 28, 46, 0.06);
  border-color: rgba(122, 28, 46, 0.15);
}

.cab-msg-bubble p {
  margin: 0.4rem 0;
}

.cab-msg-bubble p:first-child { margin-top: 0; }
.cab-msg-bubble p:last-child { margin-bottom: 0; }

.cab-msg-bubble strong { color: var(--navy); }
.cab-msg-bubble em { color: var(--burgundy); }
.cab-msg-bubble code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--ivory-soft);
  padding: 0.1em 0.35em;
  border-radius: 0.25em;
  color: var(--burgundy);
}

.cab-msg-meta {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}

/* ===== DIALOG ===== */
.cab-dialog {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.cab-dialog-content {
  max-width: 520px;
  width: 100%;
  background: var(--ivory);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow-elev);
  max-height: 90vh;
  overflow-y: auto;
}

.cab-dialog-content h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.cab-dialog-content label {
  display: block;
  margin-bottom: 0.85rem;
  font-size: 0.85rem;
}

.cab-dialog-content label > span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.03em;
}

.cab-dialog-content input,
.cab-dialog-content select,
.cab-dialog-content textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: white;
  color: var(--ink);
}

.cab-dialog-content input:focus,
.cab-dialog-content select:focus,
.cab-dialog-content textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}

.cab-dialog-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.cab-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* ===== TOAST ===== */
.cab-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  max-width: 320px;
  background: var(--navy);
  color: var(--ivory);
  padding: 0.85rem 1.25rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-elev);
  font-size: 0.85rem;
  z-index: 200;
  animation: slideIn 0.3s ease;
}

.cab-toast.error {
  background: var(--burgundy);
}

.cab-toast.success {
  background: #0f5132;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .cabinet {
    grid-template-columns: 240px 1fr;
  }
  .cab-pieces {
    position: fixed;
    right: -340px;
    top: 0;
    bottom: 0;
    width: 320px;
    transition: right 0.3s ease;
    box-shadow: var(--shadow-elev);
    z-index: 50;
  }
  .cab-pieces.open {
    right: 0;
  }
}

@media (max-width: 700px) {
  .cabinet {
    grid-template-columns: 1fr;
  }
  .cab-sidebar {
    display: none;
  }
}
