@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz@9..144&display=swap');

:root {
  --bg-primary: #FAFAF7;
  --bg-secondary: #F4F3F0;
  --bg-tertiary: #EFEFEC;
  --text-primary: #1a1a18;
  --text-secondary: #7A7A72;
  --accent-primary: #C8553D;
  --accent-light: #E8B5A8;
  --border-color: #E8E7E2;
  --border-light: #F1F0ED;
  --shadow-sm: 0 1px 2px rgba(26, 26, 24, 0.04), 0 1px 3px rgba(26, 26, 24, 0.08);
  --shadow-md: 0 4px 6px rgba(26, 26, 24, 0.08), 0 2px 4px rgba(26, 26, 24, 0.06);
  --shadow-lg: 0 10px 15px rgba(26, 26, 24, 0.1), 0 4px 6px rgba(26, 26, 24, 0.08);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 1rem;
}

p {
  margin-bottom: 1em;
  color: var(--text-primary);
}

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

a:hover {
  color: #A63D2C;
  text-decoration: underline;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.app-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-primary);
}

.main-content {
  flex: 1;
  margin-left: 240px;
  background-color: var(--bg-primary);
}

.main-content--no-sidebar {
  margin-left: 0;
}

/* Admin Top Bar */
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-primary);
}

.topbar-brand:hover {
  text-decoration: none;
  color: var(--text-primary);
}

