/* ==========================================================
   EPIC FRONTEND — Semiconductor Layout Dashboard
   Light Theme Design System & Component Styles
   ========================================================== */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Surface colors — Light Theme */
  --bg-primary: #f8f9fb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f3f7;
  --bg-elevated: #e9ecf2;
  --bg-hover: #eef0f5;
  --bg-active: #e2e6ee;

  /* Sidebar */
  --sidebar-bg: #ffffff;
  --sidebar-hover: #f1f3f7;
  --sidebar-active: #eef0ff;
  --sidebar-width: 260px;

  /* Text */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;
  --text-inverse: #ffffff;

  /* Accents */
  --accent-primary: #4f46e5;
  --accent-primary-hover: #6366f1;
  --accent-secondary: #7c3aed;
  --accent-glow: rgba(79, 70, 229, 0.1);

  /* Priority colors */
  --priority-critical-bg: #fef2f2;
  --priority-critical-text: #dc2626;
  --priority-critical-border: #fca5a5;
  --priority-high-bg: #fff7ed;
  --priority-high-text: #ea580c;
  --priority-high-border: #fdba74;
  --priority-normal-bg: #eff6ff;
  --priority-normal-text: #2563eb;
  --priority-normal-border: #93c5fd;

  /* Status colors */
  --status-not-started: #94a3b8;
  --status-in-progress: #4f46e5;
  --status-drc: #d97706;
  --status-lvs: #7c3aed;
  --status-review: #0891b2;
  --status-completed: #16a34a;

  /* Semantic */
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --info: #2563eb;

  /* Border */
  --border-subtle: #f0f0f3;
  --border-default: #e5e7eb;
  --border-strong: #d1d5db;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);

  /* Transition */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  color: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ---------- App Layout ---------- */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
}

.sidebar-logo-text {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-logo-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-lg) var(--space-md);
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-lg) var(--space-md) var(--space-sm);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  position: relative;
}

.sidebar-item:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--sidebar-active);
  color: var(--accent-primary);
  font-weight: 600;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 3px;
  height: 24px;
  background: var(--accent-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-item svg,
.sidebar-item .nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.6;
  flex-shrink: 0;
}

.sidebar-item.active svg,
.sidebar-item.active .nav-icon {
  opacity: 1;
  color: var(--accent-primary);
}

.sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}

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

.sidebar-user-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ---------- Main Area ---------- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg-primary);
}

/* ---------- Top Navbar ---------- */
.navbar {
  height: 56px;
  min-height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  z-index: 90;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.navbar-breadcrumb {
  font-size: 13px;
  color: var(--text-tertiary);
}

.navbar-breadcrumb span {
  color: var(--text-primary);
  font-weight: 600;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

/* Role Switcher Toggle */
.role-switcher {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  padding: 3px;
  border: 1px solid var(--border-default);
}

.role-btn {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition-fast);
  color: var(--text-tertiary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.role-btn:not(.active):hover {
  color: var(--text-secondary);
}

.role-btn svg {
  width: 14px;
  height: 14px;
}

.navbar-notification {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
  position: relative;
  color: var(--text-secondary);
}

.navbar-notification:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-secondary);
}

/* ---------- Content Area ---------- */
.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-xl);
}

/* ---------- Page Header ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ---------- KPI Cards Grid ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.kpi-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
}

.kpi-card:nth-child(1)::before {
  background: linear-gradient(90deg, #4f46e5, #6366f1);
}

.kpi-card:nth-child(2)::before {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}

.kpi-card:nth-child(3)::before {
  background: linear-gradient(90deg, #7c3aed, #8b5cf6);
}

.kpi-card:nth-child(4)::before {
  background: linear-gradient(90deg, #dc2626, #ef4444);
}

.kpi-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.kpi-icon svg {
  width: 20px;
  height: 20px;
}

.kpi-icon.indigo {
  background: #eef2ff;
  color: #4f46e5;
}

.kpi-icon.amber {
  background: #fffbeb;
  color: #d97706;
}

.kpi-icon.violet {
  background: #f5f3ff;
  color: #7c3aed;
}

.kpi-icon.red {
  background: #fef2f2;
  color: #dc2626;
}

.kpi-icon.emerald {
  background: #ecfdf5;
  color: #059669;
}

.kpi-icon.sky {
  background: #ecfeff;
  color: #0891b2;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.kpi-subtext {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

.kpi-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: var(--space-sm);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.kpi-change.up {
  color: var(--success);
  background: rgba(22, 163, 74, 0.08);
}

.kpi-change.down {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
}

/* ---------- Progress Bar ---------- */
.progress-bar-wrapper {
  margin-top: var(--space-md);
}

