/* modern design system & styles for canvas note app */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg-dark: #0f1117;
  --bg-canvas: #161822;
  --bg-sidebar: #1e202e;
  --bg-card: #252838;
  --bg-card-hover: #2d3145;
  --bg-floating: rgba(30, 32, 46, 0.85);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.5);
  
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #ec4899;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  --grid-dot-color: rgba(255, 255, 255, 0.12);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --sidebar-width: 72px;
  --topbar-height: 56px;
}

/* Light Theme Overrides */
[data-theme="light"] {
  color-scheme: light;
  --bg-dark: #f8fafc;
  --bg-canvas: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-floating: rgba(255, 255, 255, 0.9);
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.6);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  
  --grid-dot-color: rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
}

/* APP LAYOUT */
#app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* TOP NAVBAR */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* SEARCH BAR */
.search-container {
  position: relative;
  width: 260px;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 6px 32px 6px 14px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
  width: 320px;
}

.search-clear-btn {
  position: absolute;
  right: 4px;
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.search-results-dropdown {
  display: none;
  position: absolute;
  top: 42px;
  left: 0;
  width: 360px;
  max-height: 380px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  z-index: 500;
}

.search-results-dropdown.active {
  display: block;
}

.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.15s ease;
}

.search-result-item:hover {
  background: var(--bg-card-hover);
}

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

.search-result-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
}

.search-result-board {
  font-size: 10px;
  background: var(--accent-primary);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}

.search-result-snippet {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-board-actions {
  display: none;
}

/* Color Scheme & Dropdown Contrast Fix */
select, .board-select-btn {
  color-scheme: dark;
}

[data-theme="light"] select, [data-theme="light"] .board-select-btn {
  color-scheme: light;
}

select option,
.board-select-btn option {
  background-color: var(--bg-card);
  color: var(--text-main);
  padding: 8px 12px;
}

.board-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.board-selector:hover {
  border-color: var(--border-highlight);
}

.board-select-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  max-width: 240px;
  min-width: 90px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-select-btn:hover {
  color: var(--accent-cyan);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
}

.btn-logout {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid var(--accent-rose);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-logout:hover {
  background: var(--accent-rose);
  color: #fff;
}

.mobile-menu-toggle {
  display: none;
  font-size: 20px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow);
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 10px;
  font-size: 14px;
}

/* MAIN VIEW: SIDEBAR + CANVAS */
.main-view {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* SIDEBAR TOOLBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 8px 0;
  gap: 8px;
  z-index: 90;
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
}

.sidebar-version-info {
  margin-top: auto;
  padding: 8px 2px 2px 2px;
  text-align: center;
  font-size: 9px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  user-select: none;
}

.sidebar-version-info .version-tag {
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 10px;
}

.sidebar-version-info .date-tag {
  font-size: 8px;
  color: var(--text-dim);
}

.tool-item {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  cursor: grab;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.tool-item:hover {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  color: var(--accent-primary);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-md);
}

.tool-item svg {
  width: 18px;
  height: 18px;
}

.tool-item span {
  font-size: 9px;
  font-weight: 500;
}

/* CANVAS CONTAINER */
.canvas-viewport {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-canvas);
  cursor: default;
}

.canvas-viewport.panning {
  cursor: grabbing !important;
}

/* BACKGROUND IMAGE LAYER */
.bg-image-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.15s ease;
}

.canvas-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  will-change: transform;
  z-index: 10;
}

/* GRID BACKGROUND */
.grid-bg {
  position: absolute;
  top: -10000px;
  left: -10000px;
  width: 20000px;
  height: 20000px;
  background-image: radial-gradient(var(--grid-dot-color) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 2;
}

/* SVG CONNECTOR OVERLAY */
.connections-svg {
  position: absolute;
  top: -10000px;
  left: -10000px;
  width: 20000px;
  height: 20000px;
  pointer-events: none;
  z-index: 5;
}

.connection-path {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  pointer-events: stroke;
  cursor: pointer;
  transition: stroke 0.2s ease;
}

.connection-path:hover {
  stroke: var(--accent-secondary);
  stroke-width: 4;
}

/* CARDS / CANVAS OBJECTS */
.canvas-card {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  user-select: text;
  -webkit-user-select: text;
}

.canvas-card.selected:not(.card-column) {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary), var(--shadow-lg);
  z-index: 500 !important;
}

