.app {
  display: flex;
  min-height: 100vh;
  padding: 12px;
  gap: 12px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface-elevated);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.content {
  flex: 1;
  padding: 24px 28px 32px;
  overflow-y: auto;
  overflow-x: hidden;
}

.content-inner {
  max-width: 100%;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.kpi-card.primary {
  background: var(--gradient-premium);
  color: var(--text-on-dark);
  border: 1px solid rgba(201, 169, 98, 0.2);
  box-shadow: var(--shadow-lg);
}

.kpi-card.white {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.kpi-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.kpi-label {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
}

.kpi-card.white .kpi-label {
  color: var(--text-secondary);
  opacity: 1;
}

.kpi-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
}

.kpi-card.white .kpi-arrow {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.kpi-value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  margin: 8px 0 4px;
}

.kpi-meta {
  font-size: 12px;
  opacity: 0.8;
}

.kpi-card.white .kpi-meta {
  color: var(--text-muted);
  opacity: 1;
}

.kpi-meta.positive::before {
  content: "↑ ";
}

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 0.9fr;
  gap: 16px;
}

.dashboard-grid-row2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 0.9fr;
  gap: 16px;
  margin-top: 16px;
}

/* Progress tracker */
.progress-tracker {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 16px 0;
  margin-bottom: 24px;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 80px;
  position: relative;
}

.progress-step::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.progress-step:last-child::after {
  display: none;
}

.progress-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  font-size: 11px;
}

.progress-step.completed .progress-dot {
  background: var(--primary-dark);
  color: #fff;
}

.progress-step.current .progress-dot {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--primary-light);
}

.progress-step-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}

.progress-step.completed .progress-step-label,
.progress-step.current .progress-step-label {
  color: var(--text);
  font-weight: 500;
}

/* Kanban */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  overflow-x: auto;
  min-height: 500px;
}

.kanban-column {
  background: var(--surface-soft);
  border-radius: var(--radius-lg);
  padding: 12px;
  min-width: 180px;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.kanban-column-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.kanban-count {
  background: var(--neutral-bg);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow var(--transition);
}

.kanban-card:hover {
  box-shadow: var(--shadow);
}

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

.kanban-card-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}

.kanban-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Detail grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

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

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-secondary); }
.info-value { font-weight: 500; text-align: right; }

/* Document checklist */
.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

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

.doc-info {
  flex: 1;
  min-width: 0;
}

.doc-name {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 2px;
}

.doc-status-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.doc-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Timeline */
.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 20px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-light);
  border: 2px solid var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.timeline-content {
  flex: 1;
}

.timeline-title {
  font-weight: 500;
  font-size: 13px;
}

.timeline-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Leaderboard */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.leaderboard-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.leaderboard-rank.gold { background: var(--accent-light); color: var(--accent-dark); border: 1px solid var(--accent-muted); }

/* Search results */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 360px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.search-results.open { display: block; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
}

.search-result-item:hover { background: var(--surface-soft); }

.search-result-type {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
