:root {
  --canvas-bg: #051428;
  --canvas-dot: rgba(102, 247, 255, 0.14);
  --surface: #0a1f3d;
  --surface-subtle: #071830;
  --border: rgba(102, 247, 255, 0.16);
  --border-strong: rgba(102, 247, 255, 0.34);

  --ink-primary: #f0f9ff;
  --ink-secondary: #9cb8d4;
  --ink-muted: #6485a6;

  --accent-slate: #38bdf8;
  --accent-blue: #66f7ff;
  --accent-amber: #fbbf24;
  --accent-emerald: #34d399;
  --accent-rose: #fb7185;

  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-card-hover: 0 8px 26px rgba(0, 0, 0, 0.48), 0 0 18px rgba(102, 247, 255, 0.08);
  --shadow-card-drag: 0 16px 38px rgba(0, 0, 0, 0.6), 0 0 24px rgba(102, 247, 255, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink-primary);
  background: var(--canvas-bg);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

/* App Shell */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.app-shell.locked {
  display: none;
}

/* Passcode Gate — Zeta Innovations Navy & Cyan Theme */
.gate {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 30%, #0c274a 0%, #051428 70%, #030d1b 100%);
  color: #f0f9ff;
}

.gate.hidden {
  display: none;
}

.gate-card {
  width: 100%;
  max-width: 360px;
  padding: 36px 28px 32px;
  border-radius: 16px;
  background: rgba(8, 28, 56, 0.82);
  border: 1px solid rgba(102, 247, 255, 0.22);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(102, 247, 255, 0.08);
  text-align: center;
  backdrop-filter: blur(12px);
}

.gate-logo-wrap {
  width: 108px;
  height: 108px;
  margin: 0 auto 20px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 28px rgba(102, 247, 255, 0.28);
}

.gate-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gate-brand {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffffff;
  margin-bottom: 4px;
}

.gate-subtitle {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #66f7ff;
  margin-bottom: 26px;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-label {
  font-size: 0.76rem;
  color: #94b3cc;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gate-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid rgba(102, 247, 255, 0.3);
  background: rgba(4, 16, 34, 0.75);
  color: #ffffff;
  font-family: "JetBrains Mono", monospace;
  font-size: 1.35rem;
  letter-spacing: 0.45em;
  text-align: center;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gate-input::placeholder {
  color: rgba(148, 179, 204, 0.4);
  letter-spacing: 0.25em;
}

.gate-input:focus {
  border-color: #66f7ff;
  box-shadow: 0 0 0 3px rgba(102, 247, 255, 0.18);
}

.gate-error {
  min-height: 18px;
  font-size: 0.78rem;
  color: #ff7b8a;
}

.gate-btn {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #66f7ff 0%, #38bdf8 100%);
  color: #041326;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.12s ease;
}

.gate-btn:hover {
  opacity: 0.92;
}

.gate-btn:active {
  transform: scale(0.99);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.gate-card.shake {
  animation: shake 0.32s ease;
}

.brand-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Top Navigation Bar */
.topbar {
  position: relative;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--ink-primary);
  flex-shrink: 0;
}

.project-title-input {
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-primary);
  letter-spacing: -0.015em;
  padding: 4px 6px;
  border-radius: 5px;
  width: 185px;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.project-title-input:hover {
  background: var(--surface-subtle);
  border-color: var(--border);
}

.project-title-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--ink-primary);
}

.meta-pill {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--ink-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
}

/* Search & Filters */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--ink-muted);
  pointer-events: none;
}

.search-input {
  width: 200px;
  padding: 6px 10px 6px 30px;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--ink-primary);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.search-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--ink-primary);
}

