/*
 * CardWall - Base Application Styles
 *
 * Color palette and theme support with CSS custom properties.
 * Defaults to system preference, user can override via theme toggle.
 */

/* ===== Light Theme (default) ===== */
:root {
  /* Primary - Purple */
  --color-primary: #7C3AED;
  --color-primary-hover: #6D28D9;
  --color-primary-light: #EDE9FE;
  --color-primary-text: #FFFFFF;

  /* Neutrals */
  --color-bg: #FFFFFF;
  --color-bg-secondary: #F9FAFB;
  --color-bg-tertiary: #F3F4F6;
  --color-surface: #FFFFFF;
  --color-border: #E5E7EB;
  --color-border-light: #F3F4F6;

  /* Text */
  --color-text: #111827;
  --color-text-secondary: #6B7280;
  --color-text-muted: #9CA3AF;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  /* Overlay */
  --color-overlay: rgba(0, 0, 0, 0.5);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Lane Colors */
  --lane-coral: #F97066;
  --lane-amber: #F59E0B;
  --lane-emerald: #10B981;
  --lane-sky: #0EA5E9;
  --lane-pink: #EC4899;
  --lane-teal: #14B8A6;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --color-primary: #A78BFA;
  --color-primary-hover: #C4B5FD;
  --color-primary-light: #2E1065;
  --color-primary-text: #111827;

  --color-bg: #111827;
  --color-bg-secondary: #1F2937;
  --color-bg-tertiary: #374151;
  --color-surface: #1F2937;
  --color-border: #374151;
  --color-border-light: #1F2937;

  --color-text: #F9FAFB;
  --color-text-secondary: #D1D5DB;
  --color-text-muted: #6B7280;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);

  --color-overlay: rgba(0, 0, 0, 0.7);
}

/* System preference: auto-detect dark mode when no explicit theme is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary: #A78BFA;
    --color-primary-hover: #C4B5FD;
    --color-primary-light: #2E1065;
    --color-primary-text: #111827;

    --color-bg: #111827;
    --color-bg-secondary: #1F2937;
    --color-bg-tertiary: #374151;
    --color-surface: #1F2937;
    --color-border: #374151;
    --color-border-light: #1F2937;

    --color-text: #F9FAFB;
    --color-text-secondary: #D1D5DB;
    --color-text-muted: #6B7280;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);

    --color-overlay: rgba(0, 0, 0, 0.7);
  }
}

/* ===== Base Reset & Typography ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  text-decoration: none;
}

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

.btn-secondary:hover {
  background-color: var(--color-bg-tertiary);
  text-decoration: none;
}

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

.btn-ghost:hover {
  background-color: var(--color-bg-secondary);
  color: var(--color-text);
  text-decoration: none;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ===== Forms ===== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}

.field {
  margin-bottom: 1rem;
}

/* ===== Utility Classes ===== */
.text-secondary {
  color: var(--color-text-secondary);
}

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

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Flash Messages ===== */
.flash {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  margin: 1rem;
}

.flash-notice {
  background-color: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #16A34A;
}

.flash-alert {
  background-color: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
}

[data-theme="dark"] .flash-notice {
  background-color: #14532D;
  border-color: #166534;
  color: #86EFAC;
}

[data-theme="dark"] .flash-alert {
  background-color: #451A1A;
  border-color: #7F1D1D;
  color: #FCA5A5;
}

/* ===== Auth Pages ===== */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.auth-card > p {
  margin: 0 0 1.5rem;
}

.auth-errors {
  background-color: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.auth-errors p {
  margin: 0;
  font-size: 0.875rem;
  color: #DC2626;
}

[data-theme="dark"] .auth-errors {
  background-color: #451A1A;
  border-color: #7F1D1D;
}

[data-theme="dark"] .auth-errors p {
  color: #FCA5A5;
}

.auth-notice {
  background-color: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.auth-notice p {
  margin: 0;
  font-size: 0.875rem;
  color: #16A34A;
}

[data-theme="dark"] .auth-notice {
  background-color: #14532D;
  border-color: #166534;
}

[data-theme="dark"] .auth-notice p {
  color: #86EFAC;
}

/* ===== Template Selector ===== */
.template-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.template-option {
  position: relative;
  cursor: pointer;
}

.template-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.template-option-content {
  display: flex;
  flex-direction: column;
  padding: 0.625rem 0.75rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, background-color 0.15s;
}

.template-radio:checked + .template-option-content {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
}

.template-option:hover .template-option-content {
  border-color: var(--color-primary);
}

.template-option-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
}

.template-option-desc {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}

/* ===== Form Pages (new/edit) ===== */
.form-container {
  display: flex;
  justify-content: center;
  padding: 3rem 2rem;
}

.form-card {
  width: 100%;
  max-width: 400px;
}

.form-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.form-card > p {
  margin: 0 0 1.5rem;
}

/* ===== Profile Page ===== */
.profile-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 3rem;
}

