/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Global focus ring (keyboard only) ───────────────────────────────────── */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent, #fc9f5b);
  outline-offset: 2px;
}

/* ── Theme Variables: juunit (default) ────────────────────────────────────── */
:root {
  --nav-bg: #193761;
  --nav-text: #ffffff;
  --accent: #fc9f5b;
  --accent-hover: #e88a40;
  --shadow-note: 4px 6px 18px rgba(0,0,0,0.35);
  --radius: 6px;
  --body-font: 'Manrope', sans-serif;
  --display-font: 'Manrope', sans-serif;
  --display-font-weight: 700;

  --body-bg: #041224;
  --login-bg-a: #041224;
  --login-bg-b: #193761;
  --login-card-bg: #ffffff;
  --login-heading-color: #193761;
  --login-sub-color: #62636b;

  --user-name-color: rgba(255,255,255,0.65);
  --ghost-border: rgba(255,255,255,0.3);

  --board-list-bg: #f9fbfd;
  --page-heading-color: #193761;
  --board-card-name-color: #193761;
  --board-card-meta-color: #62636b;
  --card-default-bg: #ffffff;
  --empty-state-color: #707aa1;
  --board-surface: #041224;

  --modal-bg: #ffffff;
  --modal-heading-color: #193761;
  --modal-hint-color: #62636b;
  --input-border: #c4cae3;
  --member-info-color: #193761;
  --member-email-color: #62636b;

  --color-picker-bg: #0d1254;
  --btn-secondary-bg: #0d1254;
  --btn-secondary-text: #ffffff;
  --btn-secondary-hover: #193761;
}

/* ── Theme Variables: cork (alternate) ────────────────────────────────────── */
[data-theme="cork"] {
  --nav-bg: #2c1a0e;
  --nav-text: #f5e6c8;
  --accent: #e07b2a;
  --accent-hover: #c96a1a;
  --body-font: 'Inter', sans-serif;
  --display-font: 'Caveat', cursive;
  --display-font-weight: 600;

  --body-bg: #c4893a;
  --login-bg-a: #1a0a00;
  --login-bg-b: #2c1a0e;
  --login-card-bg: #fdf6e3;
  --login-heading-color: #2c1a0e;
  --login-sub-color: #7a6a5a;

  --user-name-color: #c4a87a;
  --ghost-border: rgba(245,230,200,0.3);

  --board-list-bg: #f5efe0;
  --page-heading-color: #2c1a0e;
  --board-card-name-color: #1a0a00;
  --board-card-meta-color: #7a6050;
  --card-default-bg: #fef3c7;
  --empty-state-color: #9a8070;
  --board-surface: #b87333;

  --modal-bg: #fdf6e3;
  --modal-heading-color: #2c1a0e;
  --modal-hint-color: #7a6a5a;
  --input-border: #c9b99a;
  --member-info-color: #2c1a0e;
  --member-email-color: #7a6050;

  --color-picker-bg: #3d2510;
  --btn-secondary-bg: #5a3e28;
  --btn-secondary-text: #f5e6c8;
  --btn-secondary-hover: #7a5a3a;
}

body {
  font-family: var(--body-font);
  height: 100dvh;
  overflow: hidden;
  background: var(--body-bg);
}

/* ── Skip-to-content link (screen-reader / keyboard users) ───────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  z-index: 9999;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; }

.hidden { display: none !important; }

/* Visually hidden but available to screen readers */
.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;
}

/* ── Login Screen ─────────────────────────────────────────────────────────── */
#login-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--login-bg-a) 0%, var(--login-bg-b) 50%, var(--login-bg-a) 100%);
}

.login-card {
  background: var(--login-card-bg);
  border-radius: 16px;
  padding: 48px 56px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  max-width: 380px;
  width: 90%;
}

.login-logo {
  font-size: 4rem;
  margin-bottom: 12px;
  filter: drop-shadow(2px 3px 6px rgba(0,0,0,0.2));
}

