*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f5f5f7;
  --bg-accent: #ffffff;
  --border-subtle: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.08);
  --danger: #ef4444;
  --idea: #f59e0b;
  --enhancement: #8b5cf6;
  --bug: #ef4444;
  --note: #0ea5e9;
  --shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --transition-fast: 150ms ease-out;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

/* Top nav */

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-subtle);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-square {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.nav-text {
  display: flex;
  flex-direction: column;
}

.nav-title {
  font-weight: 600;
  font-size: 1rem;
}

.nav-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Layout */

main {
  flex: 1;
  padding: 1.5rem 2rem 2rem;
}

.page-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* Buttons */

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  background: #e5e7eb;
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.btn.primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
}

.btn.primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn:hover {
  background: #d4d4d8;
}

.btn.link {
  background: transparent;
  padding-left: 0;
  padding-right: 0;
  color: var(--primary);
  box-shadow: none;
}

.btn.link:hover {
  background: transparent;
  text-decoration: underline;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
}

/* Views */

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Apps grid */

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 320px));
  gap: 1.25rem;
}

.app-card {
  background: var(--bg-accent);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  border-color: rgba(37, 99, 235, 0.35);
}

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

.app-card-title {
  font-weight: 600;
}

.app-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.app-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  background: #e5e7eb;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-pill.in-progress {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.status-pill.released {
  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
}

.status-pill.planning {
  background: rgba(234, 179, 8, 0.12);
  color: #854d0e;
}

.status-pill.on-hold {
  background: rgba(148, 163, 184, 0.25);
  color: #4b5563;
}

.app-card-metrics {
  display: flex;
  gap: 0.75rem;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Board view */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

.app-header p {
  margin: 0.15rem 0 0.3rem;
}

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

.board-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.3rem;
}

.board-column {
  background: var(--bg-accent);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
}

.column-header {
  padding: 0.9rem 1rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 62px; /* below nav */
  background: var(--bg-accent);
  z-index: 5;
}

.column-header h2 {
  margin: 0;
  font-size: 0.95rem;
}

.column-count {
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
  background: #e5e7eb;
  color: var(--text-muted);
}

.column-body {
  padding: 0 0.9rem 0.9rem;
  overflow-y: auto;
}

/* Item cards */

.item-card {
  background: #f9fafb;
  border-radius: var(--radius-md);
  padding: 0.75rem 0.8rem;
  border: 1px solid #e5e7eb;
  margin-bottom: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.item-title {
  font-weight: 600;
}

.item-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

.tag-pill {
  border-radius: var(--radius-pill);
  padding: 0.08rem 0.45rem;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.tag-type-idea {
  background: rgba(245, 158, 11, 0.08);
  color: #92400e;
}

.tag-type-enhancement {
  background: rgba(139, 92, 246, 0.08);
  color: #5b21b6;
}

.tag-type-bug {
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
}

.tag-type-note {
  background: rgba(14, 165, 233, 0.08);
  color: #0369a1;
}

.tag-priority-low {
  background: rgba(148, 163, 184, 0.15);
  color: #4b5563;
}

.tag-priority-medium {
  background: rgba(59, 130, 246, 0.08);
  color: #1d4ed8;
}

.tag-priority-high {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

.item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.15rem;
}

.item-status-select {
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid #d4d4d8;
  background: #ffffff;
}

.item-notes {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Footer */

.footer {
  padding: 0.75rem 2rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-subtle);
  background: #ffffff;
}

.footer-links {
  display: flex;
  gap: 0.75rem;
}

.link-small {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.8rem;
  color: var(--primary);
  cursor: pointer;
}

.link-small:hover {
  text-decoration: underline;
}

/* Modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
  max-width: 480px;
  width: 100%;
  padding: 1.2rem 1.3rem 1rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.modal-body label {
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modal-body input,
.modal-body textarea,
.modal-body select {
  border-radius: 10px;
  padding: 0.35rem 0.5rem;
  border: 1px solid #d4d4d8;
  font-size: 0.85rem;
  font-family: inherit;
}

.modal-footer {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

#modalItemFields {
  display: none;
}

#modalAppFields.hidden,
#modalItemFields.hidden {
  display: none;
}

/* Small screens */

@media (max-width: 900px) {
  main {
    padding-inline: 1.2rem;
  }

  .top-nav {
    padding-inline: 1.2rem;
  }

  .board-columns {
    grid-template-columns: 1fr;
  }

  .board-column {
    max-height: none;
  }
}
