/* ==========================================================================
   STYLE.CSS - Dictionnaire & Créateur d'Accords de Guitare
   Thème Lutherie & Acoustique : tons ambrés, bois chaleureux, métal des frettes
   Zéro inline styles - Conformité stricte W3C & Accessibilité
   ========================================================================== */

:root {
	/* Palette de lutherie */
	--bg-app: #f6f4ee;
	--bg-surface: #ffffff;
	--bg-surface-elevated: #fefdfb;
	--bg-subtle: #eae5d9;
	--border-color: #dcd4c3;
	--border-focus: #b45309;

	--text-primary: #292524;
	--text-secondary: #57534e;
	--text-muted: #78716c;
	--text-on-accent: #ffffff;

	/* Accents lutherie */
	--accent-gold: #b45309;
	--accent-gold-hover: #92400e;
	--accent-amber: #d97706;
	--accent-mahogany: #7c2d12;
	--accent-danger: #b91c1c;
	--accent-danger-hover: #991b1b;
	--accent-success: #15803d;

	/* Badges & Diagramme */
	--badge-triade: #fef3c7;
	--badge-triade-text: #92400e;
	--badge-tetrade: #e0f2fe;
	--badge-tetrade-text: #0369a1;
	--badge-barre: #fce7f3;
	--badge-barre-text: #9d174d;

	--fret-color: #78716c;
	--nut-color: #44403c;
	--string-color: #292524;
	--dot-color: #1c1917;
	--dot-text-color: #ffffff;
	--marker-open-stroke: #1c1917;
	--marker-muted-color: #b91c1c;

	/* Rayons & Ombres */
	--radius-sm: 6px;
	--radius-md: 10px;
	--radius-lg: 14px;
	--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
	--shadow-md: 0 4px 10px -1px rgba(0, 0, 0, 0.08), 0 2px 5px -1px rgba(0, 0, 0, 0.05);
	--shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.14), 0 6px 12px -2px rgba(0, 0, 0, 0.08);

	--transition: 0.18s ease-in-out;
}

/* Réinitialisation de base */
*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html, body {
	height: 100%;
	min-height: 100dvh;
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	background-color: var(--bg-app);
	color: var(--text-primary);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

body.modal-open {
	overflow: hidden;
}

/* Utilitaires pour accessibilité */
.sr-only, .visually-hidden {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.hidden {
	display: none !important;
}

/* Conteneur principal */
.app-container {
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	max-width: 1480px;
	margin: 0 auto;
	padding: 1.25rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

/* ==========================================================================
   EN-TÊTE & BARRE D'OUTILS
   ========================================================================== */

.app-header {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	padding: 1.5rem;
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-sm);
	margin-bottom: 1.5rem;
}

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

.brand-group {
	display: flex;
	align-items: center;
	gap: 0.85rem;
}

.brand-icon {
	width: 46px;
	height: 46px;
	border-radius: var(--radius-md);
	background: var(--bg-subtle);
	color: var(--accent-gold);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.brand-logo-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.app-title {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--text-primary);
	letter-spacing: -0.02em;
}

.app-subtitle {
	font-size: 0.875rem;
	color: var(--text-muted);
}

.header-actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}

/* Barre de recherche & filtres */
.toolbar-section {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border-color);
}

.search-box {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
}

.search-icon {
	position: absolute;
	left: 0.85rem;
	color: var(--text-muted);
	pointer-events: none;
	display: flex;
}

.search-box input[type="search"] {
	width: 100%;
	padding: 0.65rem 7.5rem 0.65rem 2.5rem;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	background: var(--bg-surface);
	color: var(--text-primary);
	font-size: 0.95rem;
	transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box input[type="search"]:focus {
	outline: none;
	border-color: var(--border-focus);
	box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.15);
}

.chords-count-badge {
	position: absolute;
	right: 0.75rem;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--text-muted);
	background: var(--bg-subtle);
	padding: 0.25rem 0.65rem;
	border-radius: 999px;
}

/* Lignes de filtres Chips avec scroll horizontal fluide */
.filters-row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 2px;
}

