:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #edf3f6;
  color: #243746;
  --ink: #102a43;
  --muted: #627d8d;
  --line: #d8e2e8;
  --surface: #ffffff;
  --surface-soft: #f5f8fa;
  --navy: #102a43;
  --teal: #0f9d8b;
  --teal-dark: #087d70;
  --cyan: #38bdf8;
  --danger: #c23b4a;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 2.5rem 1.25rem;
  background:
    radial-gradient(circle at 15% 0%, rgba(56, 189, 248, 0.10), transparent 28rem),
    radial-gradient(circle at 100% 20%, rgba(15, 157, 139, 0.08), transparent 30rem),
    #edf3f6;
  font-size: 16px;
}

.card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(177, 196, 207, 0.7);
  border-radius: 22px;
  padding: 1.75rem;
  box-shadow: 0 24px 65px rgba(16, 42, 67, 0.12);
  max-width: 880px;
  margin: 0 auto;
}

h1, h2, h3 {
  margin-top: 0;
  color: var(--ink);
  letter-spacing: -0.025em;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-header {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(145deg, #f4fbfb, #e8f4f6);
  border: 1px solid #d4e6e8;
}

.brand-mark img {
  width: 78px;
  height: 78px;
  object-fit: contain;
}

.brand-name {
  display: block;
  color: var(--teal-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brand-lockup h1 {
  margin: 0.12rem 0 0;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  line-height: 1.1;
}

.app-subtitle {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.view-toggle button {
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid #cbd5f5;
}
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.82rem;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
}
.toggle-slider {
  width: 44px;
  height: 22px;
  border-radius: 999px;
  background: #b8c8d1;
  position: relative;
  transition: background 0.2s;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--teal);
}
.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(22px);
}

.mobile-install-row {
  display: flex;
  justify-content: center;
  margin-top: 0.65rem;
}

.pwa-install-button {
  width: min(100%, 310px);
  padding: 0.55rem 0.85rem;
  border: 1px solid #b9dce0;
  background: #eaf8f6;
  color: var(--teal-dark);
  box-shadow: none;
}

.pwa-install-button[hidden] {
  display: none;
}

.mobile-offline-notice {
  margin-top: 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid #f0a5ae;
  border-radius: 10px;
  background: #fff1f2;
  color: #9f1239;
  font-weight: 750;
  line-height: 1.35;
  text-align: center;
}

.mobile-offline-notice[hidden] {
  display: none;
}

.mobile-offline .mobile-audio-spectrum {
  opacity: 0.42;
}

label {
  color: #486274;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.72rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.18s, box-shadow 0.18s;
}

textarea {
  min-height: 260px;
  resize: vertical;
  line-height: 1.65;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 157, 139, 0.12);
}

button {
  border: none;
  border-radius: 10px;
  font-size: 0.94rem;
  font-weight: 700;
  padding: 0.7rem 1.15rem;
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.16s, background 0.16s;
}

button.primary {
  background: linear-gradient(135deg, var(--navy), #164e63);
  color: #fff;
  box-shadow: 0 12px 25px rgba(66, 99, 235, 0.35);
}

button.primary:active {
  transform: scale(0.97);
  box-shadow: 0 6px 12px rgba(66, 99, 235, 0.25);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-top: 1rem;
  background: #eef4f5;
  color: #526d7d;
  font-size: 0.9rem;
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d65a67;
  display: inline-block;
}

.status-dot.connected {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 157, 139, 0.12);
}

.pair-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem 1.25rem;
  margin: 1rem 0;
  border: 1px solid #d9e6e9;
  border-radius: 14px;
  padding: 1.1rem;
  background: #f7fafb;
}

.pair-block > div:not(.qr) {
  min-width: 0;
}

.pair-block a {
  color: var(--teal-dark);
  overflow-wrap: anywhere;
}

.qr {
  width: 200px;
  height: 200px;
  grid-column: 2;
  grid-row: 1 / span 3;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  overflow: hidden;
  padding: 8px;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}
.qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.textarea-targets {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.25rem 0 0.75rem;
}

.pip-toggle {
  margin-top: 1rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--line);
  background: #f7fafb;
  color: var(--ink);
}