.profile-avatar {
  margin: 0 0 1.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile-avatar-btn {
  position: relative;
  display: block;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: var(--radius-full);
}

.profile-avatar-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.avatar-xl {
  width: 96px;
  height: 96px;
}

.profile-avatar-btn svg,
.profile-avatar-btn img {
  display: block;
  border-radius: var(--radius-full);
}

.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background-color: rgba(0, 0, 0, 0.4);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s;
}

.profile-avatar-btn:hover .profile-avatar-overlay {
  opacity: 1;
}

.profile-remove-photo {
  display: block;
  margin-top: 0.5rem;
  text-align: center;
}

.profile-remove-photo button,
.profile-remove-photo input[type="submit"] {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.profile-remove-photo button:hover,
.profile-remove-photo input[type="submit"]:hover {
  color: #DC2626;
}

[data-theme="dark"] .profile-remove-photo button:hover,
[data-theme="dark"] .profile-remove-photo input[type="submit"]:hover {
  color: #FCA5A5;
}

.profile-name {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  cursor: pointer;
  outline: none;
}

.profile-name.editing {
  text-decoration: underline;
  text-decoration-color: var(--color-primary);
  text-underline-offset: 3px;
  cursor: text;
}

.profile-email {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
}

/* ===== App Layout ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.app-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-header-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.app-content-board {
  padding: 1rem;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  background-color: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-brand {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-primary);
  text-decoration: none;
}

.sidebar-brand:hover {
  color: var(--color-primary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.sidebar-section {
  margin-bottom: 1rem;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.25rem;
}

.sidebar-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}

.sidebar-add-btn:hover {
  color: var(--color-primary);
  background-color: var(--color-bg-tertiary);
  text-decoration: none;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background-color 0.1s ease;
}

.sidebar-link:hover {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text);
  text-decoration: none;
}

.sidebar-link-active {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 500;
}

.sidebar-link-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-item {
  display: flex;
  align-items: center;
  position: relative;
}

.sidebar-item .sidebar-link {
  flex: 1;
  min-width: 0;
}

.sidebar-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 0.1s, color 0.1s, background-color 0.1s;
  padding: 0;
}

.sidebar-item:hover .sidebar-delete-btn {
  opacity: 1;
}

.sidebar-delete-btn:hover {
  color: #DC2626;
  background-color: #FEF2F2;
}

[data-theme="dark"] .sidebar-delete-btn:hover {
  color: #FCA5A5;
  background-color: #451A1A;
}

/* ===== Profile Dropdown ===== */
.profile-dropdown {
  position: relative;
}

.profile-dropdown-trigger {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius-full);
}

.profile-dropdown-trigger:hover {
  opacity: 0.8;
}

.avatar {
  border-radius: var(--radius-full);
  object-fit: cover;
}

.avatar-sm {
  width: 32px;
  height: 32px;
}

.profile-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  width: 220px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.375rem;
  z-index: 50;
}

.profile-dropdown-header {
  padding: 0.5rem 0.625rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.profile-dropdown-header strong {
  font-size: 0.875rem;
}

.profile-dropdown-divider {
  height: 1px;
  background-color: var(--color-border);
  margin: 0.375rem 0;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  text-align: left;
}

.profile-dropdown-item:hover {
  background-color: var(--color-bg-secondary);
  color: var(--color-text);
  text-decoration: none;
}

.profile-dropdown-item-danger:hover {
  background-color: #FEF2F2;
  color: #DC2626;
}

[data-theme="dark"] .profile-dropdown-item-danger:hover {
  background-color: #451A1A;
  color: #FCA5A5;
}

/* ===== Walls Grid ===== */
.walls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.wall-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
}

.wall-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.wall-card-icon {
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.wall-card-name {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.wall-card-meta {
  margin: 0;
}

.wall-card-new {
  border-style: dashed;
  color: var(--color-text-muted);
}

.wall-card-new .wall-card-icon {
  color: var(--color-text-muted);
}

.wall-card-new:hover {
  color: var(--color-primary);
}

.wall-card-new:hover .wall-card-icon {
  color: var(--color-primary);
}

/* ===== Board / Kanban ===== */
.board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  min-height: calc(100vh - 140px);
  align-items: flex-start;
}

.lane {
  flex: 0 0 280px;
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 160px);
}