.login-card h1 {
  font-family: var(--display-font);
  font-weight: var(--display-font-weight);
  font-size: 2.4rem;
  color: var(--login-heading-color);
  margin-bottom: 6px;
}

.login-card p {
  color: var(--login-sub-color);
  margin-bottom: 32px;
  font-size: 0.95rem;
}

.btn-ms {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #0078d4;
  color: white;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s;
}
.btn-ms:hover { background: #005a9e; }

/* ── App Shell ────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Nav ──────────────────────────────────────────────────────────────────── */
#topnav {
  background: var(--nav-bg);
  color: var(--nav-text);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  z-index: 10;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo { font-size: 1.4rem; }

#nav-title {
  font-family: var(--display-font);
  font-weight: var(--display-font-weight);
  font-size: 1.35rem;
  color: var(--nav-text);
}

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

#user-name {
  font-size: 0.85rem;
  /* Boosted from rgba(255,255,255,0.65) to meet 4.5:1 contrast on --nav-bg */
  color: rgba(255, 255, 255, 0.88);
}

/* ── Theme Switcher ───────────────────────────────────────────────────────── */
.theme-switcher-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}
.theme-switcher-wrap label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  cursor: pointer;
}

#theme-select {
  background: transparent;
  color: var(--nav-text);
  border: 1px solid var(--ghost-border);
  border-radius: var(--radius);
  padding: 4px 24px 4px 8px;
  font-size: 0.8rem;
  font-family: var(--body-font);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='rgba(255,255,255,0.6)' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  transition: background-color 0.15s;
}
#theme-select:hover { background-color: rgba(255,255,255,0.1); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  min-height: 36px;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 36px;
}
.btn-secondary:hover { background: var(--btn-secondary-hover); }

.btn-ghost {
  background: transparent;
  color: var(--nav-text);
  border: 1px solid var(--ghost-border);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 36px;
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }

.btn-danger {
  background: #7f1d1d;
  color: #fca5a5;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 36px;
}
.btn-danger:hover { background: #991b1b; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--nav-text);
  font-size: 1.3rem;
  cursor: pointer;
  /* Minimum 44x44 touch target */
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); }

.error {
  color: #c0392b;
  font-size: 0.85rem;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.error::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23c0392b'%3E%3Cpath fill-rule='evenodd' d='M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-size: contain;
  flex-shrink: 0;
}

/* ── Toast notifications ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: #1e293b;
  color: #f1f5f9;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.22s ease;
  max-width: 320px;
}
.toast.toast-success { border-left: 4px solid #22c55e; }
.toast.toast-error   { border-left: 4px solid #ef4444; }
.toast.toast-info    { border-left: 4px solid var(--accent); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Views ────────────────────────────────────────────────────────────────── */
.view {
  flex: 1;
  overflow: hidden;
}

/* ── Board List ───────────────────────────────────────────────────────────── */
#board-list-view {
  padding: 32px 40px;
  background: var(--board-list-bg);
  overflow-y: auto;
}

/* Loading skeleton for board cards */
.board-card-skeleton {
  background: var(--card-default-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 3px 4px 14px rgba(0,0,0,0.10);
}
.skeleton-preview {
  width: 100%;
  height: 110px;
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.12) 50%, rgba(0,0,0,0.06) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
}
.skeleton-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.12) 50%, rgba(0,0,0,0.06) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
}
.skeleton-line.short { width: 55%; }
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.board-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.board-list-header h2 {
  font-family: var(--display-font);
  font-weight: var(--display-font-weight);
  font-size: 2rem;
  color: var(--page-heading-color);
  letter-spacing: -0.02em;
}

.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.board-card {
  background: var(--card-bg, var(--card-default-bg));
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.10), 0 6px 16px rgba(0,0,0,0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Keyboard focus ring */
  outline: none;
}
.board-card:hover {
  transform: translateY(-4px) rotate(0.4deg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.14), 0 12px 28px rgba(0,0,0,0.14);
}
.board-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* pin sits inside the preview area */
.board-card::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 35% 35%, #cc4444, #881111);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  z-index: 4;
}