.card-column {
  z-index: 1 !important;
}

.card-column.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary), var(--shadow-lg);
  z-index: 1 !important;
}

/* NOTE RICH TEXT FORMATTING TOOLBAR - VISIBLE ONLY ON ACTIVE/SELECTED CARD */
.note-formatting-toolbar {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid var(--border-color);
  border-radius: 6px 6px 0 0;
  flex-wrap: wrap;
}

.canvas-card.selected .note-formatting-toolbar,
.canvas-card:focus-within .note-formatting-toolbar {
  display: flex;
}

.note-fmt-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.note-fmt-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color);
}

.note-fmt-select {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 4px;
  outline: none;
  cursor: pointer;
}

.note-fmt-color {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
}

/* LINK & BUTTON POPOVER TOOLTIP IN NOTE */
.link-popover {
  position: absolute;
  background: var(--bg-sidebar);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  font-size: 12px;
}

.link-popover a {
  color: var(--accent-cyan);
  text-decoration: underline;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-text {
  cursor: pointer;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  transition: all 0.15s ease;
  user-select: all;
  display: inline-block;
  margin: 0 1px;
}

.copy-text:hover {
  outline: 1px solid var(--accent-cyan);
  box-shadow: 0 0 6px rgba(6, 182, 212, 0.4);
}

.card-note-bg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  border-radius: var(--radius-md);
  z-index: 0;
}

.card-header,
.card-content {
  position: relative;
  z-index: 1;
}

.card-header {
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.card-title-input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 13px;
  width: 100%;
  outline: none;
}

.card-content {
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
}

/* FLOATING CONTEXT TOOLBAR */
.context-toolbar {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translate(-50%, -100%);
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  white-space: nowrap;
}

.context-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.image-drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.image-drop-zone:hover,
.image-drop-zone.drag-over {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.15);
}

/* BREADCRUMBS BAR FOR SUB-BOARDS */
.breadcrumbs-bar {
  position: absolute;
  top: 12px;
  left: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
}

.breadcrumb-item {
  color: var(--accent-cyan);
  cursor: pointer;
}

.breadcrumb-item:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--text-muted);
}

/* TEMPLATE GRID MODAL */
.template-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.template-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  background: rgba(99, 102, 241, 0.1);
}

.template-icon {
  font-size: 24px;
}

.template-title {
  font-weight: 600;
  font-size: 14px;
}

.template-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* CARD TYPE SUBBOARD & STICKY */
.card-subboard {
  border: 2px dashed var(--accent-primary) !important;
  background: rgba(99, 102, 241, 0.12) !important;
  cursor: pointer;
}

.card-sticky {
  background: #fef08a;
  color: #1e293b;
  border-radius: 2px;
  box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.3);
}

.card-sticky .card-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-sticky .card-title-input {
  color: #0f172a;
}

.card-sticky .editable-text {
  color: #1e293b;
}

/* CANVAS DRAG OVER HIGHLIGHT */
.canvas-viewport.drag-over-canvas {
  outline: 3px dashed var(--accent-cyan);
  outline-offset: -8px;
  background-color: rgba(6, 182, 212, 0.05);
}

.context-toolbar-select {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
  outline: none;
}

.context-toolbar-color {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
}

.context-toolbar-date {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  user-select: none;
}

.opacity-btn {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
}

.opacity-btn:hover, .opacity-btn.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.color-picker-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease;
}

.color-picker-dot:hover {
  transform: scale(1.2);
  border-color: #fff;
}

/* MICROSOFT WORD STYLE COLOR PALETTE PICKER */
.ms-palette-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ms-palette-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.ms-theme-top-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.ms-theme-matrix {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin-top: 2px;
}

.ms-standard-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin-top: 4px;
}

