/* ===== 基础样式 ===== */
:root {
    --primary: #07c160;
    --primary-dark: #06ad56;
    --bg: #0a0a0f;
    --card: #151520;
    --border: #2a2a3a;
    --text: #e0e0e0;
    --muted: #8888aa;
    --danger: #ff4d4f;
    --success: #52c41a;
    --warning: #faad14;
    --info: #1890ff;
}

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

body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== 登录页 ===== */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
}
.login-box {
    background: var(--card); border-radius: 16px;
    padding: 40px; width: 360px; box-shadow: 0 8px 32px rgba(0,0,0,.4);
    border: 1px solid var(--border);
}
.login-box h1 { font-size: 22px; margin-bottom: 8px; text-align: center; color: #fff; }
.login-box .sub { text-align: center; color: var(--muted); margin-bottom: 28px; font-size: 13px; }
.login-box input {
    width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; margin-bottom: 16px; background: #0a0a0f; color: #fff;
}
.login-box input:focus { outline: none; border-color: var(--primary); }
.login-box button {
    width: 100%; padding: 12px; background: var(--primary); color: #fff; border: none;
    border-radius: 8px; font-size: 15px; cursor: pointer;
}
.login-box button:hover { background: var(--primary-dark); }

/* ===== 顶部栏 ===== */
.topbar {
    background: var(--card); border-bottom: 1px solid var(--border);
    padding: 12px 20px; display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-size: 16px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 16px; }
.topbar .nav { display: flex; gap: 4px; }
.topbar .nav a {
    padding: 6px 14px; border-radius: 6px; font-size: 13px; color: var(--muted);
}
.topbar .nav a:hover { background: rgba(255,255,255,.05); text-decoration: none; color: #fff; }
.topbar .nav a.active { background: var(--primary); color: #fff; }
.topbar .user { color: var(--muted); font-size: 13px; }
.topbar .logout { margin-left: 12px; font-size: 13px; color: var(--muted); }

/* ===== 布局 ===== */
.container { max-width: 100%; margin: 0; padding: 0; }

/* ===== 按钮 ===== */
.btn {
    display: inline-block; padding: 8px 16px; border: none; border-radius: 6px;
    cursor: pointer; font-size: 13px; background: var(--primary); color: #fff;
    text-decoration: none; transition: all .2s;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn.secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: rgba(255,255,255,.05); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 12px; font-size: 12px; }

/* ===== 表单 ===== */
.form-card { background: var(--card); border-radius: 12px; padding: 24px; max-width: 720px; margin: 20px; border: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.form-card label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; color: var(--text); }
.form-card input, .form-card select, .form-card textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 14px; background: #0a0a0f; color: #fff;
}
.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
    outline: none; border-color: var(--primary);
}
.form-card textarea { min-height: 80px; resize: vertical; }
.form-actions { margin-top: 24px; display: flex; gap: 12px; }

/* ===== 状态标签 ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; white-space: nowrap; }
.badge.todo { background: rgba(136,136,170,.2); color: #aaa; }
.badge.doing { background: rgba(24,144,255,.2); color: #1890ff; }
.badge.done { background: rgba(82,196,26,.2); color: #52c41a; }
.badge.overdue { background: rgba(255,77,79,.2); color: #ff4d4f; }

/* ===== 消息提示 ===== */
.flash { padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.flash.success { background: rgba(82,196,26,.1); color: #52c41a; border: 1px solid rgba(82,196,26,.3); }
.flash.error { background: rgba(255,77,79,.1); color: #ff4d4f; border: 1px solid rgba(255,77,79,.3); }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* ===== 任务列表页 ===== */
.task-filters {
    display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 20px;
    background: var(--card); border-bottom: 1px solid var(--border);
}
.task-filters select, .task-filters input {
    padding: 7px 12px; border: 1px solid var(--border); border-radius: 20px;
    font-size: 13px; background: #0a0a0f; color: #fff;
}
.task-filters select:focus, .task-filters input:focus { outline: none; border-color: var(--primary); }
.task-filters .search { flex: 1; min-width: 200px; }

.task-table-wrap { background: var(--card); border-radius: 12px; overflow-x: auto; margin: 20px; border: 1px solid var(--border); }
.task-table { width: 100%; border-collapse: collapse; min-width: 1200px; }
.task-table th, .task-table td {
    padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border);
    vertical-align: top; font-size: 13px; color: var(--text);
}
.task-table th { background: rgba(255,255,255,.02); font-weight: 600; white-space: nowrap; color: var(--muted); }
.task-table tr:hover td { background: rgba(255,255,255,.02); }
.task-table .task-name { font-weight: 600; color: #fff; }
.task-table .muted { color: var(--muted); font-size: 12px; }
.task-table .cell-max { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-table .cell-max:hover { white-space: normal; }

/* ===== 甘特图页 - 深色科技风格 ===== */
.gantt-page { padding: 0; background: var(--bg); }

.gantt-toolbar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 20px;
    background: var(--card); border-bottom: 1px solid var(--border);
}
.gantt-toolbar select, .gantt-toolbar input {
    padding: 7px 12px; border: 1px solid var(--border); border-radius: 20px;
    font-size: 13px; background: #0a0a0f; color: #fff;
}
.gantt-toolbar select:focus, .gantt-toolbar input:focus { outline: none; border-color: var(--primary); }
.gantt-toolbar input { width: 200px; }
.zoom-group { display: inline-flex; border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
.zoom-btn { padding: 6px 14px; border: none; background: transparent; cursor: pointer; font-size: 13px; color: var(--muted); }
.zoom-btn + .zoom-btn { border-left: 1px solid var(--border); }
.zoom-btn.active { background: var(--primary); color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-left: auto; font-size: 12px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.swatch { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch-done { background: #52c41a; }
.swatch-overdue { background: #ff4d4f; }
.swatch-todo { background: #888; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; padding: 16px 20px; background: var(--card); border-bottom: 1px solid var(--border); }
.stat-card { background: rgba(255,255,255,.03); border-radius: 8px; padding: 12px 14px; border: 1px solid var(--border); }
.stat-num { font-size: 22px; font-weight: 700; line-height: 1.2; color: #fff; }
.stat-unit { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }

.gantt-scroll { overflow: auto; max-height: calc(100vh - 260px); min-height: 300px; }
.gantt-header { display: flex; position: sticky; top: 0; z-index: 7; background: var(--card); border-bottom: 1px solid var(--border); }
.corner { position: sticky; left: 0; z-index: 8; width: 300px; flex: none; background: var(--card); border-right: 1px solid var(--border); padding: 8px 14px; font-weight: 600; font-size: 13px; display: flex; flex-direction: column; justify-content: center; color: #fff; }
.corner-sub { font-weight: 400; font-size: 11px; color: var(--muted); }
.tl-header { flex: none; }
.hrow { display: flex; }
.hrow.months { height: 28px; border-bottom: 1px solid var(--border); }
.hm { flex: none; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--muted); border-right: 1px solid var(--border); white-space: nowrap; overflow: hidden; }
.hrow.days { height: 32px; }
.hd { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; color: var(--muted); border-right: 1px solid rgba(255,255,255,.05); line-height: 1.25; }
.hd .hd-num { font-weight: 600; color: var(--text); }
.hd .hd-wd { font-size: 9px; }
.hd.wk { background: rgba(255,255,255,.02); }
.hd.wk .hd-num { color: #666; }
.hd.wkcell { font-size: 11px; }

.gantt-body { display: flex; position: relative; }
.left-rows { position: sticky; left: 0; z-index: 6; width: 300px; flex: none; background: var(--card); border-right: 1px solid var(--border); }
.lrow { padding: 6px 14px; border-bottom: 1px solid rgba(255,255,255,.03); overflow: hidden; }
.lrow-main { display: flex; align-items: center; gap: 8px; }
.lrow-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.risk-flag { color: var(--warning); font-size: 12px; flex: none; }
.lrow-sub { display: flex; gap: 6px; font-size: 11px; white-space: nowrap; overflow: hidden; }
.muted { color: var(--muted); }

.tl-body { position: relative; flex: none; background: var(--bg); }
.grid-layer { position: absolute; inset: 0; }
.g-line { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.05); }
.g-weekend { position: absolute; top: 0; bottom: 0; background: rgba(255,255,255,.02); }
.bars-layer { position: absolute; inset: 0; }

/* 任务条 - 渐变色 + 发光效果 */
.bar { position: absolute; border-radius: 6px; cursor: pointer; display: flex; align-items: center; overflow: hidden; transition: all .2s; }
.bar:hover { filter: brightness(1.15); z-index: 5; transform: translateY(-1px); }
.bar-inner { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 10px; min-width: 0; overflow: hidden; }
.bar-name { font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.bar-date { font-size: 9px; color: rgba(255,255,255,.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.bar-todo .bar-name { color: var(--text); text-shadow: none; }
.bar-todo .bar-date { color: var(--muted); }
.bar-check { margin-left: auto; color: #fff; font-size: 12px; padding: 0 6px; flex: none; }

/* 模块渐变色 */
.bar.module-品牌中心 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); box-shadow: 0 4px 12px rgba(245,87,108,.3); }
.bar.module-内容设计中心 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); box-shadow: 0 4px 12px rgba(79,172,254,.3); }
.bar.module-电商运营中心 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); box-shadow: 0 4px 12px rgba(67,233,123,.3); }
.bar.module-直播运营中心 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); box-shadow: 0 4px 12px rgba(250,112,154,.3); }
.bar.module-default { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); box-shadow: 0 4px 12px rgba(102,126,234,.3); }

/* 状态样式 */
.bar.status-done { opacity: 0.7; }
.bar.status-overdue { background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%) !important; box-shadow: 0 4px 12px rgba(255,65,108,.4) !important; }
.bar.status-todo { background: rgba(255,255,255,.1) !important; box-shadow: none !important; border: 1px dashed rgba(255,255,255,.3); }

.arrow-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.dep-arrow { fill: none; stroke-width: 1.5; }
.dep-arrow.auto { stroke: rgba(255,255,255,.2); }
.dep-arrow.manual { stroke: var(--primary); stroke-width: 2; }
.dep-dot { fill: rgba(255,255,255,.3); }
.dep-dot.manual { fill: var(--primary); }
.today-line { position: absolute; top: 0; width: 0; border-left: 2px dashed var(--danger); z-index: 4; pointer-events: none; }
.today-tag { position: absolute; top: 4px; left: 4px; background: var(--danger); color: #fff; font-size: 10px; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.gantt-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }

.gantt-tip { position: fixed; display: none; z-index: 100; width: 300px; background: #1a1a2e; color: #fff; border-radius: 8px; padding: 12px 14px; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5); pointer-events: none; border: 1px solid var(--border); }
.tip-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 7px; }
.tip-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.tip-grid span { color: var(--muted); }
.tip-grid b { font-weight: 500; word-break: break-all; color: #fff; }
.tip-progress { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.tip-progress span { color: var(--muted); }
.tip-progress p { margin-top: 2px; line-height: 1.5; color: var(--text); }
.tip-foot { margin-top: 8px; color: #666; font-size: 11px; }

.gantt-inner.left-hidden .corner,
.gantt-inner.left-hidden .left-rows { display: none; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .topbar .nav { display: none; }
    .task-table-wrap { margin: 10px; }
    .stats-row { padding: 12px; gap: 8px; }
    .stat-card { padding: 10px; }
    .stat-num { font-size: 18px; }
    .gantt-toolbar { padding: 10px 12px; }
    .gantt-toolbar input { width: 140px; }
    .legend { display: none; }
    .corner { width: 200px; }
    .left-rows { width: 200px; }
    .lrow-sub { display: none; }
}