/* ── Board Preview Thumbnail ──────────────────────────────────────────────── */
.board-preview {
  width: 100%;
  height: 110px;
  position: relative;
  overflow: hidden;
  background-color: var(--board-surface);
  flex-shrink: 0;
}

/* juunit: dot-grid surface */
.board-preview {
  background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 14px 14px;
}
[data-theme="cork"] .board-preview {
  background-image: repeating-linear-gradient(
    42deg, transparent, transparent 4px, rgba(0,0,0,0.03) 4px, rgba(0,0,0,0.03) 5px
  ), repeating-linear-gradient(
    -42deg, transparent, transparent 4px, rgba(0,0,0,0.03) 4px, rgba(0,0,0,0.03) 5px
  );
}

.board-preview-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 1000px;
  height: 500px;
  transform: scale(0.22);
  transform-origin: top left;
  pointer-events: none;
}

.mini-note {
  position: absolute;
  width: 200px;
  min-height: 160px;
  border-radius: 2px;
  padding: 10px;
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: #1a0a00;
  line-height: 1.4;
  overflow: hidden;
  box-shadow: 3px 5px 12px rgba(0,0,0,0.3);
}

/* ── Board Card Body ──────────────────────────────────────────────────────── */
.board-card-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.board-card-name {
  font-family: var(--display-font);
  font-weight: var(--display-font-weight);
  font-size: 1.1rem;
  color: var(--board-card-name-color);
  /* Prevent very long names from breaking layout */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-card-meta {
  font-size: 0.8rem;
  color: var(--board-card-meta-color);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-shared { background: #dbeafe; color: #1e40af; }
.badge-personal { background: #d1fae5; color: #065f46; }
.badge-guest { background: #ede9fe; color: #5b21b6; }

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--empty-state-color);
}
.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  display: block;
  line-height: 1;
}
.empty-state p {
  font-size: 1rem;
  margin-bottom: 20px;
}
.empty-state .btn-primary {
  /* Make the CTA visible right in the empty state */
  padding: 10px 24px;
  font-size: 0.95rem;
}

/* ── Board View ───────────────────────────────────────────────────────────── */
#board-view {
  display: flex;
  flex-direction: column;
}

#board-toolbar {
  background: var(--nav-bg);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  flex-wrap: wrap;
  min-height: 52px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#board-title-display {
  font-family: var(--display-font);
  font-weight: var(--display-font-weight);
  font-size: 1.35rem;
  color: var(--nav-text);
}

#note-color-picker {
  background: var(--color-picker-bg);
  color: var(--nav-text);
  border: 1px solid var(--ghost-border);
  border-radius: var(--radius);
  padding: 5px 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ── Board Surface ────────────────────────────────────────────────────────── */
/* juunit default: dark navy grid */
#cork-board {
  flex: 1;
  overflow: auto;
  position: relative;
  background-color: #041224;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px),
    radial-gradient(ellipse at 15% 20%, rgba(25,55,97,0.45) 0%, transparent 65%),
    radial-gradient(ellipse at 85% 80%, rgba(13,18,84,0.4) 0%, transparent 65%);
  background-size: 28px 28px, 100% 100%, 100% 100%;
}

/* cork alternate: textured corkboard */
[data-theme="cork"] #cork-board {
  background-color: #b87333;
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(200,150,60,0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(160,110,40,0.3) 0%, transparent 45%),
    radial-gradient(ellipse at 60% 10%, rgba(220,170,80,0.2) 0%, transparent 40%),
    repeating-linear-gradient(
      42deg,
      transparent,
      transparent 8px,
      rgba(0,0,0,0.025) 8px,
      rgba(0,0,0,0.025) 9px
    ),
    repeating-linear-gradient(
      -42deg,
      transparent,
      transparent 8px,
      rgba(0,0,0,0.025) 8px,
      rgba(0,0,0,0.025) 9px
    );
  background-size: cover;
}

#notes-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 52px - 44px);
}

