/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	--mustard:        #F5C842;
	--mustard-dark:   #E0B230;
	--mustard-light:  #FDF3C0;
	--blush:          #F5A7A7;
	--sage:           #A8D5B5;
	--sky:            #A7C7E7;
	--lavender:       #C3B1E1;
	--peach:          #FFCBA4;
	--soft-white:     #F5F5F0;
	--bg:             #FFFDF4;
	--surface:        #FFFFFF;
	--text-primary:   #2C2C2C;
	--text-secondary: #6B6B6B;
	--border:         #E8E0C8;
	--danger:         #E57373;
	--danger-dark:    #C62828;
	--success:        #81C784;
	--pro-gold:       #B8860B;
	--radius-sm:      6px;
	--radius-md:      12px;
	--radius-lg:      20px;
	--shadow-sm:      0 2px 8px rgba(0,0,0,0.08);
	--shadow-md:      0 4px 20px rgba(0,0,0,0.12);
	--transition:     all 0.2s ease;
	--sidebar-width:  280px;
	--nav-height:     56px;
	--font:           'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Night Mode Variables ──────────────────────────────────────────────────── */
body.night-mode {
	--bg:             #1A1A1A;
	--surface:        #242424;
	--text-primary:   #F0EAD6;
	--text-secondary: #A0998A;
	--border:         #3A3A3A;
	--mustard-light:  #3A3000;
}

html, body {
	height: 100%;
	font-family: var(--font);
	background: var(--bg);
	color: var(--text-primary);
	overflow: hidden;
	transition: background 0.3s ease, color 0.3s ease;
}

/* ── Accessibility: skip link ──────────────────────────────────────────────── */
.skip-link {
	position: absolute;
	top: -100%;
	left: 0;
	background: var(--mustard);
	color: var(--text-primary);
	padding: 10px 18px;
	font-weight: 700;
	font-size: 0.9rem;
	border-radius: 0 0 var(--radius-sm) 0;
	z-index: 9999;
	text-decoration: none;
	transition: top 0.15s ease;
}

.skip-link:focus {
	top: 0;
}

/* ── Accessibility: global focus indicator ─────────────────────────────────── */
*:focus-visible {
	outline: 2px solid var(--mustard-dark);
	outline-offset: 2px;
}

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden {
	display: none !important;
}

.error-msg {
	color: var(--danger-dark);
	font-size: 0.85rem;
	margin-top: 8px;
	padding: 8px 12px;
	background: #FDECEA;
	border-radius: var(--radius-sm);
}

.success-msg {
	color: #2E7D32;
	font-size: 0.85rem;
	margin-top: 8px;
	padding: 8px 12px;
	background: #E8F5E9;
	border-radius: var(--radius-sm);
}

.msg {
	font-size: 0.85rem;
	margin-top: 8px;
	padding: 8px 12px;
	border-radius: var(--radius-sm);
}

.msg.success {
	color: #2E7D32;
	background: #E8F5E9;
}

.msg.error {
	color: var(--danger-dark);
	background: #FDECEA;
}

/* ── Form Groups ───────────────────────────────────────────────────────────── */
.form-group {
	margin-bottom: 14px;
}

.form-group input {
	width: 100%;
	padding: 12px 14px;
	border: 2px solid var(--border);
	border-radius: var(--radius-sm);
	font-size: 0.95rem;
	font-family: var(--font);
	background: var(--bg);
	color: var(--text-primary);
	transition: var(--transition);
	outline: none;
}

.form-group input:focus {
	border-color: var(--mustard);
	background: var(--surface);
}

/* ── Screens ───────────────────────────────────────────────────────────────── */
.screen {
	display: none;
	width: 100%;
	height: 100%;
}

.screen.active {
	display: flex;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 11px 20px;
	border: none;
	border-radius: var(--radius-sm);
	font-size: 0.95rem;
	font-family: var(--font);
	font-weight: 600;
	cursor: pointer;
	transition: var(--transition);
	gap: 6px;
}

.btn-primary {
	background: var(--mustard);
	color: var(--text-primary);
	width: 100%;
	margin-top: 4px;
}

.btn-primary:hover {
	background: var(--mustard-dark);
}

.btn-secondary {
	background: var(--border);
	color: var(--text-primary);
}

.btn-secondary:hover {
	background: #d5cdb0;
}

.btn-danger {
	background: var(--danger);
	color: #fff;
}

.btn-danger:hover {
	background: var(--danger-dark);
}

