:root {
  --sidebar-width: 248px;
  --ink: #231F20;
  --ink-soft: #67686B;
  --muted: #67686B;
  --line: #e6e2e8;
  --line-soft: #f0eef2;
  --paper: #f6f4f8;
  --card: #ffffff;
  --sidebar: #ffffff;
  --sidebar-hover: #f4f1f7;
  --accent: #462C6B;
  --accent-hover: #351f54;
  --accent-wash: #efeaf5;
  --magenta: #CA1F47;
  --forest: #4890C0;
  --forest-wash: #e7f2f8;
  --sky: #4890C0;
  --sky-wash: #e7f2f8;
  --warn: #F26524;
  --warn-wash: #fdeee6;
  --danger: #CA1F47;
  --danger-wash: #fbe7ec;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 0 rgba(35, 31, 32, 0.04), 0 8px 24px rgba(35, 31, 32, 0.04);

  --border-color: var(--line);
  --border-soft: var(--line-soft);
  --text-primary: var(--ink);
  --text-secondary: var(--ink-soft);
  --text-tertiary: var(--muted);
  --bg-primary: var(--card);
  --bg-secondary: var(--paper);
  --bg-tertiary: var(--line-soft);
  --bg-hover: #f7f5f9;
  --accent-primary: var(--accent);
  --accent-primary-hover: var(--accent-hover);
  --accent-light: var(--accent-wash);
  --accent-soft: #fbf7f4;
  --success: var(--forest);
  --success-light: var(--forest-wash);
  --warning: var(--warn);
  --warning-light: var(--warn-wash);
  --danger-light: var(--danger-wash);
  --info: var(--sky);
  --info-light: var(--sky-wash);
  --shadow-sm: var(--shadow);
  --shadow-md: var(--shadow);
}

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

body {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  min-height: 100vh;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  z-index: 1100;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.topbar-brand img {
  height: 32px;
  width: auto;
  display: block;
}

.main-content {
  margin-left: 0;
  margin-top: 52px;
  min-height: calc(100vh - 52px);
  padding: 16px 20px 32px;
}

.container-fluid {
  max-width: 1180px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.03em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 0;
}

.search-wrapper {
  position: relative;
  width: 260px;
}

.search-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
}

.search-wrapper .form-control {
  padding-left: 36px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  background: var(--card);
}

.search-wrapper .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(70, 44, 107, 0.16);
}

.btn,
.btn-primary,
.btn-secondary,
.btn-outline-secondary,
.btn-outline-danger,
.btn-show-more {
  font-size: 13px;
  padding: 7px 14px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  font-weight: 600;
  font-family: inherit;
  border-width: 1px;
  box-shadow: none;
}

.btn-sm,
.btn-group-sm > .btn {
  padding: 4px 10px;
  font-size: 12px;
  min-height: 32px;
  height: auto;
  border-radius: 8px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-secondary,
.btn-outline-secondary,
.btn-show-more {
  background: #fff;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-outline-danger {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
}

.btn:hover,
.btn:focus,
.btn:active,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active,
.btn-show-more:hover,
.btn-show-more:focus,
.ai-chip:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
  color: #fff !important;
  box-shadow: none !important;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus,
.btn-outline-danger:active {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: #fff !important;
  box-shadow: none !important;
}

/* Stats */
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
}

.stat-card:hover {
  border-color: #b7c5bb;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--forest-wash);
  color: var(--forest);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
  font-weight: 500;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table {
  font-size: 13px;
  margin: 0;
}

.table thead th {
  background: #f7faf7;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.table tbody td {
  padding: 8px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line-soft);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  cursor: pointer;
}

.table tbody tr:hover {
  background: #fbf8f5;
}

.badge {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  letter-spacing: 0.01em;
}

.badge-warning {
  background: var(--warn-wash);
  color: var(--warn);
}

.badge-info {
  background: var(--sky-wash);
  color: var(--sky);
}

.badge-success {
  background: var(--forest-wash);
  color: var(--forest);
}

.badge-primary {
  background: var(--accent-wash);
  color: var(--accent-hover);
}

.badge-secondary {
  background: var(--line-soft);
  color: var(--ink-soft);
}

.badge-danger {
  background: var(--danger-wash);
  color: var(--danger);
}

.modal {
  z-index: 1200;
}

.modal-backdrop {
  z-index: 1190;
}

.modal-dialog {
  margin: 1.5rem auto;
  max-width: min(640px, calc(100% - 24px));
}

.modal-dialog.modal-lg {
  max-width: min(800px, calc(100% - 24px));
}

.modal-dialog-centered {
  min-height: calc(100% - 3rem);
}

.modal-dialog-scrollable .modal-content,
.modal-content {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(20, 32, 28, 0.16);
  max-height: calc(100vh - 3rem);
}

.modal-header,
.modal-footer {
  border-color: var(--line-soft);
  flex-shrink: 0;
}

.modal-body {
  overflow-y: auto;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 5px;
}

.form-control,
.form-select {
  font-size: 14px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: inherit;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(70, 44, 107, 0.16);
}

textarea.form-control {
  resize: vertical;
}

.project-header-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.project-header-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
}

.project-main-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px 0;
  letter-spacing: -0.03em;
}

.project-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.meta-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
  font-weight: 600;
}

.meta-value {
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}