/* ── Sticky Notes ─────────────────────────────────────────────────────────── */
.sticky-note {
  position: absolute;
  width: 210px;
  min-height: 170px;
  padding: 10px 10px 14px;
  border-radius: 3px;
  box-shadow: var(--shadow-note);
  cursor: grab;
  user-select: none;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.1s;
}
.sticky-note:active { cursor: grabbing; }
.sticky-note.dragging {
  box-shadow: 10px 14px 34px rgba(0,0,0,0.5);
  z-index: 1000;
  transform: scale(1.03) rotate(0deg) !important;
}

.sticky-note::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: radial-gradient(circle at 35% 35%, #cc4444, #881111);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  z-index: 2;
}

.note-tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 20px;
  background: rgba(255,255,240,0.55);
  border: 1px solid rgba(200,200,180,0.4);
}

.note-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  /* Always show at reduced opacity so touch users know it exists */
  opacity: 0.35;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.sticky-note:hover .note-toolbar,
.sticky-note:focus-within .note-toolbar { opacity: 1; }

.note-color-dot {
  /* Minimum 24px touch area with visual 14px dot */
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.note-color-dot::after {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dot-color);
  border: 1.5px solid rgba(0,0,0,0.2);
  transition: transform 0.1s;
}
.note-color-dot:hover::after,
.note-color-dot:focus-visible::after { transform: scale(1.35); }

.note-delete {
  background: transparent;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  color: rgba(0,0,0,0.35);
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  /* Touch target */
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
}
.note-delete:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

.note-content {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  font-family: 'Caveat', cursive;
  font-size: 1.15rem;
  color: #1a0a00;
  resize: none;
  outline: none;
  line-height: 1.45;
  cursor: text;
  min-height: 100px;
}
.note-content::placeholder { color: rgba(0,0,0,0.3); }

.note-creator {
  /* Increased from 0.65rem (10.4px) to a readable minimum */
  font-size: 0.75rem;
  color: rgba(0,0,0,0.45);
  text-align: right;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.01em;
}