.filters-row::-webkit-scrollbar {
	display: none;
}

.filters-label {
	font-size: 0.78rem;
	font-weight: 700;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	white-space: nowrap;
	flex-shrink: 0;
}

.chips-scroll {
	display: flex;
	gap: 0.35rem;
	flex-wrap: nowrap;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	flex-shrink: 0;
}

.chips-scroll::-webkit-scrollbar {
	display: none;
}

.chip-filter {
	appearance: none;
	border: 1px solid var(--border-color);
	background: var(--bg-surface);
	color: var(--text-secondary);
	font-size: 0.85rem;
	font-weight: 500;
	padding: 0.3rem 0.65rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all var(--transition);
	white-space: nowrap;
	flex-shrink: 0;
}
	transition: all var(--transition);
	white-space: nowrap;
}

.chip-filter:hover {
	background: var(--bg-subtle);
	color: var(--text-primary);
}

.chip-filter.active {
	background: var(--accent-gold);
	border-color: var(--accent-gold);
	color: var(--text-on-accent);
}

.chip-sub {
	font-size: 0.75rem;
	opacity: 0.8;
	margin-left: 2px;
}

/* ==========================================================================
   BOUTONS & INTERACTIONS
   ========================================================================== */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	font-size: 0.875rem;
	font-weight: 600;
	padding: 0.55rem 0.95rem;
	border-radius: var(--radius-md);
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none;
	transition: background-color var(--transition), border-color var(--transition), transform var(--transition);
}

.btn:active {
	transform: scale(0.98);
}

.btn-primary {
	background: var(--accent-gold);
	color: var(--text-on-accent);
	border-color: var(--accent-gold);
}

.btn-primary:hover {
	background: var(--accent-gold-hover);
	border-color: var(--accent-gold-hover);
}

.btn-secondary {
	background: var(--bg-subtle);
	color: var(--text-primary);
	border-color: var(--border-color);
}

.btn-secondary:hover {
	background: #ded7c7;
}

.btn-ghost {
	background: transparent;
	color: var(--text-secondary);
	border-color: transparent;
}

.btn-ghost:hover {
	background: var(--bg-subtle);
	color: var(--text-primary);
}

.btn-danger {
	background: var(--accent-danger);
	color: var(--text-on-accent);
	border-color: var(--accent-danger);
}

.btn-danger:hover {
	background: var(--accent-danger-hover);
}

.btn-sm {
	padding: 0.35rem 0.65rem;
	font-size: 0.8rem;
}

.btn-file-label {
	position: relative;
	cursor: pointer;
}

.btn-icon {
	background: transparent;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	color: var(--text-secondary);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.4rem;
	transition: all var(--transition);
}

.btn-icon:hover {
	background: var(--bg-subtle);
	color: var(--accent-gold);
	border-color: var(--accent-gold);
}

/* Bouton Burger & Menu Déroulant (Options Export / Import) */
.menu-dropdown-wrapper {
	position: relative;
	display: inline-flex;
}

.btn-burger {
	padding: 0.55rem;
	width: 40px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.menu-dropdown-panel {
	position: absolute;
	right: 0;
	top: calc(100% + 6px);
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	padding: 0.4rem;
	min-width: 250px;
	z-index: 600;
	display: flex;
	flex-direction: column;
	gap: 3px;
	animation: dropdownFadeIn 0.15s ease-out;
}

.menu-dropdown-panel[hidden] {
	display: none;
}

@keyframes dropdownFadeIn {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.menu-item-btn {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	width: 100%;
	padding: 0.6rem 0.85rem;
	border: none;
	background: transparent;
	color: var(--text-primary);
	font-size: 0.88rem;
	font-weight: 500;
	border-radius: var(--radius-sm);
	cursor: pointer;
	text-align: left;
	text-decoration: none;
	transition: background-color var(--transition), color var(--transition);
}

.menu-item-btn:hover {
	background: var(--bg-subtle);
	color: var(--accent-gold);
}

.menu-item-primary {
	color: var(--accent-gold);
	font-weight: 600;
}

.menu-item-primary:hover {
	background: var(--bg-subtle);
	color: var(--accent-gold-hover);
}

.menu-item-file {
	position: relative;
	cursor: pointer;
}

/* ==========================================================================
   GRILLE DES CARTES D'ACCORDS
   ========================================================================== */

.app-main {
	flex: 1;
}

.chords-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	gap: 1.25rem;
}

.grid-empty-state {
	grid-column: 1 / -1;
	text-align: center;
	padding: 3rem 1.5rem;
	background: var(--bg-surface);
	border: 1px dashed var(--border-color);
	border-radius: var(--radius-lg);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
	color: var(--text-muted);
}

/* Carte Accord Individuelle */
.chord-card {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 0.85rem 0.95rem;
	box-shadow: var(--shadow-sm);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	cursor: pointer;
	position: relative;
	transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.chord-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-md);
	border-color: var(--accent-gold);
}