.icon-btn {
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 6px;
	border-radius: var(--radius-sm);
	color: var(--text-secondary);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: var(--transition);
}

.icon-btn:hover {
	background: var(--mustard-light);
	color: var(--text-primary);
}

.icon-btn.danger:hover {
	background: #FDECEA;
	color: var(--danger-dark);
}

/* ── PRO badge ─────────────────────────────────────────────────────────────── */
.pro-badge {
	display: inline-block;
	background: var(--mustard);
	color: #2C2C2C;
	font-size: 0.65rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 2px 6px;
	border-radius: 4px;
	line-height: 1.4;
	vertical-align: middle;
	margin-left: 4px;
	flex-shrink: 0;
}

/* ── App Screen ────────────────────────────────────────────────────────────── */
#app-screen {
	flex-direction: column;
	height: 100vh;
	overflow: hidden;
}

/* ── Top Navigation ────────────────────────────────────────────────────────── */
.top-nav {
	height: var(--nav-height);
	background: var(--mustard);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 16px;
	box-shadow: var(--shadow-sm);
	z-index: 100;
	flex-shrink: 0;
}

body.night-mode .top-nav {
	background: #2A2200;
}

.nav-title {
	font-size: 1.3rem;
	font-weight: 800;
	color: var(--text-primary);
	letter-spacing: -0.5px;
}

body.night-mode .nav-title {
	color: var(--mustard);
}

.nav-actions {
	display: flex;
	align-items: center;
	gap: 4px;
}

.nav-btn {
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 8px;
	border-radius: var(--radius-sm);
	color: var(--text-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: var(--transition);
}

body.night-mode .nav-btn {
	color: var(--mustard);
}

.nav-btn:hover {
	background: var(--mustard-dark);
}

body.night-mode .nav-btn:hover {
	background: #3A3000;
}

/* ── App Body ──────────────────────────────────────────────────────────────── */
.app-body {
	display: flex;
	flex: 1;
	overflow: hidden;
	position: relative;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
	width: var(--sidebar-width);
	background: var(--surface);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	flex-shrink: 0;
	height: 100%;
	overflow: hidden;
	transition: transform 0.3s ease, width 0.3s ease;
	z-index: 90;
}

.sidebar.collapsed {
	width: 0;
	border-right: none;
}

.sidebar-header {
	padding: 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid var(--border);
	background: var(--mustard-light);
}

.user-info {
	display: flex;
	align-items: center;
	gap: 10px;
}

/* ── User avatar — tier badge ──────────────────────────────────────────────── */
/* The background and text colour are hardcoded to light values so they never
   inherit the night-mode text colour (#F0EAD6) which would be unreadable
   against the mustard or gold background. The JS in app.js swaps the
   background to --pro-gold and the letter to "P" for Pro users.            */
.user-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--mustard);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 1rem;
	/* Fixed dark text — must never inherit the night-mode near-white value */
	color: #2C2C2C;
	text-transform: uppercase;
	flex-shrink: 0;
	cursor: default;
	position: relative;
}

/* ── Tooltip for the tier badge ────────────────────────────────────────────── */
/* CSS-only tooltip using data-tooltip attribute. Works on both desktop hover
   and mobile tap-and-hold without any JavaScript involvement.               */
.user-avatar[data-tooltip]::after {
	content: attr(data-tooltip);
	position: absolute;
	top: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	background: #2C2C2C;
	color: #FFFFFF;
	font-size: 0.72rem;
	font-weight: 600;
	white-space: nowrap;
	padding: 4px 10px;
	border-radius: var(--radius-sm);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s ease;
	z-index: 200;
}

.user-avatar[data-tooltip]:hover::after,
.user-avatar[data-tooltip]:focus::after {
	opacity: 1;
}

.user-tagline {
	font-size: 0.82rem;
	color: var(--text-secondary);
	font-style: italic;
}

.sidebar-search {
	padding: 12px 16px;
	border-bottom: 1px solid var(--border);
}

.sidebar-search input {
	width: 100%;
	padding: 8px 12px;
	border: 1.5px solid var(--border);
	border-radius: var(--radius-sm);
	font-size: 0.88rem;
	font-family: var(--font);
	background: var(--bg);
	color: var(--text-primary);
	outline: none;
	transition: var(--transition);
}

.sidebar-search input:focus {
	border-color: var(--mustard);
}

.sidebar-notes {
	flex: 1;
	overflow-y: auto;
	padding: 8px;
	min-height: 0;
}