.progress-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.progress-bar-fill.danger {
  background: linear-gradient(90deg, #dc2626, #ef4444);
}

.progress-bar-fill.warning {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}

.progress-bar-fill.success {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

/* ---------- Section ---------- */
.section {
  margin-bottom: var(--space-2xl);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.section-title svg {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
}

/* ---------- Resource Capacity ---------- */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-lg);
}

.resource-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-fast);
}

.resource-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.resource-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.resource-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.resource-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.resource-specialty {
  font-size: 12px;
  color: var(--text-tertiary);
}

.resource-work {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.resource-work-tag {
  display: inline-flex;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 11px;
  color: var(--text-secondary);
  margin-right: 4px;
  margin-bottom: 4px;
}

/* ---------- Kanban Board ---------- */
.kanban-container {
  display: flex;
  gap: var(--space-lg);
  overflow-x: auto;
  padding-bottom: var(--space-lg);
  height: calc(100vh - 160px);
}

.kanban-column {
  min-width: 280px;
  width: 280px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.kanban-column-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.kanban-column-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.kanban-column-count {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.kanban-column-body {
  flex: 1;
  padding: var(--space-md);
  overflow-y: auto;
}

.kanban-column-body.drag-over {
  background: var(--accent-glow);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Kanban Card ---------- */
.kanban-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.kanban-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.kanban-card-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

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

.kanban-card-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 9px;
  color: #fff;
}

.kanban-card-estimate {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
}

.badge-critical {
  background: var(--priority-critical-bg);
  color: var(--priority-critical-text);
  border-color: var(--priority-critical-border);
}

.badge-high {
  background: var(--priority-high-bg);
  color: var(--priority-high-text);
  border-color: var(--priority-high-border);
}

.badge-normal {
  background: var(--priority-normal-bg);
  color: var(--priority-normal-text);
  border-color: var(--priority-normal-border);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
}

.tech-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid;
}

/* ---------- Overdue Pulse ---------- */
.overdue-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
  animation: pulse-overdue 1.5s ease-in-out infinite;
}

@keyframes pulse-overdue {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.overdue-dot {
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: var(--radius-full);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  }

  50% {
    transform: scale(1.2);
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0);
  }
}

/* ---------- Alert Boxes ---------- */
.alert-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.alert-box-icon {
  width: 20px;
  height: 20px;
  color: var(--danger);
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-box-icon svg {
  width: 20px;
  height: 20px;
}

.alert-box-content {
  flex: 1;
}

.alert-box-title {
  font-weight: 600;
  font-size: 13px;
  color: #991b1b;
  margin-bottom: 2px;
}

.alert-box-text {
  font-size: 12px;
  color: #7f1d1d;
  opacity: 0.8;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-ghost {
  color: var(--text-secondary);
  padding: 6px 12px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ---------- Modal / Overlay ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-3xl);
  overflow-y: auto;
  animation: fadeIn var(--transition-fast);
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-xl);
  animation: slideUp var(--transition-normal);
}

.modal-wide {
  max-width: 1000px;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  color: var(--text-tertiary);
}

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

.modal-body {
  padding: var(--space-xl);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border-subtle);
}

/* ---------- Block Detail (GitHub Issue Style) ---------- */
.block-detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  max-height: calc(100vh - 120px);
}

.block-detail-main {
  padding: var(--space-xl);
  overflow-y: auto;
  border-right: 1px solid var(--border-subtle);
}

.block-detail-sidebar {
  padding: var(--space-xl);
  overflow-y: auto;
  background: var(--bg-primary);
}