.chord-card:focus-visible {
	outline: 2px solid var(--accent-gold);
	outline-offset: 2px;
}

/* Animation pulsation quand l'accord est joué */
.chord-card.pulse-playing {
	animation: cardPlayPulse 0.5s ease-out;
}

@keyframes cardPlayPulse {
	0% {
		border-color: var(--accent-gold);
		box-shadow: 0 0 0 4px rgba(180, 83, 9, 0.25);
	}
	100% {
		border-color: var(--border-color);
		box-shadow: var(--shadow-sm);
	}
}

.card-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 0.5rem;
}

.card-title-group {
	display: flex;
	flex-direction: column;
}

.chord-name-row {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.chord-alert-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #b91c1c;
	background-color: #fee2e2;
	border: 1px solid #fca5a5;
	border-radius: 4px;
	padding: 2px 4px;
	cursor: help;
	line-height: 1;
	transition: all var(--transition);
}

.chord-alert-badge:hover {
	background-color: #fecaca;
	border-color: #f87171;
	transform: scale(1.1);
}

.chord-alert-badge svg {
	display: block;
}

.chord-card.has-chord-warning {
	border-color: #f87171;
	background: #fffaf0;
}

.chord-name {
	font-size: 1.35rem;
	font-weight: 800;
	color: var(--text-primary);
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.chord-fr {
	font-size: 0.8rem;
	color: var(--text-muted);
	margin-top: 1px;
}

.card-badge {
	font-size: 0.72rem;
	font-weight: 600;
	padding: 0.2rem 0.5rem;
	border-radius: 999px;
	text-transform: capitalize;
}

.badge-barre {
	background: var(--badge-barre);
	color: var(--badge-barre-text);
}

.badge-open {
	background: var(--badge-triade);
	color: var(--badge-triade-text);
}

/* Diagramme SVG */
.card-diagram-wrapper {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 0.4rem 0;
}

.chord-diagram-svg {
	width: 100%;
	max-width: 140px;
	height: auto;
	aspect-ratio: 100 / 120;
	display: block;
}

/* Styles SVG */
.fret-nut {
	fill: var(--nut-color);
}

.fret-line {
	stroke: var(--fret-color);
	stroke-width: 1.2;
}

.string-line {
	stroke: var(--string-color);
}

.fret-number-text {
	font-size: 10px;
	font-weight: bold;
	fill: var(--text-muted);
	font-family: inherit;
}

.marker-muted {
	font-size: 10px;
	font-weight: bold;
	fill: var(--marker-muted-color);
	font-family: inherit;
}

.marker-open {
	fill: none;
	stroke: var(--marker-open-stroke);
	stroke-width: 1.4;
}

.fret-dot {
	fill: var(--dot-color);
}

.barre-pill {
	fill: var(--dot-color);
}

.finger-text {
	font-size: 7px;
	font-weight: bold;
	fill: var(--dot-text-color);
	font-family: inherit;
}

/* Notes théoriques réelles en bas de carte */
.card-notes-row {
	display: flex;
	gap: 0.25rem;
	flex-wrap: wrap;
	justify-content: center;
	margin: 0.4rem 0 0.6rem;
}

.note-pill {
	font-size: 0.72rem;
	font-weight: 600;
	background: var(--bg-subtle);
	color: var(--text-secondary);
	padding: 0.15rem 0.45rem;
	border-radius: var(--radius-sm);
}

/* Actions sous la carte */
.card-actions-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-top: 0.5rem;
	border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   MODALE D'ÉDITION & MANCHE INTERACTIF
   ========================================================================== */

.modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(20, 18, 16, 0.65);
	backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	padding: 1rem;
	overflow-y: auto;
}

