/* ===================================================================
   悦达项目管理看板 - 统一样式
   =================================================================== */

/* --- Design Tokens (Dark Theme - Default) --- */
:root {
  --bg: #0b0f17;
  --bg-elev: #0f1419;
  --bg-elev2: #161c28;
  --panel: #1a2332;
  --border: #2a3a52;
  --text: #e2e8f0;
  --text-muted: #8b9cb3;
  --accent: #4f8ef7;
  --green: #22c997;
  --orange: #f5a623;
  --red: #ef4444;
  --purple: #a78bfa;
  --topbar-h: 52px;
  --sidebar-w: 240px;
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
}

/* --- Light Theme --- */
.theme-light {
  --bg: #f0f2f5;
  --bg-elev: #ffffff;
  --bg-elev2: #f7f8fa;
  --panel: #ffffff;
  --border: #d8dde6;
  --text: #1a202c;
  --text-muted: #64748b;
  --accent: #3b7de8;
  --green: #16a87a;
  --orange: #d4911c;
  --red: #dc2626;
  --purple: #7c5cbf;
}

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

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
input { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===================================================================
   LOGIN OVERLAY
   =================================================================== */
.login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  transition: opacity 0.4s ease;
}
.login-overlay.hidden { opacity: 0; pointer-events: none; }

.login-bg-dots {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.35;
}

.login-card {
  position: relative; z-index: 1;
  width: 380px; max-width: 90vw;
  padding: 40px 36px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(24px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  text-align: center;
}

.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.login-logo h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.5px; }
.login-subtitle { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 28px; }

.login-field { margin-bottom: 16px; }
.login-field input {
  width: 100%; padding: 12px 16px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: border-color var(--transition);
}
.login-field input:focus { outline: none; border-color: var(--accent); }

.login-remember {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; color: var(--text-muted);
  margin-bottom: 20px; cursor: pointer; justify-content: center;
}
.login-remember input[type="checkbox"] {
  accent-color: var(--accent); width: 15px; height: 15px;
}

.login-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--accent), #6c5ce7);
  color: #fff; font-size: 1rem; font-weight: 600;
  border-radius: var(--radius-sm);
  transition: opacity var(--transition), transform var(--transition);
}
.login-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }

.login-error {
  margin-top: 14px; font-size: 0.85rem;
  color: var(--red); min-height: 1.2em;
}

/* ===================================================================
   TOPBAR
   =================================================================== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

.sidebar-toggle {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-elev2); color: var(--text); }

.topbar-brand { display: flex; align-items: center; gap: 8px; }
.topbar-title { font-size: 1.05rem; font-weight: 700; white-space: nowrap; }

.topbar-center { flex: 1; max-width: 420px; }

.global-search {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; height: 34px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 18px;
  transition: border-color var(--transition);
}
.global-search:focus-within { border-color: var(--accent); }
.search-icon { flex-shrink: 0; color: var(--text-muted); }
.global-search input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 0.9rem; min-width: 0;
}
.global-search input::placeholder { color: var(--text-muted); opacity: 0.7; }

.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-role {
  font-size: 0.82rem; color: var(--accent);
  padding: 3px 10px;
  background: rgba(79,142,247,0.12);
  border-radius: 12px; white-space: nowrap;
}
.topbar-date { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

.topbar-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.topbar-btn:hover { background: var(--bg-elev2); color: var(--text); }

/* ===================================================================
   LAYOUT
   =================================================================== */
.layout {
  display: flex;
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  height: calc(100vh - var(--topbar-h));
  position: sticky; top: var(--topbar-h);
  transition: width 0.25s ease, opacity 0.25s ease;
}
.sidebar.collapsed { width: 0; opacity: 0; overflow: hidden; }

.sidebar-inner { padding: 16px 14px; }

.sidebar-section { margin-bottom: 20px; }
.sidebar-heading {
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); margin-bottom: 10px;
}

.filter-group label {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: var(--radius-sm);
  font-size: 0.88rem; cursor: pointer;
  transition: background var(--transition);
}
.filter-group label:hover { background: var(--bg-elev2); }
.filter-group input[type="checkbox"] {
  accent-color: var(--accent); width: 14px; height: 14px; flex-shrink: 0;
}
.filter-count {
  margin-left: auto; font-size: 0.75rem;
  color: var(--text-muted); background: var(--bg-elev2);
  padding: 1px 7px; border-radius: 10px;
}