.sidebar-notes::-webkit-scrollbar {
	width: 4px;
}

.sidebar-notes::-webkit-scrollbar-thumb {
	background: var(--border);
	border-radius: 4px;
}

/* ── Sidebar empty state message ───────────────────────────────────────────── */
.sidebar-empty-msg {
	text-align: center;
	color: var(--text-secondary);
	font-size: 0.85rem;
	padding: 24px 16px;
}

/* ── Note Item in Sidebar ──────────────────────────────────────────────────── */
/* Note items always have a light background colour (the note's chosen colour).
   Their text colours are hardcoded to dark values so they remain readable
   regardless of whether the app is in light or night mode.                  */
.note-item {
	padding: 12px 14px;
	border-radius: var(--radius-md);
	cursor: pointer;
	margin-bottom: 6px;
	transition: var(--transition);
	border: 2px solid transparent;
	position: relative;
}

.note-item:hover {
	filter: brightness(0.95);
}

.note-item.active {
	border-color: var(--mustard-dark);
	box-shadow: var(--shadow-sm);
}

.note-item:focus-visible {
	outline: 2px solid var(--mustard-dark);
	outline-offset: 2px;
}

.note-item-title {
	font-weight: 600;
	font-size: 0.9rem;
	/* Hardcoded dark colour — note background is always light */
	color: #2C2C2C;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin-bottom: 4px;
}

.note-item-preview {
	font-size: 0.78rem;
	/* Hardcoded dark colour — note background is always light */
	color: #555555;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	white-space: pre-wrap;
	word-break: break-word;
	line-height: 1.5;
	max-height: 3.6em;
}

.note-item-date {
	font-size: 0.72rem;
	/* Hardcoded dark colour — note background is always light */
	color: #777777;
	margin-top: 6px;
}

/* ── Sidebar Footer ────────────────────────────────────────────────────────── */
.sidebar-footer {
	padding: 12px 16px;
	border-top: 1px solid var(--border);
	flex-shrink: 0;
	background: var(--surface);
}

.sidebar-footer-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.sidebar-app-footer {
	margin-top: 12px;
	padding-top: 10px;
	border-top: 1px solid var(--border);
	text-align: center;
}

.footer-copy {
	font-size: 0.72rem;
	color: var(--text-secondary);
	line-height: 1.5;
}

.footer-version {
	font-size: 0.68rem;
	color: var(--text-secondary);
	margin-top: 3px;
	line-height: 1.5;
	opacity: 0.8;
}

/* ── Sidebar dropdown groups ───────────────────────────────────────────────── */
.sidebar-dropdown-group {
	position: relative;
	flex: 1;
}

.btn-sidebar-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	padding: 9px 12px;
	border: 2px solid var(--border);
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--text-secondary);
	font-size: 0.88rem;
	font-family: var(--font);
	font-weight: 600;
	cursor: pointer;
	transition: var(--transition);
	white-space: nowrap;
}

.btn-sidebar-action:hover {
	border-color: var(--mustard-dark);
	color: var(--mustard-dark);
	background: var(--mustard-light);
}

body.night-mode .btn-sidebar-action:hover {
	background: #3A3000;
}

.sidebar-dropdown {
	position: absolute;
	bottom: calc(100% + 6px);
	left: 0;
	min-width: 200px;
	width: max-content;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
	z-index: 160;
	overflow: hidden;
}

#receive-dropdown-group .sidebar-dropdown {
	left: auto;
	right: 0;
}

/* ── Sidebar Overlay (mobile) ──────────────────────────────────────────────── */
.sidebar-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.35);
	z-index: 80;
}

/* ── Main Content ──────────────────────────────────────────────────────────── */
.main-content {
	flex: 1;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	height: 100%;
}

/* ── Empty State ───────────────────────────────────────────────────────────── */
.empty-state {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 40px;
	text-align: center;
}

.empty-icon {
	font-size: 3.5rem;
}

.empty-state h2 {
	font-size: 1.3rem;
	color: var(--text-primary);
}

.empty-state p {
	color: var(--text-secondary);
	font-size: 0.9rem;
	max-width: 280px;
}

.empty-state .btn-primary {
	width: auto;
	margin-top: 8px;
	padding: 11px 24px;
}

/* ── Note Editor ───────────────────────────────────────────────────────────── */
.note-editor {
	flex: 1;
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
}