.modal-backdrop[hidden] {
	display: none;
}

.modal-dialog {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg);
	width: 100%;
	max-width: 680px;
	display: flex;
	flex-direction: column;
	max-height: 90dvh;
	overflow: hidden;
}

.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid var(--border-color);
	background: var(--bg-surface-elevated);
}

.modal-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--text-primary);
}

.modal-close-icon {
	background: transparent;
	border: none;
	font-size: 1.25rem;
	line-height: 1;
	color: var(--text-muted);
	cursor: pointer;
	padding: 0.35rem;
	border-radius: var(--radius-sm);
	transition: color var(--transition);
}

.modal-close-icon:hover {
	color: var(--text-primary);
}

/* Onglets de mode dans la modale (Tablature vs Pro) */
.modal-mode-tabs {
	display: flex;
	background: var(--bg-subtle);
	border-bottom: 1px solid var(--border-color);
	padding: 0.35rem 1.5rem 0;
	gap: 0.5rem;
}

.mode-tab {
	background: transparent;
	border: none;
	border-bottom: 3px solid transparent;
	padding: 0.55rem 0.85rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text-secondary);
	cursor: pointer;
	border-radius: var(--radius-sm) var(--radius-sm) 0 0;
	transition: all var(--transition);
}

.mode-tab:hover {
	color: var(--text-primary);
	background: rgba(0, 0, 0, 0.03);
}

.mode-tab.active {
	color: var(--accent-gold);
	border-bottom-color: var(--accent-gold);
	background: var(--bg-surface);
}

.help-text {
	font-size: 0.75rem;
	color: var(--text-muted);
	margin-top: 0.15rem;
}

.auto-detected-card {
	transition: background-color var(--transition), border-color var(--transition);
}

.auto-detected-card.card-is-valid {
	background: #f0fdf4;
	border-color: #16a34a;
}

.auto-detected-card.card-is-valid .calculated-chord-name {
	color: #15803d;
}

.auto-detected-card.card-is-valid .detected-feedback-msg {
	color: #166534;
}

.auto-detected-card.card-is-warning {
	background: #fffbeb;
	border-color: #d97706;
}

.auto-detected-card.card-is-warning .calculated-chord-name {
	color: #b45309;
}

.auto-detected-card.card-is-warning .detected-feedback-msg {
	color: #b45309;
}

.detected-feedback-msg {
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.3;
	margin-top: 0.35rem;
	padding-top: 0.35rem;
	border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.chord-type-badge.badge-valid {
	background: #dcfce7;
	color: #166534;
	border: 1px solid #86efac;
}

.chord-type-badge.badge-warning {
	background: #fef3c7;
	color: #92400e;
	border: 1px solid #fcd34d;
}

.mode-section.hidden {
	display: none;
}

.modal-form {
	display: flex;
	flex-direction: column;
	overflow-y: auto;
}

.form-columns {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.5rem;
	padding: 1.5rem;
}

.form-fields {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.form-group {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.form-group label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
	padding: 0.55rem 0.75rem;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	font-size: 0.95rem;
	background: var(--bg-surface);
	color: var(--text-primary);
	transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus {
	outline: none;
	border-color: var(--border-focus);
	box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.15);
}

.form-check {
	flex-direction: row;
	align-items: center;
}

.checkbox-label {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.9rem;
	cursor: pointer;
}

/* Encart d'affichage de l'accord calculé */
.calculated-chord-card {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--accent-gold);
	border-radius: var(--radius-md);
	padding: 0.75rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.calculated-chord-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.calculated-chord-name {
	font-size: 1.4rem;
	font-weight: 800;
	color: var(--accent-gold);
	letter-spacing: -0.01em;
}

.calculated-chord-fr {
	font-size: 0.88rem;
	font-weight: 500;
	color: var(--text-secondary);
}

.preview-audio-group {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--border-color);
}

.preview-audio-label {
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--text-muted);
}