.topbar-brand-icon {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.topbar-brand-text {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 700;
}

.topbar-brand-x {
  font-weight: 400;
  color: var(--text-secondary);
  margin: 0 0.125em;
}

.topbar-brand-dash {
  color: var(--text-secondary);
  margin: 0 0.15em;
  font-weight: 300;
}

.topbar-brand-version {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 0.25em;
}

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

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.view-toggle {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 5px;
  padding: 2px;
}

.view-toggle-btn {
  padding: 0.25rem 0.625rem;
  border: none;
  background: transparent;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

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

.view-toggle-btn.active {
  background: white;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.density-toggle {
  background: var(--bg-tertiary);
}

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

.topbar-new-btn {
  background: var(--accent-primary) !important;
  color: white !important;
  font-weight: 600;
  border-radius: 5px;
  padding: 0.375rem 0.875rem !important;
}
.topbar-new-btn:hover {
  background: #b04a35 !important;
  color: white !important;
}

/* User Dropdown */
.user-dropdown {
  position: relative;
}

.user-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.user-dropdown-trigger:hover .user-dropdown-avatar {
  background: #A63D2C;
}

.user-dropdown-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.user-dropdown-chevron {
  color: var(--text-secondary);
  transition: transform var(--transition-fast);
}

.user-dropdown.open .user-dropdown-chevron {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
}

.user-dropdown.open .user-dropdown-menu {
  display: block;
}

.user-dropdown-info {
  padding: 0.75rem 1rem;
}

.user-dropdown-info-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.user-dropdown-info-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border-color);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 1rem;
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
  text-decoration: none;
}

.user-dropdown-item:hover {
  background: var(--bg-secondary);
}

.user-dropdown-logout {
  color: #DC2626;
}

.user-dropdown-logout:hover {
  background: #FEF2F2;
}

/* Accent button (reddish brown) */
.btn-accent {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 0.625rem 1rem;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-accent:hover {
  background: #A63D2C;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-accent:active {
  transform: translateY(0);
}

.topbar {
  background-color: white;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.search-box {
  position: relative;
  width: 250px;
}

.search-box input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  background-color: var(--bg-secondary);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background-color: white;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.user-avatar:hover {
  background-color: #A63D2C;
}

.page-content {
  padding: 2rem;
}

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

.page-title {
  margin: 0;
}

.page-actions {
  display: flex;
  gap: 0.75rem;
}

.card {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-light);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  margin: 0;
  font-size: 1.125rem;
}

.card-content {
  margin-bottom: 1rem;
}

.card-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.board {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.board-column {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  padding: 1rem;
  min-height: 500px;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.column-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0;
}

.column-count {
  background-color: var(--text-secondary);
  color: white;
  border-radius: 12px;
  padding: 0.25rem 0.625rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.kanban-card {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  cursor: grab;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kanban-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.kanban-card-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.kanban-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

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

.table-list thead {
  background-color: var(--bg-secondary);
  border-bottom: 2px solid var(--border-color);
}

.table-list th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.table-list tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background-color var(--transition-fast);
}

.table-list tbody tr:hover {
  background-color: var(--bg-secondary);
}

.table-list td {
  padding: 1rem;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.task-detail {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
}

.task-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.task-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.form-input,
.form-textarea,
.form-select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  background-color: white;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(200, 85, 61, 0.1);
}

.form-input::placeholder {
  color: var(--text-secondary);
}

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

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 18px;
  padding-right: 2.5rem;
}

.badge {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-priority-low {
  background-color: #E8E7E2;
  color: #7A7A72;
}

.badge-priority-medium {
  background-color: #DBEAFE;
  color: #1E40AF;
}

.badge-priority-high {
  background-color: #FED7AA;
  color: #B45309;
}

.badge-priority-urgent {
  background-color: #FEE2E2;
  color: #B91C1C;
}

.badge-status-backlog {
  background-color: #E8E7E2;
  color: #7A7A72;
}

.badge-status-todo {
  background-color: #DBEAFE;
  color: #1E40AF;
}

.badge-status-in_progress {
  background-color: #FEF3C7;
  color: #B45309;
}

.badge-status-review {
  background-color: #E9D5FF;
  color: #6B21A8;
}

.badge-status-done {
  background-color: #DCFCE7;
  color: #166534;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background-color: #A63D2C;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: white;
  color: var(--accent-primary);
  border: 1.5px solid var(--accent-primary);
}

.btn-secondary:hover {
  background-color: var(--accent-light);
  border-color: #A63D2C;
}

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

.btn-danger:hover {
  background-color: #B91C1C;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-small {
  padding: 0.5rem 0.875rem;
  font-size: 0.85rem;
}

.btn-large {
  padding: 1rem 1.5rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.comment-thread {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.comment {
  display: flex;
  gap: 1rem;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.comment-author {
  font-weight: 600;
  font-size: 0.95rem;
}

.comment-time {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.comment-text {
  background-color: var(--bg-secondary);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  line-height: 1.5;
}

.comment-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.comment-action {
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.comment-action:hover {
  color: var(--accent-primary);
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3rem 2rem;
  box-shadow: var(--shadow-lg);
}

.login-card h1 {
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.portal-layout {
  background-color: var(--bg-primary);
  min-height: 100vh;
  padding: 2rem;
}

.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
}

.portal-container {
  max-width: 900px;
  margin: 0 auto;
}

.portal-logo {
  font-size: 1.5rem;
  font-weight: 600;
}

.portal-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 1rem 1.5rem;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  max-width: 400px;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-success {
  background-color: #DCFCE7;
  color: #166534;
  border: 1px solid #BBF7D0;
}

.toast-error {
  background-color: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.toast-info {
  background-color: #DBEAFE;
  color: #1E40AF;
  border: 1px solid #BAE6FD;
}

.toast-warning {
  background-color: #FEF3C7;
  color: #B45309;
  border: 1px solid #FCD34D;
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.toast-close {
  margin-left: auto;
  cursor: pointer;
  font-weight: 600;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.toast-close:hover {
  opacity: 1;
}

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  border-style: dashed;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  opacity: 0.4;
  color: var(--text-secondary);
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state-description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(26, 26, 24, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background-color: white;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background-color: white;
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.5rem;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background-color: white;
}

/* ============================================================
   Missing component styles (bug fixes only)
   ============================================================ */

/* Legacy sidebar BEM (kept for backward compat) */
.logout-form { margin: 0; }
.logout-form--inline { display: inline; }

/* Portal Header BEM */
.header { background: white; border-bottom: 1px solid var(--border-color); box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 100; }
.header--portal { margin-bottom: 2rem; }
.header__container { max-width: 1100px; margin: 0 auto; padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.header__brand { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.header__company-name { font-family: 'Fraunces', serif; font-size: 1.125rem; font-weight: 600; color: var(--text-primary); }
.header__nav { flex: 1; display: flex; justify-content: center; }
.header__user { flex-shrink: 0; }
.nav-list--horizontal { display: flex; gap: 0.25rem; list-style: none; }
.user-menu__name { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); margin-right: 0.5rem; }

/* Admin Task Detail */
.task-detail-container { display: grid; grid-template-columns: 1fr 300px; gap: 2.5rem; padding: 2rem; max-width: 1200px; }
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; margin-bottom: 1rem; }
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-primary); }
.breadcrumb .separator { color: var(--text-secondary); }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }
.task-title-form, .task-description-form { margin-bottom: 1rem; }
.task-title-input { width: 100%; font-family: 'Fraunces', serif; font-size: 1.75rem; font-weight: 600; color: var(--text-primary); border: 1px solid transparent; padding: 0.5rem; border-radius: 6px; background: transparent; transition: border-color var(--transition-fast), background var(--transition-fast); }
.task-title-input:hover { border-color: var(--border-color); background: var(--bg-secondary); }
.task-title-input:focus { outline: none; border-color: var(--accent-primary); background: white; box-shadow: 0 0 0 3px rgba(200, 85, 61, 0.1); }
.task-description-textarea { width: 100%; min-height: 100px; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 6px; font-family: 'DM Sans', sans-serif; font-size: 0.95rem; color: var(--text-primary); line-height: 1.6; resize: vertical; }
.task-description-textarea:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(200, 85, 61, 0.1); }
.sidebar-section { margin-bottom: 1.25rem; }
.sidebar-section label { display: block; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); margin-bottom: 0.5rem; }
.badge-overdue { display: inline-block; margin-top: 0.375rem; padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; background: #FEE2E2; color: #B91C1C; }

/* Comments (admin) */
.comments-section { margin-top: 2rem; }
.comments-section h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.comments-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.comments-list .comment { display: flex; flex-direction: column; padding: 1rem; background: white; border: 1px solid var(--border-color); border-radius: 8px; }
.role-badge { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 4px; font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.role-badge.admin { background: #DBEAFE; color: #1E40AF; }
.role-badge.client { background: #E8E7E2; color: #7A7A72; }
.comment-timestamp { font-size: 0.8rem; color: var(--text-secondary); margin-left: auto; }
.no-comments { color: var(--text-secondary); font-size: 0.9rem; padding: 1rem 0; }
.new-comment-form { margin-top: 1rem; }
.comment-textarea { width: 100%; min-height: 80px; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 6px; font-family: 'DM Sans', sans-serif; font-size: 0.9rem; resize: vertical; }
.comment-textarea:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(200, 85, 61, 0.1); }

/* Activity Log */
.activity-section { background: white; border: 1px solid var(--border-color); border-radius: 8px; padding: 1.25rem; }
.activity-section h3 { font-size: 0.95rem; margin-bottom: 1rem; }
.activity-log { display: flex; flex-direction: column; gap: 0.75rem; }
.activity-item { display: flex; gap: 0.625rem; align-items: flex-start; }
.activity-icon { color: var(--accent-primary); font-size: 1.25rem; line-height: 1; flex-shrink: 0; }
.activity-content { min-width: 0; }
.activity-description { font-size: 0.85rem; color: var(--text-primary); margin: 0; line-height: 1.4; }
.activity-timestamp { font-size: 0.75rem; color: var(--text-secondary); }
.no-activity { color: var(--text-secondary); font-size: 0.85rem; }

/* Portal Dashboard */
.portal-content { display: block; max-width: 900px; margin: 0 auto; padding: 0 2rem 2rem; }
.dashboard-header { margin-bottom: 2rem; }
.dashboard-header h1 { margin-bottom: 0.25rem; }
.summary-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: white; border: 1px solid var(--border-color); border-radius: 8px; padding: 1.25rem; text-align: center; transition: box-shadow var(--transition-fast); }
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-value { font-family: 'Fraunces', serif; font-size: 2rem; font-weight: 700; color: var(--accent-primary); line-height: 1; margin-bottom: 0.375rem; }
.stat-label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }

/* Task Groups */
.tasks-section { display: flex; flex-direction: column; gap: 2rem; }
.task-group h2 { font-size: 1.125rem; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border-color); }
.task-group.completed summary h2 { margin: 0; border: none; display: inline; cursor: pointer; }
.task-list { display: flex; flex-direction: column; gap: 0.75rem; }
.task-card { background: white; border: 1px solid var(--border-color); border-radius: 8px; padding: 1rem 1.25rem; transition: box-shadow var(--transition-fast), border-color var(--transition-fast); }
.task-card:hover { box-shadow: var(--shadow-sm); border-color: var(--accent-light); }
.task-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.5rem; }
.task-title { font-weight: 600; font-size: 0.95rem; color: var(--text-primary); text-decoration: none; }
.task-title:hover { color: var(--accent-primary); text-decoration: none; }
.task-badges { display: flex; gap: 0.5rem; flex-shrink: 0; }
.status-backlog { background: #E8E7E2; color: #7A7A72; }
.status-todo { background: #DBEAFE; color: #1E40AF; }
.status-in_progress { background: #FEF3C7; color: #B45309; }
.status-review { background: #E9D5FF; color: #6B21A8; }
.status-done { background: #DCFCE7; color: #166534; }
.priority-low { background: #E8E7E2; color: #7A7A72; }
.priority-medium { background: #DBEAFE; color: #1E40AF; }
.priority-high { background: #FED7AA; color: #B45309; }
.priority-urgent { background: #FEE2E2; color: #B91C1C; }
.task-card .task-meta { display: flex; gap: 1rem; flex-wrap: wrap; border-top: none; padding: 0; }
.meta-item { font-size: 0.8rem; color: var(--text-secondary); }
.meta-label { font-weight: 600; color: var(--text-secondary); font-size: 0.8rem; display: block; margin-bottom: 0.25rem; }
.meta-value { color: var(--text-primary); font-size: 0.9rem; }
.action-section { margin-top: 2rem; text-align: center; }

/* Portal Submit */
.submit-container { display: grid; grid-template-columns: 1fr 280px; gap: 2rem; align-items: start; }
.form-wrapper { background: white; border: 1px solid var(--border-color); border-radius: 8px; padding: 2rem; }
.request-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-control { width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border-color); border-radius: 6px; font-family: 'DM Sans', sans-serif; font-size: 0.95rem; background: white; color: var(--text-primary); transition: border-color var(--transition-fast), box-shadow var(--transition-fast); }
.form-control:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(200, 85, 61, 0.1); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 18px; padding-right: 2.5rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.required { color: var(--accent-primary); }
.form-sidebar { position: sticky; top: 5rem; }
.tip-box { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 8px; padding: 1.5rem; }
.tip-box h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }
.tip-box ul { list-style: none; display: flex; flex-direction: column; gap: 0.625rem; }
.tip-box li { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.4; padding-left: 1rem; position: relative; }
.tip-box li::before { content: ''; position: absolute; left: 0; top: 0.5em; width: 4px; height: 4px; border-radius: 50%; background: var(--accent-primary); }
.alert { padding: 1rem 1.25rem; border-radius: 6px; font-size: 0.9rem; margin-bottom: 1.5rem; }
.alert-success { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; }

/* Portal Task Detail */
.task-detail-header { margin-bottom: 2rem; }
.back-link { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; color: var(--text-secondary); text-decoration: none; margin-bottom: 1rem; }
.back-link:hover { color: var(--accent-primary); text-decoration: none; }
.task-title-section { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.task-title-section h1 { margin: 0; font-size: 1.75rem; }
.task-main-content { display: flex; flex-direction: column; gap: 2rem; }
.task-section { background: white; border: 1px solid var(--border-color); border-radius: 8px; padding: 1.5rem; }
.task-section h2 { font-size: 1.1rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-light); }
.task-description { font-size: 0.95rem; line-height: 1.7; color: var(--text-primary); white-space: pre-wrap; }
.task-meta-section .task-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.task-meta-grid .meta-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; display: block; margin-bottom: 0.25rem; }
.task-meta-grid .meta-value { font-size: 0.95rem; color: var(--text-primary); }
.comments-thread { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.comment-item { padding: 1rem; background: var(--bg-secondary); border-radius: 8px; }
.comment-item .comment-author { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.comment-role { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 4px; font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; background: var(--bg-tertiary); color: var(--text-secondary); }
.comment-form { margin-top: 1rem; }
.sidebar-card { background: white; border: 1px solid var(--border-color); border-radius: 8px; padding: 1.5rem; position: sticky; top: 5rem; }
.sidebar-card h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }
.status-info { font-size: 0.9rem; line-height: 1.6; color: var(--text-secondary); }
.status-info strong { color: var(--text-primary); }

/* Text helpers */
.text-muted { color: var(--text-secondary) !important; }
.text-danger { color: #DC2626 !important; font-weight: 500; }

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .main-content {
    margin-left: 0;
  }

  .admin-topbar {
    padding: 0.5rem 1rem;
  }

  .user-dropdown-name {
    display: none;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .search-box {
    width: 100%;
    order: 3;
    flex-basis: 100%;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .board {
    gap: 1rem;
  }

  .board-column {
    flex: 0 0 280px;
  }

  .task-detail {
    grid-template-columns: 1fr;
  }

  .task-sidebar {
    order: -1;
  }

  .search-box {
    width: 100%;
  }

  .modal {
    width: calc(100% - 2rem);
    max-height: calc(100vh - 2rem);
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  :root {
    font-size: 14px;
  }

  .page-content {
    padding: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .login-card {
    padding: 2rem 1rem;
  }

  .board-column {
    flex: 0 0 260px;
  }

  .page-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .table-list {
    font-size: 0.85rem;
  }

  .table-list th,
  .table-list td {
    padding: 0.75rem 0.5rem;
  }

  .toast {
    right: 0.5rem;
    left: 0.5rem;
  }

  .modal {
    width: 100%;
    max-width: none;
    border-radius: 8px 8px 0 0;
  }

  .modal-overlay {
    align-items: flex-end;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  h3 {
    font-size: 1.125rem;
  }
}