.desktop-tools {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.desktop-tabs {
  display: flex;
  flex: 1 1 480px;
  align-items: flex-end;
  gap: 0.2rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.desktop-tabs button {
  flex: 1 0 auto;
  margin: 0;
  padding: 0.65rem 0.9rem;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.desktop-tabs button.active {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  box-shadow: 0 -3px 0 var(--teal) inset;
}

.desktop-tab-panel {
  margin-top: 0.75rem;
}

.desktop-tabs-close {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin: 0 0 0.35rem;
  padding: 0;
  border-radius: 50%;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 1.2rem;
  line-height: 1;
}

.command-help {
  margin-top: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  max-height: 360px;
  overflow-y: auto;
}

.command-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.command-help-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.command-help-header button {
  padding: 0.15rem 0.55rem;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 1.25rem;
}

.command-help h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
}

.command-help ul {
  margin: 0;
  padding-left: 1.25rem;
}

.command-help code {
  font-size: 0.85rem;
}

.macro-command-guide {
  margin: 1.1rem 0;
  padding: 0.9rem 1rem;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  background: #eff6ff;
}

.macro-command-guide h3 {
  margin-top: 0;
}

.macro-command-guide p {
  margin: 0.45rem 0;
  line-height: 1.45;
}

.macro-command-guide summary {
  margin-top: 0.7rem;
  cursor: pointer;
  font-weight: 700;
}

.macro-command-guide details ul {
  margin-top: 0.55rem;
}

.macro-manager {
  margin-top: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.dev-validation {
  margin-top: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.dev-validation .command-help-header p,
.macro-manager .command-help-header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.dev-validation #dev-validation-storage-status.error {
  color: var(--danger);
}

.dev-validation-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.dev-validation-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.dev-validation-item code {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.dev-validation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.dev-validation-actions button {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.78rem;
}

.macro-form {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.macro-form textarea {
  min-height: 145px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

.macro-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.macro-form-actions button:not(.primary) {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.macro-status {
  min-height: 1.2em;
  color: var(--teal-dark);
  font-size: 0.85rem;
  font-weight: 650;
}

.macro-status.error {
  color: var(--danger);
}

.macro-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.macro-list-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.macro-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.macro-list-item small {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
}

.macro-list-item.readonly {
  grid-template-columns: minmax(0, 1fr);
}

.macro-choice-panel {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(3px);
  overscroll-behavior: none;
}

.macro-choice-dialog {
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  max-height: min(480px, calc(100vh - 2rem));
  max-height: min(480px, calc(100dvh - 2rem));
  overflow: hidden;
  padding: 1.1rem;
  border: 2px solid #f59e0b;
  border-radius: 14px;
  background: #fffbeb;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.32);
}

.macro-choice-dialog > strong {
  display: block;
  font-size: 1.05rem;
}

.macro-choice-dialog > p {
  margin: 0.35rem 0 0.75rem;
  color: var(--muted);
}

#macro-choice-list {
  display: grid;
  gap: 0.45rem;
  min-height: 0;
  margin-bottom: 0.7rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.macro-choice-open {
  overflow: hidden;
}

#macro-choice-list button {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #fbbf24;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.macro-list-item strong,
.macro-list-item code {
  display: block;
  overflow-wrap: anywhere;
}

.macro-list-item code {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.macro-list-actions {
  display: flex;
  gap: 0.35rem;
}

.macro-list-actions button {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.78rem;
}

.macro-list-actions button[data-action="delete"] {
  color: var(--danger);
}

.pip-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.textarea-targets button {
  flex: 1;
  min-width: 150px;
  border: 1px solid var(--line);
  background: #f5f8fa;
  color: #486274;
}

.textarea-targets button.active {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.engine-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.microphone-row select {
  flex: 1;
  min-width: 0;
}

.debug-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.debug-panel {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem;
  border: 1px solid #cbd5f5;
  border-radius: 8px;
  background: var(--surface-soft);
}

.debug-model {
  margin-bottom: 0.5rem;
  color: #475569;
  font-size: 0.9rem;
}

.debug-panel pre {
  margin: 0;
  padding: 0.75rem;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.notice {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}

.mobile-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.dictation-button {
  background: linear-gradient(145deg, #123c53, var(--teal));
  color: #fff;
  font-size: 1.2rem;
  border-radius: 999px;
  padding: 1.25rem;
  box-shadow: 0 14px 30px rgba(15, 118, 110, 0.24);
}

.dictation-button.recording {
  background: linear-gradient(145deg, #9f2f3d, var(--danger));
  box-shadow: 0 14px 30px rgba(194, 59, 74, 0.28);
}

.dictation-controls,
.mobile-dictation-controls {
  display: grid;
  gap: 0.65rem;
}

.mobile-audio-spectrum {
  display: block;
  width: min(100%, 310px);
  height: 58px;
  margin: 0 auto;
  border: 1px solid #bfd1d8;
  border-radius: 14px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    #102a43;
  box-shadow: inset 0 0 18px rgba(56, 189, 248, 0.08);
}

.command-dictation-button {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a5f;
}

.command-dictation-button.recording {
  border-color: #7c3aed;
  background: #7c3aed;
  color: #fff;
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.25);
}

.mobile-command-button {
  width: min(100%, 310px);
  margin: 0 auto;
}

.mobile-dictation-controls button {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.big-round {
  width: 100%;
  max-width: 320px;
  height: 160px;
  border-radius: 999px;
  font-size: 1.3rem;
  margin: 0 auto;
  display: block;
}

.circle-button {
  width: min(78vw, 78vmin, 420px) !important;
  height: min(78vw, 78vmin, 420px) !important;
  min-width: 220px;
  min-height: 220px;
  max-width: 100%;
  border-radius: 50%;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 0;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.action-buttons button {
  border: 1px solid var(--line);
  background: #f5f8fa;
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-weight: 600;
}

.action-buttons button:active {
  transform: scale(0.98);
}

.log {
  background: #102a43;
  color: #f8fafc;
  border-radius: 10px;
  padding: 1rem;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.85rem;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 1rem;
}

.hidden {
  display: none !important;
}

.compact-desktop .full-only {
  display: none !important;
}

.compact-desktop .compact-only {
  display: block;
}

.compact-desktop .card {
  padding: 1rem;
}

.compact-desktop .textarea-targets,
.compact-desktop .action-buttons,
.compact-desktop .mobile-actions {
  margin-top: 0.5rem;
}

.compact-desktop textarea {
  min-height: 140px;
}

.compact-mobile .full-only {
  display: none !important;
}

.compact-mobile .card {
  padding: 1rem;
}

.compact-mobile .mobile-actions {
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.compact-mobile .mobile-install-row {
  margin-top: 0.4rem;
}

.compact-mobile .mobile-offline-notice {
  margin-top: 0.45rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.82rem;
}

.compact-mobile .pwa-install-button {
  width: auto;
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
}

.compact-mobile .circle-button {
  width: min(68vw, 38dvh, 260px) !important;
  height: min(68vw, 38dvh, 260px) !important;
  min-width: 160px;
  min-height: 160px;
}

body.compact-mobile {
  min-height: 100dvh;
  padding:
    max(0.5rem, env(safe-area-inset-top))
    max(0.5rem, env(safe-area-inset-right))
    max(0.5rem, env(safe-area-inset-bottom))
    max(0.5rem, env(safe-area-inset-left));
}

.compact-only {
  display: none;
}

section {
  margin-top: 1.25rem;
}

small {
  color: var(--muted);
  line-height: 1.45;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(16, 42, 67, 0.10);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.desktop-tools {
  margin-top: 0.85rem;
}

.engine-row label {
  min-width: 62px;
  margin: 0;
}

.debug-toggle {
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0;
  text-transform: none;
}

.circle-button {
  position: relative;
  border: 10px solid #e7f3f3;
  outline: 1px solid #cfe2e3;
  font-size: 3rem;
}

.circle-button::after {
  content: 'Maintenir pour dicter';
  position: absolute;
  bottom: 20%;
  left: 50%;
  width: max-content;
  max-width: 80%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.82;
}

.circle-button.recording::after {
  content: 'Relâcher pour envoyer';
}

#preview {
  min-height: 110px;
  background: #f7fafb;
}

#connect-block {
  grid-template-columns: 1fr;
}

.compact-desktop .app-header,
.compact-mobile .app-header {
  padding-bottom: 0.65rem;
}

.compact-desktop .brand-mark,
.compact-mobile .brand-mark {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  border-radius: 12px;
}

.compact-desktop .brand-mark img,
.compact-mobile .brand-mark img {
  width: 60px;
  height: 60px;
}

.compact-desktop textarea {
  min-height: 210px;
}

@media (max-width: 640px) {
  body {
    padding: 0.75rem;
    background: #edf3f6;
  }

  .card {
    padding: 1rem;
    border-radius: 16px;
  }

  .header-row {
    align-items: flex-start;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }

  .brand-mark img {
    width: 68px;
    height: 68px;
  }

  .toggle-switch > span:first-child {
    display: none;
  }

  .pair-block {
    grid-template-columns: 1fr;
  }

  .qr {
    grid-column: 1;
    grid-row: auto;
    justify-self: center;
  }

  .desktop-tools > #pip-toggle-btn {
    width: 100%;
  }

  .desktop-tabs {
    flex-basis: 100%;
  }

  .circle-button {
    min-width: 210px;
    min-height: 210px;
  }

  .dev-validation-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .dev-validation-actions {
    grid-column: 2;
  }
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  html,
  body {
    width: 100%;
    min-height: 100dvh;
  }

  body,
  body.compact-mobile {
    padding:
      env(safe-area-inset-top)
      env(safe-area-inset-right)
      env(safe-area-inset-bottom)
      env(safe-area-inset-left);
    background: var(--surface);
  }

  body > .card {
    width: 100%;
    max-width: none;
    min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

/* Dans le portail Laravel, la carte devient la surface centrale bord à bord. */
body.dragon-embedded,
body.dragon-embedded.compact-desktop,
body.dragon-embedded.compact-mobile {
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  background: var(--surface);
}

body.dragon-embedded > .card {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.secret-value-dialog {
  width: min(92vw, 480px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(16, 42, 67, 0.28);
}

.secret-value-dialog::backdrop {
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
}

.secret-value-form {
  display: grid;
  gap: 0.9rem;
  padding: 1.35rem;
}

.secret-value-form h2,
.secret-value-form p {
  margin: 0;
}

.secret-value-form input {
  width: 100%;
}

.secret-value-form small {
  color: var(--muted);
}

.secret-value-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.secret-manager {
  display: grid;
  gap: 1rem;
}

.secret-manager.hidden {
  display: none;
}

.secret-manager > h3 {
  margin: 0.25rem 0 -0.35rem;
  font-size: 0.95rem;
}

.secret-preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.secret-preset-list button {
  padding: 0.58rem 0.78rem;
  border-color: #b8d7df;
  background: #f3fafb;
}

.custom-secret-form {
  display: grid;
  gap: 0.45rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.custom-secret-form > div {
  display: flex;
  gap: 0.6rem;
}

.custom-secret-form input {
  flex: 1;
  min-width: 0;
}

.active-secret-list {
  display: grid;
  gap: 0.7rem;
}

.active-secret-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.active-secret-heading {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
}

.active-secret-heading code {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.76rem;
}

.active-secret-row > input {
  width: 100%;
  min-width: 0;
}

.active-secret-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.active-secret-actions button {
  padding: 0.52rem 0.68rem;
}

.active-secret-actions .danger {
  border-color: #fecaca;
  color: #991b1b;
  background: #fff7f7;
}

.secret-list-empty {
  margin: 0;
  padding: 0.9rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .active-secret-row {
    grid-template-columns: 1fr;
  }

  .custom-secret-form > div {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Application desktop : navigation latérale inspirée du portail Laravel. */
body.desktop-workspace {
  padding: 0;
  background: #eef2f5;
}

.card.desktop-app-shell,
.compact-desktop .card.desktop-app-shell,
body.dragon-embedded > .card.desktop-app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: #f8fafc;
  box-shadow: none;
  transition: grid-template-columns 0.2s ease;
}

.card.desktop-app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  padding: 1rem 0.8rem;
  overflow: hidden;
  border-right: 1px solid #d8e1e7;
  background: #f8fafc;
}

.app-sidebar .app-header {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0.2rem 0.2rem 1rem;
  border-bottom: 0;
}

.app-sidebar .brand-lockup {
  min-width: 0;
}

.app-sidebar .brand-mark {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border-radius: 11px;
}

.app-sidebar .brand-mark img {
  width: 58px;
  height: 58px;
}

.app-sidebar .brand-name {
  white-space: nowrap;
}

.app-sidebar .brand-lockup h1 {
  font-size: 1rem;
  white-space: nowrap;
}

.sidebar-collapse-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  margin-bottom: 0.85rem;
  padding: 0.48rem 0.6rem;
  border: 1px solid #d8e1e7;
  border-radius: 9px;
  color: #526575;
  background: #fff;
  box-shadow: none;
}

.sidebar-collapse-button > span:first-child {
  font-size: 1.3rem;
  line-height: 0.8;
}

.sidebar-collapse-label {
  font-size: 0.78rem;
}

.app-sidebar .desktop-tabs {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
}

.app-sidebar .desktop-tabs button {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 0.8rem;
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.72rem;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #526575;
  text-align: left;
  white-space: nowrap;
  background: transparent;
  box-shadow: none;
}

.app-sidebar .desktop-tabs button:hover {
  color: var(--ink);
  background: #eef3f5;
  box-shadow: none;
  transform: none;
}

.app-sidebar .desktop-tabs button.active {
  border-color: #cfe4e2;
  color: #0a6d63;
  background: #e7f5f2;
  box-shadow: inset 3px 0 0 var(--teal);
}

.sidebar-nav-icon {
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  color: currentColor;
  font-size: 1rem;
  font-weight: 800;
}

.sidebar-nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar-footer {
  display: grid;
  gap: 0.5rem;
  padding-top: 0.8rem;
  border-top: 1px solid #d8e1e7;
}

.app-sidebar-footer .pip-toggle {
  width: 100%;
  margin: 0;
  padding: 0.62rem;
  overflow: hidden;
  white-space: nowrap;
}

.app-sidebar-footer .toggle-switch {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0.4rem 0.25rem;
}

.sidebar-collapsed .app-sidebar {
  padding-inline: 0.65rem;
}

.sidebar-collapsed .app-sidebar .brand-lockup > div,
.sidebar-collapsed .sidebar-collapse-label,
.sidebar-collapsed .sidebar-nav-label {
  display: none;
}

.sidebar-collapsed .app-sidebar .app-header {
  justify-content: center;
}

.sidebar-collapsed .app-sidebar .desktop-tabs button {
  justify-content: center;
  padding-inline: 0.45rem;
}

.sidebar-collapsed .app-sidebar-footer .pip-toggle {
  height: 42px;
  padding: 0;
  font-size: 0;
}

.sidebar-collapsed .app-sidebar-footer .pip-toggle::before {
  content: '▣';
  font-size: 1rem;
}

.sidebar-collapsed .app-sidebar-footer .toggle-switch {
  justify-content: center;
  padding-inline: 0;
}

.sidebar-collapsed .app-sidebar-footer .toggle-switch > span:first-child {
  display: none;
}

.app-main {
  min-width: 0;
  min-height: 100dvh;
  padding: 0 1.5rem 2rem;
  overflow: hidden;
  background: #fff;
}

.app-main-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  margin: 0 -1.5rem;
  padding: 0.8rem 1.5rem;
  border-bottom: 1px solid #e2e8ec;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.app-view-title {
  display: grid;
  gap: 0.08rem;
}

.app-view-title span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-view-title strong {
  color: var(--ink);
  font-size: 1.15rem;
}

.app-main-topbar .status-pill {
  flex: 0 0 auto;
  margin: 0;
}

#desktop-tab-panels {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.app-main .desktop-tab-panel {
  min-height: calc(100dvh - 104px);
  margin: 0;
  padding: 1.5rem 0 0;
}

.app-main .dictation-view {
  display: grid;
  align-content: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 1rem;
}

.dictation-view > .app-subtitle,
.dictation-view > .action-buttons,
.dictation-view > .textarea-targets,
.dictation-view > .debug-toggle,
.dictation-view > .debug-panel,
.dictation-view > textarea,
.dictation-view > .notice,
.dictation-view > .mobile-actions,
.dictation-view > section.full-only {
  grid-column: 1 / -1;
}

.dictation-view > .app-subtitle {
  margin: 0 0 0.2rem;
}

.dictation-view > .textarea-targets {
  margin: 0.3rem 0 0;
}

.dictation-view > textarea {
  min-height: min(46dvh, 520px);
}

.dictation-view > .mobile-actions {
  margin-top: 0;
}

.desktop-workspace .dev-log-panel {
  display: block !important;
}

.desktop-workspace .dev-log-panel .log {
  max-height: 260px;
}

.app-main .pair-block,
.app-main .command-help,
.app-main .macro-manager,
.app-main .dev-validation,
.app-main .secret-manager,
.app-main .hid-panel {
  max-height: calc(100dvh - 104px);
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-main .pair-block {
  margin: 0;
  padding: 1.5rem 0 0;
}

.desktop-tools,
.desktop-tabs-close {
  display: none;
}

@media (max-width: 760px) {
  .card.desktop-app-shell,
  .compact-desktop .card.desktop-app-shell,
  body.dragon-embedded > .card.desktop-app-shell {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .app-sidebar {
    padding-inline: 0.55rem;
  }

  .app-sidebar .brand-lockup > div,
  .sidebar-collapse-label,
  .sidebar-nav-label {
    display: none;
  }

  .app-sidebar .app-header,
  .app-sidebar .desktop-tabs button {
    justify-content: center;
  }

  .sidebar-collapse-button {
    display: none;
  }

  .app-sidebar-footer .pip-toggle {
    padding-inline: 0.35rem;
    font-size: 0.7rem;
  }

  .app-main {
    padding-inline: 0.85rem;
  }

  .app-main-topbar {
    margin-inline: -0.85rem;
    padding-inline: 0.85rem;
  }

  .app-main .dictation-view {
    grid-template-columns: 1fr;
  }

  .dictation-view > .engine-row {
    grid-column: 1;
  }
}