.ms-color-square {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.ms-color-square:hover {
  transform: scale(1.15);
  border-color: #ffffff !important;
  z-index: 10;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

.ms-color-square.active {
  outline: 2px solid var(--accent-rose);
  outline-offset: 1px;
  border-color: #ffffff !important;
}

/* COMPACT CODE / SNIPPET COPY CARD STYLES */
.card-code {
  min-width: 140px;
  min-height: 48px;
  background: #090a0f !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.card-code .card-header {
  padding: 3px 6px;
  background: #11131f;
}

.card-code .card-title-input {
  color: #ffffff !important;
  font-size: 12px;
  font-weight: 600;
}

.card-code .card-content {
  padding: 4px;
}

.code-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 6px;
  background: #000000;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
}

.code-input-area {
  width: 100%;
  height: 26px;
  min-height: 22px;
  background: transparent;
  border: none;
  color: #38bdf8;
  font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.4;
  outline: none;
  resize: vertical;
}

.code-copy-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 3px;
  margin-top: 2px;
}

.code-copy-btn {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s ease;
}

.code-copy-btn:hover {
  background: #38bdf8;
  color: #000;
}

/* HTML / CREDENTIALS CARD STYLES */
.card-html {
  min-width: 260px;
  min-height: 120px;
}

.html-render-area {
  width: 100%;
  height: 100%;
  font-size: 13px;
  color: var(--text-main);
  word-break: break-word;
  outline: none;
  min-height: 60px;
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text;
}

.html-render-area * {
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text;
}

.html-render-area table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.html-render-area td, .html-render-area th {
  padding: 6px 8px;
  border: 1px solid var(--border-color);
}

.html-edit-toggle {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.copy-text {
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 6px;
  transition: all 0.15s ease;
  display: inline-block;
  user-select: text !important;
}

.copy-text:hover {
  outline: 1px dashed var(--accent-cyan);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
  background: rgba(6, 182, 212, 0.15) !important;
}

/* STYLES FOR CUSTOM BUTTONS IN HTML CARDS (e.g. .se-custom-btn) */
.se-custom-btn, .html-render-area a.se-custom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  margin: 4px 4px 4px 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
  cursor: pointer;
}

.se-custom-btn:hover, .html-render-area a.se-custom-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
  background: linear-gradient(135deg, #4f46e5, var(--accent-primary));
}

/* RESIZE HANDLE FOR CARDS */
.card-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 25;
  border-bottom-right-radius: var(--radius-md);
}

.card-resize-handle::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
}

.canvas-card.selected .card-resize-handle::after {
  border-color: var(--accent-primary);
}

/* MULTI-LINK CARD STYLES */
.card-link { min-width: 260px; }
.multi-link-list { display: flex; flex-direction: column; gap: 8px; }
.multi-link-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  padding: 8px;
  border-radius: var(--radius-sm);
}

.multi-link-inputs { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.multi-link-inputs input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

.multi-link-inputs input.link-url-input {
  font-size: 11px;
  color: var(--accent-cyan);
}

.multi-link-actions { display: flex; align-items: center; gap: 4px; }

/* INTERACTIVE TABLE CARD STYLES */
.card-table { min-width: 320px; min-height: 200px; }
.note-table-container { width: 100%; overflow-x: auto; }
.note-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.note-table th, .note-table td {
  border: 1px solid var(--border-color);
  padding: 6px 8px;
  text-align: left;
}

.note-table th {
  background: rgba(99, 102, 241, 0.15);
  font-weight: 600;
  color: var(--text-main);
}

.table-cell-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

.table-action-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.table-action-btn {
  flex: 1;
  background: var(--bg-sidebar);
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 4px;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
}

.table-action-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* FREEHAND DRAW / SKETCH CARD */
.card-draw {
  background: transparent !important;
  border: 1px dashed transparent !important;
  box-shadow: none !important;
  pointer-events: auto !important;
  z-index: 600 !important;
}

.card-draw.selected {
  border: 2px dashed var(--accent-pink, #ec4899) !important;
  background: rgba(236, 72, 153, 0.08) !important;
  box-shadow: 0 0 15px rgba(236, 72, 153, 0.3) !important;
}

.sketch-svg-container {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* CARD SPECIFIC STYLES */
.card-note { min-width: 180px; min-height: 120px; }
.editable-text {
  min-height: 60px;
  outline: none;
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text;
}
.editable-text:empty:before { content: attr(placeholder); color: var(--text-dim); }

.card-column {
  min-width: 280px;
  min-height: 320px;
  background: rgba(30, 32, 46, 0.4);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  z-index: 1 !important;
}
.column-drop-zone { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 8px; min-height: 200px; }

.card-todo { min-width: 200px; }
.todo-progress { height: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
.todo-progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent-primary), var(--accent-emerald)); width: 0%; transition: width 0.3s ease; }
.todo-list { display: flex; flex-direction: column; gap: 6px; }
.todo-item { display: flex; align-items: center; gap: 8px; }
.todo-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent-primary); cursor: pointer; }
.todo-item input[type="text"] { background: transparent; border: none; color: var(--text-main); font-size: 13px; flex: 1; outline: none; }
.todo-item.completed input[type="text"] { text-decoration: line-through; color: var(--text-dim); }
.add-todo-btn { background: transparent; border: 1px dashed var(--border-color); color: var(--text-muted); border-radius: var(--radius-sm); padding: 6px; font-size: 12px; cursor: pointer; text-align: center; margin-top: 4px; }
.add-todo-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