.btn-group {
	display: flex;
	gap: 0.5rem;
}

/* Manche Interactif dans la modale */
.form-visual-editor {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
}

.editor-section-title {
	display: flex;
	flex-direction: column;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--text-primary);
}

.help-text {
	font-size: 0.75rem;
	color: var(--text-muted);
	font-weight: normal;
}

.fretboard-editor-container {
	background: var(--bg-subtle);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 0.75rem;
	display: flex;
	justify-content: center;
}

.interactive-fretboard {
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 100%;
	max-width: 220px;
}

.fretboard-row {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 4px;
}

.row-nut-controls {
	margin-bottom: 4px;
	padding-bottom: 4px;
	border-bottom: 2px solid var(--nut-color);
}

.fretboard-start-badge {
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--primary-accent);
	text-align: center;
	padding: 0.35rem 0.6rem;
	background: rgba(37, 99, 235, 0.08);
	border: 1px solid rgba(37, 99, 235, 0.2);
	border-radius: var(--radius-sm);
	margin-bottom: 0.5rem;
	letter-spacing: 0.02em;
}

.fret-nut-btn {
	appearance: none;
	border: 1px solid var(--border-color);
	background: var(--bg-surface);
	color: var(--text-primary);
	border-radius: var(--radius-sm);
	height: 28px;
	font-size: 0.85rem;
	font-weight: bold;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all var(--transition);
}

.fret-nut-btn.muted {
	color: var(--accent-danger);
	background: #fee2e2;
	border-color: #fca5a5;
}

.fret-nut-btn.open {
	color: var(--accent-success);
	background: #dcfce7;
	border-color: #86efac;
}

.fret-nut-btn.fretted {
	color: var(--text-muted);
	background: var(--bg-surface);
}

.fret-nut-btn.fretted-barre {
	color: #16a34a;
	font-weight: 700;
	background: #f0fdf4;
	border-color: #86efac;
}

.fretboard-row.row-is-barre {
	background-color: rgba(22, 163, 74, 0.12);
	border: 1px dashed rgba(22, 163, 74, 0.45);
	border-radius: var(--radius-sm);
	padding: 2px;
	box-shadow: inset 0 0 6px rgba(22, 163, 74, 0.1);
}

.row-is-barre .fret-cell:not(.active) {
	background: #f0fdf4;
	border-color: rgba(22, 163, 74, 0.3);
}

.row-is-barre .fret-cell:not(.active):hover {
	background: #dcfce7;
	border-color: #16a34a;
}

.fret-cell {
	appearance: none;
	border: 1px solid var(--border-color);
	background: #fafaf9;
	color: var(--text-primary);
	height: 32px;
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-size: 0.85rem;
	font-weight: bold;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all var(--transition);
}

.fret-cell:hover {
	background: #e7e5e4;
	border-color: var(--accent-gold);
}

.fret-cell.active {
	background: var(--dot-color);
	color: var(--dot-text-color);
	border-color: var(--dot-color);
}

.fret-cell.active.is-barre {
	background-color: #16a34a;
	border-color: #15803d;
	color: #ffffff;
	font-weight: 800;
	box-shadow: 0 0 8px rgba(22, 163, 74, 0.45);
}

.fret-cell.active.is-barre:hover {
	background-color: #15803d;
	border-color: #166534;
}

/* Boîte d'aperçu */
.editor-preview-box {
	background: var(--bg-surface-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 0.75rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
}

.editor-preview-label {
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--text-muted);
	align-self: flex-start;
}

.diagram-preview {
	width: 100px;
}

.notes-preview-row {
	display: flex;
	gap: 0.35rem;
	flex-wrap: wrap;
	justify-content: center;
}

.modal-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1rem 1.5rem;
	border-top: 1px solid var(--border-color);
	background: var(--bg-surface-elevated);
}

.modal-actions-right {
	display: flex;
	gap: 0.5rem;
	margin-left: auto;
}

