/* Bouton info + modal style Kommandia */

/* Les .brick orbitaux restent en absolute (delta.css) ;
   .brick--static et .card ont déjà / besoin de relative. */
.card {
  position: relative;
}

.brick-info {
  position: absolute;
  right: 0.38rem;
  bottom: 0.34rem;
  z-index: 6;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #f4f8ff;
  background: rgba(18, 32, 58, 0.88);
  box-shadow:
    0 0 0 1px rgba(180, 205, 255, 0.45),
    0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.brick-info svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}

.brick-info:hover,
.brick-info:focus-visible {
  transform: scale(1.08);
  color: #fff;
  background: color-mix(in srgb, var(--accent, #3b8dff) 72%, #0b1224);
  outline: none;
}

.brick-info.has-notes {
  color: #fff;
  background: linear-gradient(160deg, #3b8dff, #1a5fd6);
}

.km-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  font-family: Outfit, system-ui, sans-serif;
  color: #1c2416;
}

.km-modal[hidden] {
  display: none !important;
}

.km-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 28, 18, 0.32);
  backdrop-filter: blur(4px);
}

.km-modal-box {
  position: relative;
  z-index: 1;
  background: #fff;
  width: min(560px, 100%);
  max-height: min(86vh, 860px);
  border-radius: 14px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(28, 36, 22, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.km-modal.is-max {
  padding: 12px;
}

.km-modal.is-max .km-modal-box {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 10px;
}

.km-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: #f6f3ea;
  border-bottom: 1px solid #e6e0d2;
  flex-shrink: 0;
  user-select: none;
}

.km-modal-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  flex: 1;
  min-width: 0;
  color: #1c2416;
}

.km-modal-win {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  flex-shrink: 0;
}

.km-win {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  box-shadow:
    0 2px 3px rgba(0, 0, 0, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 -1px 1px rgba(0, 0, 0, 0.18) inset;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.km-win:hover {
  transform: scale(1.1);
  filter: brightness(1.05);
}

.km-win:active {
  transform: scale(0.96);
}

.km-win-min {
  background: radial-gradient(120% 90% at 30% 18%, #ffe27a 0%, #ffc53d 38%, #f5a623 72%, #d8890c 100%);
}

.km-win-max {
  background: radial-gradient(120% 90% at 30% 18%, #7dff8f 0%, #3fd65a 38%, #22c53e 72%, #14a32e 100%);
}

.km-win-close {
  background: radial-gradient(120% 90% at 30% 18%, #ff9a93 0%, #ff6b63 38%, #ff3b30 72%, #d92018 100%);
}

.km-win::before {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: 8%;
  height: 38%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.km-win::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: center / 11px 11px no-repeat;
  pointer-events: none;
}

.km-win-min::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 6h7.6' stroke='%231a1a1a' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.km-win-max::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Crect x='2.6' y='2.6' width='6.8' height='6.8' rx='0.6' fill='none' stroke='%23fff' stroke-width='1.7'/%3E%3C/svg%3E");
}

.km-win-max.is-restore::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.2 2.8h5v5' fill='none' stroke='%23fff' stroke-width='1.5'/%3E%3Crect x='2.4' y='4' width='5.2' height='5.2' rx='0.4' fill='none' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E");
}

.km-win-close::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 3l6 6M9 3L3 9' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.km-modal-body {
  padding: 16px 18px 8px;
  overflow: auto;
  min-height: 0;
  flex: 1;
}

.km-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
  padding: 12px 16px 14px;
  border-top: 1px solid #ebe6da;
  background: #fff;
  flex-shrink: 0;
}

.km-btn {
  border: 1px solid #b7b39a;
  background: #fff;
  border-radius: 3px;
  padding: 7px 11px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: #1c2416;
}

.km-btn:hover {
  border-color: #6d7a55;
}

.km-btn-primary {
  background: linear-gradient(180deg, #7c32e0, #5b1fb8);
  border-color: #4a1896;
  color: #fff;
}

.km-btn-primary:hover {
  filter: brightness(1.08);
}

.km-btn-danger {
  background: #fff;
  color: #c0392b;
  border-color: #e3b2ae;
}

.km-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.km-notes-empty {
  margin: 0.4rem 0 1rem;
  color: #6d675c;
  font-size: 13px;
}

.km-notes-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.km-note {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid #e6e0d2;
  border-radius: 8px;
  background: #fbfaf6;
}

.km-note-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: #1c2416;
}

.km-note-del {
  width: 28px;
  height: 28px;
  border: 1px solid #e3b2ae;
  border-radius: 3px;
  background: #fff;
  color: #c0392b;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.km-note-del:hover {
  background: #fff5f4;
}

.km-add {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.km-add textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  border: 1px solid #cfcab8;
  background: #fff;
  border-radius: 2px;
  padding: 8px 9px;
  font: inherit;
  font-size: 14px;
  color: #1c2416;
}

.km-add textarea:focus {
  outline: 2px solid rgba(92, 31, 184, 0.25);
  border-color: #7c32e0;
}

.km-add-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.km-ro-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: #8a8478;
}