.card-image { min-width: 200px; min-height: 160px; }
.image-preview-container { position: relative; width: 100%; height: 100%; border-radius: var(--radius-sm); overflow: hidden; background: #000; display: flex; align-items: center; justify-content: center; flex: 1; }
.image-preview-container img { width: 100%; height: 100%; display: block; object-fit: contain; }
.image-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-dim); padding: 16px; cursor: pointer; text-align: center; font-size: 12px; }

.card-header-title { background: transparent; border: none; box-shadow: none; min-width: 180px; padding: 4px; }
.header-text-input { font-family: 'Outfit', sans-serif; font-size: 26px; font-weight: 700; color: var(--text-main); background: transparent; border: none; outline: none; width: 100%; height: 100%; text-align: center; line-height: 1.3; padding: 4px 8px; box-sizing: border-box; }

.card-color { min-width: 140px; padding: 8px; }
.color-swatch-box { height: 80px; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); display: flex; align-items: flex-end; padding: 8px; cursor: pointer; }
.color-hex-code { font-family: monospace; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }

/* ZOOM & CANVAS CONTROLS */
.canvas-controls {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 80;
}

.zoom-indicator {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  width: 48px;
  text-align: center;
}

/* MODAL STYLES */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* BACKGROUND CUSTOMIZER SPECIFIC OVERLAY - NO BLUR SO USER SEES LIVE CANVAS BG CHANGES! */
#bgModalOverlay {
  background: rgba(0, 0, 0, 0.15) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#bgModalOverlay .modal-card {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  border-color: var(--accent-primary);
}

.modal-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 440px;
  max-width: 90vw;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.auth-tab-btn.active {
  background: var(--accent-primary);
  color: #fff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-main);
  outline: none;
  font-size: 14px;
}

.form-group input:focus {
  border-color: var(--accent-primary);
}

.auth-error-msg {
  color: var(--accent-rose);
  font-size: 12px;
  margin-top: 8px;
  text-align: center;
}

/* TOAST NOTIFICATION */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-sidebar);
  border: 1px solid var(--accent-primary);
  color: var(--text-main);
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-weight: 500;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.active {
  transform: translateX(-50%) translateY(0);
}

/* MOBILE RESPONSIVE MEDIA QUERIES (<= 768px) */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 56px;
  }

  .search-container {
    width: 140px;
  }

  .search-input:focus {
    width: 200px;
  }

  .search-results-dropdown {
    width: 280px;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .topbar-actions {
    display: none;
    position: absolute;
    top: var(--topbar-height);
    right: 0;
    width: 100%;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    z-index: 200;
  }

  .topbar-actions.mobile-open {
    display: flex;
  }

  .topbar-group {
    justify-content: space-between;
    width: 100%;
  }

  .user-pill {
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
  }

  .btn-logout {
    padding: 6px 12px;
    font-size: 13px;
  }

  .topbar {
    padding: 0 8px;
    gap: 6px;
  }

  .topbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
  }

  .topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .brand-title {
    display: none;
  }

  .board-selector {
    padding: 3px 6px;
    gap: 3px;
    flex: 1;
    min-width: 0;
    max-width: calc(100vw - 140px);
  }

  .board-select-btn {
    font-size: 13px;
    max-width: 140px;
    flex: 1;
  }

  .board-selector .desk-only {
    display: none !important;
  }

  .mobile-board-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
  }

  .mobile-board-actions .icon-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 13px;
  }

  .tool-item {
    width: 42px;
    height: 46px;
  }
}