.section-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.section-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.feature-item {
  background: #f8faf7;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}

.feature-item:hover {
  border-color: var(--line);
}

.feature-item h6 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.feature-item p {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 8px 0;
}

.feature-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.project-tabs {
  border-bottom: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px;
  gap: 4px;
  box-shadow: var(--shadow);
  margin-bottom: 14px !important;
  display: flex;
  flex-wrap: wrap;
}

.project-tabs .nav-item {
  flex: 1;
  min-width: 90px;
}

.project-tabs .nav-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border: none !important;
  border-radius: 6px !important;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.project-tabs .nav-link:hover {
  color: #fff !important;
  background: var(--accent-hover) !important;
}

.project-tabs .nav-link.active {
  color: #fff !important;
  background: var(--accent) !important;
}

.tab-pane-content {
  display: none;
}

.tab-pane-content.active {
  display: block;
}

.highlight-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  height: 100%;
  background: var(--card);
  box-shadow: var(--shadow);
}

.highlight-now {
  border-top: 3px solid var(--warn);
}

.highlight-next {
  border-top: 3px solid var(--forest);
}

.highlight-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.highlight-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}

.highlight-text {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.55;
}

.history-timeline {
  position: relative;
  padding-left: 22px;
}

.history-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}

.timeline-event {
  position: relative;
  padding-bottom: 14px;
}

.timeline-event:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--card);
  background: var(--accent);
}

.timeline-dot-milestone,
.timeline-dot-demo,
.timeline-dot-meeting,
.timeline-dot-feedback,
.timeline-dot-development,
.timeline-dot-release {
  background: var(--forest);
}

.timeline-event-card {
  background: #f8faf7;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.timeline-event-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 4px;
}

.timeline-event-date {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.timeline-event-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.timeline-event-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.type-milestone { background: var(--accent-wash); color: var(--accent-hover); }
.type-demo { background: var(--sky-wash); color: var(--sky); }
.type-meeting { background: var(--forest-wash); color: var(--forest); }
.type-feedback { background: var(--warn-wash); color: var(--warn); }
.type-development { background: var(--forest-wash); color: var(--forest); }
.type-release { background: var(--danger-wash); color: var(--danger); }

.timeline-event-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 6px;
}

.flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.flow-legend-item {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.flow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: var(--forest);
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-date {
  color: var(--muted);
  white-space: nowrap;
  min-width: 90px;
  font-size: 12px;
  font-weight: 500;
  font-family: 'IBM Plex Mono', monospace;
}

.activity-text {
  color: var(--ink);
}

.meeting-card {
  background: #f8faf7;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}

.meeting-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 6px;
}

.meeting-date {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  font-family: 'IBM Plex Mono', monospace;
}

.meeting-title {
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

.meeting-attendees,
.meeting-detail {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.meeting-summary {
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 6px;
}

.task-group-title {
  font-size: 13px;
  margin-bottom: 10px;
}

.empty-state {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
}

.empty-state.small {
  padding: 14px;
}

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

.small {
  font-size: 13px;
}

/* search box on the dashboard / project page */
.ai-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.ai-panel::before {
  display: none;
}

.ai-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 6px;
  flex-wrap: wrap;
}

.ai-panel-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-avatar {
  display: none;
}

.ai-panel-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.ai-panel-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 0;
}

.ai-badge-live {
  display: none;
}

.ai-hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}

.ai-panel-body {
  padding: 8px 10px;
}

.ai-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
}

.ai-input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(70, 44, 107, 0.14);
  background: #fff;
}

.ai-input-row .form-control {
  border: none;
  background: transparent;
  box-shadow: none !important;
  height: 34px;
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
}

.ai-input-row .btn {
  height: 34px;
  border-radius: 6px;
  flex-shrink: 0;
  padding: 0 14px;
}

.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ai-chip {
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.ai-answer {
  margin-top: 12px;
  display: none;
}

.ai-answer.has-content {
  display: block;
}

.ai-answer-bubble {
  background: #f8faf7;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
}

.ai-answer-label {
  display: none;
}

.ask-answer:empty {
  display: none;
}

.cell-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 280px;
}

.table .cell-clamp {
  max-width: 220px;
}

.btn-show-more {
  display: block;
  width: 100%;
  margin-top: 8px;
}

.feature-item-compact {
  padding: 12px;
}

.meeting-card-compact {
  padding: 12px;
}

.tab-count {
  font-size: 10px;
  font-weight: 700;
  background: var(--line-soft);
  color: var(--ink-soft);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.project-tabs .nav-link.active .tab-count {
  background: var(--accent);
  color: #fff;
}

.min-w-0 {
  min-width: 0;
}

.access-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.access-row {
  padding: 12px 14px;
  background: #f8faf7;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.access-link a {
  font-weight: 600;
  color: var(--accent-hover);
  word-break: break-all;
}

.access-creds {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 8px;
  font-size: 13px;
}

.access-cred code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--line-soft);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--ink);
}

.access-notes {
  margin-top: 6px;
}

.product-thumb {
  width: 56px;
  height: 40px;
  object-fit: contain;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  display: block;
}

.product-hero {
  width: 96px;
  height: 64px;
  object-fit: contain;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}

.product-thumb-logo {
  object-fit: contain;
  background: #fff;
}

.project-name-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

@media (max-width: 900px) {
  .main-content {
    padding: 16px;
  }

  .search-wrapper {
    width: 100%;
  }

  .page-title {
    font-size: 22px;
  }
}
