@import url('https://fonts.googleapis.com/css2?family=Segoe+UI:wght@400;500;600&display=swap');

:root {
  --primary: #0078d4;
  --primary-dark: #106ebe;
  --primary-light: #deecf9;
  --bg: #f3f2f1;
  --card-bg: #fff;
  --text: #323130;
  --text-light: #666;
  --text-muted: #8a8886;
  --border: #edebe9;
  --danger: #d13438;
  --success: #107c10;
  --warning: #ff8c00;
  --sidebar-bg: #fff;
  --sidebar-width: 260px;
  --radius: 1rem;
  --radius-lg: 1.5rem;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Layout: Sidebar + Main */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-brand {
  background: linear-gradient(90deg, #0078d4, #106ebe);
  color: #fff;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand .brand-icon {
  width: 40px;
  height: 40px;
  background: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 24px;
  font-weight: 700;
}

.sidebar-brand .brand-text {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  opacity: 0.75;
  margin-top: -2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  margin-bottom: 4px;
  transition: background 0.15s;
}

.sidebar-nav a:hover { background: #f3f2f1; }
.sidebar-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-nav a .nav-icon {
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Main content area */
.main-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Whiteboard page - override main-area background */
.main-area.whiteboard-bg {
  background: #e8e6e3;
}

.main-area.whiteboard-bg .topbar {
  background: #ffffff;
  color: #333;
  margin: 8px 8px 0 8px;
  border-radius: 4px 4px 0 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}

.main-area.whiteboard-bg .topbar select {
  background: #fff;
  color: #333;
  border: 1px solid var(--border);
}

/* Top bar */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

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

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

.topbar-center .meta-item label {
  font-size: 10px;
  margin-bottom: 1px;
}
.topbar-center .meta-item span,
.topbar-center .meta-item select,
.topbar-center .meta-item input {
  font-size: 12px;
}

.topbar select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 2rem;
  padding: 8px 20px;
  font-size: 14px;
  outline: none;
}

.topbar select:focus { border-color: var(--primary); }

.btn-new-task {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  padding: 8px 20px;
  border-radius: 2rem;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-new-task:hover { background: var(--primary-dark); }

/* Page content */
.page-content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* Whiteboard wrapper for boards page */
.page-content.whiteboard {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow-y: auto;
}

.page-content.whiteboard .kanban {
  flex: 1;
  gap: 16px;
  padding: 16px;
  margin: 0 8px 8px 8px;
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.page-content.whiteboard .kanban-col {
  background: #ffffff;
  border-radius: 6px;
  border: none;
}

.page-content.whiteboard > .kanban,
.page-content.whiteboard > *:not(.kanban):not(form):not(button):not(div[style*="margin-bottom:12px"]):not(div[style*="filterSection"]) {
  background: #ffffff;
}

/* Whiteboard filters bar */
.page-content.whiteboard > div:first-child,
.page-content.whiteboard > button:first-of-type {
  margin: 12px 8px 0 8px;
}

/* Kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.kanban-col {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px;
  min-height: 400px;
  border: none;
}

.kanban-col h2 {
  font-size: 22px;
  padding: 8px 16px;
  margin: -20px -20px 16px -20px;
  font-weight: 600;
  font-family: 'Comic Sans MS','Segoe Script','Bradley Hand',cursive;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-col h2 .col-count {
  background: rgba(0,0,0,0.06);
  padding: 2px 10px;
  border-radius: 1rem;
  font-size: 12px;
  font-weight: 500;
}

.kanban-col[data-status="Open"] h2 { color: var(--primary); }
.kanban-col[data-status="InProgress"] h2 { color: var(--warning); }
.kanban-col[data-status="Closed"] h2 { color: var(--success); }

.kanban-col.drag-over { background: #deecf9; }

/* Task cards */
.card {
  background: #fff9c4;
  border: none;
  border-radius: 2px;
  padding: 20px 18px 14px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 2px 3px 8px rgba(0,0,0,0.1);
  position: relative;
  /* Paper texture via subtle gradient */
  background-image: linear-gradient(135deg, rgba(0,0,0,0.02) 25%, transparent 25%, transparent 50%, rgba(0,0,0,0.02) 50%, rgba(0,0,0,0.02) 75%, transparent 75%);
  background-size: 4px 4px;
}

.card:hover {
  transform: translateY(-3px) rotate(-0.5deg);
  box-shadow: 3px 5px 14px rgba(0,0,0,0.15);
}

/* Fold effect top-right corner */
.card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 20px 20px 0;
  border-color: transparent rgba(0,0,0,0.06) transparent transparent;
  border-radius: 0 2px 0 0;
}

/* Yellow - To Do (default) */
/* Boards page cards - restore original colours */
.kanban-col[data-status="Open"] .card {
  background-color: #fff9c4;
  border-left: 4px solid #f9a825;
}

.kanban-col[data-status="InProgress"] .card {
  background-color: #e3f2fd;
  border-left: 4px solid #1976d2;
}

.kanban-col[data-status="Closed"] .card {
  background-color: #e8f5e9;
  border-left: 4px solid #2e7d32;
}

/* Unallocated tasks - white regardless of status */
.card.unallocated {
  background-color: #ffffff !important;
  border-left: 4px solid #bdbdbd !important;
}


/* Todo items - clean card style */
.todo-item {
  border: none;
  border-radius: 2px;
  padding: 20px;
  cursor: grab;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 2px 3px 8px rgba(0,0,0,0.12);
  position: relative;
}

/* Sticky note colours by assigned color index (via JS) - 40% transparent */
.todo-item.sticky-red {
  background: rgba(253, 236, 234, 0.6);
  border-left: 6px solid #e53935;
}
.todo-item.sticky-orange {
  background: rgba(255, 243, 224, 0.6);
  border-left: 6px solid #fb8c00;
}
.todo-item.sticky-yellow {
  background: rgba(255, 249, 196, 0.6);
  border-left: 6px solid #f9a825;
}
.todo-item.sticky-green {
  background: rgba(232, 245, 233, 0.6);
  border-left: 6px solid #2e7d32;
}
.todo-item.sticky-blue {
  background: rgba(227, 242, 253, 0.6);
  border-left: 6px solid #1976d2;
}
.todo-item.sticky-purple {
  background: rgba(243, 229, 245, 0.6);
  border-left: 6px solid #7b1fa2;
}
.todo-item.sticky-pink {
  background: rgba(252, 228, 236, 0.6);
  border-left: 6px solid #c2185b;
}
.todo-item.sticky-teal {
  background: rgba(224, 242, 241, 0.6);
  border-left: 6px solid #00897b;
}
.todo-item.sticky-none {
  background: rgba(250, 248, 245, 0.6);
  border-left: 6px solid #bdbdbd;
}

.todo-item:active {
  cursor: grabbing;
}

.todo-item:hover {
  transform: translateY(-3px) rotate(-0.5deg);
  box-shadow: 4px 6px 16px rgba(0,0,0,0.18);
}

.card .card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 8px;
}

.card p {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.card .due {
  font-size: 12px;
  color: #c62828;
  font-weight: 600;
  margin-top: 4px;
}

.card .step-info {
  font-size: 12px;
  color: #5d4037;
  margin-top: 4px;
}

.card .allocations {
  font-size: 12px;
  color: #795548;
  margin-top: 4px;
}

.card.dragging { opacity: 0.5; }

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.filters label { font-size: 13px; font-weight: 600; color: var(--text); }

.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: 2rem;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  color: var(--text);
}

.filter-pill:hover { border-color: var(--primary); color: var(--primary); }
.filter-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.filters select, .filters input {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
}

.filters select:focus, .filters input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Status tabs */
.status-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.status-tabs a, .status-tabs button {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  text-decoration: none;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.status-tabs a:hover, .status-tabs button:hover { color: var(--text); }
.status-tabs a.active, .status-tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea { resize: vertical; min-height: 80px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 2rem;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a0272a; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #0b6b0b; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 12px; }

/* Task/Step detail page */
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.detail-header h1 {
  font-size: 28px;
  font-weight: 600;
}

.edit-btn {
  cursor: pointer;
  font-size: 20px;
  padding: 8px;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.edit-btn:hover { background: #f3f2f1; }

.task-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.meta-item { font-size: 13px; }
.meta-item label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.meta-item span, .meta-item select, .meta-item input[type="date"] {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.meta-item select, .meta-item input[type="date"] {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  min-width: 120px;
}

.meta-select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
  min-width: 100px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.meta-select:focus {
  outline: none;
  border-color: var(--primary);
}

.meta-item select:focus, .meta-item input[type="date"]:focus {
  outline: none;
  border-color: var(--primary);
}

/* Steps list */
.steps-list { margin: 12px 0; }

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card-bg);
  border: 1px solid #f0eeec;
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  font-size: 14px;
  transition: border-color 0.15s;
}

.step-item:hover { border-color: var(--primary); }
.step-item.completed { text-decoration: line-through; opacity: 0.5; }

.step-item input[type=checkbox] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

.step-item a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.step-item a:hover { text-decoration: underline; }

/* Notes */
.notes-list { margin: 12px 0; }

.note-item {
  padding: 14px 18px;
  background: #fff;
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  margin-bottom: 8px;
}

.note-item .note-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: inline;
  margin-right: 8px;
}

.note-item .note-content { font-size: 13px; display: inline; }

/* Attachments */
.attachments { margin: 12px 0; }

.attachment-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--primary-light);
  border-radius: var(--radius);
  font-size: 12px;
  margin: 2px 4px 2px 0;
}

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

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  margin: 12px 0;
  transition: border-color 0.15s, background 0.15s;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Login */
.login-box {
  max-width: 400px;
  margin: 80px auto;
  padding: 32px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  position: relative;
  z-index: 1;
}

.login-box h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 24px;
  text-align: center;
}

/* Section headers */
.section-header {
  font-size: 15px;
  font-weight: 600;
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header .btn-sm { font-size: 12px; }

/* Calendar */
.calendar-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.calendar-controls select, .calendar-controls button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: #fff;
}

.calendar-grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cal-header {
  background: var(--primary);
  color: #fff;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.cal-cell {
  background: var(--card-bg);
  padding: 6px;
  min-height: 80px;
  font-size: 11px;
}

.cal-cell.today { background: #fffde7; }
.cal-cell .cal-date { font-weight: 600; font-size: 12px; margin-bottom: 2px; }

.cal-task {
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 6px;
  margin-bottom: 2px;
  font-size: 11px;
}

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

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-area { margin-left: 0; }
  .kanban { grid-template-columns: 1fr; }
  .task-meta { grid-template-columns: 1fr; }
  .filters { flex-direction: column; }
  .topbar { padding: 0 12px; }
  .page-content { padding: 16px; }
}

@media (max-width: 1024px) {
  .sidebar { width: 60px; }
  .sidebar .brand-text, .sidebar .brand-sub, .sidebar-nav a span, .sidebar-footer { display: none; }
  .sidebar-nav a { justify-content: center; padding: 12px; }
  .sidebar-brand { justify-content: center; padding: 16px 8px; }
  .main-area { margin-left: 60px; }
}