/* ==========================================================================
   FINANCIAL & MONETY WIDGETS STYLES (Light & Dark Theme Compatible)
   ========================================================================== */

.card-finanse_summary, .card-finanse_stats, .card-widget_konta,
.card-widget_rachunki, .card-widget_portfel, .card-monety_summary,
.card-monety_stats, .card-widget_monety, .card-widget_cel_oszczednosciowy, .card-widget_nieruchomosc {
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  overflow: visible !important;
}

.fin-loading, .fin-error {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.fin-error { color: var(--accent-rose); }

.fin-summary-card, .fin-stats-card, .fin-konta-widget,
.fin-rachunki-widget, .fin-portfel-widget, .monety-summary-card,
.monety-stats-card, .monety-widget {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  color: var(--text-main);
}

.fin-grid, .monety-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.fin-stat-box {
  background: var(--bg-floating);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fin-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.fin-value {
  font-size: 15px;
  font-weight: 700;
}

.text-cyan { color: #0284c7; }
body:not(.light-theme) .text-cyan { color: #38bdf8; }

.text-amber { color: #d97706; }
body:not(.light-theme) .text-amber { color: #f59e0b; }

.text-emerald { color: #059669; }
body:not(.light-theme) .text-emerald { color: #10b981; }

.text-rose { color: #e11d48; }
body:not(.light-theme) .text-rose { color: #f43f5e; }

.fin-total-banner, .monety-value-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 182, 212, 0.12));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fin-total-title {
  font-size: 11px;
  font-weight: 700;
  color: #10b981;
  letter-spacing: 1px;
}

.fin-total-amount {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
}

.fin-bills-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-floating);
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.fin-actions-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-fin-refresh, .btn-monety-refresh {
  background: var(--bg-floating);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

.btn-fin-refresh:hover, .btn-monety-refresh:hover {
  background: var(--border-color);
}

.btn-fin-link {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #4f46e5;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}
body:not(.light-theme) .btn-fin-link { color: #a5b4fc; }

.btn-fin-link:hover {
  background: rgba(99, 102, 241, 0.3);
}

.fin-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.fin-share-bar {
  display: flex;
  height: 22px;
  border-radius: 11px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.fin-share-konta { background: #3b82f6; color: #fff; }
.fin-share-portfel { background: #f59e0b; color: #000; }
.fin-share-monety { background: #10b981; color: #fff; }

.fin-cats-list, .fin-acc-list, .fin-rach-list, .fin-portfel-list, .monety-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fin-cat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.fin-cat-head {
  display: flex;
  justify-content: space-between;
  color: var(--text-main);
  font-weight: 600;
}

.fin-progress-bg {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.fin-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  border-radius: 3px;
}

.fin-acc-row, .fin-rach-row, .fin-portfel-row, .monety-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-floating);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-main);
}

.fin-acc-name strong { display: block; color: var(--text-main); font-size: 13px; }
.fin-acc-name small { color: var(--text-muted); font-size: 11px; }
.fin-acc-bal { font-weight: 700; color: #0284c7; font-size: 13px; }
body:not(.light-theme) .fin-acc-bal { color: #38bdf8; }

.fin-quick-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-floating);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

.fin-form-title { font-size: 11px; font-weight: 700; color: #0284c7; text-transform: uppercase; }
body:not(.light-theme) .fin-form-title { color: var(--accent-cyan); }

.fin-form-row { display: flex; gap: 6px; flex-wrap: wrap; }

.fin-input {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  flex: 1;
}

.fin-input:focus { border-color: var(--accent-cyan); }

.btn-fin-submit {
  background: #0284c7;
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
}
body:not(.light-theme) .btn-fin-submit { background: var(--accent-cyan); color: #000; }

.btn-fin-submit:hover { opacity: 0.9; }

.fin-rach-header {
  display: grid;
  grid-template-columns: 75px 1fr 1fr 90px;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-color);
}

.fin-rach-row {
  display: grid;
  grid-template-columns: 75px 1fr 1fr 85px 30px;
  gap: 6px;
  align-items: center;
}

.fin-rach-cat { font-weight: 600; color: var(--text-main); }
.fin-rach-note { color: var(--text-muted); font-size: 11px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }

.badge-wspolne {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}
body:not(.light-theme) .badge-wspolne { color: #60a5fa; }

.badge-osobiste {
  background: rgba(168, 85, 247, 0.15);
  color: #7c3aed;
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}
body:not(.light-theme) .badge-osobiste { color: #c084fc; }

.fin-rach-footer-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  background: var(--bg-floating);
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
  flex-wrap: wrap;
}

.fin-rach-input, .fin-portfel-input {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: #059669;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  text-align: right;
  width: 100%;
}
body:not(.light-theme) .fin-rach-input, body:not(.light-theme) .fin-portfel-input { color: #10b981; }

.fin-denom-badge {
  font-weight: 700;
  color: #d97706;
  width: 110px;
}
body:not(.light-theme) .fin-denom-badge { color: #f59e0b; }

.fin-denom-total {
  font-weight: 700;
  color: #0284c7;
  width: 110px;
  text-align: right;
}
body:not(.light-theme) .fin-denom-total { color: #38bdf8; }

.monety-item-info strong { display: block; color: #d97706; }
body:not(.light-theme) .monety-item-info strong { color: #f59e0b; }
.monety-item-info small { color: var(--text-muted); }
.monety-item-prices { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.btn-monety-del { background: none; border: none; cursor: pointer; opacity: 0.7; }
.btn-monety-del:hover { opacity: 1; }

/* UNLINKED ACCOUNTS NOTICE & AUTO-LINK BUTTON */
.fin-unlinked-box {
  padding: 16px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.5;
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fin-unlinked-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fin-unlinked-icon {
  font-size: 20px;
}

.fin-unlinked-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #ef4444;
}

.fin-unlinked-desc {
  margin: 0;
  color: var(--text-main);
}

.fin-unlinked-action {
  display: flex;
  justify-content: center;
  margin: 4px 0;
}

.btn-auto-link {
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-auto-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
  background: linear-gradient(135deg, #4f46e5, #2563eb);
}

.btn-auto-link:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.fin-unlinked-note {
  display: flex;
  gap: 8px;
  background: rgba(99, 102, 241, 0.1);
  border-left: 3px solid #6366f1;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.fin-unlinked-note .note-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* ==========================================================================
   NEW STYLES FOR ENHANCED FEATURES (SHADOWS, BORDER-RADIUS, CAPTIONS, FIXED)
   ========================================================================== */

:root {
  --card-border-radius: 12px;
  --shadow-aggressive-dark: 0 16px 48px -6px rgba(0, 0, 0, 0.85), 0 8px 24px -4px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --shadow-aggressive-light: 0 16px 40px -6px rgba(0, 0, 0, 0.32), 0 8px 20px -4px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.canvas-card {
  border-radius: var(--card-border-radius, 12px) !important;
  overflow: visible !important; /* Umożliwia wyświetlanie menu kontekstowego nad kartą */
  box-shadow: var(--shadow-aggressive-dark) !important;
  transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.card-content,
.card-image,
.card-image .image-preview-container,
.card-image img {
  border-radius: inherit;
  overflow: hidden;
}

[data-theme="light"] .canvas-card {
  box-shadow: var(--shadow-aggressive-light) !important;
}

.canvas-card.is-fixed {
  position: fixed !important;
  z-index: 8500 !important;
  box-shadow: 0 20px 50px rgba(0,0,0,0.9), 0 0 0 2px var(--accent-amber) !important;
}

/* Active Sidebar Tool Highlight */
.tool-item.active {
  background: var(--bg-card-hover) !important;
  color: var(--accent-secondary) !important;
  border-color: var(--accent-secondary) !important;
  box-shadow: 0 0 16px rgba(236, 72, 153, 0.45) !important;
}

/* Split header & body for note cards */
.note-header-sec {
  padding: 8px 12px;
  border-radius: var(--card-border-radius, 12px) var(--card-border-radius, 12px) 0 0;
  transition: background-color 0.2s ease;
}

.note-body-sec {
  padding: 8px 12px;
  border-radius: 0 0 var(--card-border-radius, 12px) var(--card-border-radius, 12px);
  transition: background-color 0.2s ease;
  flex: 1;
}

/* Image Card Caption - Default White Background */
.card-image-caption-box {
  background: #ffffff;
  color: #0f172a;
  padding: 6px 10px;
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 var(--card-border-radius, 12px) var(--card-border-radius, 12px);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.card-image-caption-input {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 12px;
  font-weight: 500;
  width: 100%;
  outline: none;
  font-family: inherit;
}

.card-image-caption-input::placeholder {
  color: #64748b;
}

/* Sidebar Color Widget & Palette Swatches */
.sidebar-color-widget {
  width: 58px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.color-swatches-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
}

.color-swatch-chip {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: grab;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-swatch-chip:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.custom-color-chip {
  width: 24px;
  height: 24px;
  border: 2px solid var(--accent-cyan) !important;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}


/* Admin Table Row Styling */
.admin-table-row:hover {
  background: var(--bg-card-hover);
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

/* PUZZLE VERIFIER & TERMINAL CARD STYLES */
.card-puzzle_verifier {
  min-width: 380px;
  background: #0f172a !important;
  border: 1.5px solid #06b6d4 !important;
  box-shadow: 0 8px 32px rgba(6, 182, 212, 0.25), 0 0 15px rgba(6, 182, 212, 0.15) !important;
}

.puzzle-verifier-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 4px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #e2e8f0;
}

.puzzle-hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.5px;
}

.puzzle-hud-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulseNeon 1.5s infinite alternate;
}

@keyframes pulseNeon {
  from { opacity: 0.4; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.15); }
}

.puzzle-hud-tag {
  background: rgba(56, 189, 248, 0.15);
  border-radius: 4px;
  padding: 2px 6px;
}

.puzzle-status-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  transition: all 0.25s ease;
}

.puzzle-status-banner.banner-success {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #34d399;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.puzzle-status-banner.banner-partial {
  background: rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
  color: #fcd34d;
}

.puzzle-status-banner.banner-failed {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #f87171;
}

.puzzle-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.puzzle-input-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.3px;
}

.puzzle-textarea {
  width: 100%;
  height: 80px;
  background: #090d16;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 6px;
  color: #f8fafc;
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.puzzle-textarea:focus {
  border-color: #06b6d4;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.35);
}

.puzzle-btn-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.puzzle-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  user-select: none;
}

.puzzle-btn-primary {
  flex: 1;
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.puzzle-btn-primary:hover {
  background: linear-gradient(135deg, #06b6d4, #38bdf8);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.45);
  transform: translateY(-1px);
}

.puzzle-btn-secondary {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
}

.puzzle-btn-secondary:hover {
  background: #334155;
  color: #f8fafc;
}

.puzzle-btn-icon {
  background: #1e293b;
  border: 1px solid #334155;
  padding: 6px 9px;
  color: #cbd5e1;
}

.puzzle-btn-icon:hover {
  background: #334155;
  color: #ffffff;
}

.puzzle-console-box {
  background: #030712;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.puzzle-progress-bar-container {
  width: 100%;
  height: 6px;
  background: #111827;
  border-radius: 3px;
  overflow: hidden;
}

.puzzle-progress-bar {
  height: 100%;
  width: 0%;
  background: #06b6d4;
  border-radius: 3px;
  transition: width 0.4s ease, background-color 0.4s ease;
}

.puzzle-log-output {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #94a3b8;
  max-height: 140px;
  overflow-y: auto;
}

.puzzle-log-output .log-success {
  color: #34d399;
  background: rgba(16, 185, 129, 0.08);
  padding: 6px 8px;
  border-left: 3px solid #10b981;
  border-radius: 3px;
}

.puzzle-log-output .log-partial {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.08);
  padding: 6px 8px;
  border-left: 3px solid #f59e0b;
  border-radius: 3px;
}

.puzzle-log-output .log-fail {
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  padding: 6px 8px;
  border-left: 3px solid #ef4444;
  border-radius: 3px;
}

.puzzle-hints-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.puzzle-hint-item {
  background: rgba(30, 41, 59, 0.7);
  border-left: 3px solid #38bdf8;
  border-radius: 4px;
  padding: 6px 9px;
  font-size: 11px;
  line-height: 1.35;
  color: #e2e8f0;
}