.lane-header {
  padding: 0.75rem;
  border-top: 3px solid var(--lane-coral);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lane-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
}

.lane-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.lane:hover .lane-actions {
  opacity: 1;
}

.lane-cards {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 2rem;
}

.lane-footer {
  padding: 0.5rem;
}

.lane-new {
  background: none;
  border: 2px dashed var(--color-border);
  flex: 0 0 280px;
  padding: 0.75rem;
  display: flex;
  align-items: flex-start;
}

.inline-create-input {
  width: 100%;
  padding: 0.5rem 0.625rem;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  background-color: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.inline-create-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 25%, transparent);
}

/* ===== Card Tile ===== */
.card-tile {
  display: block;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
  text-decoration: none;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.card-tile:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border);
  text-decoration: none;
}

.card-tile-title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
}

.card-tile-badges {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.card-tile-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

.card-tile-badge svg {
  width: 12px;
  height: 12px;
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.empty-state .icon-lg {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.empty-state h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.empty-state p {
  margin: 0 0 1.5rem;
}

/* ===== SVG Icon Sizing ===== */
.icon-sm svg {
  width: 16px;
  height: 16px;
}

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

.icon-lg svg {
  width: 24px;
  height: 24px;
}

/* ===== Modal Overlay ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--color-overlay);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
  z-index: 100;
  overflow-y: auto;
}

.modal-container {
  width: 100%;
  max-width: 640px;
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 6rem);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
}

/* ===== Modal Sections ===== */
.modal-section {
  margin-bottom: 1.5rem;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section-title {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin: 0 0 0.75rem;
}

.modal-section-title-muted {
  color: var(--color-text-muted);
}

.modal-section-title .badge {
  font-size: 0.6875rem;
  font-weight: 500;
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-full);
}

.modal-description {
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ===== Attachment List (in modal) ===== */
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  transition: background-color 0.1s;
}

.attachment-item:hover {
  background-color: var(--color-bg-tertiary);
}

.attachment-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex: 1;
}

.attachment-preview-link {
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: block;
}

.attachment-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: block;
}

.attachment-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.attachment-icon-file-pdf { color: #DC2626; }
.attachment-icon-file-video { color: var(--color-primary); }
.attachment-icon-file-image { color: #10B981; }
.attachment-icon-file-text { color: #6B7280; }

.attachment-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.attachment-name {
  font-size: 0.8125rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text);
  text-decoration: none;
}

.attachment-name:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.attachment-meta {
  font-size: 0.6875rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.attachment-meta-sep {
  opacity: 0.5;
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  flex-shrink: 0;
}

/* ===== Attachment Upload (drop zone style) ===== */
.attachment-drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.attachment-drop-zone:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background-color: var(--color-bg-secondary);
}

.attachment-drop-text {
  font-size: 0.8125rem;
  font-weight: 500;
}

/* ===== Link List (in modal) ===== */
.link-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.link-list-description {
  border-left: 2px dashed var(--color-border);
  padding-left: 0.75rem;
}

.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.625rem;
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-md);
}

.link-item-description {
  background: none;
  padding: 0.375rem 0;
}

.link-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex: 1;
}

.link-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.link-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.link-url {
  font-size: 0.8125rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-description {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Inline Forms (attachment upload, add link) ===== */
.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.inline-form .file-input {
  flex: 1;
  font-size: 0.8125rem;
}

.inline-form .link-input {
  flex: 1;
  font-size: 0.8125rem;
  padding: 0.375rem 0.625rem;
}

/* ===== Danger button variant ===== */
.btn-danger {
  color: var(--color-text-muted);
}

.btn-danger:hover {
  color: #DC2626;
  background-color: #FEF2F2;
}

[data-theme="dark"] .btn-danger:hover {
  color: #FCA5A5;
  background-color: #451A1A;
}

/* ===== Drag Handles ===== */
.lane-drag-handle,
.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--color-text-muted);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.lane-drag-handle:active,
.drag-handle:active {
  cursor: grabbing;
}

.lane:hover .lane-drag-handle,
.attachment-item:hover .drag-handle,
.link-item:hover .drag-handle {
  opacity: 1;
}

/* ===== Sortable Ghost & Chosen States ===== */
.lane-ghost {
  opacity: 0.4;
}

.lane-chosen {
  box-shadow: var(--shadow-lg);
}

.card-tile-ghost {
  opacity: 0.4;
}

.card-tile-chosen {
  box-shadow: var(--shadow-lg);
  transform: rotate(2deg);
}

.sortable-ghost {
  opacity: 0.4;
}

.sortable-chosen {
  background-color: var(--color-bg-tertiary);
}