.filter-group {
  display: flex;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.filter-btn {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-secondary);
  padding: 4px 9px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.filter-btn:hover {
  color: var(--ink-primary);
}

.filter-btn.active {
  background: var(--surface);
  color: var(--ink-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn-primary {
  background: var(--ink-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: #272c33;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-subtle);
  border-color: var(--ink-secondary);
}

/* Spatial Architectural Canvas */
.board {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: auto;
  background-color: var(--canvas-bg);
  background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-size: 20px 20px;
  user-select: none;
}

/* Optional Column Headers shown when organized by status */
.column-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.column-header {
  position: absolute;
  top: 20px;
  width: 340px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-secondary);
}

/* Project Card */
.card {
  position: absolute;
  width: 340px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--card-accent, var(--accent-slate));
  border-radius: 6px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
}

.card.dragging {
  box-shadow: var(--shadow-card-drag);
  border-color: var(--ink-secondary);
  cursor: grabbing;
  transition: none;
}

.card.hidden {
  display: none;
}

/* Status Accent Colors */
.card[data-status="todo"]        { --card-accent: var(--accent-slate); }
.card[data-status="in-progress"] { --card-accent: var(--accent-blue); }
.card[data-status="blocked"]     { --card-accent: var(--accent-rose); }
.card[data-status="done"]        { --card-accent: var(--accent-emerald); }

/* Drag Bar */
.card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px 8px;
  border-bottom: 1px solid rgba(102, 247, 255, 0.12);
  cursor: grab;
  touch-action: none;
}

.card.dragging .card-header {
  cursor: grabbing;
}

.drag-handle {
  color: var(--ink-muted);
  font-size: 0.78rem;
  letter-spacing: -1px;
  line-height: 1;
  padding: 2px 3px;
  flex-shrink: 0;
  cursor: grab;
  opacity: 0.55;
  transition: opacity 0.12s ease;
}

.card:hover .drag-handle {
  opacity: 1;
}

.card.dragging .drag-handle {
  cursor: grabbing;
}

.delete-btn {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.card:hover .delete-btn,
.card:focus-within .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: rgba(251, 113, 133, 0.16);
  color: #fb7185;
}

/* Editable Content */
.card-content {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
}

.card-title {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-primary);
  letter-spacing: -0.01em;
  user-select: text;
}

.card-title::placeholder {
  color: var(--ink-muted);
  font-weight: 500;
}

/* Aligned Key-Value Display */
.card-display {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: text;
}

.card-display.hidden {
  display: none;
}

.kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  line-height: 1.45;
}

.kv-label {
  color: var(--ink-secondary);
  flex: 1;
}

.kv-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-primary);
  white-space: nowrap;
  text-align: right;
}

.kv-row.kv-highlight {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-strong);
}

.kv-row.kv-highlight .kv-label {
  font-weight: 600;
  color: var(--ink-primary);
}

.kv-row.kv-highlight .kv-value {
  font-weight: 600;
  color: #66f7ff;
}

.plain-line {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.plain-placeholder {
  font-size: 0.82rem;
  color: #a3aab5;
}

.card-body {
  width: 100%;
  min-height: 96px;
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-secondary);
  user-select: text;
}

.card-body.hidden {
  display: none;
}

.card-body::placeholder {
  color: #a3aab5;
}

/* Footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 8px;
  border-top: 1px solid rgba(102, 247, 255, 0.1);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  color: var(--ink-muted);
}

@media (max-width: 960px) {
  .topbar {
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .filter-group {
    display: none;
  }
}

/* Mobile Optimization */
@media (max-width: 768px) {
  html,
  body {
    overflow: auto;
    height: auto;
    min-height: 100%;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    position: sticky;
    top: 0;
    padding: 12px 16px;
  }

  .project-title-input {
    width: 155px;
    font-size: 0.92rem;
  }

  .board {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px 14px 28px;
    overflow: visible;
  }

  .column-guides {
    display: none;
  }

  .card {
    position: static !important;
    width: 100% !important;
    left: auto !important;
    top: auto !important;
  }

  .card-header {
    cursor: default;
  }

  .drag-handle {
    display: none;
  }

  .delete-btn {
    opacity: 0.6;
  }

  .kv-row {
    font-size: 0.82rem;
    gap: 10px;
  }

  .kv-value {
    font-size: 0.8rem;
  }
}