.block-detail-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  letter-spacing: -0.02em;
}

.block-detail-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
}

/* Discussion Thread */
.discussion-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.discussion-header svg {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
}

.comment {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}

.comment-author {
  font-weight: 600;
  color: var(--text-primary);
}

.comment-role {
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.comment-role.manager {
  background: #f5f3ff;
  color: #6d28d9;
}

.comment-role.engineer {
  background: #eef2ff;
  color: #4338ca;
}

.comment-time {
  color: var(--text-tertiary);
  margin-left: auto;
}

.comment-text {
  padding: var(--space-md) var(--space-lg);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Comment Input */
.comment-input-area {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}

.comment-input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  color: var(--text-primary);
  font-size: 13px;
  resize: vertical;
  min-height: 60px;
}

.comment-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Sidebar Detail Items */
.detail-group {
  margin-bottom: var(--space-xl);
}

.detail-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-sm);
}

.detail-group-value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.detail-dropdown {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' 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 10px center;
}

.detail-dropdown option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* AI Suggestion Badge */
.ai-badge {
  background: linear-gradient(135deg, #f5f3ff, #eef2ff);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-top: var(--space-md);
}

.ai-badge-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.ai-badge-header svg {
  width: 14px;
  height: 14px;
}

.ai-badge-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---------- Form Controls ---------- */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' 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 10px center;
}

.form-select option {
  background: var(--bg-secondary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

/* ---------- Data Table ---------- */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-tertiary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table tbody td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

/* ---------- Activity Feed ---------- */
.activity-feed {
  max-width: 800px;
}

.activity-item {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.activity-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 48px;
  bottom: -1px;
  width: 2px;
  background: var(--border-subtle);
}

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

.activity-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 2px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}

.activity-avatar svg {
  width: 14px;
  height: 14px;
}

.activity-content {
  flex: 1;
  padding-top: 4px;
}

.activity-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.activity-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.activity-text .action-verb {
  color: var(--accent-primary);
  font-weight: 500;
}

.activity-text .block-link {
  color: var(--accent-primary);
  font-weight: 600;
}

.activity-time {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ---------- Template Cards ---------- */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.template-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.template-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.template-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.template-card-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.template-card-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
  margin-bottom: var(--space-lg);
}

.template-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.meta-chip svg {
  width: 12px;
  height: 12px;
}

/* ---------- Effort Widget ---------- */
.effort-widget {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-top: var(--space-sm);
}

.effort-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: var(--space-sm);
}

.effort-label {
  color: var(--text-tertiary);
}

.effort-value {
  color: var(--text-primary);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.effort-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-tertiary);
}

.empty-state-icon {
  margin-bottom: var(--space-lg);
  color: var(--text-tertiary);
  opacity: 0.4;
}

.empty-state-icon svg {
  width: 48px;
  height: 48px;
}

.empty-state-text {
  font-size: 14px;
}

/* ---------- Utility ---------- */
.text-mono {
  font-family: 'JetBrains Mono', monospace;
}

.text-sm {
  font-size: 12px;
}

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

.mt-sm {
  margin-top: var(--space-sm);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

/* ---------- Lucide Icon Base ---------- */
.icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon svg {
  width: 100%;
  height: 100%;
}

/* ---------- Animations ---------- */
.fade-in {
  animation: fadeIn var(--transition-normal);
}

.slide-in {
  animation: slideUp var(--transition-normal);
}

/* ---------- Mobile Warning ---------- */
.mobile-warning {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100vh;
  background-color: var(--bg-primary);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.mobile-warning-content {
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  padding: 20px;
  max-width: 400px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .block-detail-layout {
    grid-template-columns: 1fr;
  }

  .block-detail-sidebar {
    border-right: none;
    border-top: 1px solid var(--border-subtle);
  }
}

@media (max-width: 768px) {
  .mobile-warning {
    display: flex;
  }

  .app-layout {
    display: none;
  }

  .sidebar {
    display: none;
  }

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

  .kanban-container {
    gap: var(--space-md);
  }

  .kanban-column {
    min-width: 260px;
    width: 260px;
  }
}