/* ── Note footer (creator + comment toggle) ───────────────────────────────── */
.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  flex-shrink: 0;
}
.note-footer .note-creator {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-comment-toggle {
  background: rgba(0,0,0,0.06);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  color: rgba(0,0,0,0.6);
  padding: 3px 9px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.note-comment-toggle:hover { background: rgba(0,0,0,0.12); }
.note-comment-toggle .comment-count { font-weight: 600; }

/* ── Comment thread ───────────────────────────────────────────────────────── */
.note-comments {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.12);
  flex-shrink: 0;
}

.comment-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.comment-loading,
.comment-empty {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  color: rgba(0,0,0,0.4);
  padding: 2px 0;
}

.comment {
  font-family: 'Inter', sans-serif;
  background: rgba(0,0,0,0.05);
  border-radius: 6px;
  padding: 6px 8px;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.comment-author {
  font-size: 0.74rem;
  font-weight: 600;
  color: rgba(0,0,0,0.72);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comment-time {
  font-size: 0.68rem;
  color: rgba(0,0,0,0.42);
  flex-shrink: 0;
}
.comment-delete {
  margin-left: auto;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(0,0,0,0.3);
  font-size: 0.72rem;
  line-height: 1;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.comment-delete:hover { color: #dc2626; background: rgba(220,38,38,0.1); }

.comment-body {
  font-size: 0.78rem;
  color: rgba(0,0,0,0.78);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-input {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.comment-text {
  flex: 1;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 6px;
  background: rgba(255,255,255,0.6);
  font-family: 'Inter', sans-serif;
  font-size: 0.76rem;
  color: #1a0a00;
  padding: 5px 7px;
  resize: none;
  outline: none;
  line-height: 1.4;
  max-height: 80px;
}
.comment-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(252,159,91,0.25);
}
.comment-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 6px 12px;
  min-height: 30px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.comment-send:hover { background: var(--accent-hover); }
.comment-send:disabled { opacity: 0.6; cursor: default; }

/* ── Modals ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal {
  background: var(--modal-bg);
  border-radius: 12px;
  padding: 32px 36px;
  min-width: 340px;
  max-width: 480px;
  width: 92%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

/* Confirmation dialog overlay */
#confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}
#confirm-overlay.hidden { display: none; }
#confirm-box {
  background: var(--modal-bg, #fff);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
#confirm-box h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--modal-heading-color, #193761);
  margin-bottom: 10px;
}
#confirm-box p {
  font-size: 0.9rem;
  color: var(--modal-hint-color, #62636b);
  margin-bottom: 24px;
  line-height: 1.5;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal h3 {
  font-family: var(--display-font);
  font-weight: var(--display-font-weight);
  font-size: 1.6rem;
  color: var(--modal-heading-color);
  margin-bottom: 16px;
}

.modal input[type="text"],
.modal input[type="email"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 8px;
  font-family: var(--body-font);
}
.modal input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(252, 159, 91, 0.2);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.modal-hint {
  font-size: 0.82rem;
  color: var(--modal-hint-color);
  margin-bottom: 12px;
}

.share-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.share-input-row input { flex: 1; margin-bottom: 0; }

#members-list {
  margin-top: 16px;
  max-height: 240px;
  overflow-y: auto;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  background: rgba(0,0,0,0.04);
}
.member-info { font-size: 0.88rem; color: var(--member-info-color); }
.member-email { font-size: 0.75rem; color: var(--member-email-color); }
.member-remove {
  background: none;
  border: none;
  color: #9a2020;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.member-remove:hover { background: #fee2e2; }

/* ── Admin View ───────────────────────────────────────────────────────────── */
#admin-view {
  padding: 28px 32px;
  background: var(--board-list-bg);
  overflow-y: auto;
}

.admin-content { max-width: 900px; }

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-header h2 {
  font-family: var(--display-font);
  font-weight: var(--display-font-weight);
  font-size: 1.8rem;
  color: var(--page-heading-color);
}

.invite-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.invite-form input {
  padding: 7px 12px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  background: white;
  outline: none;
  transition: border-color 0.15s;
  font-family: var(--body-font);
}
.invite-form input:focus { border-color: var(--accent); }
#invite-name { width: 150px; }
#invite-email { width: 210px; }

.users-table-wrap {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  margin-top: 8px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--board-card-meta-color);
  border-bottom: 1.5px solid var(--input-border);
  white-space: nowrap;
  background: var(--board-list-bg);
}

.users-table td {
  padding: 10px 16px;
  font-size: 0.875rem;
  color: var(--member-info-color);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: none; }
.users-table tbody tr:hover td { background: rgba(0,0,0,0.018); }

.user-cell-name { font-weight: 500; }
.user-cell-email { font-size: 0.78rem; color: var(--board-card-meta-color); margin-top: 2px; }

.badge-admin { background: #fef3c7; color: #92400e; }
.badge-pending { background: #f3f4f6; color: #6b7280; font-style: italic; }

.user-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }

.btn-table {
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: var(--body-font);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-table-promote { color: var(--accent-hover); }
.btn-table-promote:hover { background: rgba(252,159,91,0.12); border-color: var(--accent); }
.btn-table-demote { color: var(--board-card-meta-color); }
.btn-table-demote:hover { background: rgba(0,0,0,0.05); border-color: var(--input-border); }
.btn-table-delete { color: #9a2020; }
.btn-table-delete:hover { background: #fee2e2; border-color: #fca5a5; }

/* ── Invite form label (accessibility) ───────────────────────────────────── */
.invite-form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--board-card-meta-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 3px;
}
.invite-field-wrap {
  display: flex;
  flex-direction: column;
}

/* ── Member remove — minimum touch target ────────────────────────────────── */
.member-remove {
  min-height: 36px;
  padding: 6px 12px;
}

/* ── Loading indicator on board open ─────────────────────────────────────── */
.notes-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.45);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: rgba(255,255,255,0.7);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  #board-list-view { padding: 20px 16px; }
  #admin-view { padding: 20px 16px; }
  .admin-header { flex-direction: column; align-items: flex-start; }
  .invite-form { flex-direction: column; align-items: stretch; }
  #invite-name, #invite-email { width: 100%; }
  .boards-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .modal { padding: 24px 20px; min-width: 0; }
  #nav-title { font-size: 1.1rem; }
  #user-name { display: none; } /* save nav space on narrow screens */
  .board-list-header h2 { font-size: 1.5rem; }
  #board-toolbar { padding: 6px 12px; }
  .toolbar-right { gap: 6px; }
  .users-table th:nth-child(2),
  .users-table td:nth-child(2),
  .users-table th:nth-child(3),
  .users-table td:nth-child(3) { display: none; } /* hide Boards/Notes cols */
}

@media (max-width: 400px) {
  .boards-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Liquid Glass theme  (Apple-style frosted glass)
   Everything scoped under [data-theme="glass"] so juunit/cork are untouched.
   ═══════════════════════════════════════════════════════════════════════════ */

/* (a) Variable overrides ──────────────────────────────────────────────────── */
[data-theme="glass"] {
  --body-font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', sans-serif;
  --display-font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', sans-serif;
  --display-font-weight: 600;

  --accent: #0a84ff;
  --accent-hover: #0071e3;
  --radius: 12px;

  --body-bg: #0b1020;

  --nav-text: #f5f7ff;
  --user-name-color: rgba(255,255,255,0.82);
  --ghost-border: rgba(255,255,255,0.25);

  --board-list-bg: #0b1020;
  --page-heading-color: #ffffff;
  --board-card-name-color: #ffffff;
  --board-card-meta-color: rgba(255,255,255,0.72);
  --card-default-bg: rgba(255,255,255,0.10);
  --empty-state-color: rgba(255,255,255,0.72);
  --board-surface: #0a0f1e;

  --modal-bg: rgba(28,30,42,0.55);
  --modal-heading-color: #ffffff;
  --modal-hint-color: rgba(255,255,255,0.70);
  --input-border: rgba(255,255,255,0.20);
  --member-info-color: #ffffff;
  --member-email-color: rgba(255,255,255,0.65);

  --color-picker-bg: rgba(255,255,255,0.12);
  --btn-secondary-bg: rgba(255,255,255,0.14);
  --btn-secondary-text: #ffffff;
  --btn-secondary-hover: rgba(255,255,255,0.22);

  --login-bg-a: #1b2735;
  --login-bg-b: #2a1b4d;
  --login-card-bg: rgba(255,255,255,0.12);
  --login-heading-color: #ffffff;
  --login-sub-color: rgba(255,255,255,0.72);

  --shadow-note: 0 10px 30px rgba(0,0,0,0.35);
}

/* (b) Vivid wallpaper — gives the blur color to refract ────────────────────── */
[data-theme="glass"] body,
[data-theme="glass"] #board-list-view,
[data-theme="glass"] #admin-view {
  background-color: #0b1020;
  background-image:
    radial-gradient(ellipse at 12% 18%, rgba(10,132,255,0.55) 0%, transparent 48%),
    radial-gradient(ellipse at 85% 12%, rgba(175,82,222,0.50) 0%, transparent 50%),
    radial-gradient(ellipse at 78% 82%, rgba(48,209,196,0.45) 0%, transparent 50%),
    radial-gradient(ellipse at 22% 88%, rgba(255,55,140,0.42) 0%, transparent 50%),
    linear-gradient(135deg, #0b1020 0%, #161a36 50%, #0b1020 100%);
  background-attachment: fixed;
}

[data-theme="glass"] #login-screen {
  background-color: #0b1020;
  background-image:
    radial-gradient(ellipse at 15% 20%, rgba(10,132,255,0.55) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 25%, rgba(175,82,222,0.50) 0%, transparent 52%),
    radial-gradient(ellipse at 50% 90%, rgba(48,209,196,0.42) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 78%, rgba(255,55,140,0.38) 0%, transparent 50%),
    linear-gradient(135deg, var(--login-bg-a) 0%, var(--login-bg-b) 100%);
  background-attachment: fixed;
}

/* Board surface — a touch darker so the frosted notes pop on top */
[data-theme="glass"] #cork-board {
  background-color: #060912;
  background-image:
    radial-gradient(ellipse at 18% 22%, rgba(10,132,255,0.40) 0%, transparent 48%),
    radial-gradient(ellipse at 82% 20%, rgba(140,70,200,0.38) 0%, transparent 50%),
    radial-gradient(ellipse at 75% 85%, rgba(40,180,170,0.34) 0%, transparent 52%),
    radial-gradient(ellipse at 20% 82%, rgba(220,50,120,0.30) 0%, transparent 50%),
    linear-gradient(160deg, #060912 0%, #10142b 55%, #060912 100%);
  background-size: cover;
  background-attachment: fixed;
}

/* (c) Frosted chrome ───────────────────────────────────────────────────────── */
[data-theme="glass"] #topnav,
[data-theme="glass"] #board-toolbar {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.12);
  box-shadow: none;
}

[data-theme="glass"] .board-card {
  background: color-mix(in srgb, var(--card-bg, rgba(255,255,255,0.12)) 22%, rgba(255,255,255,0.08)) !important;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.25);
}
[data-theme="glass"] .board-card:hover {
  box-shadow: 0 12px 40px rgba(10,132,255,0.30), 0 8px 32px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.35);
}

[data-theme="glass"] .modal,
[data-theme="glass"] #confirm-box {
  background: var(--modal-bg) !important;
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 20px;
}

[data-theme="glass"] .modal-overlay,
[data-theme="glass"] #confirm-overlay {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Modal & invite inputs hardcode background:white — override for glass */
[data-theme="glass"] .modal input[type="text"],
[data-theme="glass"] .modal input[type="email"],
[data-theme="glass"] .invite-form input {
  background: rgba(255,255,255,0.10);
  color: #fff;
  border-color: rgba(255,255,255,0.20);
}
[data-theme="glass"] .modal input::placeholder,
[data-theme="glass"] .invite-form input::placeholder {
  color: rgba(255,255,255,0.5);
}

[data-theme="glass"] .login-card {
  background: var(--login-card-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 24px;
}

[data-theme="glass"] .users-table-wrap {
  background: rgba(255,255,255,0.07) !important;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.14);
}
[data-theme="glass"] .users-table th {
  background: rgba(255,255,255,0.08);
  border-bottom-color: rgba(255,255,255,0.16);
}
[data-theme="glass"] .users-table td {
  border-bottom-color: rgba(255,255,255,0.08);
}
[data-theme="glass"] .users-table tbody tr:hover td {
  background: rgba(255,255,255,0.06);
}

[data-theme="glass"] #theme-select,
[data-theme="glass"] #note-color-picker {
  background-color: rgba(255,255,255,0.12);
}

[data-theme="glass"] .btn-primary {
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(10,132,255,0.4);
}

/* (d) Sticky notes = frosted colored glass (centerpiece) ───────────────────── */
[data-theme="glass"] .sticky-note {
  background: color-mix(in srgb, var(--note-color, #fef08a) 42%, rgba(255,255,255,0.40)) !important;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.40);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.30), inset 0 1px 0 rgba(255,255,255,0.5);
}

/* Cleaner Apple look — hide pushpins and tape in glass only */
[data-theme="glass"] .sticky-note::before,
[data-theme="glass"] .board-card::before,
[data-theme="glass"] .note-tape {
  display: none;
}

/* (e) Polish fixes ─────────────────────────────────────────────────────────── */

/* Skeleton loaders: light shimmer so the loading state is visible on dark glass */
[data-theme="glass"] .skeleton-preview,
[data-theme="glass"] .skeleton-line {
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.16) 50%, rgba(255,255,255,0.06) 75%);
  background-size: 400% 100%;
}

/* Comment input focus ring → Apple blue (was juunit orange) */
[data-theme="glass"] .comment-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(10,132,255,0.30);
}

/* Frosted toasts */
[data-theme="glass"] .toast {
  background: rgba(30,41,59,0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.12);
}