/* Workload list */
.workload-list { max-height: 280px; overflow-y: auto; }
.workload-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: background var(--transition);
}
.workload-item:hover { background: var(--bg-elev2); }
.workload-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workload-badge {
  font-size: 0.72rem; padding: 1px 7px;
  border-radius: 10px; font-weight: 600;
}
.workload-badge.tasks { background: rgba(79,142,247,0.15); color: var(--accent); }
.workload-badge.overdue { background: rgba(239,68,68,0.15); color: var(--red); }

/* --- Main Content --- */
.main {
  flex: 1; min-width: 0;
  padding: 20px 24px 40px;
}

/* ===================================================================
   KPI ROW
   =================================================================== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 4px; height: 100%; border-radius: 4px 0 0 4px;
}
.kpi-card.kpi-total::before { background: var(--accent); }
.kpi-card.kpi-active::before { background: var(--green); }
.kpi-card.kpi-overdue::before { background: var(--red); }
.kpi-card.kpi-rate::before { background: var(--purple); }

.kpi-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.kpi-value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.kpi-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }
.kpi-value .kpi-unit { font-size: 0.85rem; font-weight: 400; margin-left: 2px; }

/* ===================================================================
   TOOLBAR
   =================================================================== */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

.toolbar-count { font-size: 0.88rem; color: var(--text-muted); }