/* ==========================================================================
   TOAST DE NOTIFICATION
   ========================================================================== */

.toast-notice {
	position: fixed;
	bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
	left: 50%;
	transform: translateX(-50%) translateY(100px);
	background: #1c1917;
	color: #fafaf9;
	padding: 0.75rem 1.25rem;
	border-radius: 999px;
	box-shadow: var(--shadow-lg);
	font-size: 0.875rem;
	font-weight: 500;
	z-index: 2000;
	opacity: 0;
	pointer-events: none;
	transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease-out;
}

.toast-notice.visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.toast-notice.toast-error {
	background: #991b1b;
	color: #ffffff;
}

.toast-notice.toast-warning {
	background: #b45309;
	color: #ffffff;
}

.toast-notice.toast-success {
	background: #15803d;
	color: #ffffff;
}

/* ==========================================================================
   RESPONSIVE DESIGN (100dvh, 3 Colonnes Mobile & Safe Areas)
   ========================================================================== */

@media (max-width: 768px) {
	.app-container {
		padding: 0.5rem calc(0.5rem + env(safe-area-inset-right, 0px)) calc(1rem + env(safe-area-inset-bottom, 0px)) calc(0.5rem + env(safe-area-inset-left, 0px));
	}

	.app-header {
		padding: 0.75rem;
		gap: 0.65rem;
		margin-bottom: 0.75rem;
		border-radius: var(--radius-md);
	}

	.header-main-row {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		gap: 0.5rem;
		width: 100%;
	}

	.brand-group {
		gap: 0.5rem;
	}

	.brand-icon {
		width: 36px;
		height: 36px;
	}

	.brand-icon svg {
		width: 20px;
		height: 20px;
	}

	.app-title {
		font-size: 1.15rem;
		line-height: 1.2;
	}

	.app-subtitle {
		display: none; /* Gain de place vertical net sur mobile */
	}

	.btn-burger {
		width: 38px;
		height: 38px;
		padding: 0;
		flex-shrink: 0;
	}

	.toolbar-section {
		padding-top: 0.5rem;
		gap: 0.5rem;
	}

	.search-box input[type="search"] {
		padding: 0.5rem 5.5rem 0.5rem 2.2rem;
		font-size: 0.85rem;
	}

	.chords-count-badge {
		font-size: 0.72rem;
		padding: 0.15rem 0.45rem;
		right: 0.45rem;
	}

	.filters-row {
		gap: 0.45rem;
	}

	.filters-label {
		font-size: 0.72rem;
	}

	.chip-filter {
		font-size: 0.78rem;
		padding: 0.25rem 0.5rem;
	}

	/* GRILLE À 3 COLONNES SUR MOBILE */
	.chords-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 0.45rem;
	}

	/* CARTES COMPACTES SANS RÉDUIRE LE MOTIF DU MANCHE */
	.chord-card {
		padding: 0.45rem 0.35rem;
		border-radius: var(--radius-sm);
	}

	.card-header {
		margin-bottom: 0.25rem;
	}

	.chord-name {
		font-size: 1.05rem;
	}

	.chord-fr {
		font-size: 0.7rem;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		max-width: 65px;
	}

	.card-badge {
		font-size: 0.62rem;
		padding: 0.12rem 0.35rem;
	}

	.card-diagram-wrapper {
		padding: 0.15rem 0;
	}

	.chord-diagram-svg {
		max-width: 100%;
	}

	.card-notes-row {
		gap: 2px;
		margin: 0.25rem 0 0.35rem;
	}

	.note-pill {
		font-size: 0.65rem;
		padding: 1px 3px;
	}

	.card-actions-footer {
		padding-top: 0.35rem;
	}

	.btn-icon {
		padding: 0.25rem;
		border-radius: 4px;
	}

	.btn-icon svg {
		width: 13px;
		height: 13px;
	}

	/* Modale mobile */
	.form-columns {
		grid-template-columns: 1fr;
		gap: 1rem;
		padding: 1rem;
	}

	.modal-dialog {
		max-height: 94dvh;
	}
}