/* ── Editor Toolbar ────────────────────────────────────────────────────────── */
.editor-toolbar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
	padding: 8px 12px;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
}

.toolbar-group {
	display: flex;
	align-items: center;
	gap: 2px;
	position: relative;
}

.toolbar-divider {
	width: 1px;
	height: 22px;
	background: var(--border);
	margin: 0 4px;
}

.tool-btn {
	background: transparent;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	padding: 5px 8px;
	cursor: pointer;
	font-size: 0.88rem;
	font-family: var(--font);
	color: var(--text-primary);
	transition: var(--transition);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 28px;
	height: 28px;
}

.tool-btn:hover {
	background: var(--mustard-light);
	border-color: var(--mustard);
}

.tool-btn.active {
	background: var(--mustard);
	border-color: var(--mustard-dark);
}

#font-size-select {
	padding: 4px 8px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	font-size: 0.85rem;
	font-family: var(--font);
	background: var(--bg);
	color: var(--text-primary);
	cursor: pointer;
	outline: none;
	height: 28px;
}

#font-size-select:focus {
	border-color: var(--mustard);
}

#font-size-select:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.tool-label {
	font-size: 0.8rem;
	color: var(--text-secondary);
	margin-right: 4px;
}

.color-options {
	display: flex;
	gap: 6px;
	align-items: center;
}

/* ── Color dots ────────────────────────────────────────────────────────────── */
.color-dot {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	cursor: pointer;
	border: 2px solid transparent;
	transition: var(--transition);
	flex-shrink: 0;
	padding: 0;
	appearance: none;
	-webkit-appearance: none;
}

.color-dot:hover {
	transform: scale(1.2);
	border-color: var(--text-secondary);
}

.color-dot.active,
.color-dot[aria-pressed="true"] {
	border-color: var(--text-primary);
	transform: scale(1.2);
}

/* ── Table Picker ──────────────────────────────────────────────────────────── */
.table-picker {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 10px;
	box-shadow: var(--shadow-md);
	z-index: 150;
	min-width: 160px;
}

.table-picker-grid {
	display: grid;
	grid-template-columns: repeat(8, 18px);
	grid-template-rows: repeat(8, 18px);
	gap: 3px;
}

.table-cell-selector {
	width: 18px;
	height: 18px;
	border: 1px solid var(--border);
	border-radius: 2px;
	cursor: pointer;
	background: var(--bg);
	transition: var(--transition);
}

.table-cell-selector.highlighted {
	background: var(--mustard);
	border-color: var(--mustard-dark);
}

.table-picker-label {
	text-align: center;
	font-size: 0.78rem;
	color: var(--text-secondary);
	margin-top: 8px;
	font-weight: 600;
}

/* ── Note Title Bar ────────────────────────────────────────────────────────── */
.note-title-bar {
	display: flex;
	align-items: center;
	padding: 10px 16px;
	border-bottom: 1px solid var(--border);
	background: var(--surface);
	gap: 10px;
	flex-shrink: 0;
}

#note-title-input {
	flex: 1;
	border: none;
	outline: none;
	font-size: 1.2rem;
	font-weight: 700;
	font-family: var(--font);
	background: transparent;
	color: var(--text-primary);
}

#note-title-input::placeholder {
	color: var(--text-secondary);
	font-weight: 400;
}

.note-actions {
	display: flex;
	align-items: center;
	gap: 4px;
}

/* ── Note title bar export dropdown ───────────────────────────────────────── */
.export-dropdown-group {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.export-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
	z-index: 160;
	min-width: 180px;
	overflow: hidden;
}

/* ── Shared dropdown item style ────────────────────────────────────────────── */
.dropdown-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 11px 16px;
	border: none;
	background: transparent;
	color: var(--text-primary);
	font-size: 0.88rem;
	font-family: var(--font);
	font-weight: 500;
	cursor: pointer;
	text-align: left;
	transition: var(--transition);
	white-space: nowrap;
}

.dropdown-item:hover {
	background: var(--mustard-light);
	color: var(--text-primary);
}

.dropdown-item + .dropdown-item {
	border-top: 1px solid var(--border);
}

body.night-mode .dropdown-item:hover {
	background: #3A3000;
}

/* ── Note Canvas ───────────────────────────────────────────────────────────── */
/* The canvas always has a light note colour as its background. Its text
   colour is therefore hardcoded to a dark value and must not adapt to
   night mode — the background never goes dark.                              */