.view-switch { display: flex; gap: 2px; background: var(--bg-elev2); border-radius: var(--radius-sm); padding: 3px; }
.view-btn {
  width: 32px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.view-btn:hover { color: var(--text); }
.view-btn.active { background: var(--accent); color: #fff; }

/* ===================================================================
   CARDS VIEW
   =================================================================== */
.view-cards { /* container */ }

.dept-group { margin-bottom: 28px; }
.dept-group-title {
  font-size: 1rem; font-weight: 700;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.dept-group-count {
  font-size: 0.75rem; color: var(--text-muted);
  background: var(--bg-elev2); padding: 2px 8px;
  border-radius: 10px; font-weight: 400;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.project-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* Type color strips */
.project-card[data-type="operation"] { border-left-color: #4f8ef7; }
.project-card[data-type="development"] { border-left-color: #a78bfa; }
.project-card[data-type="business"] { border-left-color: #22c997; }
.project-card[data-type="internal"] { border-left-color: #f5a623; }

.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-title { font-size: 1rem; font-weight: 700; line-height: 1.3; flex: 1; min-width: 0; }
.card-priority { flex-shrink: 0; }

.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.card-meta span { font-size: 0.8rem; color: var(--text-muted); }

.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

.card-progress { margin-bottom: 8px; }
.card-progress-bar {
  height: 8px; background: var(--bg-elev2);
  border-radius: 4px; overflow: hidden;
}
.card-progress-fill {
  height: 100%; border-radius: 4px;
  transition: width 0.4s ease;
}
.card-progress-text {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; color: var(--text-muted); margin-top: 4px;
}

.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.8rem; color: var(--text-muted); padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* --- Tags / Badges --- */
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 600;
  line-height: 1.5;
}

/* Type tags */
.tag-operation { background: rgba(79,142,247,0.15); color: #4f8ef7; }
.tag-development { background: rgba(167,139,250,0.15); color: #a78bfa; }
.tag-business { background: rgba(34,201,151,0.15); color: #22c997; }
.tag-internal { background: rgba(245,166,35,0.15); color: #f5a623; }

/* Status tags */
.tag-active { background: rgba(34,201,151,0.15); color: var(--green); }
.tag-completed { background: rgba(139,156,179,0.15); color: var(--text-muted); }
.tag-overdue { background: rgba(239,68,68,0.15); color: var(--red); animation: pulse-red 1.5s infinite; }
.tag-blocked { background: rgba(245,166,35,0.15); color: var(--orange); }
.tag-paused { background: rgba(139,156,179,0.1); color: var(--text-muted); opacity: 0.7; }
.tag-pending { background: rgba(79,142,247,0.1); color: rgba(79,142,247,0.7); }

.tag-in_progress { background: rgba(79,142,247,0.15); color: var(--accent); }
.tag-done { background: rgba(34,201,151,0.15); color: var(--green); }

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Priority tags */
.tag-P0 { background: rgba(239,68,68,0.15); color: var(--red); }
.tag-P1 { background: rgba(245,166,35,0.15); color: var(--orange); }
.tag-P2 { background: rgba(79,142,247,0.15); color: var(--accent); }
.tag-P3 { background: rgba(139,156,179,0.15); color: var(--text-muted); }

/* Deadline classes */
.deadline-overdue { color: var(--red); text-decoration: line-through; }
.deadline-today { color: var(--red); font-weight: 600; }
.deadline-urgent { color: var(--red); }
.deadline-soon { color: var(--orange); }
.deadline-safe { color: var(--green); }

/* Progress colors */
.progress-low { background: var(--red); }
.progress-mid { background: var(--orange); }
.progress-good { background: var(--accent); }
.progress-done { background: var(--green); }

/* ===================================================================
   TABLE VIEW
   =================================================================== */
.view-table { overflow-x: auto; }

.data-table {
  width: 100%; border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table th,
.data-table td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem; white-space: nowrap;
}
.data-table th {
  background: var(--bg-elev2);
  font-weight: 600; font-size: 0.8rem;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.4px; cursor: pointer;
  user-select: none; position: relative;
}
.data-table th:hover { color: var(--text); }
.data-table th .sort-arrow { margin-left: 4px; font-size: 0.7rem; }
.data-table th.sorted { color: var(--accent); }

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:nth-child(even) { background: var(--bg-elev2); }
.data-table tbody tr:hover { background: rgba(79,142,247,0.06); }

.data-table tbody tr.row-overdue {
  border-left: 3px solid var(--red);
}

.table-project-name {
  font-weight: 600; cursor: pointer; color: var(--text);
  transition: color var(--transition);
}
.table-project-name:hover { color: var(--accent); }

.table-progress-bar {
  display: inline-flex; align-items: center; gap: 8px;
}
.table-progress-track {
  width: 80px; height: 6px;
  background: var(--bg-elev2); border-radius: 3px; overflow: hidden;
}
.table-progress-fill { height: 100%; border-radius: 3px; }
.table-progress-text { font-size: 0.8rem; color: var(--text-muted); }

/* ===================================================================
   TIMELINE VIEW
   =================================================================== */
.view-timeline { overflow-x: auto; }

.timeline-container {
  min-width: 100%; position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.timeline-header {
  display: flex; position: sticky; top: 0; z-index: 5;
  background: var(--bg-elev2);
  border-bottom: 1px solid var(--border);
}
.timeline-label-col {
  width: 180px; min-width: 180px; flex-shrink: 0;
  padding: 8px 12px; font-size: 0.8rem;
  font-weight: 600; color: var(--text-muted);
  border-right: 1px solid var(--border);
}
.timeline-dates {
  display: flex; flex: 1;
}
.timeline-date-cell {
  flex: 1; min-width: 28px;
  padding: 6px 2px; text-align: center;
  font-size: 0.7rem; color: var(--text-muted);
  border-right: 1px solid rgba(42,58,82,0.3);
}
.timeline-date-cell.is-today {
  background: rgba(79,142,247,0.1); color: var(--accent); font-weight: 700;
}
.timeline-date-cell.is-weekend { opacity: 0.5; }

.timeline-body { position: relative; }

.timeline-row {
  display: flex; align-items: center;
  border-bottom: 1px solid var(--border);
  min-height: 36px;
}
.timeline-row:hover { background: rgba(79,142,247,0.03); }

.timeline-row-label {
  width: 180px; min-width: 180px; flex-shrink: 0;
  padding: 4px 12px; font-size: 0.82rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-right: 1px solid var(--border);
  cursor: pointer;
}
.timeline-row-label:hover { color: var(--accent); }

.timeline-bar-area {
  flex: 1; position: relative; height: 36px;
}
.timeline-bar {
  position: absolute; top: 8px; height: 20px;
  border-radius: 4px; font-size: 0.7rem;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600;
  min-width: 4px;
  cursor: pointer;
  transition: opacity var(--transition);
}
.timeline-bar:hover { opacity: 0.85; }

.timeline-bar.bar-active { background: var(--accent); }
.timeline-bar.bar-completed { background: var(--green); opacity: 0.7; }
.timeline-bar.bar-overdue { background: var(--red); }
.timeline-bar.bar-paused { background: var(--text-muted); opacity: 0.5; }
.timeline-bar.bar-cancelled { background: var(--text-muted); opacity: 0.3; }

.timeline-today-line {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--red); z-index: 4; pointer-events: none;
}

/* ===================================================================
   DETAIL PANEL
   =================================================================== */
.detail-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5);
  display: flex; justify-content: flex-end;
  animation: fadeIn 0.2s ease;
}
.detail-overlay[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.detail-panel {
  width: 440px; max-width: 92vw;
  height: 100vh; overflow-y: auto;
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  padding: 24px;
  animation: slideIn 0.25s ease;
}

.detail-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1.3rem;
  transition: background var(--transition), color var(--transition);
}
.detail-close:hover { background: var(--bg-elev2); color: var(--text); }

.detail-header { margin-bottom: 20px; }
.detail-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 10px; line-height: 1.3; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.detail-info-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 20px;
}
.detail-info-item { padding: 12px; background: var(--bg-elev2); border-radius: var(--radius-sm); }
.detail-info-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.detail-info-value { font-size: 0.95rem; font-weight: 600; }

.detail-progress { margin-bottom: 20px; }
.detail-progress-bar {
  height: 12px; background: var(--bg-elev2);
  border-radius: 6px; overflow: hidden; margin-bottom: 6px;
}
.detail-progress-fill { height: 100%; border-radius: 6px; transition: width 0.4s ease; }
.detail-progress-text { font-size: 0.85rem; color: var(--text-muted); text-align: right; }

.detail-section { margin-bottom: 20px; }
.detail-section-title {
  font-size: 0.85rem; font-weight: 700;
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* KPI list */
.detail-kpi-list { display: flex; flex-direction: column; gap: 8px; }
.detail-kpi-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: var(--bg-elev2); border-radius: var(--radius-sm);
}
.detail-kpi-key { font-size: 0.85rem; color: var(--text-muted); }
.detail-kpi-val { font-size: 0.95rem; font-weight: 600; }

/* Task table */
.detail-tasks-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.detail-tasks-table th {
  text-align: left; padding: 6px 8px;
  font-size: 0.75rem; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.detail-tasks-table td {
  padding: 8px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.detail-tasks-table tr:last-child td { border-bottom: none; }
.detail-task-title { font-weight: 600; max-width: 200px; }
.detail-task-note { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ===================================================================
   EMPTY STATE
   =================================================================== */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-muted);
}
.empty-state p { margin-top: 12px; font-size: 0.95rem; }

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 1024px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 0; opacity: 0; overflow: hidden; }
  .sidebar.show { width: var(--sidebar-w); opacity: 1; overflow-y: auto; position: fixed; z-index: 90; top: var(--topbar-h); bottom: 0; }
}
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
  .topbar-center { display: none; }
  .topbar-date { display: none; }
  .detail-panel { width: 100vw; }
}

/* ===================================================================
   PRINT
   =================================================================== */
/* =================================================================
   IMPORT MODAL
   ================================================================= */
.import-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.import-overlay[hidden] { display: none; }

.import-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; width: min(600px, 92vw); max-height: 80vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.import-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.import-header h2 { font-size: 16px; margin: 0; color: var(--text); }

.import-body { padding: 20px; overflow-y: auto; }

.import-tabs {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.import-tab {
  padding: 6px 16px; border-radius: 6px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; transition: all .15s;
}
.import-tab.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

.import-drop-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.import-drop-zone:hover, .import-drop-zone.drag-active {
  border-color: var(--accent); background: rgba(79,142,247,0.06);
}
.import-drop-zone p { margin: 8px 0; color: var(--text-muted); font-size: 14px; }
.import-hint { font-size: 12px !important; opacity: 0.6; }

.import-preview { margin-top: 12px; }
.import-preview-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; font-size: 13px; color: var(--text-muted);
}

.import-preview-table {
  max-height: 240px; overflow: auto; border: 1px solid var(--border);
  border-radius: 8px;
}
.preview-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.preview-table th {
  background: var(--bg); position: sticky; top: 0;
  padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border);
  color: var(--text-muted); font-weight: 600;
}
.preview-table td {
  padding: 5px 8px; border-bottom: 1px solid var(--border);
  color: var(--text); white-space: nowrap; max-width: 160px;
  overflow: hidden; text-overflow: ellipsis;
}

.import-status {
  margin: 12px 0; font-size: 13px; min-height: 18px;
  color: var(--text-muted);
}

.import-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px;
}
.import-btn {
  padding: 8px 20px; border-radius: 8px; font-size: 13px;
  cursor: pointer; border: none; transition: all .15s;
}
.import-btn.primary {
  background: var(--accent); color: #fff;
}
.import-btn.primary:disabled {
  opacity: 0.4; cursor: not-allowed;
}
.import-btn.secondary {
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border);
}
.import-btn-sm {
  padding: 4px 10px; border-radius: 6px; font-size: 12px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
}

@media print {
  .sidebar, .topbar, .login-overlay, .detail-overlay,
  .toolbar, .view-switch { display: none !important; }
  .main { padding: 0; }
  .layout { margin-top: 0; }
  body { background: white; color: black; }
  .project-card, .kpi-card, .data-table { break-inside: avoid; }
  .project-card { box-shadow: none; border: 1px solid #ccc; }
}
