* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f0f2f5; color: #333; padding: 20px; }
.container { max-width: 1100px; margin: 0 auto; }
h1 { font-size: 24px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h1 small { font-size: 14px; color: #888; font-weight: normal; }
.user-badge { font-size: 13px; color: #555; background: #f5f5f5; padding: 4px 10px; border-radius: 12px; display: inline-flex; align-items: center; gap: 8px; }
.user-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #52c41a; display: inline-block; }
.user-badge .dot.offline { background: #d9d9d9; }
.user-badge button { background: none; border: none; color: #1890ff; cursor: pointer; font-size: 12px; padding: 0; }

/* Banner */
.banner { padding: 8px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.banner.warn { background: #fff7e6; color: #d46b08; border: 1px solid #ffd591; }
.banner.ok { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.08); text-align: center; }
.stat-card .num { font-size: 28px; font-weight: 700; }
.stat-card .label { font-size: 13px; color: #888; margin-top: 4px; }
.stat-card.total .num { color: #1890ff; }
.stat-card.open .num { color: #fa8c16; }
.stat-card.done .num { color: #52c41a; }
.stat-card.overdue .num { color: #ff4d4f; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .search-box { flex: 1; min-width: 200px; position: relative; }
.toolbar .search-box input { width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; outline: none; }
.toolbar .search-box input:focus { border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,.15); }
.toolbar select, .toolbar button { padding: 8px 14px; border-radius: 6px; font-size: 14px; border: 1px solid #d9d9d9; background: #fff; cursor: pointer; }
.toolbar button:disabled { opacity: 0.5; cursor: not-allowed; }
.toolbar button.primary { background: #1890ff; color: #fff; border-color: #1890ff; }
.toolbar button.primary:hover { background: #40a9ff; }
.toolbar button.danger { background: #ff4d4f; color: #fff; border-color: #ff4d4f; }
.toolbar button.danger:hover { background: #ff7875; }

/* Modal */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.45); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 90%; max-width: 540px; max-height: 90vh; overflow-y: auto; padding: 24px; box-shadow: 0 6px 30px rgba(0,0,0,.15); }
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #555; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; outline: none; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,.15); }
.form-group textarea { resize: vertical; min-height: 60px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-error { color: #ff4d4f; font-size: 13px; margin-top: 4px; min-height: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal-actions button { padding: 8px 20px; border-radius: 6px; font-size: 14px; border: 1px solid #d9d9d9; cursor: pointer; }
.modal-actions .btn-primary { background: #1890ff; color: #fff; border-color: #1890ff; }
.modal-actions .btn-primary:hover { background: #40a9ff; }
.modal-actions .btn-cancel { background: #fff; }
.modal-actions button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Login view */
.login-wrap { max-width: 380px; margin: 60px auto; background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.login-wrap h1 { justify-content: center; margin-bottom: 8px; }
.login-wrap .subtitle { text-align: center; color: #888; font-size: 13px; margin-bottom: 24px; }
.login-tabs { display: flex; gap: 0; border-bottom: 1px solid #f0f0f0; margin-bottom: 20px; }
.login-tabs button { flex: 1; padding: 10px; background: none; border: none; cursor: pointer; font-size: 14px; color: #888; border-bottom: 2px solid transparent; }
.login-tabs button.active { color: #1890ff; border-bottom-color: #1890ff; font-weight: 600; }
.login-wrap .form-error { min-height: 20px; margin-bottom: 8px; }
.login-wrap button.submit { width: 100%; padding: 10px; background: #1890ff; color: #fff; border: none; border-radius: 6px; font-size: 15px; cursor: pointer; }
.login-wrap button.submit:hover { background: #40a9ff; }
.login-wrap button.submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Table */
.table-wrap { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 14px; white-space: nowrap; }
th { background: #fafafa; font-weight: 600; color: #555; position: sticky; top: 0; }
tr:hover { background: #f5f9ff; }
td .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; background: #e6f7ff; color: #1890ff; }
.priority-P0 { color: #ff4d4f; font-weight: 700; }
.priority-P1 { color: #fa8c16; font-weight: 600; }
.priority-P2 { color: #1890ff; }
.priority-P3 { color: #999; }
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.status-open { background: #fff7e6; color: #d46b08; }
.status-inprogress { background: #e6f7ff; color: #096dd9; }
.status-done { background: #f6ffed; color: #389e0d; }
.overdue { color: #ff4d4f; font-size: 12px; margin-left: 4px; }
td.action-btn button { padding: 4px 10px; border-radius: 4px; border: none; cursor: pointer; font-size: 12px; margin: 0 2px; }
td.action-btn .btn-edit { background: #1890ff; color: #fff; }
td.action-btn .btn-done { background: #52c41a; color: #fff; }
td.action-btn .btn-delete { background: #ff4d4f; color: #fff; }
.empty { text-align: center; padding: 40px; color: #999; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast { background: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.12); border-left: 4px solid #1890ff; font-size: 13px; display: flex; flex-direction: column; gap: 6px; animation: slideIn 0.2s ease-out; }
.toast.success { border-left-color: #52c41a; }
.toast.warn { border-left-color: #fa8c16; }
.toast.error { border-left-color: #ff4d4f; }
.toast .actions { display: flex; gap: 8px; margin-top: 4px; }
.toast button { padding: 4px 12px; border-radius: 4px; border: 1px solid #d9d9d9; background: #fff; cursor: pointer; font-size: 12px; }
.toast button.primary { background: #1890ff; color: #fff; border-color: #1890ff; }
.toast button:hover { opacity: 0.85; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 600px) {
  body { padding: 12px; }
  .toolbar { flex-direction: column; }
  .toolbar .search-box { min-width: auto; width: 100%; }
  .form-row { flex-direction: column; gap: 0; }
  th, td { padding: 8px 10px; font-size: 13px; }
  h1 { font-size: 20px; }
  .login-wrap { margin: 24px auto; padding: 20px; }
}