.note-canvas {
	flex: 1;
	padding: 32px 36px;
	overflow-y: auto;
	outline: none;
	font-size: 0.97rem;
	line-height: 1.7;
	/* Hardcoded dark colour — canvas background is always a light note colour */
	color: #2C2C2C;
	word-break: break-word;
	transition: background 0.3s ease;
}

.note-canvas:empty::before {
	content: attr(data-placeholder);
	color: var(--text-secondary);
	pointer-events: none;
	font-style: italic;
}

.note-canvas::-webkit-scrollbar {
	width: 6px;
}

.note-canvas::-webkit-scrollbar-thumb {
	background: var(--border);
	border-radius: 6px;
}

/* ── Table Styles inside Canvas ────────────────────────────────────────────── */
.note-canvas table {
	border-collapse: collapse;
	width: 100%;
	margin: 12px 0;
	font-size: 0.95rem;
}

.note-canvas table td,
.note-canvas table th {
	border: 1px solid var(--border);
	/* Increased left padding gives list markers room to render inside the cell.
	   overflow is intentionally left as visible (the default) so long content
	   is never silently clipped.                                              */
	padding: 8px 12px 8px 28px;
	min-width: 80px;
	vertical-align: top;
}

.note-canvas table th {
	background: var(--mustard-light);
	font-weight: 600;
}

/* ── List items inside table cells ─────────────────────────────────────────── */
.note-canvas table td ul,
.note-canvas table td ol,
.note-canvas table th ul,
.note-canvas table th ol {
	padding-left: 20px;
	margin: 0;
}

body.night-mode .note-canvas table th {
	background: #3A3000;
}

.note-canvas table tr:nth-child(even) td {
	background: rgba(0,0,0,0.02);
}

body.night-mode .note-canvas table tr:nth-child(even) td {
	background: rgba(255,255,255,0.02);
}

/* ── Save Indicator ────────────────────────────────────────────────────────── */
.save-indicator {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 16px;
	background: var(--surface);
	border-top: 1px solid var(--border);
	flex-shrink: 0;
}

#save-status {
	font-size: 0.78rem;
	color: var(--text-secondary);
}

.note-counts {
	font-size: 0.75rem;
	color: var(--text-secondary);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
	opacity: 0.85;
}

/* ── Modals ────────────────────────────────────────────────────────────────── */
.modal {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.4);
}

.modal-box {
	position: relative;
	background: var(--surface);
	border-radius: var(--radius-lg);
	width: 100%;
	max-width: 460px;
	box-shadow: var(--shadow-md);
	z-index: 1;
	overflow: hidden;
}

.modal-box-sm {
	max-width: 340px;
}

.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px 16px;
	border-bottom: 1px solid var(--border);
}

.modal-header h2 {
	font-size: 1.15rem;
	font-weight: 700;
}

.modal-close {
	background: transparent;
	border: none;
	font-size: 1.5rem;
	cursor: pointer;
	color: var(--text-secondary);
	line-height: 1;
	padding: 2px 6px;
	border-radius: var(--radius-sm);
	transition: var(--transition);
}

.modal-close:hover {
	background: var(--border);
	color: var(--text-primary);
}

.modal-body {
	padding: 20px 24px;
}

.modal-footer {
	padding: 16px 24px;
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	border-top: 1px solid var(--border);
}

.settings-section h3 {
	font-size: 1rem;
	font-weight: 600;
	margin-bottom: 14px;
	color: var(--text-primary);
}

.settings-divider {
	height: 1px;
	background: var(--border);
	margin: 20px 0;
}

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	background: #2C2C2C;
	color: #fff;
	padding: 12px 24px;
	border-radius: var(--radius-md);
	font-size: 0.88rem;
	font-weight: 500;
	z-index: 300;
	box-shadow: var(--shadow-md);
	transition: opacity 0.3s ease;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 14px;
}

.toast.success {
	background: #2E7D32;
}

.toast.error {
	background: var(--danger-dark);
}

.toast.update {
	background: #2C2C2C;
}

.toast-action-btn {
	background: var(--mustard);
	color: var(--text-primary);
	border: none;
	border-radius: var(--radius-sm);
	padding: 5px 12px;
	font-size: 0.82rem;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	transition: var(--transition);
}

.toast-action-btn:hover {
	background: var(--mustard-dark);
}

/* ── QR Modal ──────────────────────────────────────────────────────────────── */
.qr-instructions {
	font-size: 0.88rem;
	color: var(--text-secondary);
	line-height: 1.6;
	margin-bottom: 18px;
}