.km-dock {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 81;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  color: #1c2416;
}

.km-dock[hidden] {
  display: none !important;
}

.km-dock i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(120% 90% at 30% 18%, #ffe27a 0%, #f5a623 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.km-modal.is-min {
  pointer-events: none;
  padding: 0;
}

.km-modal.is-min .km-modal-backdrop,
.km-modal.is-min .km-modal-box {
  display: none;
}

/* Connexion PrestaIA — suit le thème clair / sombre du hub */
.delta-auth-modal {
  color: var(--ink, #eef3ff);
}

.delta-auth-modal .km-modal-backdrop {
  background: rgba(4, 8, 18, 0.55);
}

.delta-auth-modal .km-modal-box {
  width: min(420px, 100%);
  max-height: min(86vh, 720px);
  background: var(--glass, rgba(14, 22, 40, 0.92));
  border: 1px solid var(--line, rgba(120, 170, 255, 0.28));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
  color: var(--ink, #eef3ff);
}

.delta-auth-modal .km-modal-box.is-dragged {
  z-index: 2;
  margin: 0;
}

.delta-auth-modal .km-modal-box.is-dragging {
  user-select: none;
  cursor: grabbing;
}

.delta-auth-modal .km-modal-header {
  background: color-mix(in srgb, var(--bg, #070b14) 72%, var(--hub, #6ec8ff) 12%);
  border-bottom: 1px solid var(--line, rgba(120, 170, 255, 0.28));
}

.delta-auth-modal .km-modal-header h2 {
  color: var(--ink, #eef3ff);
}

.delta-auth-modal #delta-auth-drag {
  cursor: grab;
}

.delta-auth-modal #delta-auth-drag .km-win {
  cursor: pointer;
}

.delta-auth-modal.is-max .km-modal-box {
  width: 100%;
}

.delta-auth-modal .km-modal-body {
  background: transparent;
}

.delta-auth-form {
  margin: 0;
}

.delta-auth-modal .delta-login-kicker {
  margin: 0 0 0.2rem;
  color: var(--hub, #6ec8ff);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 650;
}

.delta-auth-modal .delta-login-lead {
  margin: 0 0 1rem;
  color: var(--muted, #9aa8c3);
  font-size: 0.9rem;
  line-height: 1.45;
}

.delta-auth-modal .delta-login-error {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.55rem;
  background: rgba(220, 60, 60, 0.16);
  border: 1px solid rgba(255, 120, 120, 0.35);
  color: #ffc4c4;
  font-size: 0.88rem;
}

.delta-auth-modal .delta-login-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
  font-size: 0.82rem;
  color: var(--muted, #9aa8c3);
}

.delta-auth-modal .delta-login-field input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 0.55rem;
  border: 1px solid color-mix(in srgb, var(--line, rgba(120, 170, 255, 0.28)) 80%, transparent);
  background: color-mix(in srgb, var(--bg, #070b14) 88%, black);
  color: var(--ink, #eef3ff);
  font: inherit;
  font-size: 1rem;
}

.delta-auth-modal .delta-login-field input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--hub, #6ec8ff) 70%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hub, #6ec8ff) 28%, transparent);
}

.delta-auth-modal .delta-login-passwrap {
  position: relative;
  display: block;
}

.delta-auth-modal .delta-login-passwrap input {
  padding-right: 2.6rem;
}

.delta-auth-modal .delta-login-eye {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--muted, #9aa8c3);
  cursor: pointer;
  padding: 0;
}

.delta-auth-modal .delta-login-eye svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.delta-auth-modal .delta-login-eye:hover,
.delta-auth-modal .delta-login-eye[aria-pressed="true"] {
  color: var(--hub, #6ec8ff);
}

.delta-auth-modal .delta-login-submit {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: 0.65rem;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  color: #061018;
  background: linear-gradient(135deg, #8fd4ff, #3b8dff);
  box-shadow: 0 8px 22px rgba(40, 120, 220, 0.28);
}

.delta-auth-modal .delta-login-submit:hover:not(:disabled) {
  filter: brightness(1.04);
}

.delta-auth-modal .delta-login-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}

.delta-account-panel .delta-login-lead {
  margin: 0 0 1rem;
}

.delta-account-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 1rem;
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(140, 180, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.86rem;
}

.delta-account-info dt {
  color: var(--muted, #9aa8c3);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  align-self: center;
}

.delta-account-info dd {
  margin: 0;
  color: var(--text, #e8eef8);
  font-weight: 600;
  overflow-wrap: anywhere;
}

html[data-theme="light"] .delta-account-info {
  border-color: rgba(30, 60, 110, 0.14);
  background: rgba(15, 23, 42, 0.03);
}

html[data-theme="light"] .delta-account-info dd {
  color: #122033;
}

.delta-account-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.delta-account-logout {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #fca5a5, #ef4444) !important;
  color: #450a0a !important;
  box-shadow: 0 8px 22px rgba(220, 38, 38, 0.28) !important;
}

.delta-account-logout svg {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

.delta-account-cancel {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(140, 180, 255, 0.28);
  background: transparent;
  color: var(--muted, #9aa8c3);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.delta-account-cancel:hover,
.delta-account-cancel:focus-visible {
  color: var(--text, #e8eef8);
  border-color: rgba(140, 180, 255, 0.5);
  outline: none;
}

html[data-theme="light"] .delta-account-cancel {
  color: #334155;
  border-color: rgba(30, 60, 110, 0.22);
  background: #fff;
}

html[data-theme="light"] .delta-account-cancel:hover,
html[data-theme="light"] .delta-account-cancel:focus-visible {
  color: #0f172a;
  border-color: rgba(30, 60, 110, 0.4);
  background: #f8fafc;
}

.delta-auth-dock {
  z-index: 81;
}

html[data-theme="light"] .delta-auth-modal .km-modal-backdrop {
  background: rgba(15, 23, 42, 0.28);
}

html[data-theme="light"] .delta-auth-modal .km-modal-box {
  background: var(--glass, rgba(255, 255, 255, 0.92));
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.14);
}

html[data-theme="light"] .delta-auth-modal .km-modal-header {
  background: color-mix(in srgb, #fff 70%, var(--bg, #eef2f8));
}

html[data-theme="light"] .delta-auth-modal .delta-login-error {
  color: #991b1b;
  background: rgba(254, 226, 226, 0.9);
  border-color: rgba(248, 113, 113, 0.45);
}

html[data-theme="light"] .delta-auth-modal .delta-login-field input {
  background: #fff;
  border-color: rgba(30, 60, 110, 0.18);
}

html[data-theme="light"] .delta-auth-modal .delta-login-submit {
  color: #fff;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
}