.qr-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 24px 0;
	font-size: 0.9rem;
	color: var(--text-secondary);
}

.qr-spinner {
	width: 28px;
	height: 28px;
	border: 3px solid var(--border);
	border-top-color: var(--mustard-dark);
	border-radius: 50%;
	animation: qr-spin 0.8s linear infinite;
	flex-shrink: 0;
}

@keyframes qr-spin {
	to { transform: rotate(360deg); }
}

.qr-result {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding: 8px 0;
}

.qr-image {
	width: 250px;
	height: 250px;
	border-radius: var(--radius-md);
	border: 3px solid var(--border);
	display: block;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}

.qr-token-text {
	font-family: 'Courier New', Courier, monospace;
	font-size: 0.92rem;
	font-weight: 700;
	color: var(--text-primary);
	letter-spacing: 0.08em;
	background: var(--mustard-light);
	padding: 8px 16px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	word-break: break-all;
	text-align: center;
}

/* ── Triplet token display in QR send result ───────────────────────────────── */
.qr-triplet-text {
	font-family: 'Courier New', Courier, monospace;
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--text-primary);
	letter-spacing: 0.06em;
	background: var(--mustard-light);
	padding: 10px 18px;
	border-radius: var(--radius-sm);
	border: 2px solid var(--mustard-dark);
	word-break: break-all;
	text-align: center;
	margin-top: 4px;
}

.qr-triplet-label {
	font-size: 0.75rem;
	color: var(--text-secondary);
	text-align: center;
	margin-top: 2px;
}

.qr-expire-note {
	font-size: 0.78rem;
	color: var(--text-secondary);
	text-align: center;
}

/* ── Token input row — three word fields with hyphen separators ────────────── */
.token-input-row {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 14px;
}

.token-word-input {
	flex: 1;
	min-width: 0;
	padding: 11px 10px;
	border: 2px solid var(--border);
	border-radius: var(--radius-sm);
	font-size: 0.95rem;
	font-family: 'Courier New', Courier, monospace;
	background: var(--bg);
	color: var(--text-primary);
	text-align: center;
	text-transform: lowercase;
	transition: var(--transition);
	outline: none;
	letter-spacing: 0.04em;
}

.token-word-input:focus {
	border-color: var(--mustard);
	background: var(--surface);
}

.token-word-input::placeholder {
	color: var(--text-secondary);
	letter-spacing: normal;
}

.token-hyphen {
	font-size: 1.3rem;
	font-weight: 700;
	color: var(--text-secondary);
	flex-shrink: 0;
	line-height: 1;
	user-select: none;
}

#qr-token-input {
	width: 100%;
	padding: 12px 14px;
	border: 2px solid var(--border);
	border-radius: var(--radius-sm);
	font-size: 0.95rem;
	font-family: 'Courier New', Courier, monospace;
	background: var(--bg);
	color: var(--text-primary);
	transition: var(--transition);
	outline: none;
	letter-spacing: 0.05em;
}

#qr-token-input:focus {
	border-color: var(--mustard);
	background: var(--surface);
}

#qr-modal .modal-body {
	max-height: 75vh;
	overflow-y: auto;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
	.sidebar {
		position: fixed;
		top: var(--nav-height);
		left: 0;
		bottom: 0;
		transform: translateX(-100%);
		width: 85%;
		max-width: 300px;
		transition: transform 0.3s ease;
	}

	.sidebar.open {
		transform: translateX(0);
		width: 85%;
	}

	.sidebar.collapsed {
		width: 85%;
		border-right: 1px solid var(--border);
	}

	.sidebar-overlay.active {
		display: block;
	}

	.editor-toolbar {
		padding: 6px 8px;
		gap: 2px;
	}

	.toolbar-divider {
		display: none;
	}

	.note-canvas {
		padding: 20px 18px;
	}

	.modal-box {
		max-width: 100%;
	}

	.color-picker-group {
		margin-top: 4px;
	}

	.table-picker {
		left: auto;
		right: 0;
	}

	.export-dropdown {
		right: 0;
		left: auto;
	}

	.toast {
		white-space: normal;
		max-width: calc(100vw - 32px);
		text-align: left;
	}

	/* Stack token fields vertically on very narrow screens */
	.token-input-row {
		flex-wrap: nowrap;
	}

	.token-word-input {
		padding: 10px 6px;
		font-size: 0.88rem;
	}
}